Esempio n. 1
0
    def addExtendedGroupOptions(self, group):
        group.add_option("--useExistingAlignStats",
                         dest="useExistingAlignStats",
                         action="store_true",
                         help="Use pre-calculated alignment statistics.")
        group.add_option("--useExistingChromDepths",
                         dest="useExistingChromDepths",
                         action="store_true",
                         help="Use pre-calculated chromosome depths.")
        group.add_option(
            "--candidateBins",
            type="int",
            dest="nonlocalWorkBins",
            metavar="candidateBins",
            help="Provide the total number of tasks which candidate generation "
            " will be sub-divided into. (default: %default)")
        group.add_option(
            "--retainTempFiles",
            dest="isRetainTempFiles",
            action="store_true",
            help="Keep all temporary files (for workflow debugging)")
        group.add_option("--generateEvidenceBam",
                         dest="isGenerateSupportBam",
                         action="store_true",
                         help="Generate a bam of supporting reads for all SVs")

        MantaWorkflowOptionsBase.addExtendedGroupOptions(self, group)
Esempio n. 2
0
    def addExtendedGroupOptions(self, group):
        group.add_option(
            "--defaultAlignStatsFile",
            "--existingAlignStatsFile",
            dest="defaultAlignStatsFile",
            metavar="FILE",
            help=
            "Default alignment statistics to use when direct estimation from the sample fails"
        )
        group.add_option("--useExistingChromDepths",
                         dest="useExistingChromDepths",
                         action="store_true",
                         help="Use pre-calculated chromosome depths.")
        group.add_option(
            "--retainTempFiles",
            dest="isRetainTempFiles",
            action="store_true",
            help="Keep all temporary files (for workflow debugging)")
        group.add_option("--generateEvidenceBam",
                         dest="isGenerateSupportBam",
                         action="store_true",
                         help="Generate a bam of supporting reads for all SVs")
        group.add_option("--outputContig",
                         dest="isOutputContig",
                         action="store_true",
                         help="Output assembled contig sequences in VCF file")

        MantaWorkflowOptionsBase.addExtendedGroupOptions(self, group)
Esempio n. 3
0
    def validateAndSanitizeExistingOptions(self,options) :

        options.normalBam=validateFixExistingFileArg(options.normalBam,"normal sample BAM file")
        options.tumorBam=validateFixExistingFileArg(options.tumorBam,"tumor sample BAM file")

        # check for bam index files:
        for bam in (options.tumorBam,options.normalBam) :
            if bam is None : continue
            baiFile=bam+".bai"
            if not os.path.isfile(baiFile) :
                raise OptParseException("Can't find expected BAM index file: '%s'" % (baiFile))

        # check alignerMode:
        if options.alignerMode is not None :
            options.alignerMode = options.alignerMode.lower()
            if options.alignerMode not in self.validAlignerModes :
                raise OptParseException("Invalid aligner mode: '%s'" % options.alignerMode)

        options.referenceFasta=validateFixExistingFileArg(options.referenceFasta,"reference")


        # check for reference fasta index file:
        if options.referenceFasta is not None :
            faiFile=options.referenceFasta + ".fai"
            if not os.path.isfile(faiFile) :
                raise OptParseException("Can't find expected fasta index file: '%s'" % (faiFile))

        MantaWorkflowOptionsBase.validateAndSanitizeExistingOptions(self,options)
Esempio n. 4
0
    def validateAndSanitizeExistingOptions(self, options):

        groomBamList(options.normalBamList, "normal sample")
        groomBamList(options.tumorBamList, "tumor sample")

        MantaWorkflowOptionsBase.validateAndSanitizeExistingOptions(
            self, options)
Esempio n. 5
0
    def validateOptionExistence(self,options) :

        assertOptionExists(options.normalBam,"normal sample BAM file")
        assertOptionExists(options.alignerMode,"aligner mode")

        assertOptionExists(options.referenceFasta,"reference fasta file")

        MantaWorkflowOptionsBase.validateOptionExistence(self,options)

        # check that the reference and the two bams are using the same set of chromosomes:
        bamList=[]
        bamLabels=[]
        if options.normalBam is not None :
            bamList.append(options.normalBam)
            bamLabels.append("Normal")

        if options.tumorBam is not None :
            bamList.append(options.tumorBam)
            bamLabels.append("Tumor")

        checkChromSet(options.samtoolsBin,
                      options.referenceFasta,
                      bamList,
                      bamLabels,
                      isReferenceLocked=True)
Esempio n. 6
0
    def addExtendedGroupOptions(self,group) :
        group.add_option("--useExistingAlignStats",
                         dest="useExistingAlignStats", action="store_true",
                         help="Use pre-calculated alignment statistics.")
        group.add_option("--useExistingChromDepths",
                         dest="useExistingChromDepths", action="store_true",
                         help="Use pre-calculated chromosome depths.")
        group.add_option("--candidateBins",type="int",dest="nonlocalWorkBins",metavar="candidateBins",
                         help="Provide the total number of tasks which candidate generation "
                            " will be sub-divided into. (default: %default)")

        MantaWorkflowOptionsBase.addExtendedGroupOptions(self,group)
Esempio n. 7
0
    def addWorkflowGroupOptions(self,group) :
        group.add_option("--bam","--normalBam", type="string",dest="normalBamList",metavar="FILE", action="append",
                         help="Normal sample BAM or CRAM file. May be specified more than once, multiple inputs will be treated as each BAM file representing a different sample. [optional] (no default)")
        group.add_option("--tumorBam","--tumourBam", type="string",dest="tumorBamList",metavar="FILE", action="append",
                          help="Tumor sample BAM or CRAM file. Only up to one tumor bam file accepted. [optional] (no default)")
        group.add_option("--exome", dest="isExome", action="store_true",
                         help="Set options for WES input: turn off depth filters")
        group.add_option("--rna", dest="isRNA", action="store_true",
                         help="Set options for RNA-Seq input. Must specify exactly one bam input file")
        group.add_option("--unstrandedRNA", dest="isUnstrandedRNA", action="store_true",
                         help="Set if RNA-Seq input is unstranded: Allows splice-junctions on either strand")

        MantaWorkflowOptionsBase.addWorkflowGroupOptions(self,group)
Esempio n. 8
0
    def addWorkflowGroupOptions(self,group) :
        group.add_option("--normalBam", type="string",dest="normalBam",metavar="FILE",
                         help="Normal sample BAM file. [required] (no default)")
        group.add_option("--tumorBam", type="string",dest="tumorBam",metavar="FILE",
                          help="Tumor sample BAM file. [optional] (no default)")
#         group.add_option("--aligner", type="string",dest="alignerMode",metavar="ALIGNER",
#                          help="Aligner type. Accepted option are {%s} [required] (no default)" % (",".join(['%s' % (x) for x in self.validAlignerModes])))
        group.add_option("--exome", dest="isExome", action="store_true",
                         help="Turn off depth filters which don't make sense for exome or other targeted output.")
        # TODO:
        # need argument to set the workflow to either ISAAC or bwa mode

        MantaWorkflowOptionsBase.addWorkflowGroupOptions(self,group)
Esempio n. 9
0
    def validateOptionExistence(self,options) :

        if (((options.normalBamList is None) or (len(options.normalBamList) == 0)) and
            ((options.tumorBamList is None) or (len(options.tumorBamList) == 0))) :
            raise OptParseException("No normal & tumor sample BAM files specified")

        bcheck = BamSetChecker()
        bcheck.appendBams(options.normalBamList,"Normal")
        bcheck.appendBams(options.tumorBamList,"Tumor")
        bcheck.check(options.samtoolsBin,
                     options.referenceFasta)

        MantaWorkflowOptionsBase.validateOptionExistence(self,options)
Esempio n. 10
0
    def addWorkflowGroupOptions(self,group) :
        group.add_option("--normalBam", type="string",dest="normalBamList",metavar="FILE", action="append",
                         help="Normal sample BAM file. May be specified more than once, multiple inputs will be merged. [optional] (no default)")
        group.add_option("--tumorBam","--tumourBam", type="string",dest="tumorBamList",metavar="FILE", action="append",
                          help="Tumor sample BAM file. May be specified more than once, multiple inputs will be merged. [optional] (no default)")
        group.add_option("--exome", dest="isExome", action="store_true",
                         help="Set options for WES input: turn off depth filters")
        group.add_option("--rna", dest="isRNA", action="store_true",
                         help="Set options for RNA-Seq input: turn off depth filters and don't treat "
                              "anomalous reads as SV evidence when the proper-pair bit is set.")
        group.add_option("--unstrandedRNA", dest="isUnstrandedRNA", action="store_true",
                         help="Set if RNA-Seq input is unstranded: Allows splice-junctions on either strand")

        MantaWorkflowOptionsBase.addWorkflowGroupOptions(self,group)
Esempio n. 11
0
    def addWorkflowGroupOptions(self,group) :
        group.add_option("--normalBam", type="string",dest="normalBamList",metavar="FILE", action="append",
                         help="Normal sample BAM file. May be specified more than once, multiple inputs will be merged. [at least one required] (no default)")
        group.add_option("--tumorBam","--tumourBam", type="string",dest="tumorBamList",metavar="FILE", action="append",
                          help="Tumor sample BAM file. May be specified more than once, multiple inputs will be merged. [optional] (no default)")
#         group.add_option("--aligner", type="string",dest="alignerMode",metavar="ALIGNER",
#                          help="Aligner type. Accepted option are {%s} [required] (no default)" % (",".join(['%s' % (x) for x in self.validAlignerModes])))
        group.add_option("--exome", dest="isExome", action="store_true",
                         help="Set options for WES input: turn off depth filters")
        group.add_option("--rna", dest="isRNA", action="store_true",
                         help="Set options for RNA-Seq input: turn off depth filters and don't treat "
                              "anomalous reads as SV evidence when the proper-pair bit is set.")
        group.add_option("--referenceFasta",type="string",dest="referenceFasta",metavar="FILE",
                         help="samtools-indexed reference fasta file [required] (default: %default)")

        MantaWorkflowOptionsBase.addWorkflowGroupOptions(self,group)
Esempio n. 12
0
    def addWorkflowGroupOptions(self, group):
        group.add_option(
            "--bam",
            "--normalBam",
            type="string",
            dest="normalBamList",
            metavar="FILE",
            action="append",
            help=
            "Normal sample BAM or CRAM file. May be specified more than once, multiple inputs will be treated as each BAM file representing a different sample. [optional] (no default)"
        )
        group.add_option(
            "--tumorBam",
            "--tumourBam",
            type="string",
            dest="tumorBamList",
            metavar="FILE",
            action="append",
            help=
            "Tumor sample BAM or CRAM file. Only up to one tumor bam file accepted. [optional] (no default)"
        )
        group.add_option(
            "--exome",
            dest="isExome",
            action="store_true",
            help="Set options for WES input: turn off depth filters")
        group.add_option(
            "--rna",
            dest="isRNA",
            action="store_true",
            help=
            "Set options for RNA-Seq input. Must specify exactly one bam input file"
        )
        group.add_option(
            "--unstrandedRNA",
            dest="isUnstrandedRNA",
            action="store_true",
            help=
            "Set if RNA-Seq input is unstranded: Allows splice-junctions on either strand"
        )
        group.add_option("--outputContig",
                         dest="isOutputContig",
                         action="store_true",
                         help="Output assembled contig sequences in VCF file")

        MantaWorkflowOptionsBase.addWorkflowGroupOptions(self, group)
Esempio n. 13
0
    def validateAndSanitizeExistingOptions(self, options):
        def checkForBamIndex(bamFile):
            baiFile = bamFile + ".bai"
            if not os.path.isfile(baiFile):
                raise OptParseException(
                    "Can't find expected BAM index file: '%s'" % (baiFile))

        def groomBamList(bamList, sampleLabel):
            if bamList is None: return
            for (index, bamFile) in enumerate(bamList):
                bamList[index] = validateFixExistingFileArg(
                    bamFile, "%s BAM file" % (sampleLabel))
                checkForBamIndex(bamList[index])

        groomBamList(options.normalBamList, "normal sample")
        groomBamList(options.tumorBamList, "tumor sample")

        # check alignerMode:
        if options.alignerMode is not None:
            options.alignerMode = options.alignerMode.lower()
            if options.alignerMode not in self.validAlignerModes:
                raise OptParseException("Invalid aligner mode: '%s'" %
                                        options.alignerMode)

        options.referenceFasta = validateFixExistingFileArg(
            options.referenceFasta, "reference")

        # check for reference fasta index file:
        if options.referenceFasta is not None:
            faiFile = options.referenceFasta + ".fai"
            if not os.path.isfile(faiFile):
                raise OptParseException(
                    "Can't find expected fasta index file: '%s'" % (faiFile))

        if (options.regionStrList is None) or (len(options.regionStrList)
                                               == 0):
            options.genomeRegionList = None
        else:
            options.genomeRegionList = [
                parseGenomeRegion(r) for r in options.regionStrList
            ]

        MantaWorkflowOptionsBase.validateAndSanitizeExistingOptions(
            self, options)
Esempio n. 14
0
    def addWorkflowGroupOptions(self, group):
        group.add_option(
            "--normalBam",
            type="string",
            dest="normalBamList",
            metavar="FILE",
            action="append",
            help=
            "Normal sample BAM file. May be specified more than once, multiple inputs will be merged. [at least one required] (no default)"
        )
        group.add_option(
            "--tumorBam",
            "--tumourBam",
            type="string",
            dest="tumorBamList",
            metavar="FILE",
            action="append",
            help=
            "Tumor sample BAM file. May be specified more than once, multiple inputs will be merged. [optional] (no default)"
        )
        #         group.add_option("--aligner", type="string",dest="alignerMode",metavar="ALIGNER",
        #                          help="Aligner type. Accepted option are {%s} [required] (no default)" % (",".join(['%s' % (x) for x in self.validAlignerModes])))
        group.add_option(
            "--exome",
            dest="isExome",
            action="store_true",
            help="Set options for WES input: turn off depth filters")
        group.add_option(
            "--rna",
            dest="isRNA",
            action="store_true",
            help=
            "Set options for RNA-Seq input: turn off depth filters and don't treat "
            "anomalous reads as SV evidence when the proper-pair bit is set.")
        group.add_option(
            "--referenceFasta",
            type="string",
            dest="referenceFasta",
            metavar="FILE",
            help=
            "samtools-indexed reference fasta file [required] (default: %default)"
        )

        MantaWorkflowOptionsBase.addWorkflowGroupOptions(self, group)
Esempio n. 15
0
    def validateAndSanitizeOptions(self, options):

        MantaWorkflowOptionsBase.validateAndSanitizeOptions(self, options)

        def safeLen(x):
            if x is None: return 0
            return len(x)

        if ((safeLen(options.normalBamList) == 0)
                and (safeLen(options.tumorBamList) == 0)):
            raise OptParseException(
                "No normal or tumor sample alignment files specified")

        if (safeLen(options.tumorBamList) > 1):
            raise OptParseException("Can't accept more then one tumor sample")

        if ((safeLen(options.tumorBamList) > 0)
                and (safeLen(options.normalBamList) > 1)):
            raise OptParseException(
                "Can't accept multiple normal samples for tumor subtraction")

        if options.isRNA:
            if ((safeLen(options.normalBamList) != 1)
                    or (safeLen(options.tumorBamList) != 0)):
                raise OptParseException(
                    "RNA mode currently requires exactly one normal sample")
        else:
            if options.isUnstrandedRNA:
                raise OptParseException(
                    "Unstranded only applied for RNA inputs")

        if options.existingAlignStatsFile is not None:
            options.existingAlignStatsFile = validateFixExistingFileArg(
                options.existingAlignStatsFile, "existing align stats")

        groomBamList(options.normalBamList, "normal sample")
        groomBamList(options.tumorBamList, "tumor sample")

        bamSetChecker = BamSetChecker()
        if safeLen(options.normalBamList) > 0:
            bamSetChecker.appendBams(options.normalBamList, "Normal")
        if safeLen(options.tumorBamList) > 0:
            bamSetChecker.appendBams(options.tumorBamList, "Tumor")
        bamSetChecker.check(options.htsfileBin, options.referenceFasta)
Esempio n. 16
0
 def getOptionDefaults(self) :
     self.configScriptDir=scriptDir
     defaults=MantaWorkflowOptionsBase.getOptionDefaults(self)
     defaults.update({
         'alignerMode' : "isaac",
         'runDir' : 'MantaWorkflow',
         'isExome' : False,
         'binSize' : 25000000,
         'nonlocalWorkBins' : 128
                       })
     return defaults
Esempio n. 17
0
    def addExtendedGroupOptions(self,group) :
        group.add_option("--useExistingAlignStats",
                         dest="useExistingAlignStats", action="store_true",
                         help="Use pre-calculated alignment statistics.")
        group.add_option("--useExistingChromDepths",
                         dest="useExistingChromDepths", action="store_true",
                         help="Use pre-calculated chromosome depths.")
        group.add_option("--scanSizeMb",type="int",dest="scanSizeMb",metavar="scanSizeMb",
                         help="Maximum sequence region size (in Mb) scanned by each task during "
                         "SV locus graph generation. (default: %default)")
        group.add_option("--candidateBins",type="int",dest="nonlocalWorkBins",metavar="candidateBins",
                         help="Provide the total number of tasks which candidate generation "
                            " will be sub-divided into. (default: %default)")
        group.add_option("--region",type="string",dest="regionStrList",metavar="samtoolsRegion", action="append",
                         help="Limit the SV analysis to a region of the genome for debugging purposes. "
                              "If this argument is provided multiple times all specified regions will "
                              "be analyzed together. All regions must be non-overlapping to get a "
                              "meaningful result. Examples: '--region chr20' (whole chromosome), "
                              "'--region chr2:100-2000 --region chr3:2500-3000' (two translocation regions)'")

        MantaWorkflowOptionsBase.addExtendedGroupOptions(self,group)
Esempio n. 18
0
    def addExtendedGroupOptions(self,group) :
        group.add_option("--existingAlignStatsFile",
                         dest="existingAlignStatsFile", metavar="FILE",
                         help="Pre-calculated alignment statistics file. Skips alignment stats calculation.")
        group.add_option("--useExistingChromDepths",
                         dest="useExistingChromDepths", action="store_true",
                         help="Use pre-calculated chromosome depths.")
        group.add_option("--candidateBins",type="int",
                         dest="nonlocalWorkBins", metavar="candidateBins",
                         help="Provide the total number of tasks which candidate generation "
                            " will be sub-divided into. (default: %default)")
        group.add_option("--retainTempFiles",
                         dest="isRetainTempFiles", action="store_true",
                         help="Keep all temporary files (for workflow debugging)")
        group.add_option("--generateEvidenceBam",
                         dest="isGenerateSupportBam", action="store_true",
                         help="Generate a bam of supporting reads for all SVs")
        group.add_option("--outputContig", dest="isOutputContig", action="store_true",
                         help="Output assembled contig sequences in VCF file")

        MantaWorkflowOptionsBase.addExtendedGroupOptions(self,group)
Esempio n. 19
0
    def validateAndSanitizeOptions(self,options) :

        MantaWorkflowOptionsBase.validateAndSanitizeOptions(self,options)

        def safeLen(x) :
            if x is None : return 0
            return len(x)

        if ((safeLen(options.normalBamList) == 0) and
                (safeLen(options.tumorBamList) == 0)) :
            raise OptParseException("No normal or tumor sample alignment files specified")

        if (safeLen(options.tumorBamList) > 1) :
            raise OptParseException("Can't accept more then one tumor sample")

        if ((safeLen(options.tumorBamList) > 0) and (safeLen(options.normalBamList) > 1)) :
            raise OptParseException("Can't accept multiple normal samples for tumor subtraction")

        if options.isRNA :
            if ((safeLen(options.normalBamList) != 1) or
                    (safeLen(options.tumorBamList) != 0)) :
                raise OptParseException("RNA mode currently requires exactly one normal sample")
        else :
            if options.isUnstrandedRNA :
                raise OptParseException("Unstranded only applied for RNA inputs")

        if options.existingAlignStatsFile is not None :
            options.existingAlignStatsFile=validateFixExistingFileArg(options.existingAlignStatsFile,"existing align stats")

        groomBamList(options.normalBamList,"normal sample")
        groomBamList(options.tumorBamList, "tumor sample")

        bamSetChecker = BamSetChecker()
        if safeLen(options.normalBamList) > 0 :
            bamSetChecker.appendBams(options.normalBamList,"Normal")
        if safeLen(options.tumorBamList) > 0 :
            bamSetChecker.appendBams(options.tumorBamList,"Tumor")
        bamSetChecker.check(options.htsfileBin,
                            options.referenceFasta)
Esempio n. 20
0
    def validateOptionExistence(self, options):

        if (options.normalBamList is None) or (len(options.normalBamList)
                                               == 0):
            raise OptParseException("No normal sample BAM files specified")

        assertOptionExists(options.alignerMode, "aligner mode")
        assertOptionExists(options.referenceFasta, "reference fasta file")

        MantaWorkflowOptionsBase.validateOptionExistence(self, options)

        # check that the reference and all bams are using the same
        # set of chromosomes:
        bamList = []
        bamLabels = []

        def appendBams(inputBamList, inputLabel):
            if inputBamList is None: return
            for inputBamFile in inputBamList:
                bamList.append(inputBamFile)
                bamLabels.append(inputLabel)

        appendBams(options.normalBamList, "Normal")
        appendBams(options.tumorBamList, "Tumor")

        checkChromSet(options.samtoolsBin,
                      options.referenceFasta,
                      bamList,
                      bamLabels,
                      isReferenceLocked=True)

        # check for repeated bam entries:
        #
        bamSet = set()
        for bamFile in bamList:
            if bamFile in bamSet:
                raise OptParseException("Repeated input BAM file: %s" %
                                        (bamFile))
            bamSet.add(bamFile)
Esempio n. 21
0
    def addExtendedGroupOptions(self, group):
        group.add_option("--useExistingAlignStats",
                         dest="useExistingAlignStats",
                         action="store_true",
                         help="Use pre-calculated alignment statistics.")
        group.add_option("--useExistingChromDepths",
                         dest="useExistingChromDepths",
                         action="store_true",
                         help="Use pre-calculated chromosome depths.")
        group.add_option(
            "--scanSizeMb",
            type="int",
            dest="scanSizeMb",
            metavar="scanSizeMb",
            help=
            "Maximum sequence region size (in Mb) scanned by each task during "
            "SV locus graph generation. (default: %default)")
        group.add_option(
            "--candidateBins",
            type="int",
            dest="nonlocalWorkBins",
            metavar="candidateBins",
            help="Provide the total number of tasks which candidate generation "
            " will be sub-divided into. (default: %default)")
        group.add_option(
            "--region",
            type="string",
            dest="regionStrList",
            metavar="samtoolsRegion",
            action="append",
            help=
            "Limit the SV analysis to a region of the genome for debugging purposes. "
            "If this argument is provided multiple times all specified regions will "
            "be analyzed together. All regions must be non-overlapping to get a "
            "meaningful result. Examples: '--region chr20' (whole chromosome), "
            "'--region chr2:100-2000 --region chr3:2500-3000' (two translocation regions)'"
        )

        MantaWorkflowOptionsBase.addExtendedGroupOptions(self, group)
Esempio n. 22
0
    def getOptionDefaults(self) :

        self.configScriptDir=scriptDir
        defaults=MantaWorkflowOptionsBase.getOptionDefaults(self)
        defaults.update({
            'runDir' : 'MantaWorkflow',
            'isExome' : False,
            'isRNA' : False,
            'isUnstrandedRNA' : False,
            'useExistingAlignStats' : False,
            'useExistingChromDepths' : False,
            'nonlocalWorkBins' : 256
                          })
        return defaults
Esempio n. 23
0
    def validateOptionExistence(self,options) :

        def safeLen(x) :
            if x is None : return 0
            return len(x)

        if ((safeLen(options.normalBamList) == 0) and
            (safeLen(options.tumorBamList) == 0)) :
            raise OptParseException("No normal or tumor sample alignment files specified")

        if (safeLen(options.tumorBamList) > 1) :
            raise OptParseException("Can't accept more then one tumor sample")

        if ((safeLen(options.tumorBamList) > 0) and (safeLen(options.normalBamList) > 1)) :
            raise OptParseException("Can't accept multiple normal samples for tumor subtraction")

        bcheck = BamSetChecker()
        bcheck.appendBams(options.normalBamList,"Normal")
        bcheck.appendBams(options.tumorBamList,"Tumor")
        bcheck.check(options.htsfileBin,
                     options.referenceFasta)

        MantaWorkflowOptionsBase.validateOptionExistence(self,options)
Esempio n. 24
0
    def validateAndSanitizeExistingOptions(self,options) :

        def checkForBamIndex(bamFile):
            baiFile=bamFile + ".bai"
            if not os.path.isfile(baiFile) :
                raise OptParseException("Can't find expected BAM index file: '%s'" % (baiFile))

        def groomBamList(bamList, sampleLabel):
            if bamList is None : return
            for (index,bamFile) in enumerate(bamList) :
                bamList[index]=validateFixExistingFileArg(bamFile,"%s BAM file" % (sampleLabel))
                checkForBamIndex(bamList[index])

        groomBamList(options.normalBamList,"normal sample")
        groomBamList(options.tumorBamList, "tumor sample")

        # check alignerMode:
        if options.alignerMode is not None :
            options.alignerMode = options.alignerMode.lower()
            if options.alignerMode not in self.validAlignerModes :
                raise OptParseException("Invalid aligner mode: '%s'" % options.alignerMode)

        options.referenceFasta=validateFixExistingFileArg(options.referenceFasta,"reference")


        # check for reference fasta index file:
        if options.referenceFasta is not None :
            faiFile=options.referenceFasta + ".fai"
            if not os.path.isfile(faiFile) :
                raise OptParseException("Can't find expected fasta index file: '%s'" % (faiFile))

        if (options.regionStrList is None) or (len(options.regionStrList) == 0) :
            options.genomeRegionList = None
        else :
            options.genomeRegionList = [parseGenomeRegion(r) for r in options.regionStrList]

        MantaWorkflowOptionsBase.validateAndSanitizeExistingOptions(self,options)
Esempio n. 25
0
    def validateOptionExistence(self,options) :

        if (options.normalBamList is None) or (len(options.normalBamList) == 0) :
            raise OptParseException("No normal sample BAM files specified")

        assertOptionExists(options.alignerMode,"aligner mode")
        assertOptionExists(options.referenceFasta,"reference fasta file")

        MantaWorkflowOptionsBase.validateOptionExistence(self,options)

        # check that the reference and all bams are using the same
        # set of chromosomes:
        bamList=[]
        bamLabels=[]

        def appendBams(inputBamList,inputLabel) :
            if inputBamList is None : return
            for inputBamFile in inputBamList :
                bamList.append(inputBamFile)
                bamLabels.append(inputLabel)

        appendBams(options.normalBamList,"Normal")
        appendBams(options.tumorBamList,"Tumor")

        checkChromSet(options.samtoolsBin,
                      options.referenceFasta,
                      bamList,
                      bamLabels,
                      isReferenceLocked=True)

        # check for repeated bam entries:
        #
        bamSet=set()
        for bamFile in bamList :
            if bamFile in bamSet :
                raise OptParseException("Repeated input BAM file: %s" % (bamFile))
            bamSet.add(bamFile)
Esempio n. 26
0
    def validateOptionExistence(self, options):
        def safeLen(x):
            if x is None: return 0
            return len(x)

        if ((safeLen(options.normalBamList) == 0)
                and (safeLen(options.tumorBamList) == 0)):
            raise OptParseException(
                "No normal or tumor sample alignment files specified")

        if (safeLen(options.tumorBamList) > 1):
            raise OptParseException("Can't accept more then one tumor sample")

        if ((safeLen(options.tumorBamList) > 0)
                and (safeLen(options.normalBamList) > 1)):
            raise OptParseException(
                "Can't accept multiple normal samples for tumor subtraction")

        bcheck = BamSetChecker()
        bcheck.appendBams(options.normalBamList, "Normal")
        bcheck.appendBams(options.tumorBamList, "Tumor")
        bcheck.check(options.htsfileBin, options.referenceFasta)

        MantaWorkflowOptionsBase.validateOptionExistence(self, options)
Esempio n. 27
0
    def getOptionDefaults(self) :

        self.configScriptDir=scriptDir
        defaults=MantaWorkflowOptionsBase.getOptionDefaults(self)
        defaults.update({
            'alignerMode' : "isaac",
            'runDir' : 'MantaWorkflow',
            'isExome' : False,
            'isRNA' : False,
            'useExistingAlignStats' : False,
            'useExistingChromDepths' : False,
            'scanSizeMb' : 12,
            'nonlocalWorkBins' : 256
                          })
        return defaults
Esempio n. 28
0
    def getOptionDefaults(self):

        self.configScriptDir = scriptDir
        defaults = MantaWorkflowOptionsBase.getOptionDefaults(self)
        defaults.update({
            'alignerMode': "isaac",
            'runDir': 'MantaWorkflow',
            'isExome': False,
            'isRNA': False,
            'useExistingAlignStats': False,
            'useExistingChromDepths': False,
            'scanSizeMb': 12,
            'nonlocalWorkBins': 256
        })
        return defaults
Esempio n. 29
0
    def getOptionDefaults(self):

        self.configScriptDir = scriptDir
        defaults = MantaWorkflowOptionsBase.getOptionDefaults(self)
        defaults.update({
            'runDir': 'MantaWorkflow',
            'isExome': False,
            'isRNA': False,
            'isOutputContig': False,
            'isUnstrandedRNA': False,
            'useExistingChromDepths': False,
            'isRetainTempFiles': False,
            'isGenerateSupportBam': False,
            'nonlocalWorkBins': 256
        })
        return defaults
Esempio n. 30
0
    def getOptionDefaults(self) :

        self.configScriptDir=scriptDir
        defaults=MantaWorkflowOptionsBase.getOptionDefaults(self)
        defaults.update({
            'runDir' : 'MantaWorkflow',
            'isExome' : False,
            'isRNA' : False,
            'isOutputContig' : False,
            'isUnstrandedRNA' : False,
            'existingAlignStatsFile' : None,
            'useExistingChromDepths' : False,
            'isRetainTempFiles' : False,
            'isGenerateSupportBam' : False,
            'nonlocalWorkBins' : 256
                          })
        return defaults
Esempio n. 31
0
    def validateAndSanitizeExistingOptions(self,options) :

        groomBamList(options.normalBamList,"normal sample")
        groomBamList(options.tumorBamList, "tumor sample")

        MantaWorkflowOptionsBase.validateAndSanitizeExistingOptions(self,options)
Esempio n. 32
0
 def addExtendedGroupOptions(self,group) :
     group.add_option("--referenceFasta",type="string",dest="referenceFasta",metavar="FILE",
                      help="samtools-indexed reference fasta file [required] (default: %default)")
     MantaWorkflowOptionsBase.addExtendedGroupOptions(self,group)