Exemple #1
0
 def inputs(self):
     return [
         ToolInput("vcf", CompressedVcf, position=3),
         ToolInput(
             "truth",
             CompressedVcf(),
             prefix="-t",
             doc="use this VCF as ground truth for ROC generation",
         ),
         ToolInput(
             "windowSize",
             Int(optional=True),
             prefix="-w",
             default=30,
             doc="compare records up to this many bp away (default 30)",
         ),
         ToolInput("reference",
                   FastaWithDict,
                   prefix="-r",
                   doc="FASTA reference file"),
     ]
    def constructor(self):

        self.input("reference", Fasta)

        # Change the default BWA index algorithm to bwtsw (for human genome), and up blockSize to 50M
        self.input("bwa_algorithm", String(optional=True), default="bwtsw")
        self.input("bwa_block_size", Int(optional=True), default=int(5e7))

        self.step(
            "create_bwa",
            BwaIndexLatest(
                reference=self.reference,
                algorithm=self.bwa_algorithm,
                blockSize=self.bwa_block_size,
            ),
        )
        self.step("create_samtools",
                  SamToolsFaidxLatest(reference=self.reference))
        self.step(
            "create_dict",
            Gatk4CreateSequenceDictionaryLatest(reference=self.reference))

        self.step(
            "merge",
            _JoinIndexedFasta(
                ref_bwa=self.create_bwa,
                ref_samtools=self.create_samtools,
                ref_dict=self.create_dict,
            ),
        )

        self.output("out_reference", source=self.merge.out_reference)
        self.output("out_bwa", source=self.create_bwa, output_name="reference")
        self.output("out_samtools",
                    source=self.create_samtools,
                    output_name="reference")
        self.output("out_dict",
                    source=self.create_dict,
                    output_name="reference")
Exemple #3
0
 def inputs(self):
     return [
         ToolInput("vcf", CompressedVcf, position=3),
         ToolInput(
             "useMnpsFlag",
             Boolean(optional=True),
             prefix="-m",
             default=False,
             doc="Retain MNPs as separate events (default: false)",
         ),
         ToolInput(
             "tagParsed",
             String(optional=True),
             prefix="-t",
             doc=
             "Tag records which are split apart of a complex allele with this flag",
         ),
         ToolInput(
             "keepInfoFlag",
             Boolean(optional=True),
             prefix="-k",
             doc=
             "Maintain site and allele-level annotations when decomposing. Note that in many cases, such as multisample VCFs, these won't be valid post-decomposition.  For biallelic loci in single-sample VCFs, they should be usable with caution.",
         ),
         ToolInput(
             "keepGenoFlag",
             Boolean(optional=True),
             prefix="-g",
             doc=
             "Maintain genotype-level annotations when decomposing.  Similar caution should be used for this as for --keep-info.",
         ),
         ToolInput(
             "maxLength",
             Int(optional=True),
             prefix="-L",
             doc=
             "Do not manipulate records in which either the ALT or REF is longer than LEN (default: 200).",
         ),
     ]
Exemple #4
0
 def inputs(self):
     return [
         ToolInput("reference", Fasta, position=1, localise_file=True),
         # ToolInput(
         #     "prefix",
         #     String(optional=True),
         #     prefix="-p",
         #     doc="prefix of the index [same as fasta name]",
         # ),
         ToolInput(
             "blockSize",
             Int(optional=True),
             prefix="-b",
             doc=
             "block size for the bwtsw algorithm (effective with -a bwtsw) [10000000]",
         ),
         ToolInput(
             "algorithm",
             String(optional=True),
             prefix="-a",
             doc="BWT construction algorithm: bwtsw, is or rb2 [auto]",
         ),
     ]
Exemple #5
0
 def inputs(self):
     return [
         *super(SeqzBinningBase, self).inputs(),
         ToolInput("seqz",
                   File(),
                   prefix="--seqz",
                   position=2,
                   doc="A seqz file."),
         ToolInput(
             "window",
             Int(),
             prefix="--window",
             position=4,
             doc=
             "Window size used for binning the original seqz file. Default is 50.",
         ),
         ToolInput(
             "output_filename",
             Filename(extension=".gz"),
             prefix="-o",
             position=6,
             doc='Output file "-" for STDOUT',
         ),
     ]
 def add_inputs_for_configuration(self):
     super().add_inputs_for_configuration()
     # facets
     self.input("pseudo_snps", Int(optional=True))
     self.input("max_depth", Int(optional=True))
     self.input("everything", Boolean(optional=True))
     self.input("genome", String(optional=True))
     self.input("cval", Int(optional=True))
     self.input("purity_cval", Int(optional=True))
     self.input("normal_depth", Int(optional=True))
     # vardict
     self.input(
         "allele_freq_threshold",
         Float,
         default=0.05,
         doc=InputDocumentation(
             "The threshold for VarDict's allele frequency, default: 0.05 or 5%",
             quality=InputQualityType.configuration,
         ),
     )
     self.input("minMappingQual", Int(optional=True))
     self.input("filter", String(optional=True))
Exemple #7
0
class BwaMem_SamToolsView(BioinformaticsTool):
    def tool(self) -> str:
        return "BwaMemSamtoolsView"

    def tool_provider(self):
        return "common"

    def version(self):
        return "0.7.17|1.9"

    def container(self):
        return "michaelfranklin/bwasamtools:0.7.17-1.9"

    def base_command(self):
        return None

    def arguments(self):
        return [
            ToolArgument("bwa", position=0, shell_quote=False),
            ToolArgument("mem", position=1, shell_quote=False),
            ToolArgument("|", position=5, shell_quote=False),
            ToolArgument("samtools", position=6, shell_quote=False),
            ToolArgument("view", position=7, shell_quote=False),
            ToolArgument(InputSelector("reference"),
                         prefix="-T",
                         position=8,
                         shell_quote=False),
            ToolArgument(
                CpuSelector(),
                position=8,
                shell_quote=False,
                prefix="--threads",
                doc="(-@)  Number of additional threads to use [0]",
            ),
            ToolArgument(
                "-h",
                position=8,
                shell_quote=False,
                doc="Include the header in the output.",
            ),
            ToolArgument("-b",
                         position=8,
                         shell_quote=False,
                         doc="Output in the BAM format."),
            ToolArgument(
                StringFormatter(
                    "@RG\\tID:{name}\\tSM:{name}\\tLB:{name}\\tPL:{pl}",
                    name=InputSelector("sampleName"),
                    pl=InputSelector("platformTechnology"),
                ),
                prefix="-R",
                position=2,
                doc=
                "Complete read group header line. ’\\t’ can be used in STR and will be converted to a TAB"
                "in the output SAM. The read group ID will be attached to every read in the output. "
                "An example is ’@RG\\tID:foo\\tSM:bar’. (Default=null) "
                "https://gatkforums.broadinstitute.org/gatk/discussion/6472/read-groups",
            ),
            ToolArgument(
                CpuSelector(),
                prefix="-t",
                position=2,
                shell_quote=False,
                doc="Number of threads. (default = 1)",
            ),
        ]

    def inputs(self) -> List[ToolInput]:
        return [
            ToolInput("reference",
                      FastaWithDict(),
                      position=2,
                      shell_quote=False),
            ToolInput("reads",
                      FastqGzPair,
                      position=3,
                      shell_quote=False,
                      doc=None),
            ToolInput(
                "mates",
                FastqGzPair(optional=True),
                separator=" ",
                position=4,
                shell_quote=False,
                doc=None,
            ),
            ToolInput(
                "outputFilename",
                Filename(prefix=InputSelector("sampleName"), extension=".bam"),
                position=8,
                shell_quote=False,
                prefix="-o",
                doc="output file name [stdout]",
            ),
            # Eventually it would be cool to have like a cascading:
            #   - If readGroupHeaderLine provided, use that,
            #   - If sampleName provided, construct based on that
            #   - Else don't include
            # but this is probbaly a bit hard to do, and for all our purposes we require a readGroupHeaderLine,
            # so we're always going to construct it:
            ToolInput(
                "sampleName",
                String(),
                doc="Used to construct the readGroupHeaderLine with format: "
                "'@RG\\tID:{name}\\tSM:{name}\\tLB:{name}\\tPL:ILLUMINA'",
            ),
            ToolInput(
                "platformTechnology",
                String(optional=True),
                doc=
                "(ReadGroup: PL) Used to construct the readGroupHeaderLine, defaults: ILLUMINA",
                default="ILLUMINA",
            ),
            *self.bwa_additional_inputs,
            *self.samtools_additional_args,
        ]

    def outputs(self) -> List[ToolOutput]:
        return [
            ToolOutput("out", Bam(), glob=InputSelector("outputFilename")),
            # ToolOutput("skippedReads", File(optional=True), glob=InputSelector("skippedReadsOutputFilename"))
        ]

    def memory(self, hints: Dict[str, Any]):
        val = get_value_for_hints_and_ordered_resource_tuple(
            hints, BWA_MEM_TUPLE)
        if val:
            return val
        return 16

    def cpus(self, hints: Dict[str, Any]):
        val = get_value_for_hints_and_ordered_resource_tuple(
            hints, BWA_CORES_TUPLE)
        if val:
            return val
        return 16

    def friendly_name(self) -> str:
        return "Bwa mem + Samtools View"

    bwa_additional_inputs = [
        ToolInput(
            "minimumSeedLength",
            Int(optional=True),
            prefix="-k",
            position=2,
            shell_quote=False,
            doc=
            "Matches shorter than INT will be missed. The alignment speed is usually "
            "insensitive to this value unless it significantly deviates 20. (Default: 19)",
        ),
        ToolInput(
            "bandwidth",
            Int(optional=True),
            prefix="-w",
            position=2,
            shell_quote=False,
            doc=
            "Essentially, gaps longer than ${bandWidth} will not be found. Note that the maximum gap length "
            "is also affected by the scoring matrix and the hit length, not solely determined by this option."
            " (Default: 100)",
        ),
        ToolInput(
            "offDiagonalXDropoff",
            Int(optional=True),
            prefix="-d",
            position=2,
            shell_quote=False,
            doc=
            "(Z-dropoff): Stop extension when the difference between the best and the current extension "
            "score is above |i-j|*A+INT, where i and j are the current positions of the query and reference, "
            "respectively, and A is the matching score. Z-dropoff is similar to BLAST’s X-dropoff except "
            "that it doesn’t penalize gaps in one of the sequences in the alignment. Z-dropoff not only "
            "avoids unnecessary extension, but also reduces poor alignments inside a long good alignment. "
            "(Default: 100)",
        ),
        ToolInput(
            "reseedTrigger",
            Float(optional=True),
            prefix="-r",
            position=2,
            shell_quote=False,
            doc=
            "Trigger re-seeding for a MEM longer than minSeedLen*FLOAT. This is a key heuristic parameter "
            "for tuning the performance. Larger value yields fewer seeds, which leads to faster alignment "
            "speed but lower accuracy. (Default: 1.5)",
        ),
        ToolInput(
            "occurenceDiscard",
            Int(optional=True),
            prefix="-c",
            position=2,
            shell_quote=False,
            doc="Discard a MEM if it has more than INT occurence in the genome. "
            "This is an insensitive parameter. (Default: 10000)",
        ),
        ToolInput(
            "performSW",
            Boolean(optional=True),
            prefix="-P",
            position=2,
            shell_quote=False,
            doc=
            "In the paired-end mode, perform SW to rescue missing hits only but "
            "do not try to find hits that fit a proper pair.",
        ),
        ToolInput(
            "matchingScore",
            Int(optional=True),
            prefix="-A",
            position=2,
            shell_quote=False,
            doc="Matching score. (Default: 1)",
        ),
        ToolInput(
            "mismatchPenalty",
            Int(optional=True),
            prefix="-B",
            position=2,
            shell_quote=False,
            doc=
            "Mismatch penalty. The sequence error rate is approximately: {.75 * exp[-log(4) * B/A]}. "
            "(Default: 4)",
        ),
        ToolInput(
            "openGapPenalty",
            Int(optional=True),
            prefix="-O",
            position=2,
            shell_quote=False,
            doc="Gap open penalty. (Default: 6)",
        ),
        ToolInput(
            "gapExtensionPenalty",
            Int(optional=True),
            prefix="-E",
            position=2,
            shell_quote=False,
            doc="Gap extension penalty. A gap of length k costs O + k*E "
            "(i.e. -O is for opening a zero-length gap). (Default: 1)",
        ),
        ToolInput(
            "clippingPenalty",
            Int(optional=True),
            prefix="-L",
            position=2,
            shell_quote=False,
            doc=
            "Clipping penalty. When performing SW extension, BWA-MEM keeps track of the best score "
            "reaching the end of query. If this score is larger than the best SW score minus the "
            "clipping penalty, clipping will not be applied. Note that in this case, the SAM AS tag "
            "reports the best SW score; clipping penalty is not deducted. (Default: 5)",
        ),
        ToolInput(
            "unpairedReadPenalty",
            Int(optional=True),
            prefix="-U",
            position=2,
            shell_quote=False,
            doc=
            "Penalty for an unpaired read pair. BWA-MEM scores an unpaired read pair as "
            "scoreRead1+scoreRead2-INT and scores a paired as scoreRead1+scoreRead2-insertPenalty. "
            "It compares these two scores to determine whether we should force pairing. (Default: 9)",
        ),
        ToolInput(
            "assumeInterleavedFirstInput",
            Boolean(optional=True),
            prefix="-p",
            position=2,
            shell_quote=False,
            doc=
            "Assume the first input query file is interleaved paired-end FASTA/Q. ",
        ),
        ToolInput(
            "outputAlignmentThreshold",
            Int(optional=True),
            prefix="-T",
            position=2,
            shell_quote=False,
            doc=
            "Don’t output alignment with score lower than INT. Only affects output. (Default: 30)",
        ),
        ToolInput(
            "outputAllElements",
            Boolean(optional=True),
            prefix="-a",
            position=2,
            shell_quote=False,
            doc=
            "Output all found alignments for single-end or unpaired paired-end reads. "
            "These alignments will be flagged as secondary alignments.",
        ),
        ToolInput(
            "appendComments",
            Boolean(optional=True),
            prefix="-C",
            position=2,
            shell_quote=False,
            doc=
            "Append append FASTA/Q comment to SAM output. This option can be used to transfer "
            "read meta information (e.g. barcode) to the SAM output. Note that the FASTA/Q comment "
            "(the string after a space in the header line) must conform the SAM spec (e.g. BC:Z:CGTAC). "
            "Malformated comments lead to incorrect SAM output.",
        ),
        ToolInput(
            "hardClipping",
            Boolean(optional=True),
            prefix="-H",
            position=2,
            shell_quote=False,
            doc=
            "Use hard clipping ’H’ in the SAM output. This option may dramatically reduce "
            "the redundancy of output when mapping long contig or BAC sequences.",
        ),
        ToolInput(
            "markShorterSplits",
            Boolean(optional=True),
            prefix="-M",
            position=2,
            shell_quote=False,
            doc=
            "Mark shorter split hits as secondary (for Picard compatibility).",
        ),
        ToolInput(
            "verboseLevel",
            Int(optional=True),
            prefix="-v",
            position=2,
            shell_quote=False,
            doc="Control the verbose level of the output. "
            "This option has not been fully supported throughout BWA. Ideally, a value: "
            "0 for disabling all the output to stderr; "
            "1 for outputting errors only; "
            "2 for warnings and errors; "
            "3 for all normal messages; "
            "4 or higher for debugging. When this option takes value 4, the output is not SAM. (Default: 3)",
        ),
    ]

    samtools_additional_args = [
        ToolInput(
            "skippedReadsOutputFilename",
            String(optional=True),
            position=8,
            shell_quote=False,
            prefix="-U",
            doc="output reads not selected by filters to FILE [null]",
        ),
        ToolInput(
            "referenceIndex",
            File(optional=True),
            position=8,
            shell_quote=False,
            prefix="-t",
            doc=
            "FILE listing reference names and lengths (see long help) [null]",
        ),
        ToolInput(
            "intervals",
            Bed(optional=True),
            position=8,
            shell_quote=False,
            prefix="-L",
            doc="only include reads overlapping this BED FILE [null]",
        ),
        ToolInput(
            "includeReadsInReadGroup",
            String(optional=True),
            position=8,
            shell_quote=False,
            prefix="-r",
            doc="only include reads in read group STR [null]",
        ),
        ToolInput(
            "includeReadsInFile",
            File(optional=True),
            position=8,
            shell_quote=False,
            prefix="-R",
            doc="only include reads with read group listed in FILE [null]",
        ),
        ToolInput(
            "includeReadsWithQuality",
            Int(optional=True),
            position=8,
            shell_quote=False,
            prefix="-q",
            doc="only include reads with mapping quality >= INT [0]",
        ),
        ToolInput(
            "includeReadsInLibrary",
            String(optional=True),
            position=8,
            shell_quote=False,
            prefix="-l",
            doc="only include reads in library STR [null]",
        ),
        ToolInput(
            "includeReadsWithCIGAROps",
            Int(optional=True),
            position=8,
            shell_quote=False,
            prefix="-m",
            doc=
            "only include reads with number of CIGAR operations consuming query sequence >= INT [0]",
        ),
        ToolInput(
            "includeReadsWithAllFLAGs",
            Array(Int(), optional=True),
            position=8,
            shell_quote=False,
            prefix="-f",
            separator=" ",
            doc="only include reads with all of the FLAGs in INT present [0]",
        ),
        ToolInput(
            "includeReadsWithoutFLAGs",
            Array(Int(), optional=True),
            position=8,
            shell_quote=False,
            prefix="-F",
            separator=" ",
            doc="only include reads with none of the FLAGS in INT present [0]",
        ),
        ToolInput(
            "excludeReadsWithAllFLAGs",
            Array(Int(), optional=True),
            position=8,
            shell_quote=False,
            prefix="-G",
            separator=" ",
            doc="only EXCLUDE reads with all of the FLAGs in INT present [0] "
            "fraction of templates/read pairs to keep; INT part sets seed)",
        ),
        ToolInput(
            "useMultiRegionIterator",
            Boolean(optional=True),
            position=8,
            shell_quote=False,
            prefix="-M",
            doc="use the multi-region iterator (increases the speed, removes "
            "duplicates and outputs the reads as they are ordered in the file)",
        ),
        ToolInput(
            "readTagToStrip",
            String(optional=True),
            position=8,
            shell_quote=False,
            prefix="-x",
            doc="read tag to strip (repeatable) [null]",
        ),
        ToolInput(
            "collapseBackwardCIGAROps",
            Boolean(optional=True),
            position=8,
            shell_quote=False,
            prefix="-B",
            doc=
            "collapse the backward CIGAR operation Specify a single input file format "
            "option in the form of OPTION or OPTION=VALUE",
        ),
        ToolInput(
            "outputFmt",
            String(optional=True),
            position=8,
            shell_quote=False,
            prefix="--output-fmt",
            doc=
            "(OPT[, -O)  Specify output format (SAM, BAM, CRAM) Specify a single "
            "output file format option in the form of OPTION or OPTION=VALUE",
        ),
    ]
Exemple #8
0
class Gatk4GatherVcfsBase(Gatk4ToolBase, ABC):
    @classmethod
    def gatk_command(cls):
        return "GatherVcfs"

    def tool(self):
        return "Gatk4GatherVcfs"

    def friendly_name(self):
        return "GATK4: Gather VCFs"

    def cpus(self, hints: Dict[str, Any]):
        val = get_value_for_hints_and_ordered_resource_tuple(
            hints, CORES_TUPLE)
        if val:
            return val
        return 1

    def memory(self, hints: Dict[str, Any]):
        val = get_value_for_hints_and_ordered_resource_tuple(hints, MEM_TUPLE)
        if val:
            return val
        return 8

    def inputs(self):
        return [
            *super().inputs(),
            ToolInput(
                "vcfs",
                Array(Vcf),
                prefix="--INPUT",
                doc="[default: []] (-I) Input VCF file(s).",
                prefix_applies_to_all_elements=True,
            ),
            ToolInput(
                "outputFilename",
                Filename(extension=".vcf", suffix=".gathered"),
                prefix="--OUTPUT",
                doc="[default: null] (-O) Output VCF file.",
            ),
            *self.additional_args,
        ]

    def outputs(self):
        return [ToolOutput("out", Vcf, glob=InputSelector("outputFilename"))]

    def bind_metadata(self):
        from datetime import date

        return ToolMetadata(
            contributors=["Michael Franklin"],
            dateCreated=date(2018, 5, 1),
            dateUpdated=date(2019, 5, 1),
            institution="Broad Institute",
            doi=None,
            citation=
            "See https://software.broadinstitute.org/gatk/documentation/article?id=11027 for more information",
            keywords=[
                "gatk",
                "gatk4",
                "broad",
                "gather",
                "vcfs",
                "variant manipulation",
            ],
            documentationUrl=
            "https://software.broadinstitute.org/gatk/documentation/tooldocs/4.0.12.0/picard_vcf_GatherVcfs.php",
            documentation="""GatherVcfs (Picard)
            
Gathers multiple VCF files from a scatter operation into a single VCF file. 
Input files must be supplied in genomic order and must not have events at overlapping positions.
""".strip(),
        )

    additional_args = [
        ToolInput(
            "argumentsFile",
            Array(File(), optional=True),
            prefix="--arguments_file",
            doc=
            "[default: []] read one or more arguments files and add them to the command line",
        ),
        ToolInput(
            "compressionLevel",
            Int(optional=True),
            prefix="--COMPRESSION_LEVEL",
            doc=
            "[default: 5] Compression level for all compressed files created (e.g. BAM and VCF).",
        ),
        ToolInput(
            "createIndex",
            Boolean(optional=True),
            prefix="--CREATE_INDEX",
            doc=
            "[default: TRUE] Whether to create a BAM index when writing a coordinate-sorted BAM file.",
        ),
        ToolInput(
            "createMd5File",
            Boolean(optional=True),
            prefix="--CREATE_MD5_FILE",
            doc=
            "[default: FALSE] Whether to create an MD5 digest for any BAM or FASTQ files created.",
        ),
        ToolInput(
            "ga4ghClientSecrets",
            File(optional=True),
            prefix="--GA4GH_CLIENT_SECRETS",
            doc=
            "[default: client_secrets.json] Google Genomics API client_secrets.json file path.",
        ),
        ToolInput(
            "maxRecordsInRam",
            Int(optional=True),
            prefix="--MAX_RECORDS_IN_RAM",
            doc=
            "[default: 500000] When writing files that need to be sorted, this will specify the number of "
            "records stored in RAM before spilling to disk. Increasing this number reduces the number of "
            "file handles needed to sort the file, and increases the amount of RAM needed.",
        ),
        ToolInput(
            "quiet",
            Boolean(optional=True),
            prefix="--QUIET",
            doc=
            "[default: FALSE] Whether to suppress job-summary info on System.err.",
        ),
        ToolInput(
            "referenceSequence",
            File(optional=True),
            prefix="--REFERENCE_SEQUENCE",
            doc="[default: null] Reference sequence file.",
        ),
        ToolInput(
            "tmpDir",
            String(optional=True),
            default="/tmp",
            prefix="--TMP_DIR",
            doc=
            "[default: []] One or more directories with space available to be "
            "used by this program for temporary storage of working files",
        ),
        ToolInput(
            "useJdkDeflater",
            Boolean(optional=True),
            prefix="--USE_JDK_DEFLATER",
            doc=
            "[default: FALSE] (-use_jdk_deflater) Use the JDK Deflater instead "
            "of the Intel Deflater for writing compressed output",
        ),
        ToolInput(
            "useJdkInflater",
            Boolean(optional=True),
            prefix="--USE_JDK_INFLATER",
            doc=
            "[default: FALSE] (-use_jdk_inflater) Use the JDK Inflater instead "
            "of the Intel Inflater for reading compressed input",
        ),
        ToolInput(
            "validationStringency",
            String(optional=True),
            prefix="--VALIDATION_STRINGENCY",
            doc=
            "[default: STRICT] Validation stringency for all SAM files read by this program. Setting "
            "stringency to SILENT can improve performance when processing a BAM file in which "
            "variable-length data (read, qualities, tags) do not otherwise need to be decoded.",
        ),
        ToolInput(
            "verbosity",
            Boolean(optional=True),
            prefix="--VERBOSITY",
            doc="[default: INFO] Control verbosity of logging.",
        ),
    ]

    def tests(self):
        remote_dir = "https://swift.rc.nectar.org.au/v1/AUTH_4df6e734a509497692be237549bbe9af/janis-test-data/bioinformatics/wgsgermline_data"
        return [
            TTestCase(
                name="basic",
                input={
                    "javaOptions": ["-Xmx6G"],
                    "vcfs": [
                        f"{remote_dir}/NA12878-BRCA1.norm.vcf",
                    ],
                },
                output=Vcf.basic_test(
                    "out",
                    51615,
                    221,
                    ["GATKCommandLine"],
                    "b7acb0a9900713cc7da7aeed5160c971",
                ),
            )
        ]
Exemple #9
0
class Bcl2FastqBase(IlluminaToolBase, ABC):
    def tool(self):
        return "bcl2fastq"

    def tool_provider(self):
        return "Illumina"

    def friendly_name(self):
        return "Bcl2Fastq"

    def base_command(self):
        return "bcl2fastq"

    def arguments(self):
        return [
            ToolArgument(".",
                         prefix="--output-dir",
                         doc="path to demultiplexed output")
        ]

    def inputs(self):
        return [
            ToolInput(
                "runFolderDir",
                input_type=Directory(),
                prefix="-R",
                doc="path to runfolder directory",
            ),
            ToolInput(
                "sampleSheet",
                input_type=Csv(),
                prefix="--sample-sheet",
                doc="path to the sample sheet",
            ),
            ToolInput(
                "loadingThreads",
                input_type=Int(),
                prefix="-r",
                default=4,
                doc="number of threads used for loading BCL data",
            ),
            ToolInput(
                "processingThreads",
                input_type=Int(),
                prefix="-p",
                default=4,
                doc="number of threads used for processing demultiplexed data",
            ),
            ToolInput(
                "writingThreads",
                input_type=Int(),
                prefix="-w",
                default=4,
                doc="number of threads used for writing FASTQ data",
            ),
            *Bcl2FastqBase.additional_inputs,
        ]

    def outputs(self):
        return [
            ToolOutput(
                "unalignedReads",
                output_type=Array(FastqGz()),
                glob=WildcardSelector("*/*.fastq.gz"),
            ),
            ToolOutput("stats",
                       output_type=Array(File()),
                       glob=WildcardSelector("Stats/*")),
            ToolOutput("interop",
                       output_type=Array(File()),
                       glob=WildcardSelector("InterOp/*")),
        ]

    def cpus(self, hints: Dict[str, Any]):
        val = get_value_for_hints_and_ordered_resource_tuple(
            hints, CORES_TUPLE)
        if val:
            return val
        return 4

    def memory(self, hints: Dict[str, Any]):
        val = get_value_for_hints_and_ordered_resource_tuple(hints, MEM_TUPLE)
        if val:
            return val
        return 4

    def bind_metadata(self):
        from datetime import date

        return ToolMetadata(
            contributors=["Matthias De Smet (@mattdsm)"],
            dateCreated=date(2020, 3, 5),
            dateUpdated=date(2020, 3, 5),
            institution=None,
            doi=None,
            keywords=["illumina", "demultiplex"],
            documentationUrl=
            "https://support.illumina.com/downloads/bcl2fastq-conversion-software-v2-20.html",
            documentation="BCL to FASTQ file converter",
        )

    additional_inputs = [
        ToolInput(
            "minimumTrimmedReadLength",
            input_type=Int(optional=True),
            prefix="--minimum-trimmed-read-length",
            doc="minimum read length after adapter trimming",
        ),
        ToolInput(
            "useBasesMask",
            input_type=String(optional=True),
            prefix="--use-bases-mask",
            doc="specifies how to use each cycle",
        ),
        ToolInput(
            "maskShortAdapterReads",
            input_type=Int(optional=True),
            prefix="--mask-short-adapter-reads",
            doc=
            "smallest number of remaining bases (after masking bases below the minimum trimmed read length) below which whole read is masked",
        ),
        ToolInput(
            "adapterStringency",
            input_type=Float(optional=True),
            prefix="--adapter-stringency",
            doc="adapter stringency",
        ),
        ToolInput(
            "ignoreMissingBcls",
            input_type=Boolean(optional=True),
            prefix="--ignore-missing-bcls",
            doc="assume 'N'/'#' for missing calls",
        ),
        ToolInput(
            "ignoreMissingFilter",
            input_type=Boolean(optional=True),
            prefix="--ignore-missing-filter",
            doc="assume 'true' for missing filters",
        ),
        ToolInput(
            "ignoreMissingPositions",
            input_type=Boolean(optional=True),
            prefix="--ignore-missing-positions",
            doc=
            "assume [0,i] for missing positions, where i is incremented starting from 0",
        ),
        ToolInput(
            "writeFastqReverseComplement",
            input_type=Boolean(optional=True),
            prefix="--write-fastq-reverse-complement",
            doc="generate FASTQs containing reverse complements of actual data",
        ),
        ToolInput(
            "withFailedReads",
            input_type=Boolean(optional=True),
            prefix="--with-failed-reads",
            doc="include non-PF clusters",
        ),
        ToolInput(
            "createFastqForIndexReads",
            input_type=Boolean(optional=True),
            prefix="--create-fastq-for-index-reads",
            doc="create FASTQ files also for index reads",
        ),
        ToolInput(
            "findAdaptersWithSlidingWindow",
            input_type=Boolean(optional=True),
            prefix="--find-adapters-with-sliding-window",
            doc="find adapters with simple sliding window algorithm",
        ),
        ToolInput(
            "noBgzfCompression",
            input_type=Boolean(optional=True),
            prefix="--no-bgzf-compression",
            doc="turn off BGZF compression for FASTQ files",
        ),
        ToolInput(
            "barcodeMismatches",
            input_type=Int(optional=True),
            prefix="--barcode-mismatches",
            doc="number of allowed mismatches per index",
        ),
        ToolInput(
            "noLaneSplitting",
            input_type=Boolean(optional=True),
            prefix=" --no-lane-splitting",
            doc="do not split fastq files by lane",
        ),
    ]
class VarDictSomaticCompressedBase(BioinformaticsTool, ABC):
    def friendly_name(self) -> str:
        return "Vardict (Somatic)"

    def tool_provider(self):
        return "VarDict"

    def tool(self):
        return "vardict_somatic"

    def base_command(self):
        return "VarDict"

    def cpus(self, hints: Dict[str, Any]):
        val = get_value_for_hints_and_ordered_resource_tuple(
            hints, CORES_TUPLE)
        if val:
            return val
        return 4

    def memory(self, hints: Dict[str, Any]):
        val = get_value_for_hints_and_ordered_resource_tuple(hints, MEM_TUPLE)
        if val:
            return val
        return 8

    def inputs(self) -> List[ToolInput]:
        return [
            ToolInput("tumorBam", BamBai(), doc="The indexed BAM file"),
            ToolInput("normalBam", BamBai(), doc="The indexed BAM file"),
            ToolInput("intervals", Bed(), position=2, shell_quote=False),
            ToolInput(
                "reference",
                FastaFai(),
                prefix="-G",
                position=1,
                shell_quote=False,
                doc="The reference fasta. Should be indexed (.fai). "
                "Defaults to: /ngs/reference_data/genomes/Hsapiens/hg19/seq/hg19.fa",
            ),
            ToolInput(
                "tumorName",
                String(),
                doc=
                "The sample name to be used directly.  Will overwrite -n option",
            ),
            ToolInput(
                "normalName",
                String(),
                doc="The normal sample name to use with the -b option",
            ),
            ToolInput(
                "alleleFreqThreshold",
                Float(optional=True),
                doc="The threshold for allele frequency, default: 0.05 or 5%",
            ),
            ToolInput(
                "outputFilename",
                Filename(extension=".vcf", suffix=".vardict"),
                prefix=">",
                position=10,
                shell_quote=False,
            ),
            *VarDictSomaticCompressedBase.vardict_inputs,
            *VarDictSomaticCompressedBase.var2vcf_inputs,
        ]

    def outputs(self):
        return [
            ToolOutput("out",
                       CompressedVcf,
                       glob=InputSelector("outputFilename"))
        ]

    def arguments(self):
        return [
            ToolArgument("| testsomatic.R |", position=3, shell_quote=False),
            ToolArgument("var2vcf_paired.pl", position=4, shell_quote=False),
            ToolArgument(
                JoinOperator(
                    [InputSelector("tumorBam"),
                     InputSelector("normalBam")], "|"),
                prefix="-b",
                position=1,
                shell_quote=True,
            ),
            ToolArgument(InputSelector("tumorName"),
                         prefix="-N",
                         position=1,
                         shell_quote=True),
            ToolArgument(
                JoinOperator(
                    [InputSelector("tumorName"),
                     InputSelector("normalName")], "|"),
                prefix="-N",
                position=5,
                shell_quote=True,
            ),
            ToolArgument(
                InputSelector("alleleFreqThreshold"),
                prefix="-f",
                position=5,
                shell_quote=False,
            ),
            ToolArgument(
                InputSelector("alleleFreqThreshold"),
                prefix="-f",
                position=1,
                shell_quote=False,
            ),
            ToolArgument(" | bcftools view -O z",
                         position=6,
                         shell_quote=False),
        ]

    vardict_inputs = [
        ToolInput(
            "indels3prime",
            Boolean(optional=True),
            prefix="-3",
            position=1,
            shell_quote=False,
            doc=
            "Indicate to move indels to 3-prime if alternative alignment can be achieved.",
        ),
        ToolInput(
            "amplicon",
            Float(optional=True),
            prefix="-a",
            position=1,
            shell_quote=False,
            doc=
            "Indicate it's amplicon based calling.  Reads that don't map to the amplicon will be skipped.  "
            "A read pair is considered belonging  to the amplicon if the edges are less than int bp to "
            "the amplicon, and overlap fraction is at least float.  Default: 10:0.95",
        ),
        ToolInput(
            "minReads",
            Int(optional=True),
            prefix="-B",
            position=1,
            shell_quote=False,
            doc="The minimum # of reads to determine strand bias, default 2",
        ),
        ToolInput(
            "chromNamesAreNumbers",
            Boolean(optional=True),
            prefix="-C",
            position=1,
            shell_quote=False,
            doc=
            "Indicate the chromosome names are just numbers, such as 1, 2, not chr1, chr2",
        ),
        ToolInput(
            "chromColumn",
            Int(optional=True),
            prefix="-c",
            position=1,
            shell_quote=False,
            doc="The column for chromosome",
        ),
        ToolInput(
            "debug",
            Boolean(optional=True),
            prefix="-D",
            position=1,
            shell_quote=False,
            doc=
            "Debug mode.  Will print some error messages and append full genotype at the end.",
        ),
        ToolInput(
            "splitDelimeter",
            String(optional=True),
            prefix="-d",
            position=1,
            shell_quote=False,
            doc='The delimiter for split region_info, default to tab "\t"',
        ),
        ToolInput(
            "geneEndCol",
            Int(optional=True),
            prefix="-E",
            position=1,
            shell_quote=False,
            doc="The column for region end, e.g. gene end",
        ),
        ToolInput(
            "segEndCol",
            Int(optional=True),
            prefix="-e",
            position=1,
            shell_quote=False,
            doc="The column for segment ends in the region, e.g. exon ends",
        ),
        ToolInput(
            "filter",
            String(optional=True),
            prefix="-F",
            position=1,
            shell_quote=False,
            doc=
            "The hexical to filter reads using samtools. Default: 0x500 (filter 2nd alignments and "
            "duplicates). Use -F 0 to turn it off.",
        ),
        ToolInput(
            "geneNameCol",
            Int(optional=True),
            prefix="-g",
            position=1,
            shell_quote=False,
            doc="The column for gene name, or segment annotation",
        ),
        # ToolInput("help", Boolean(optional=True), prefix="-H", position=1, shell_quote=False,
        #           doc="Print this help page"),
        ToolInput(
            "printHeaderRow",
            Boolean(optional=True),
            prefix="-h",
            position=1,
            shell_quote=False,
            doc="Print a header row describing columns",
        ),
        ToolInput(
            "indelSize",
            Int(optional=True),
            prefix="-I",
            position=1,
            shell_quote=False,
            doc="The indel size.  Default: 120bp",
        ),
        ToolInput(
            "outputSplice",
            Boolean(optional=True),
            prefix="-i",
            position=1,
            shell_quote=False,
            doc="Output splicing read counts",
        ),
        ToolInput(
            "performLocalRealignment",
            Int(optional=True),
            prefix="-k",
            position=1,
            shell_quote=False,
            doc=
            "Indicate whether to perform local realignment.  Default: 1.  Set to 0 to disable it. "
            "For Ion or PacBio, 0 is recommended.",
        ),
        ToolInput(
            "minMatches",
            Int(optional=True),
            prefix="-M",
            position=1,
            shell_quote=False,
            doc=
            "The minimum matches for a read to be considered. If, after soft-clipping, the matched "
            "bp is less than INT, then the read is discarded. It's meant for PCR based targeted sequencing "
            "where there's no insert and the matching is only the primers. Default: 0, or no filtering",
        ),
        ToolInput(
            "maxMismatches",
            Int(optional=True),
            prefix="-m",
            position=1,
            shell_quote=False,
            doc=
            "If set, reads with mismatches more than INT will be filtered and ignored. "
            "Gaps are not counted as mismatches. Valid only for bowtie2/TopHat or BWA aln "
            "followed by sampe. BWA mem is calculated as NM - Indels. "
            "Default: 8, or reads with more than 8 mismatches will not be used.",
        ),
        ToolInput(
            "regexSampleName",
            String(optional=True),
            prefix="-n",
            position=1,
            shell_quote=False,
            doc=
            "The regular expression to extract sample name from BAM filenames. "
            "Default to: /([^\/\._]+?)_[^\/]*.bam/",
        ),
        ToolInput(
            "mapq",
            String(optional=True),
            prefix="-O",
            position=1,
            shell_quote=False,
            doc=
            "The reads should have at least mean MapQ to be considered a valid variant. "
            "Default: no filtering",
        ),
        ToolInput(
            "qratio",
            Float(optional=True),
            prefix="-o",
            position=1,
            shell_quote=False,
            doc="The Qratio of (good_quality_reads)/(bad_quality_reads+0.5). "
            "The quality is defined by -q option.  Default: 1.5",
        ),
        ToolInput(
            "readPosition",
            Float(optional=True),
            prefix="-P",
            position=1,
            shell_quote=False,
            doc=
            "The read position filter. If the mean variants position is less that specified, "
            "it's considered false positive.  Default: 5",
        ),
        ToolInput(
            "pileup",
            Boolean(optional=True),
            prefix="-p",
            position=1,
            shell_quote=False,
            doc="Do pileup regardless of the frequency",
        ),
        ToolInput(
            "minMappingQual",
            Int(optional=True),
            prefix="-Q",
            position=1,
            shell_quote=False,
            doc=
            "If set, reads with mapping quality less than INT will be filtered and ignored",
        ),
        ToolInput(
            "phredScore",
            Int(optional=True),
            prefix="-q",
            position=1,
            shell_quote=False,
            doc="The phred score for a base to be considered a good call.  "
            "Default: 25 (for Illumina) For PGM, set it to ~15, as PGM tends to under estimate base quality.",
        ),
        ToolInput(
            "region",
            String(optional=True),
            prefix="-R",
            position=1,
            shell_quote=False,
            doc=
            "The region of interest.  In the format of chr:start-end.  If end is omitted, "
            "then a single position.  No BED is needed.",
        ),
        ToolInput(
            "minVariantReads",
            Int(optional=True),
            prefix="-r",
            position=1,
            shell_quote=False,
            doc="The minimum # of variant reads, default 2",
        ),
        ToolInput(
            "regStartCol",
            Int(optional=True),
            prefix="-S",
            position=1,
            shell_quote=False,
            doc="The column for region start, e.g. gene start",
        ),
        ToolInput(
            "segStartCol",
            Int(optional=True),
            prefix="-s",
            position=1,
            shell_quote=False,
            doc="The column for segment starts in the region, e.g. exon starts",
        ),
        ToolInput(
            "minReadsBeforeTrim",
            Int(optional=True),
            prefix="-T",
            position=1,
            shell_quote=False,
            doc="Trim bases after [INT] bases in the reads",
        ),
        ToolInput(
            "removeDuplicateReads",
            Boolean(optional=True),
            prefix="-t",
            position=1,
            shell_quote=False,
            doc=
            "Indicate to remove duplicated reads.  Only one pair with same start positions will be kept",
        ),
        ToolInput(
            "threads",
            Int(optional=True),
            default=CpuSelector(),
            prefix="-th",
            position=1,
            shell_quote=False,
            doc="Threads count.",
        ),
        ToolInput(
            "freq",
            Int(optional=True),
            prefix="-V",
            position=1,
            shell_quote=False,
            doc=
            "The lowest frequency in the normal sample allowed for a putative somatic mutation. "
            "Defaults to 0.05",
        ),
        ToolInput(
            "vcfFormat",
            Boolean(optional=True),
            prefix="-v",
            position=1,
            shell_quote=False,
            doc="VCF format output",
        ),
        ToolInput(
            "vs",
            String(optional=True),
            prefix="-VS",
            position=1,
            shell_quote=False,
            doc=
            "[STRICT | LENIENT | SILENT] How strict to be when reading a SAM or BAM: "
            "STRICT   - throw an exception if something looks wrong. "
            "LENIENT	- Emit warnings but keep going if possible. "
            "SILENT	- Like LENIENT, only don't emit warning messages. "
            "Default: LENIENT",
        ),
        ToolInput(
            "bp",
            Int(optional=True),
            prefix="-X",
            position=1,
            shell_quote=False,
            doc=
            "Extension of bp to look for mismatches after insersion or deletion.  "
            "Default to 3 bp, or only calls when they're within 3 bp.",
        ),
        ToolInput(
            "extensionNucleotide",
            Int(optional=True),
            prefix="-x",
            position=1,
            shell_quote=False,
            doc=
            "The number of nucleotide to extend for each segment, default: 0",
        ),
        ToolInput(
            "yy",
            Boolean(optional=True),
            prefix="-y",
            position=1,
            shell_quote=False,
            doc="<No content>",
        ),
        ToolInput(
            "downsamplingFraction",
            Int(optional=True),
            prefix="-Z",
            position=1,
            shell_quote=False,
            doc=
            "For downsampling fraction.  e.g. 0.7 means roughly 70% downsampling.  "
            "Default: No downsampling.  Use with caution.  "
            "The downsampling will be random and non-reproducible.",
        ),
        ToolInput(
            "zeroBasedCoords",
            Int(optional=True),
            prefix="-z",
            position=1,
            shell_quote=False,
            doc=
            "0/1  Indicate whether coordinates are zero-based, as IGV uses.  "
            "Default: 1 for BED file or amplicon BED file. Use 0 to turn it off. "
            "When using the -R option, it's set to 0",
        ),
    ]

    var2vcf_inputs = []

    def docurl():
        return "https://github.com/AstraZeneca-NGS/VarDict"

    def doc(self):
        return """
Exemple #11
0
class BcfToolsViewBase(BcfToolsToolBase, ABC):
    def bind_metadata(self):
        from datetime import date

        self.metadata.dateUpdated = date(2019, 1, 24)
        self.metadata.doi = "http://www.ncbi.nlm.nih.gov/pubmed/19505943"
        self.metadata.citation = (
            "Li H, Handsaker B, Wysoker A, Fennell T, Ruan J, Homer N, Marth G, Abecasis G, Durbin R, "
            "and 1000 Genome Project Data Processing Subgroup, The Sequence alignment/map (SAM) "
            "format and SAMtools, Bioinformatics (2009) 25(16) 2078-9")
        self.metadata.documentationUrl = (
            "https://samtools.github.io/bcftools/bcftools.html#view")
        self.metadata.documentation = """________________________________\n 
        View, subset and filter VCF or BCF files by position and filtering expression
        Convert between VCF and BCF. Former bcftools subset."""

    def tool(self):
        return "bcftoolsview"

    def friendly_name(self):
        return "BCFTools: View"

    def base_command(self):
        return ["bcftools", "view"]

    def cpus(self, hints: Dict[str, Any]):
        val = get_value_for_hints_and_ordered_resource_tuple(
            hints, CORES_TUPLE)
        if val:
            return val
        return 1

    def memory(self, hints: Dict[str, Any]):
        val = get_value_for_hints_and_ordered_resource_tuple(hints, MEM_TUPLE)
        if val:
            return val
        return 8

    def inputs(self) -> List[ToolInput]:
        return [
            ToolInput("file", CompressedVcf(), position=2),
            *self.additional_inputs
        ]

    def outputs(self) -> List[ToolOutput]:
        return [ToolOutput("out", Stdout(CompressedVcf()))]

    def arguments(self):
        return [
            # Ensures the output is compressed
            ToolArgument(
                "z",
                prefix="--output-type",
                position=1,
                doc="(-O) [<b|u|z|v>] b: compressed BCF, u: uncompressed BCF, "
                "z: compressed VCF, v: uncompressed VCF [v]",
            )
        ]

    additional_inputs = [
        ToolInput(
            "dropGenotypes",
            Boolean(optional=True),
            prefix="--drop-genotypes",
            position=1,
            doc=
            "(-G) drop individual genotype information (after subsetting if -s option set)",
        ),
        ToolInput(
            "headerOnly",
            Boolean(optional=True),
            prefix="--header-only",
            position=1,
            doc="(-h) print the header only",
        ),
        ToolInput(
            "noHeader",
            Boolean(optional=True),
            prefix="--no-header",
            position=1,
            doc="(-H) suppress the header in VCF output",
        ),
        ToolInput(
            "compressionLevel",
            Int(optional=True),
            prefix="--compression-level",
            position=1,
            doc=
            "(-l) compression level: 0 uncompressed, 1 best speed, 9 best compression [-1]",
        ),
        ToolInput(
            "noVersion",
            Boolean(optional=True),
            prefix="--no-version",
            position=1,
            doc="do not append version and command line to the header",
        ),
        # Captured by stdout
        # ToolInput(
        #     "outputFilename",
        #     File(optional=True),
        #     prefix="--output-file",
        #     position=1,
        #     doc="(-o) output file name [stdout]",
        # ),
        ToolInput(
            "regions",
            String(optional=True),
            prefix="--regions",
            position=1,
            doc="(-r) restrict to comma-separated list of regions",
        ),
        ToolInput(
            "regionsFile",
            File(optional=True),
            prefix="--regions-file",
            position=1,
            doc="(-R) restrict to regions listed in a file",
        ),
        ToolInput(
            "targets",
            String(optional=True),
            prefix="--targets",
            position=1,
            doc=
            "(-t) similar to -r but streams rather than index-jumps. Exclude regions with '^' prefix",
        ),
        ToolInput(
            "targetsFile",
            File(optional=True),
            prefix="--targets-file",
            position=1,
            doc=
            "(-T) similar to -R but streams rather than index-jumps. Exclude regions with '^' prefix",
        ),
        ToolInput(
            "threads",
            Int(optional=True),
            prefix="--threads",
            position=1,
            doc="number of extra output compression threads [0]",
        ),
        ToolInput(
            "trimAltAlleles",
            Boolean(optional=True),
            prefix="--trim-alt-alleles",
            position=1,
            doc="(-a) trim alternate alleles not seen in the subset",
        ),
        ToolInput(
            "noUpdate",
            Boolean(optional=True),
            prefix="--no-update",
            position=1,
            doc=
            "(-I) do not (re)calculate INFO fields for the subset (currently INFO/AC and INFO/AN)",
        ),
        ToolInput(
            "samples",
            Array(String(), optional=True),
            prefix="--samples",
            position=1,
            doc=
            "(-s) comma separated list of samples to include (or exclude with '^' prefix)",
        ),
        ToolInput(
            "samplesFile",
            File(optional=True),
            prefix="--samples-file",
            position=1,
            doc="(-S) file of samples to include (or exclude with '^' prefix)",
        ),
        ToolInput(
            "forceSamples",
            Boolean(optional=True),
            prefix="--force-samples",
            position=1,
            doc="only warn about unknown subset samples",
        ),
        ToolInput(
            "minAc",
            Int(optional=True),
            prefix="--min-ac",
            position=1,
            doc=
            "(-c) minimum count for non-reference (nref), 1st alternate (alt1), least frequent (minor), "
            "most frequent (major) or sum of all but most frequent (nonmajor) alleles [nref]",
        ),
        ToolInput(
            "maxAc",
            Int(optional=True),
            prefix="--max-ac",
            position=1,
            doc=
            "(-C) maximum count for non-reference (nref), 1st alternate (alt1), least frequent (minor), "
            "most frequent (major) or sum of all but most frequent (nonmajor) alleles [nref]",
        ),
        ToolInput(
            "applyFilters",
            Array(String(), optional=True),
            prefix="--apply-filters",
            position=1,
            doc=
            "(-f) require at least one of the listed FILTER strings (e.g. 'PASS,.'')",
        ),
        ToolInput(
            "genotype",
            String(optional=True),
            prefix="--genotype",
            position=1,
            doc=
            "(-g) [<hom|het|miss>] require one or more hom/het/missing genotype or, if prefixed with '^', "
            "exclude sites with hom/het/missing genotypes",
        ),
        ToolInput(
            "include",
            String(optional=True),
            prefix="--include",
            position=1,
            doc=
            "(-i) select sites for which the expression is true (see man page for details)",
        ),
        ToolInput(
            "exclude",
            String(optional=True),
            prefix="--exclude",
            position=1,
            doc=
            "(-e) exclude sites for which the expression is true (see man page for details)",
        ),
        ToolInput(
            "known",
            Boolean(optional=True),
            prefix="--known",
            position=1,
            doc="(-k) select known sites only (ID is not/is '.')",
        ),
        ToolInput(
            "novel",
            Boolean(optional=True),
            prefix="--novel",
            position=1,
            doc="(-n) select novel sites only (ID is not/is '.')",
        ),
        ToolInput(
            "minAlleles",
            Int(optional=True),
            prefix="--min-alleles",
            position=1,
            doc=
            "(-m) minimum number of alleles listed in REF and ALT (e.g. -m2 -M2 for biallelic sites)",
        ),
        ToolInput(
            "maxAlleles",
            Int(optional=True),
            prefix="--max-alleles",
            position=1,
            doc=
            "(-M) maximum number of alleles listed in REF and ALT (e.g. -m2 -M2 for biallelic sites)",
        ),
        ToolInput(
            "phased",
            Boolean(optional=True),
            prefix="--phased",
            position=1,
            doc="(-p) select sites where all samples are phased",
        ),
        ToolInput(
            "excludePhased",
            Boolean(optional=True),
            prefix="--exclude-phased",
            position=1,
            doc="(-P) exclude sites where all samples are phased",
        ),
        ToolInput(
            "minAf",
            Float(optional=True),
            prefix="--min-af",
            position=1,
            doc=
            "(-q) minimum frequency for non-reference (nref), 1st alternate (alt1), least frequent (minor), "
            "most frequent (major) or sum of all but most frequent (nonmajor) alleles [nref]",
        ),
        ToolInput(
            "maxAf",
            Float(optional=True),
            prefix="--max-af",
            position=1,
            doc=
            "(-Q) maximum frequency for non-reference (nref), 1st alternate (alt1), least frequent (minor), "
            "most frequent (major) or sum of all but most frequent (nonmajor) alleles [nref]",
        ),
        ToolInput(
            "uncalled",
            Boolean(optional=True),
            prefix="--uncalled",
            position=1,
            doc="(-u) select sites without a called genotype",
        ),
        ToolInput(
            "excludeUncalled",
            Boolean(optional=True),
            prefix="--exclude-uncalled",
            position=1,
            doc="(-U) exclude sites without a called genotype",
        ),
        ToolInput(
            "types",
            Array(String(), optional=True),
            prefix="--types",
            position=1,
            doc=
            "(-v) select comma-separated list of variant types: snps,indels,mnps,other [null]",
        ),
        ToolInput(
            "excludeTypes",
            Array(String(), optional=True),
            prefix="--exclude-types",
            position=1,
            doc=
            "(-V) exclude comma-separated list of variant types: snps,indels,mnps,other [null]",
        ),
        ToolInput(
            "private",
            Boolean(optional=True),
            prefix="--private",
            position=1,
            doc=
            "(-x) select sites where the non-reference alleles are exclusive (private) to the subset samples",
        ),
        ToolInput(
            "excludePrivate",
            Boolean(optional=True),
            prefix="--exclude-private",
            position=1,
            doc=
            "(-X) exclude sites where the non-reference alleles are exclusive (private) to the subset samples",
        ),
    ]
Exemple #12
0
class Gatk4MergeBamAlignmentBase(Gatk4ToolBase, ABC):
    @classmethod
    def gatk_command(cls):
        return "MergeBamAlignment"

    def tool(self):
        return "Gatk4MergeBamAlignment"

    def friendly_name(self):
        return "GATK4: Merge SAM or BAM with unmapped BAM file"

    def cpus(self, hints: Dict[str, Any]):
        val = get_value_for_hints_and_ordered_resource_tuple(
            hints, CORES_TUPLE)
        if val:
            return val
        return 1

    def memory(self, hints: Dict[str, Any]):
        val = get_value_for_hints_and_ordered_resource_tuple(hints, MEM_TUPLE)
        if val:
            return val
        return 4

    def inputs(self):
        return [
            ToolInput(
                "ubam",
                BamBai(),
                prefix="--UNMAPPED_BAM",
                prefix_applies_to_all_elements=True,
                doc=
                "Original SAM or BAM file of unmapped reads, which must be in queryname order.",
                position=10,
            ),
            ToolInput(
                "bam",
                Array(BamBai()),
                prefix="--ALIGNED_BAM",
                prefix_applies_to_all_elements=True,
                doc="SAM or BAM file(s) with alignment data.",
                position=10,
            ),
            ToolInput(
                "reference",
                FastaWithDict(optional=True),
                prefix="--REFERENCE_SEQUENCE",
                position=10,
                doc="Reference sequence file.",
            ),
            ToolInput(
                "outputFilename",
                Filename(extension=".bam"),
                position=10,
                prefix="--OUTPUT",
                doc="Merged SAM or BAM file to write to.",
            ),
            *self.additional_args,
        ]

    def outputs(self):
        return [
            ToolOutput(
                "out",
                BamBai(),
                glob=InputSelector("outputFilename"),
                secondaries_present_as={".bai": "^.bai"},
            )
        ]

    def bind_metadata(self):
        from datetime import date

        return ToolMetadata(
            contributors=[
                "Michael Franklin (@illisional)",
                "Matthias De Smet(@matthdsm)",
            ],
            dateCreated=date(2018, 12, 24),
            dateUpdated=date(2020, 2, 26),
            institution="Broad Institute",
            doi=None,
            citation=
            "See https://software.broadinstitute.org/gatk/documentation/article?id=11027 for more information",
            keywords=["gatk", "gatk4", "broad", "merge", "sam"],
            documentationUrl=
            "https://gatk.broadinstitute.org/hc/en-us/articles/360037225832-MergeBamAlignment-Picard-",
            documentation="Merges SAM/BAM file with an unmapped BAM file",
        )

    additional_args = [
        ToolInput(
            "addMateCigar",
            Boolean(optional=True),
            prefix="--ADD_MATE_CIGAR",
            position=11,
            doc="Adds the mate CIGAR tag (MC)",
        ),
        ToolInput(
            "alignedReadsOnly",
            Boolean(optional=True),
            prefix="--ALIGNED_READS_ONLY",
            position=11,
            doc="Whether to output only aligned reads.",
        ),
        ToolInput(
            "alignerProperPairFlags",
            Boolean(optional=True),
            prefix="--ALIGNER_PROPER_PAIR_FLAGS",
            position=11,
            doc=
            "Use the aligner's idea of what a proper pair is rather than computing in this program.",
        ),
        ToolInput(
            "argumentsFile",
            Array(File(), optional=True),
            prefix="--arguments_file",
            position=11,
            doc=
            "read one or more arguments files and add them to the command line",
        ),
        ToolInput(
            "attributesToRemove",
            Array(String(), optional=True),
            prefix="--ATTRIBUTES_TO_REMOVE",
            position=11,
            doc=
            "Attributes from the alignment record that should be removed when merging.",
        ),
        ToolInput(
            "attributesToRetain",
            Array(String(), optional=True),
            prefix="--ATTRIBUTES_TO_RETAIN",
            position=11,
            doc=
            "Reserved alignment attributes (tags starting with X, Y, or Z) that should be brought over from the alignment data when merging.",
        ),
        ToolInput(
            "attributesToReverse",
            Array(String(), optional=True),
            prefix="--ATTRIBUTES_TO_REVERSE",
            position=11,
            doc="Attributes on negative strand reads that need to be reversed.",
        ),
        ToolInput(
            "attributesToReverseComplement",
            Array(String(), optional=True),
            prefix="--ATTRIBUTES_TO_REVERSE_COMPLEMENT",
            position=11,
            doc=
            "Attributes on negative strand reads that need to be reverse complemented.",
        ),
        ToolInput(
            "clipAdapter",
            Boolean(optional=True),
            prefix="--CLIP_ADAPTERS",
            position=11,
            doc="Whether to clip adapters where identified.",
        ),
        ToolInput(
            "clipOverlappingReads",
            Boolean(optional=True),
            prefix="--CLIP_OVERLAPPING_READS",
            position=11,
            doc=
            "For paired reads, soft clip the 3' end of each read if necessary so that it does not extend past the 5' end of its mate.",
        ),
        ToolInput(
            "expectedOrientations",
            Array(String(), optional=True),
            prefix="--EXPECTED_ORIENTATIONS",
            position=11,
            doc="The expected orientation of proper read pairs.",
        ),
        ToolInput(
            "includeSecondaryAlginments",
            Boolean(optional=True),
            prefix="--INCLUDE_SECONDARY_ALIGNMENTS",
            position=11,
            doc="If false, do not write secondary alignments to output.",
        ),
        ToolInput(
            "isBisulfiteSequencing",
            Boolean(optional=True),
            prefix="--IS_BISULFITE_SEQUENCE",
            position=11,
            doc=
            "Whether the lane is bisulfite sequence (used when calculating the NM tag).",
        ),
        ToolInput(
            "matchingDictionaryTags",
            Array(String(), optional=True),
            prefix="--MATCHING_DICTIONARY_TAGS",
            position=11,
            doc=
            "List of Sequence Records tags that must be equal (if present) in the reference dictionary and in the aligned file.",
        ),
        ToolInput(
            "maxInsertionsOrDeletions",
            Int(optional=True),
            prefix="--MAX_INSERTIONS_OR_DELETIONS",
            position=11,
            doc=
            "The maximum number of insertions or deletions permitted for an alignment to be included.",
        ),
        ToolInput(
            "minUnclippedBases",
            Int(optional=True),
            prefix="--MIN_UNCLIPPED_BASES",
            position=11,
            doc=
            "If UNMAP_CONTAMINANT_READS is set, require this many unclipped bases or else the read will be marked as contaminant.",
        ),
        ToolInput(
            "primaryAlignmentStrategy",
            Int(optional=True),
            prefix="--PRIMARY_ALIGNMENT_STRATEGY",
            position=11,
            doc=
            "Strategy for selecting primary alignment when the aligner has provided more than one alignment for a pair or fragment, and none are marked as primary, more than one is marked as primary, or the primary alignment is filtered out for some reason.",
        ),
        ToolInput(
            "programGroupCommandLine",
            String(optional=True),
            prefix="--PROGRAM_GROUP_COMMAND_LINE",
            position=11,
            doc="The command line of the program group.",
        ),
        ToolInput(
            "programGroupName",
            String(optional=True),
            prefix="--PROGRAM_GROUP_NAME",
            position=11,
            doc="The name of the program group.",
        ),
        ToolInput(
            "programGroupVersion",
            String(optional=True),
            prefix="--PROGRAM_GROUP_VERSION",
            position=11,
            doc="The version of the program group.",
        ),
        ToolInput(
            "programRecordId",
            String(optional=True),
            prefix="--PROGRAM_RECORD_ID",
            position=11,
            doc="The program group ID of the aligner.",
        ),
        ToolInput(
            "sortOrder",
            String(optional=True),
            prefix="-SO",
            position=10,
            doc=
            "The --SORT_ORDER argument is an enumerated type (SortOrder), which can have one of "
            "the following values: [unsorted, queryname, coordinate, duplicate, unknown]",
        ),
        ToolInput(
            "unmapContaminantReads",
            Boolean(optional=True),
            prefix="--UNMAP_CONTAMINANT_READS",
            position=11,
            doc=
            "Detect reads originating from foreign organisms (e.g. bacterial DNA in a non-bacterial sample),and unmap + label those reads accordingly.",
        ),
        ToolInput(
            "unmappedReadStrategy",
            String(optional=True),
            prefix="--UNMAPPED_READ_STRATEGY",
            position=11,
            doc=
            "How to deal with alignment information in reads that are being unmapped (e.g. due to cross-species contamination.) Currently ignored unless UNMAP_CONTAMINANT_READS = true.",
        ),
        ToolInput(
            "addPgTagToReads",
            Boolean(optional=True),
            prefix="--ADD_PG_TAG_TO_READS",
            position=11,
            doc="Add PG tag to each read in a SAM or BAM",
        ),
        ToolInput(
            "compressionLevel",
            Int(optional=True),
            prefix="--COMPRESSION_LEVEL",
            position=11,
            doc=
            "Compression level for all compressed files created (e.g. BAM and GELI).",
        ),
        ToolInput(
            "createIndex",
            Boolean(optional=True),
            prefix="--CREATE_INDEX",
            position=11,
            doc=
            "Whether to create a BAM index when writing a coordinate-sorted BAM file.",
        ),
        ToolInput(
            "createMd5File",
            Boolean(optional=True),
            prefix="--CREATE_MD5_FILE",
            position=11,
            doc=
            "Whether to create an MD5 digest for any BAM or FASTQ files created.",
        ),
        ToolInput(
            "maxRecordsInRam",
            Int(optional=True),
            prefix="--MAX_RECORDS_IN_RAM",
            position=11,
            doc=
            "When writing SAM files that need to be sorted, this will specify the number of "
            "records stored in RAM before spilling to disk. Increasing this number reduces "
            "the number of file handles needed to sort a SAM file, and increases the amount of RAM needed.",
        ),
        ToolInput(
            "quiet",
            Boolean(optional=True),
            prefix="--QUIET",
            position=11,
            doc="Whether to suppress job-summary info on System.err.",
        ),
        ToolInput(
            "tmpDir",
            String(optional=True),
            prefix="--TMP_DIR",
            position=11,
            default="/tmp/",
            doc="Undocumented option",
        ),
        ToolInput(
            "useJdkDeflater",
            Boolean(optional=True),
            prefix="--use_jdk_deflater",
            position=11,
            doc="Whether to use the JdkDeflater (as opposed to IntelDeflater)",
        ),
        ToolInput(
            "useJdkInflater",
            Boolean(optional=True),
            prefix="--use_jdk_inflater",
            position=11,
            doc="Whether to use the JdkInflater (as opposed to IntelInflater)",
        ),
        ToolInput(
            "validationStringency",
            String(optional=True),
            prefix="--VALIDATION_STRINGENCY",
            position=11,
            doc=
            "Validation stringency for all SAM files read by this program. Setting stringency to SILENT "
            "can improve performance when processing a BAM file in which variable-length data "
            "(read, qualities, tags) do not otherwise need to be decoded."
            "The --VALIDATION_STRINGENCY argument is an enumerated type (ValidationStringency), "
            "which can have one of the following values: [STRICT, LENIENT, SILENT]",
        ),
        ToolInput(
            "verbosity",
            String(optional=True),
            prefix="--verbosity",
            position=11,
            doc=
            "The --verbosity argument is an enumerated type (LogLevel), which can have "
            "one of the following values: [ERROR, WARNING, INFO, DEBUG]",
        ),
    ]
Exemple #13
0
class BedToolsCoverageBedBase(BedToolsToolBase, ABC):
    def bind_metadata(self):

        self.contributors = ["Jiaan Yu"]
        self.metadata.dateUpdated = date(2020, 2, 26)
        self.metadata.dateCreated = date(2020, 2, 20)
        self.metadata.doi = None
        self.metadata.citation = None
        self.keywords = ["bedtools", "coverageBed", "coverage"]
        self.metadata.documentationUrl = (
            "https://bedtools.readthedocs.io/en/latest/content/tools/coverage.html"
        )
        self.metadata.documentation = """The bedtools coverage tool computes both the depth and breadth of coverage of features in file B on the features in file A. For example, bedtools coverage can compute the coverage of sequence alignments (file B) across 1 kilobase (arbitrary) windows (file A) tiling a genome of interest. One advantage that bedtools coverage offers is that it not only counts the number of features that overlap an interval in file A, it also computes the fraction of bases in the interval in A that were overlapped by one or more features. Thus, bedtools coverage also computes the breadth of coverage observed for each interval in A."""

    def tool(self):
        return "bedtoolsCoverageBed"

    def friendly_name(self):
        return "BEDTools: coverageBed"

    def base_command(self):
        return ["coverageBed"]

    def inputs(self):
        return [
            *self.additional_inputs,
            ToolInput(
                "inputABed",
                Bed(),
                prefix="-a",
                doc=
                "input file a: only bed is supported. May be followed with multiple databases and/or  wildcard (*) character(s). ",
            ),
            ToolInput(
                "inputBBam",
                Bam(),
                prefix="-b",
                doc="input file b: only bam is supported.",
            ),
            ToolInput(
                "histogram",
                Boolean(optional=True),
                prefix="-hist",
                doc=
                "Report a histogram of coverage for each feature in A as well as a summary histogram for _all_ features in A. Output (tab delimited) after each feature in A: 1) depth 2) # bases at depth 3) size of A 4) % of A at depth.",
            ),
            ToolInput(
                "depth",
                Boolean(optional=True),
                prefix="-d",
                doc=
                "Report the depth at each position in each A feature. Positions reported are one based.  Each position and depth follow the complete A feature.",
            ),
            ToolInput(
                "counts",
                Boolean(optional=True),
                prefix="-counts",
                doc=
                "Only report the count of overlaps, don't compute fraction, etc.",
            ),
            ToolInput(
                "mean",
                Boolean(optional=True),
                prefix="-mean",
                doc="Report the mean depth of all positions in each A feature.",
            ),
        ]

    def outputs(self):
        return [ToolOutput("out", Stdout(TextFile))]

    additional_inputs = [
        ToolInput(
            "strandedness",
            Boolean(optional=True),
            prefix="-s",
            doc=
            "Require same strandedness.  That is, only report hits in B that overlap A on the _same_ strand. - By default, overlaps are reported without respect to strand.",
        ),
        ToolInput(
            "differentStrandedness",
            Boolean(optional=True),
            prefix="-S",
            doc=
            "Require different strandedness.  That is, only report hits in B that overlap A on the _opposite_ strand. - By default, overlaps are reported without respect to strand.",
        ),
        ToolInput(
            "fractionA",
            Float(optional=True),
            prefix="-f",
            doc=
            "Minimum overlap required as a fraction of A. - Default is 1E-9 (i.e., 1bp). - FLOAT (e.g. 0.50)",
        ),
        ToolInput(
            "fractionB",
            Float(optional=True),
            prefix="-F",
            doc=
            "Minimum overlap required as a fraction of B. - Default is 1E-9 (i.e., 1bp). - FLOAT (e.g. 0.50)",
        ),
        ToolInput(
            "reciprocalFraction",
            Boolean(optional=True),
            prefix="-r",
            doc=
            "Require that the fraction overlap be reciprocal for A AND B. - In other words, if -f is 0.90 and -r is used, this requires that B overlap 90% of A and A _also_ overlaps 90% of B.",
        ),
        ToolInput(
            "minFraction",
            Boolean(optional=True),
            prefix="-r",
            doc=
            "Require that the minimum fraction be satisfied for A OR B. - In other words, if -e is used with -f 0.90 and -F 0.10 this requires that either 90% of A is covered OR 10% of  B is covered. Without -e, both fractions would have to be satisfied.",
        ),
        ToolInput(
            "split",
            Boolean(optional=True),
            prefix="-split",
            doc="Treat 'split' BAM or BED12 entries as distinct BED intervals.",
        ),
        ToolInput(
            "genome",
            File(optional=True),
            prefix="-g",
            doc=
            "Provide a genome file to enforce consistent chromosome sort order across input files. Only applies when used with -sorted option.",
        ),
        ToolInput(
            "noNameCheck",
            Boolean(optional=True),
            prefix="-nonamecheck",
            doc=
            "For sorted data, don't throw an error if the file has different naming conventions for the same chromosome. ex. 'chr1' vs 'chr01'.",
        ),
        ToolInput(
            "sorted",
            Boolean(optional=True),
            prefix="-sorted",
            doc=
            "Use the 'chromsweep' algorithm for sorted (-k1,1 -k2,2n) input.",
        ),
        ToolInput(
            "header",
            Boolean(optional=True),
            prefix="-header",
            doc="Print the header from the A file prior to results.",
        ),
        ToolInput(
            "noBuf",
            Boolean(optional=True),
            prefix="-nobuf",
            doc=
            "Disable buffered output. Using this option will cause each line of output to be printed as it is generated, rather than saved in a buffer. This will make printing large output files noticeably slower, but can be useful in conjunction with other software tools and scripts that need to process one line of bedtools output at a time.",
        ),
        ToolInput(
            "bufMem",
            Int(optional=True),
            prefix="-iobuf",
            doc=
            "Specify amount of memory to use for input buffer. Takes an integer argument. Optional suffixes K/M/G supported. Note: currently has no effect with compressed files.",
        ),
    ]
Exemple #14
0
 def inputs(self):
     return [
         *super().inputs(),
         ToolInput(
             tag="tumorBams",
             input_type=Array(BamBai),
             prefix="-I",
             prefix_applies_to_all_elements=True,
             doc="(--input) BAM/SAM/CRAM file containing reads This argument must be specified at least once. Required. ",
         ),
         ToolInput(
             tag="normalBams",
             input_type=Array(BamBai, optional=True),
             prefix="-I",
             prefix_applies_to_all_elements=True,
             doc="(--input) Extra BAM/SAM/CRAM file containing reads This argument must be specified at least once. Required. ",
         ),
         ToolInput(
             tag="normalSample",
             input_type=String(optional=True),
             prefix="--normal-sample",
             doc="(--normal-sample, if) May be URL-encoded as output by GetSampleName with",
         ),
         ToolInput(
             "outputPrefix",
             String(optional=True),
             doc="Used as a prefix for the outputFilename if not specified, with format: {outputPrefix}.vcf.gz",
             default="generated",
         ),
         ToolInput(
             "outputFilename",
             Filename(prefix=InputSelector("outputPrefix"), extension=".vcf.gz"),
             position=20,
             prefix="-O",
         ),
         ToolInput(
             tag="reference",
             input_type=FastaWithDict(),
             prefix="--reference",
             doc="(-R) Reference sequence file Required.",
         ),
         ToolInput(
             tag="outputBamName",
             # This is not a FileName because otherwise we cant make this optional
             input_type=String(optional=True),
             prefix="-bamout",
             doc="File to which assembled haplotypes should be written",
         ),
         ToolInput(
             tag="activityProfileOut",
             input_type=String(optional=True),
             prefix="--activity-profile-out",
             doc="Default value: null.",
         ),
         ToolInput(
             tag="addOutputSamProgramRecord",
             input_type=Boolean(optional=True),
             prefix="-add-output-sam-program-record",
             doc="(--add-output-sam-program-record)  If true, adds a PG tag to created SAM/BAM/CRAM files.  Default value: true. Possible values: {true, false} ",
         ),
         ToolInput(
             tag="addOutputVcfCommandLine",
             input_type=Boolean(optional=True),
             prefix="-add-output-vcf-command-line",
             doc="(--add-output-vcf-command-line)  If true, adds a command line header line to created VCF files.  Default value: true. Possible values: {true, false} ",
         ),
         ToolInput(
             tag="afOfAllelesNotInResource",
             input_type=String(optional=True),
             prefix="--af-of-alleles-not-in-resource",
             doc="(-default-af)  Population allele fraction assigned to alleles not found in germline resource.  Please see docs/mutect/mutect2.pdf fora derivation of the default value.  Default value: -1.0. ",
         ),
         ToolInput(
             tag="alleles",
             input_type=String(optional=True),
             prefix="--alleles",
             doc="The set of alleles for which to force genotyping regardless of evidence Default value: null. ",
         ),
         ToolInput(
             tag="annotation",
             input_type=String(optional=True),
             prefix="--annotation",
             doc="(-A) One or more specific annotations to add to variant calls This argument may be specified 0 or more times. Default value: null. Possible Values: {AlleleFraction, AS_BaseQualityRankSumTest, AS_FisherStrand, AS_InbreedingCoeff, AS_MappingQualityRankSumTest, AS_QualByDepth, AS_ReadPosRankSumTest, AS_RMSMappingQuality, AS_StrandOddsRatio, BaseQuality, BaseQualityRankSumTest, ChromosomeCounts, ClippingRankSumTest, CountNs, Coverage, DepthPerAlleleBySample, DepthPerSampleHC, ExcessHet, FisherStrand, FragmentLength, GenotypeSummaries, InbreedingCoeff, LikelihoodRankSumTest, MappingQuality, MappingQualityRankSumTest, MappingQualityZero, OrientationBiasReadCounts, OriginalAlignment, PossibleDeNovo, QualByDepth, ReadPosition, ReadPosRankSumTest, ReferenceBases, RMSMappingQuality, SampleList, StrandBiasBySample, StrandOddsRatio, TandemRepeat, UniqueAltReadCount}",
         ),
         ToolInput(
             tag="annotationGroup",
             input_type=String(optional=True),
             prefix="--annotation-group",
             doc="(-G) One or more groups of annotations to apply to variant calls This argument may be specified 0 or more times. Default value: null. Possible Values: {AS_StandardAnnotation, ReducibleAnnotation, StandardAnnotation, StandardHCAnnotation, StandardMutectAnnotation}",
         ),
         ToolInput(
             tag="annotationsToExclude",
             input_type=String(optional=True),
             prefix="--annotations-to-exclude",
             doc="(-AX)  One or more specific annotations to exclude from variant calls  This argument may be specified 0 or more times. Default value: null. Possible Values: {BaseQuality, Coverage, DepthPerAlleleBySample, DepthPerSampleHC, FragmentLength, MappingQuality, OrientationBiasReadCounts, ReadPosition, StrandBiasBySample, TandemRepeat}",
         ),
         ToolInput(
             tag="arguments_file",
             input_type=File(optional=True),
             prefix="--arguments_file",
             doc="read one or more arguments files and add them to the command line This argument may be specified 0 or more times. Default value: null. ",
         ),
         ToolInput(
             tag="assemblyRegionOut",
             input_type=String(optional=True),
             prefix="--assembly-region-out",
             doc="Output the assembly region to this IGV formatted file Default value: null.",
         ),
         ToolInput(
             tag="baseQualityScoreThreshold",
             input_type=Int(optional=True),
             prefix="--base-quality-score-threshold",
             doc=" Base qualities below this threshold will be reduced to the minimum (6)  Default value: 18.",
         ),
         ToolInput(
             tag="callableDepth",
             input_type=Int(optional=True),
             prefix="--callable-depth",
             doc="Minimum depth to be considered callable for Mutect stats. Does not affect genotyping. Default value: 10. ",
         ),
         ToolInput(
             tag="cloudIndexPrefetchBuffer",
             input_type=Int(optional=True),
             prefix="--cloud-index-prefetch-buffer",
             doc="(-CIPB)  Size of the cloud-only prefetch buffer (in MB; 0 to disable). Defaults to cloudPrefetchBuffer if unset.  Default value: -1. ",
         ),
         ToolInput(
             tag="cloudPrefetchBuffer",
             input_type=Int(optional=True),
             prefix="--cloud-prefetch-buffer",
             doc="(-CPB)  Size of the cloud-only prefetch buffer (in MB; 0 to disable).  Default value: 40. ",
         ),
         ToolInput(
             tag="createOutputBamIndex",
             input_type=Boolean(optional=True),
             prefix="--create-output-bam-index",
             doc="(-OBI)  If true, create a BAM/CRAM index when writing a coordinate-sorted BAM/CRAM file.  Default value: true. Possible values: {true, false} ",
         ),
         ToolInput(
             tag="createOutputBamMd5",
             input_type=Boolean(optional=True),
             prefix="--create-output-bam-md5",
             doc="(-OBM)  If true, create a MD5 digest for any BAM/SAM/CRAM file created  Default value: false. Possible values: {true, false} ",
         ),
         ToolInput(
             tag="createOutputVariantIndex",
             input_type=Boolean(optional=True),
             prefix="--create-output-variant-index",
             doc="(-OVI)  If true, create a VCF index when writing a coordinate-sorted VCF file.  Default value: true. Possible values: {true, false} ",
         ),
         ToolInput(
             tag="createOutputVariantMd5",
             input_type=Boolean(optional=True),
             prefix="--create-output-variant-md5",
             doc="(-OVM)  If true, create a a MD5 digest any VCF file created.  Default value: false. Possible values: {true, false} ",
         ),
         ToolInput(
             tag="disableBamIndexCaching",
             input_type=Boolean(optional=True),
             prefix="--disable-bam-index-caching",
             doc="(-DBIC)  If true, don't cache bam indexes, this will reduce memory requirements but may harm performance if many intervals are specified.  Caching is automatically disabled if there are no intervals specified.  Default value: false. Possible values: {true, false} ",
         ),
         ToolInput(
             tag="disableReadFilter",
             input_type=Boolean(optional=True),
             prefix="--disable-read-filter",
             doc="(-DF)  Read filters to be disabled before analysis  This argument may be specified 0 or more times. Default value: null. Possible Values: {GoodCigarReadFilter, MappedReadFilter, MappingQualityAvailableReadFilter, MappingQualityNotZeroReadFilter, MappingQualityReadFilter, NonChimericOriginalAlignmentReadFilter, NonZeroReferenceLengthAlignmentReadFilter, NotDuplicateReadFilter, NotSecondaryAlignmentReadFilter, PassesVendorQualityCheckReadFilter, ReadLengthReadFilter, WellformedReadFilter}",
         ),
         ToolInput(
             tag="disableSequenceDictionaryValidation",
             input_type=Boolean(optional=True),
             prefix="-disable-sequence-dictionary-validation",
             doc="(--disable-sequence-dictionary-validation)  If specified, do not check the sequence dictionaries from our inputs for compatibility. Use at your own risk!  Default value: false. Possible values: {true, false} ",
         ),
         ToolInput(
             tag="downsamplingStride",
             input_type=Int(optional=True),
             prefix="--downsampling-stride",
             doc="(-stride)  Downsample a pool of reads starting within a range of one or more bases.  Default value: 1. ",
         ),
         ToolInput(
             tag="excludeIntervals",
             input_type=Boolean(optional=True),
             prefix="--exclude-intervals",
             doc="(-XLOne) This argument may be specified 0 or more times. Default value: null. ",
         ),
         ToolInput(
             tag="f1r2MaxDepth",
             input_type=Int(optional=True),
             prefix="--f1r2-max-depth",
             doc="sites with depth higher than this value will be grouped Default value: 200.",
         ),
         ToolInput(
             tag="f1r2MedianMq",
             input_type=Int(optional=True),
             prefix="--f1r2-median-mq",
             doc="skip sites with median mapping quality below this value Default value: 50.",
         ),
         ToolInput(
             tag="f1r2MinBq",
             input_type=Int(optional=True),
             prefix="--f1r2-min-bq",
             doc="exclude bases below this quality from pileup Default value: 20.",
         ),
         ToolInput(
             tag="f1r2TarGz_outputFilename",
             input_type=Filename(extension=".tar.gz"),
             prefix="--f1r2-tar-gz",
             doc="If specified, collect F1R2 counts and output files into this tar.gz file Default value: null. ",
         ),
         ToolInput(
             tag="founderId",
             input_type=String(optional=True),
             prefix="-founder-id",
             doc="(--founder-id)  Samples representing the population founders This argument may be specified 0 or more times. Default value: null. ",
         ),
         ToolInput(
             tag="gatkConfigFile",
             input_type=String(optional=True),
             prefix="--gatk-config-file",
             doc="A configuration file to use with the GATK. Default value: null.",
         ),
         ToolInput(
             tag="gcsRetries",
             input_type=Int(optional=True),
             prefix="-gcs-retries",
             doc="(--gcs-max-retries)  If the GCS bucket channel errors out, how many times it will attempt to re-initiate the connection  Default value: 20. ",
         ),
         ToolInput(
             tag="gcsProjectForRequesterPays",
             input_type=String(optional=True),
             prefix="--gcs-project-for-requester-pays",
             doc=" Project to bill when accessing requester pays buckets. If unset, these buckets cannot be accessed.  Default value: . ",
         ),
         ToolInput(
             tag="genotypeGermlineSites",
             input_type=Boolean(optional=True),
             prefix="--genotype-germline-sites",
             doc=" (EXPERIMENTAL) Call all apparent germline site even though they will ultimately be filtered.  Default value: false. Possible values: {true, false} ",
         ),
         ToolInput(
             tag="genotypePonSites",
             input_type=Boolean(optional=True),
             prefix="--genotype-pon-sites",
             doc="Call sites in the PoN even though they will ultimately be filtered. Default value: false. Possible values: {true, false} ",
         ),
         ToolInput(
             tag="germlineResource",
             input_type=VcfTabix(optional=True),
             prefix="--germline-resource",
             doc=" Population vcf of germline sequencing containing allele fractions.  Default value: null. ",
         ),
         ToolInput(
             tag="graph",
             input_type=String(optional=True),
             prefix="-graph",
             doc="(--graph-output) Write debug assembly graph information to this file Default value: null.",
         ),
         ToolInput(
             tag="help",
             input_type=Boolean(optional=True),
             prefix="-h",
             doc="(--help) display the help message Default value: false. Possible values: {true, false}",
         ),
         ToolInput(
             tag="ignoreItrArtifacts",
             input_type=String(optional=True),
             prefix="--ignore-itr-artifactsTurn",
             doc=" inverted tandem repeats.  Default value: false. Possible values: {true, false} ",
         ),
         ToolInput(
             tag="initialTumorLod",
             input_type=String(optional=True),
             prefix="--initial-tumor-lod",
             doc="(-init-lod)  Log 10 odds threshold to consider pileup active.  Default value: 2.0. ",
         ),
         ToolInput(
             tag="intervalExclusionPadding",
             input_type=String(optional=True),
             prefix="--interval-exclusion-padding",
             doc="(-ixp)  Amount of padding (in bp) to add to each interval you are excluding.  Default value: 0. ",
         ),
         ToolInput(
             tag="imr",
             input_type=String(optional=True),
             prefix="--interval-merging-rule",
             doc="(--interval-merging-rule)  Interval merging rule for abutting intervals  Default value: ALL. Possible values: {ALL, OVERLAPPING_ONLY} ",
         ),
         ToolInput(
             tag="ip",
             input_type=String(optional=True),
             prefix="-ipAmount",
             doc="(--interval-padding) Default value: 0.",
         ),
         ToolInput(
             tag="isr",
             input_type=String(optional=True),
             prefix="--interval-set-rule",
             doc="(--interval-set-rule)  Set merging approach to use for combining interval inputs  Default value: UNION. Possible values: {UNION, INTERSECTION} ",
         ),
         ToolInput(
             tag="intervals",
             input_type=Bed(optional=True),
             prefix="--intervals",
             doc="(-L) One or more genomic intervals over which to operate This argument may be specified 0 or more times. Default value: null. ",
         ),
         ToolInput(
             tag="le",
             input_type=Boolean(optional=True),
             prefix="-LE",
             doc="(--lenient) Lenient processing of VCF files Default value: false. Possible values: {true, false}",
         ),
         ToolInput(
             tag="maxPopulationAf",
             input_type=String(optional=True),
             prefix="--max-population-af",
             doc="(-max-af)  Maximum population allele frequency in tumor-only mode.  Default value: 0.01. ",
         ),
         ToolInput(
             tag="maxReadsPerAlignmentStart",
             input_type=Int(optional=True),
             prefix="--max-reads-per-alignment-start",
             doc=" Maximum number of reads to retain per alignment start position. Reads above this threshold will be downsampled. Set to 0 to disable.  Default value: 50. ",
         ),
         ToolInput(
             tag="minBaseQualityScore",
             input_type=String(optional=True),
             prefix="--min-base-quality-score",
             doc="(-mbq:Byte)  Minimum base quality required to consider a base for calling  Default value: 10. ",
         ),
         ToolInput(
             tag="mitochondriaMode",
             input_type=Boolean(optional=True),
             prefix="--mitochondria-mode",
             doc="Mitochondria mode sets emission and initial LODs to 0. Default value: false. Possible values: {true, false} ",
         ),
         ToolInput(
             tag="nativePairHmmThreads",
             input_type=Int(optional=True),
             prefix="--native-pair-hmm-threads",
             default=CpuSelector(),
             doc=" How many threads should a native pairHMM implementation use  Default value: 4. ",
         ),
         ToolInput(
             tag="nativePairHmmUseDoublePrecision",
             input_type=Boolean(optional=True),
             prefix="--native-pair-hmm-use-double-precision",
             doc=" use double precision in the native pairHmm. This is slower but matches the java implementation better  Default value: false. Possible values: {true, false} ",
         ),
         ToolInput(
             tag="normalLod",
             input_type=Double(optional=True),
             prefix="--normal-lod",
             doc="Log 10 odds threshold for calling normal variant non-germline. Default value: 2.2.",
         ),
         ToolInput(
             tag="encode",
             input_type=String(optional=True),
             prefix="-encode",
             doc="This argument may be specified 0 or more times. Default value: null.",
         ),
         ToolInput(
             tag="panelOfNormals",
             input_type=VcfTabix(optional=True),
             prefix="--panel-of-normals",
             doc="(--panel-of-normals)  VCF file of sites observed in normal.  Default value: null. ",
         ),
         ToolInput(
             tag="pcrIndelQual",
             input_type=Int(optional=True),
             prefix="--pcr-indel-qual",
             doc="Phred-scaled PCR SNV qual for overlapping fragments Default value: 40.",
         ),
         ToolInput(
             tag="pcrSnvQual",
             input_type=Int(optional=True),
             prefix="--pcr-snv-qual",
             doc="Phred-scaled PCR SNV qual for overlapping fragments Default value: 40.",
         ),
         ToolInput(
             tag="pedigree",
             input_type=String(optional=True),
             prefix="--pedigree",
             doc="(-ped) Pedigree file for determining the population founders. Default value: null.",
         ),
         ToolInput(
             tag="quiet",
             input_type=Boolean(optional=True),
             prefix="--QUIET",
             doc="Whether to suppress job-summary info on System.err. Default value: false. Possible values: {true, false} ",
         ),
         ToolInput(
             tag="readFilter",
             input_type=String(optional=True),
             prefix="--read-filter",
             doc="(-RF) Read filters to be applied before analysis This argument may be specified 0 or more times. Default value: null. Possible Values: {AlignmentAgreesWithHeaderReadFilter, AllowAllReadsReadFilter, AmbiguousBaseReadFilter, CigarContainsNoNOperator, FirstOfPairReadFilter, FragmentLengthReadFilter, GoodCigarReadFilter, HasReadGroupReadFilter, IntervalOverlapReadFilter, LibraryReadFilter, MappedReadFilter, MappingQualityAvailableReadFilter, MappingQualityNotZeroReadFilter, MappingQualityReadFilter, MatchingBasesAndQualsReadFilter, MateDifferentStrandReadFilter, MateOnSameContigOrNoMappedMateReadFilter, MateUnmappedAndUnmappedReadFilter, MetricsReadFilter, NonChimericOriginalAlignmentReadFilter, NonZeroFragmentLengthReadFilter, NonZeroReferenceLengthAlignmentReadFilter, NotDuplicateReadFilter, NotOpticalDuplicateReadFilter, NotSecondaryAlignmentReadFilter, NotSupplementaryAlignmentReadFilter, OverclippedReadFilter, PairedReadFilter, PassesVendorQualityCheckReadFilter, PlatformReadFilter, PlatformUnitReadFilter, PrimaryLineReadFilter, ProperlyPairedReadFilter, ReadGroupBlackListReadFilter, ReadGroupReadFilter, ReadLengthEqualsCigarLengthReadFilter, ReadLengthReadFilter, ReadNameReadFilter, ReadStrandFilter, SampleReadFilter, SecondOfPairReadFilter, SeqIsStoredReadFilter, ValidAlignmentEndReadFilter, ValidAlignmentStartReadFilter, WellformedReadFilter}",
         ),
         ToolInput(
             tag="readIndex",
             input_type=String(optional=True),
             prefix="-read-index",
             doc="(--read-index)  Indices to use for the read inputs. If specified, an index must be provided for every read input and in the same order as the read inputs. If this argument is not specified, the path to the index for each input will be inferred automatically.  This argument may be specified 0 or more times. Default value: null. ",
         ),
         ToolInput(
             tag="readValidationStringency",
             input_type=String(optional=True),
             prefix="--read-validation-stringency",
             doc="(-VS:ValidationStringency)  Validation stringency for all SAM/BAM/CRAM/SRA files read by this program.  The default stringency value SILENT can improve performance when processing a BAM file in which variable-length data (read, qualities, tags) do not otherwise need to be decoded.  Default value: SILENT. Possible values: {STRICT, LENIENT, SILENT} ",
         ),
         ToolInput(
             tag="secondsBetweenProgressUpdates",
             input_type=Double(optional=True),
             prefix="-seconds-between-progress-updates",
             doc="(--seconds-between-progress-updates)  Output traversal statistics every time this many seconds elapse  Default value: 10.0. ",
         ),
         ToolInput(
             tag="sequenceDictionary",
             input_type=String(optional=True),
             prefix="-sequence-dictionary",
             doc="(--sequence-dictionary)  Use the given sequence dictionary as the master/canonical sequence dictionary.  Must be a .dict file.  Default value: null. ",
         ),
         ToolInput(
             tag="sitesOnlyVcfOutput",
             input_type=Boolean(optional=True),
             prefix="--sites-only-vcf-output",
             doc=" If true, don't emit genotype fields when writing vcf file output.  Default value: false. Possible values: {true, false} ",
         ),
         ToolInput(
             tag="tmpDir",
             input_type=String(optional=True),
             prefix="--tmp-dir",
             doc="Temp directory to use. Default value: null.",
         ),
         ToolInput(
             tag="tumorLodToEmit",
             input_type=String(optional=True),
             prefix="--tumor-lod-to-emit",
             doc="(-emit-lod)  Log 10 odds threshold to emit variant to VCF.  Default value: 3.0. ",
         ),
         ToolInput(
             tag="tumor",
             input_type=String(optional=True),
             prefix="-tumor",
             doc="(--tumor-sample) BAM sample name of tumor. May be URL-encoded as output by GetSampleName with -encode argument.  Default value: null. ",
         ),
         ToolInput(
             tag="jdkDeflater",
             input_type=Boolean(optional=True),
             prefix="-jdk-deflater",
             doc="(--use-jdk-deflater)  Whether to use the JdkDeflater (as opposed to IntelDeflater)  Default value: false. Possible values: {true, false} ",
         ),
         ToolInput(
             tag="jdkInflater",
             input_type=Boolean(optional=True),
             prefix="-jdk-inflater",
             doc="(--use-jdk-inflater)  Whether to use the JdkInflater (as opposed to IntelInflater)  Default value: false. Possible values: {true, false} ",
         ),
         ToolInput(
             tag="verbosity",
             input_type=String(optional=True),
             prefix="-verbosity",
             doc="(--verbosity)  Control verbosity of logging.  Default value: INFO. Possible values: {ERROR, WARNING, INFO, DEBUG} ",
         ),
         ToolInput(
             tag="version",
             input_type=Boolean(optional=True),
             prefix="--version",
             doc="display the version number for this tool Default value: false. Possible values: {true, false} ",
         ),
         ToolInput(
             tag="activeProbabilityThreshold",
             input_type=Double(optional=True),
             prefix="--active-probability-threshold",
             doc=" Minimum probability for a locus to be considered active.  Default value: 0.002. ",
         ),
         ToolInput(
             tag="adaptivePruningInitialErrorRate",
             input_type=Double(optional=True),
             prefix="--adaptive-pruning-initial-error-rate",
             doc=" Initial base error rate estimate for adaptive pruning  Default value: 0.001. ",
         ),
         ToolInput(
             tag="allowNonUniqueKmersInRef",
             input_type=Boolean(optional=True),
             prefix="--allow-non-unique-kmers-in-ref",
             doc=" Allow graphs that have non-unique kmers in the reference  Default value: false. Possible values: {true, false} ",
         ),
         ToolInput(
             tag="assemblyRegionPadding",
             input_type=Int(optional=True),
             prefix="--assembly-region-padding",
             doc=" Number of additional bases of context to include around each assembly region  Default value: 100. ",
         ),
         ToolInput(
             tag="bamWriterType",
             input_type=String(optional=True),
             prefix="--bam-writer-type",
             doc="Which haplotypes should be written to the BAM Default value: CALLED_HAPLOTYPES. Possible values: {ALL_POSSIBLE_HAPLOTYPES, CALLED_HAPLOTYPES} ",
         ),
         ToolInput(
             tag="debugAssembly",
             input_type=String(optional=True),
             prefix="--debug-assembly",
             doc="(-debug)  Print out verbose debug information about each assembly region  Default value: false. Possible values: {true, false} ",
         ),
         ToolInput(
             tag="disableAdaptivePruning",
             input_type=Boolean(optional=True),
             prefix="--disable-adaptive-pruning",
             doc=" Disable the adaptive algorithm for pruning paths in the graph  Default value: false. Possible values: {true, false} ",
         ),
         ToolInput(
             tag="disableToolDefaultAnnotations",
             input_type=Boolean(optional=True),
             prefix="-disable-tool-default-annotations",
             doc="(--disable-tool-default-annotations)  Disable all tool default annotations  Default value: false. Possible values: {true, false}",
         ),
         ToolInput(
             tag="disableToolDefaultReadFilters",
             input_type=Boolean(optional=True),
             prefix="-disable-tool-default-read-filters",
             doc="(--disable-tool-default-read-filters)  Disable all tool default read filters (WARNING: many tools will not function correctly without their default read filters on)  Default value: false. Possible values: {true, false} ",
         ),
         ToolInput(
             tag="dontIncreaseKmerSizesForCycles",
             input_type=Boolean(optional=True),
             prefix="--dont-increase-kmer-sizes-for-cycles",
             doc=" Disable iterating over kmer sizes when graph cycles are detected  Default value: false. Possible values: {true, false} ",
         ),
         ToolInput(
             tag="dontTrimActiveRegions",
             input_type=Boolean(optional=True),
             prefix="--dont-trim-active-regions",
             doc=" If specified, we will not trim down the active region from the full region (active + extension) to just the active interval for genotyping  Default value: false. Possible values: {true, false} ",
         ),
         ToolInput(
             tag="dontUseSoftClippedBases",
             input_type=Boolean(optional=True),
             prefix="--dont-use-soft-clipped-bases",
             doc=" Do not analyze soft clipped bases in the reads  Default value: false. Possible values: {true, false} ",
         ),
         ToolInput(
             tag="erc",
             input_type=String(optional=True),
             prefix="-ERC",
             doc="(--emit-ref-confidence)  (BETA feature) Mode for emitting reference confidence scores  Default value: NONE. Possible values: {NONE, BP_RESOLUTION, GVCF} ",
         ),
         ToolInput(
             tag="enableAllAnnotations",
             input_type=Boolean(optional=True),
             prefix="--enable-all-annotations",
             doc=" Use all possible annotations (not for the faint of heart)  Default value: false. Possible values: {true, false} ",
         ),
         ToolInput(
             tag="forceActive",
             input_type=Boolean(optional=True),
             prefix="--force-active",
             doc="If provided, all regions will be marked as active Default value: false. Possible values: {true, false} ",
         ),
         ToolInput(
             tag="genotypeFilteredAlleles",
             input_type=Boolean(optional=True),
             prefix="--genotype-filtered-alleles",
             doc=" Whether to force genotype even filtered alleles  Default value: false. Possible values: {true, false} ",
         ),
         ToolInput(
             tag="gvcfLodBand",
             input_type=String(optional=True),
             prefix="--gvcf-lod-band",
             doc="(-LODB) Exclusive upper bounds for reference confidence LOD bands (must be specified in increasing order)  This argument may be specified 0 or more times. Default value: [-2.5, -2.0, -1.5,",
         ),
         ToolInput(
             tag="kmerSize",
             input_type=Int(optional=True),
             prefix="--kmer-size",
             doc="Kmer size to use in the read threading assembler This argument may be specified 0 or more times. Default value: [10, 25]. ",
         ),
         ToolInput(
             tag="maxAssemblyRegionSize",
             input_type=Int(optional=True),
             prefix="--max-assembly-region-size",
             doc=" Maximum size of an assembly region  Default value: 300. ",
         ),
         ToolInput(
             tag="mnpDist",
             input_type=Int(optional=True),
             prefix="-mnp-dist",
             doc="(--max-mnp-distance)  Two or more phased substitutions separated by this distance or less are merged into MNPs.  Default value: 1. ",
         ),
         ToolInput(
             tag="maxNumHaplotypesInPopulation",
             input_type=Int(optional=True),
             prefix="--max-num-haplotypes-in-population",
             doc=" Maximum number of haplotypes to consider for your population  Default value: 128. ",
         ),
         ToolInput(
             tag="maxProbPropagationDistance",
             input_type=Int(optional=True),
             prefix="--max-prob-propagation-distance",
             doc=" Upper limit on how many bases away probability mass can be moved around when calculating the boundaries between active and inactive assembly regions  Default value: 50. ",
         ),
         ToolInput(
             tag="maxSuspiciousReadsPerAlignmentStart",
             input_type=Int(optional=True),
             prefix="--max-suspicious-reads-per-alignment-start",
             doc=" Maximum number of suspicious reads (mediocre mapping quality or too many substitutions) allowed in a downsampling stride.  Set to 0 to disable.  Default value: 0. ",
         ),
         ToolInput(
             tag="maxUnprunedVariants",
             input_type=Int(optional=True),
             prefix="--max-unpruned-variants",
             doc=" Maximum number of variants in graph the adaptive pruner will allow  Default value: 100. ",
         ),
         ToolInput(
             tag="minAssemblyRegionSize",
             input_type=Int(optional=True),
             prefix="--min-assembly-region-size",
             doc=" Minimum size of an assembly region  Default value: 50. ",
         ),
         ToolInput(
             tag="minDanglingBranchLength",
             input_type=Int(optional=True),
             prefix="--min-dangling-branch-length",
             doc=" Minimum length of a dangling branch to attempt recovery  Default value: 4. ",
         ),
         ToolInput(
             tag="minPruning",
             input_type=Int(optional=True),
             prefix="--min-pruning",
             doc="Minimum support to not prune paths in the graph Default value: 2.",
         ),
         ToolInput(
             tag="minimumAlleleFraction",
             input_type=Float(optional=True),
             prefix="--minimum-allele-fraction",
             doc="(-min-AF)  Lower bound of variant allele fractions to consider when calculating variant LOD  Default value: 0.0. ",
         ),
         ToolInput(
             tag="numPruningSamples",
             input_type=Int(optional=True),
             prefix="--num-pruning-samples",
             doc="Default value: 1.",
         ),
         ToolInput(
             tag="pairHmmGapContinuationPenalty",
             input_type=Int(optional=True),
             prefix="--pair-hmm-gap-continuation-penalty",
             doc=" Flat gap continuation penalty for use in the Pair HMM  Default value: 10. ",
         ),
         ToolInput(
             tag="pairhmm",
             input_type=String(optional=True),
             prefix="-pairHMM",
             doc="(--pair-hmm-implementation)  The PairHMM implementation to use for genotype likelihood calculations  Default value: FASTEST_AVAILABLE. Possible values: {EXACT, ORIGINAL, LOGLESS_CACHING, AVX_LOGLESS_CACHING, AVX_LOGLESS_CACHING_OMP, EXPERIMENTAL_FPGA_LOGLESS_CACHING, FASTEST_AVAILABLE} ",
         ),
         ToolInput(
             tag="pcrIndelModel",
             input_type=String(optional=True),
             prefix="--pcr-indel-model",
             doc=" The PCR indel model to use  Default value: CONSERVATIVE. Possible values: {NONE, HOSTILE, AGGRESSIVE, CONSERVATIVE} ",
         ),
         ToolInput(
             tag="phredScaledGlobalReadMismappingRate",
             input_type=Int(optional=True),
             prefix="--phred-scaled-global-read-mismapping-rate",
             doc=" The global assumed mismapping rate for reads  Default value: 45. ",
         ),
         ToolInput(
             tag="pruningLodThreshold",
             input_type=Float(optional=True),
             prefix="--pruning-lod-thresholdLn",
             doc="Default value: 2.302585092994046. ",
         ),
         ToolInput(
             tag="recoverAllDanglingBranches",
             input_type=Boolean(optional=True),
             prefix="--recover-all-dangling-branches",
             doc=" Recover all dangling branches  Default value: false. Possible values: {true, false} ",
         ),
         ToolInput(
             tag="showhidden",
             input_type=Boolean(optional=True),
             prefix="-showHidden",
             doc="(--showHidden)  display hidden arguments  Default value: false. Possible values: {true, false} ",
         ),
         ToolInput(
             tag="smithWaterman",
             input_type=String(optional=True),
             prefix="--smith-waterman",
             doc=" Which Smith-Waterman implementation to use, generally FASTEST_AVAILABLE is the right choice  Default value: JAVA. Possible values: {FASTEST_AVAILABLE, AVX_ENABLED, JAVA} ",
         ),
         ToolInput(
             tag="ambigFilterBases",
             input_type=Int(optional=True),
             prefix="--ambig-filter-bases",
             doc="Threshold number of ambiguous bases. If null, uses threshold fraction; otherwise, overrides threshold fraction.  Default value: null.  Cannot be used in conjuction with argument(s) maxAmbiguousBaseFraction",
         ),
         ToolInput(
             tag="ambigFilterFrac",
             input_type=Double(optional=True),
             prefix="--ambig-filter-frac",
             doc="Threshold fraction of ambiguous bases Default value: 0.05. Cannot be used in conjuction with argument(s) maxAmbiguousBases",
         ),
         ToolInput(
             tag="maxFragmentLength",
             input_type=Int(optional=True),
             prefix="--max-fragment-length",
             doc="Default value: 1000000.",
         ),
         ToolInput(
             tag="minFragmentLength",
             input_type=Int(optional=True),
             prefix="--min-fragment-length",
             doc="Default value: 0.",
         ),
         ToolInput(
             tag="keepIntervals",
             input_type=String(optional=True),
             prefix="--keep-intervals",
             doc="One or more genomic intervals to keep This argument must be specified at least once. Required. ",
         ),
         ToolInput(
             tag="library",
             input_type=String(optional=True),
             prefix="-library",
             doc="(--library) Name of the library to keep This argument must be specified at least once. Required.",
         ),
         ToolInput(
             tag="maximumMappingQuality",
             input_type=Int(optional=True),
             prefix="--maximum-mapping-quality",
             doc=" Maximum mapping quality to keep (inclusive)  Default value: null. ",
         ),
         ToolInput(
             tag="minimumMappingQuality",
             input_type=Int(optional=True),
             prefix="--minimum-mapping-quality",
             doc=" Minimum mapping quality to keep (inclusive)  Default value: 20. ",
         ),
         ToolInput(
             tag="dontRequireSoftClipsBothEnds",
             input_type=Boolean(optional=True),
             prefix="--dont-require-soft-clips-both-ends",
             doc=" Allow a read to be filtered out based on having only 1 soft-clipped block. By default, both ends must have a soft-clipped block, setting this flag requires only 1 soft-clipped block  Default value: false. Possible values: {true, false} ",
         ),
         ToolInput(
             tag="filterTooShort",
             input_type=Int(optional=True),
             prefix="--filter-too-short",
             doc="Minimum number of aligned bases Default value: 30.",
         ),
         ToolInput(
             tag="platformFilterName",
             input_type=String(optional=True),
             prefix="--platform-filter-name",
             doc="This argument must be specified at least once. Required.",
         ),
         ToolInput(
             tag="blackListedLanes",
             input_type=String(optional=True),
             prefix="--black-listed-lanes",
             doc="Platform unit (PU) to filter out This argument must be specified at least once. Required.",
         ),
         ToolInput(
             tag="readGroupBlackList",
             input_type=String(optional=True),
             prefix="--read-group-black-listThe",
             doc="This argument must be specified at least once. Required. ",
         ),
         ToolInput(
             tag="keepReadGroup",
             input_type=String(optional=True),
             prefix="--keep-read-group",
             doc="The name of the read group to keep Required.",
         ),
         ToolInput(
             tag="maxReadLength",
             input_type=Int(optional=True),
             prefix="--max-read-length",
             doc="Keep only reads with length at most equal to the specified value Default value: 2147483647. ",
         ),
         ToolInput(
             tag="minReadLength",
             input_type=Int(optional=True),
             prefix="--min-read-length",
             doc="Keep only reads with length at least equal to the specified value Default value: 30.",
         ),
         ToolInput(
             tag="readName",
             input_type=String(optional=True),
             prefix="--read-name",
             doc="Keep only reads with this read name Required.",
         ),
         ToolInput(
             tag="keepReverseStrandOnly",
             input_type=Boolean(optional=True),
             prefix="--keep-reverse-strand-only",
             doc=" Keep only reads on the reverse strand  Required. Possible values: {true, false} ",
         ),
         ToolInput(
             tag="sample",
             input_type=String(optional=True),
             prefix="-sample",
             doc="(--sample) The name of the sample(s) to keep, filtering out all others This argument must be specified at least once. Required. ",
         ),
     ]
Exemple #15
0
class FastQCBase(BioinformaticsTool, ABC):
    def friendly_name(self) -> str:
        return "FastQC"

    def tool(self):
        return "fastqc"

    def base_command(self):
        return "fastqc"

    def tool_provider(self):
        return "FastQC"

    def bind_metadata(self):
        return ToolMetadata(
            contributors=["Michael Franklin"],
            dateCreated=datetime(2019, 3, 25),
            dateUpdated=datetime(2019, 3, 25),
            institution="Babraham Bioinformatics",
            doi=None,
            citation=None,
            keywords=["fastqc", "quality", "qa"],
            documentationUrl="http://www.bioinformatics.babraham.ac.uk/projects/fastqc/",
            documentation="FastQC is a program designed to spot potential problems in high througput sequencing datasets. "
            "It runs a set of analyses on one or more raw sequence files in fastq or bam format and produces a "
            "report which summarises the results.\n"
            "FastQC will highlight any areas where this library looks unusual and where you should take a closer look. "
            "The program is not tied to any specific type of sequencing technique and can be used to look at libraries "
            "coming from a large number of different experiment types "
            "(Genomic Sequencing, ChIP-Seq, RNA-Seq, BS-Seq etc etc).",
        )

    def cpus(self, hints: Dict[str, Any]):
        val = get_value_for_hints_and_ordered_resource_tuple(hints, CORES_TUPLE)
        if val:
            return val
        return 1

    def memory(self, hints: Dict[str, Any]):
        val = get_value_for_hints_and_ordered_resource_tuple(hints, MEM_TUPLE)
        if val:
            return val
        return 8

    def inputs(self) -> List[ToolInput]:
        return [ToolInput("reads", Array(FastqGz), position=5), *self.additional_inputs]

    def outputs(self) -> List[ToolOutput]:
        return [
            ToolOutput(
                "out", Array(ZipFile()), glob=WildcardSelector(wildcard="*.zip")
            ),
            ToolOutput(
                "datafile",
                Array(File),
                glob=WildcardSelector(wildcard="*/fastqc_data.txt"),
            ),
        ]

    additional_inputs = [
        ToolInput(
            "outdir",
            String(optional=True),
            default=".",
            prefix="--outdir",
            doc="(-o) Create all output files in the specified output directory. Please note that this "
            "directory must exist as the program will not create it.  If this option is not set then "
            "the output file for each sequence file is created in the same directory as the sequence "
            "file which was processed.",
        ),
        ToolInput(
            "casava",
            Boolean(optional=True),
            prefix="--casava",
            doc="Files come from raw casava output. Files in the same sample group "
            "(differing only by the group number) will be analysed as a set rather than individually. "
            "Sequences with the filter flag set in the header will be excluded from the analysis. "
            "Files must have the same names given to them by casava (including being gzipped and "
            "ending with .gz) otherwise they won't be grouped together correctly.",
        ),
        ToolInput(
            "nano",
            Boolean(optional=True),
            prefix="--nano",
            doc="Files come from naopore sequences and are in fast5 format. In this mode you can pass in "
            "directories to process and the program will take in all fast5 files within those "
            "directories and produce a single output file from the sequences found in all files.",
        ),
        ToolInput(
            "nofilter",
            Boolean(optional=True),
            prefix="--nofilter",
            doc="If running with --casava then don't remove read flagged by casava as poor quality when "
            "performing the QC analysis.",
        ),
        ToolInput(
            "extract",
            Boolean(optional=True),
            prefix="--extract",
            default=True,
            doc="If set then the zipped output file will be uncompressed in the same directory after it has "
            "been created.  By default this option will be set if fastqc is run in non-interactive mode.",
        ),
        ToolInput(
            "java",
            String(optional=True),
            prefix="--java",
            doc="(-j) Provides the full path to the java binary you want to use to launch fastqc. "
            "If not supplied then java is assumed to be in your path.",
        ),
        ToolInput(
            "noextract",
            Boolean(optional=True),
            prefix="--noextract",
            doc="Do not uncompress the output file after creating it.  You should set this option if you do"
            "not wish to uncompress the output when running in non-interactive mode. ",
        ),
        ToolInput(
            "nogroup",
            Boolean(optional=True),
            prefix="--nogroup",
            doc="Disable grouping of bases for reads >50bp. "
            "All reports will show data for every base in the read. "
            "WARNING: Using this option will cause fastqc to crash and burn if you use it on "
            "really long reads, and your plots may end up a ridiculous size. You have been warned! ",
        ),
        ToolInput(
            "format",
            String(optional=True),
            prefix="--format",
            doc="(-f) Bypasses the normal sequence file format detection and forces the program to use the "
            "specified format.  Valid formats are bam,sam,bam_mapped,sam_mapped and fastq ",
        ),
        ToolInput(
            "threads",
            Int(optional=True),
            prefix="--threads",
            default=CpuSelector(),
            doc="(-t) Specifies the number of files which can be processed simultaneously. "
            "Each thread will be allocated 250MB of memory so you shouldn't run more threads than your "
            "available memory will cope with, and not more than 6 threads on a 32 bit machine",
        ),
        ToolInput(
            "contaminants",
            File(optional=True),
            prefix="--contaminants",
            doc="(-c) Specifies a non-default file which contains the list of contaminants to screen "
            "overrepresented sequences against. The file must contain sets of named contaminants in "
            "the form name[tab]sequence.  Lines prefixed with a hash will be ignored.",
        ),
        ToolInput(
            "adapters",
            File(optional=True),
            prefix="--adapters",
            doc="(-a) Specifies a non-default file which contains the list of adapter sequences which will "
            "be explicity searched against the library. The file must contain sets of named adapters in "
            "the form name[tab]sequence. Lines prefixed with a hash will be ignored.",
        ),
        ToolInput(
            "limits",
            File(optional=True),
            prefix="--limits",
            doc="(-l) Specifies a non-default file which contains a set of criteria which will be used to "
            "determine the warn/error limits for the various modules.  This file can also be used to "
            "selectively  remove some modules from the output all together. "
            "The format needs to mirror the default limits.txt file found in the Configuration folder.",
        ),
        ToolInput(
            "kmers",
            Int(optional=True),
            prefix="--kmers",
            doc="(-k) Specifies the length of Kmer to look for in the Kmer content module. "
            "Specified Kmer length must be between 2 and 10. Default length is 7 if not specified. ",
        ),
        ToolInput(
            "quiet",
            Boolean(optional=True),
            prefix="--quiet",
            doc="(-q) Supress all progress messages on stdout and only report errors.",
        ),
        ToolInput(
            "dir",
            String(optional=True),
            prefix="--dir",
            doc="(-d) Selects a directory to be used for temporary files written when generating report images."
            "Defaults to system temp directory if not specified.",
        ),
    ]
 def test_int_invalid_float(self):
     self.assertFalse(Array(Int()).validate_value(2.0, True))
Exemple #17
0
    def inputs(self) -> List[ToolInput]:
        return [
            ToolInput(
                "inputFile",
                CompressedVcf(),
                prefix="--input_file",
                doc="Input file name. Can use compressed file (gzipped).",
            ),
            ToolInput(
                "outputFilename",
                Filename(
                    prefix=InputSelector("inputFile", remove_file_extension=True),
                    extension=".vcf",
                ),
                prefix="--output_file",
                doc="(-o) Output file name. Results can write to STDOUT by specifying "
                ' as the output file name - this will force quiet mode. Default = "variant_effect_output.txt"',
            ),
            ToolInput(
                "vcf",
                Boolean(),
                default=True,
                prefix="--vcf",
                doc="Writes output in VCF format. Consequences are added in the INFO field of the VCF file, using the "
                'key "CSQ". Data fields are encoded separated by "|"; the order of fields is written in the VCF header.'
                ' Output fields in the "CSQ" INFO field can be selected by using --fields. If the input format was VCF,'
                " the file will remain unchanged save for the addition of the CSQ field (unless using any filtering). "
                "Custom data added with --custom are added as separate fields, using the key specified for each data "
                "file. Commas in fields are replaced with ampersands (&) to preserve VCF format.",
            ),
            # ToolInput('plugin', [PLUGINS](optional=True), prefix='--plugin',
            #           doc='Use named plugin. Plugin modules should be installed in the Plugins subdirectory of the VEP cache directory (defaults to $HOME/.vep/). Multiple plugins can be used by supplying the --plugin flag multiple times. See plugin documentation. Not used by default'),
            ToolInput(
                "help",
                Boolean(optional=True),
                prefix="--help",
                doc="Display help message and quit",
            ),
            ToolInput(
                "quiet",
                Boolean(optional=True),
                prefix="--quiet",
                doc="(-q) Suppress warning messages.Not used by default",
            ),
            ToolInput(
                "verbose",
                Boolean(optional=True),
                prefix="--verbose",
                doc="(-v) Print out a bit more information while running. Not used by default",
            ),
            ToolInput(
                "config",
                File(optional=True),
                prefix="--config",
                doc="""Load configuration options from a config file. The config file should consist of whitespace-separated pairs of option names and settings e.g.:

            output_file   my_output.txt
            species       mus_musculus
            format        vcf
            host          useastdb.ensembl.org

            A config file can also be implicitly read; save the file as $HOME/.vep/vep.ini (or equivalent directory if 
            using --dir). Any options in this file will be overridden by those specified in a config file using --config, 
            and in turn by any options specified on the command line. You can create a quick version file of this by 
            setting the flags as normal and running VEP in verbose (-v) mode. This will output lines that can be copied 
            to a config file that can be loaded in on the next run using --config. Not used by default""",
            ),
            ToolInput(
                "everything",
                Boolean(optional=True),
                prefix="--everything",
                doc="(-e) Shortcut flag to switch on all of the following: --sift b, --polyphen b, --ccds, "
                "--uniprot, --hgvs, --symbol, --numbers, --domains, --regulatory, --canonical, --protein, "
                "--biotype, --uniprot, --tsl, --appris, --gene_phenotype --af, --af_1kg, --af_esp, "
                "--af_gnomad, --max_af, --pubmed, --variant_class, --mane",
            ),
            ToolInput(
                "species",
                String(optional=True),
                prefix="--species",
                doc='Species for your data. This can be the latin name e.g. "homo_sapiens" or any Ensembl alias e.g. '
                '"mouse". Specifying the latin name can speed up initial database connection as the registry does '
                'not have to load all available database aliases on the server. Default = "homo_sapiens"',
            ),
            ToolInput(
                "assembly",
                String(optional=True),
                prefix="--assembly",
                doc="""(-a) Select the assembly version to use if more than one available. If using the cache, you must 
                have the appropriate assembly's cache file installed. If not specified and you have only 1 assembly 
                version installed, this will be chosen by default. Default = use found assembly version""",
            ),
            ToolInput(
                "inputData",
                String(optional=True),
                prefix="--input_data",
                doc="(--id) Raw input data as a string. May be used, for example, to input a single rsID or HGVS "
                "notation quickly to vep: --input_data rs699",
            ),
            ToolInput(
                "format",
                String(optional=True),
                prefix="--format",
                doc='Input file format - one of "ensembl", "vcf", "hgvs", "id", "region", "spdi". By default, '
                "VEP auto-detects the input file format. Using this option you can specify the input file is "
                "Ensembl, VCF, IDs, HGVS, SPDI or region format. Can use compressed version (gzipped) of any "
                "file format listed above. Auto-detects format by default",
            ),
            ToolInput(
                "forceOverwrite",
                Boolean(optional=True),
                prefix="--force_overwrite",
                doc="(--force) By default, VEP will fail with an error if the output file already exists. You can "
                "force the overwrite of the existing file by using this flag. Not used by default",
            ),
            ToolInput(
                "statsFile",
                String(optional=True),
                default="variant_effect_output.txt_summary.html",
                prefix="--stats_file",
                doc="(--sf) Summary stats file name. This is an HTML file containing a summary of the VEP run - the "
                'file name must end ".htm" or ".html". Default = "variant_effect_output.txt_summary.html"',
            ),
            ToolInput(
                "noStats",
                Boolean(optional=True),
                prefix="--no_stats",
                doc="""Don\'t generate a stats file. Provides marginal gains in run time.""",
            ),
            ToolInput(
                "statsText",
                Boolean(optional=True),
                prefix="--stats_text",
                doc="Generate a plain text stats file in place of the HTML.",
            ),
            ToolInput(
                "warningFile",
                Filename(suffix="warning", extension=".txt"),
                prefix="--warning_file",
                doc="File name to write warnings and errors to. Default = STDERR (standard error)",
            ),
            ToolInput(
                "maxSvSize",
                Boolean(optional=True),
                prefix="--max_sv_size",
                doc="Extend the maximum Structural Variant size VEP can process.",
            ),
            ToolInput(
                "noCheckVariantsOrder",
                Boolean(optional=True),
                prefix="--no_check_variants_order",
                doc="Permit the use of unsorted input files. However running VEP on unsorted input files slows down "
                "the tool and requires more memory.",
            ),
            ToolInput(
                "fork",
                Int(optional=True),
                default=CpuSelector(),
                prefix="--fork",
                doc="Enable forking, using the specified number of forks. Forking can dramatically improve runtime. "
                "Not used by default",
            ),
            ToolInput(
                "custom",
                Array(BedTabix, optional=True),
                prefix="--custom",
                prefix_applies_to_all_elements=True,
                doc="Add custom annotation to the output. Files must be tabix indexed or in the bigWig format. "
                "Multiple files can be specified by supplying the --custom flag multiple times. "
                "See https://asia.ensembl.org/info/docs/tools/vep/script/vep_custom.html for full details. "
                "Not used by default",
            ),
            ToolInput(
                "gff",
                File(optional=True),
                prefix="--gff",
                doc="Use GFF transcript annotations in [filename] as an annotation source. "
                "Requires a FASTA file of genomic sequence.Not used by default",
            ),
            ToolInput(
                "gtf",
                File(optional=True),
                prefix="--gtf",
                doc="Use GTF transcript annotations in [filename] as an annotation source. "
                "Requires a FASTA file of genomic sequence.Not used by default",
            ),
            ToolInput(
                "bam",
                Bam(optional=True),
                prefix="--bam",
                doc="ADVANCED Use BAM file of sequence alignments to correct transcript models not derived from "
                "reference genome sequence. Used to correct RefSeq transcript models. "
                "Enables --use_transcript_ref; add --use_given_ref to override this behaviour. Not used by default",
            ),
            ToolInput(
                "useTranscriptRef",
                Boolean(optional=True),
                prefix="--use_transcript_ref",
                doc="By default VEP uses the reference allele provided in the input file to calculate consequences "
                "for the provided alternate allele(s). Use this flag to force VEP to replace the provided "
                "reference allele with sequence derived from the overlapped transcript. This is especially "
                "relevant when using the RefSeq cache, see documentation for more details. The GIVEN_REF and "
                "USED_REF fields are set in the output to indicate any change. Not used by default",
            ),
            ToolInput(
                "useGivenRef",
                Boolean(optional=True),
                prefix="--use_given_ref",
                doc="Using --bam or a BAM-edited RefSeq cache by default enables --use_transcript_ref; add this flag "
                "to override this behaviour and use the provided reference allele from the input. Not used by default",
            ),
            ToolInput(
                "customMultiAllelic",
                Boolean(optional=True),
                prefix="--custom_multi_allelic",
                doc="By default, comma separated lists found within the INFO field of custom annotation VCFs are "
                "assumed to be allele specific. For example, a variant with allele_string A/G/C with associated "
                'custom annotation "single,double,triple" will associate triple with C, double with G and single '
                "with A. This flag instructs VEP to return all annotations for all alleles. Not used by default",
            ),
            ToolInput(
                "tab",
                Boolean(optional=True),
                prefix="--tab",
                doc="Writes output in tab-delimited format. Not used by default",
            ),
            ToolInput(
                "json",
                Boolean(optional=True),
                prefix="--json",
                doc="Writes output in JSON format. Not used by default",
            ),
            ToolInput(
                "compressOutput",
                String(optional=True),
                default="bgzip",
                prefix="--compress_output",
                doc="Writes output compressed using either gzip or bgzip. Not used by default",
            ),
            ToolInput(
                "fields",
                Array(String, optional=True),
                prefix="--fields",
                doc="""Configure the output format using a comma separated list of fields.
Can only be used with tab (--tab) or VCF format (--vcf) output.
For the tab format output, the selected fields may be those present in the default output columns, or 
any of those that appear in the Extra column (including those added by plugins or custom annotations). 
Output remains tab-delimited. For the VCF format output, the selected fields are those present within the ""CSQ"" INFO field.

Example of command for the tab output:

--tab --fields ""Uploaded_variation,Location,Allele,Gene""
Example of command for the VCF format output:

--vcf --fields ""Allele,Consequence,Feature_type,Feature""
Not used by default""",
            ),
            ToolInput(
                "minimal",
                Boolean(optional=True),
                prefix="--minimal",
                doc="Convert alleles to their most minimal representation before consequence calculation i.e. "
                "sequence that is identical between each pair of reference and alternate alleles is trimmed "
                "off from both ends, with coordinates adjusted accordingly. Note this may lead to discrepancies "
                "between input coordinates and coordinates reported by VEP relative to transcript sequences; "
                "to avoid issues, use --allele_number and/or ensure that your input variants have unique "
                "identifiers. The MINIMISED flag is set in the VEP output where relevant. Not used by default",
            ),
            ToolInput(
                "variantClass",
                Boolean(optional=True),
                prefix="--variant_class",
                doc="Output the Sequence Ontology variant class. Not used by default",
            ),
            ToolInput(
                "sift",
                String(optional=True),
                prefix="--sift",
                doc="Species limited SIFT predicts whether an amino acid substitution affects protein function based "
                "on sequence homology and the physical properties of amino acids. VEP can output the prediction "
                "term, score or both. Not used by default",
            ),
            ToolInput(
                "polyphen",
                String(optional=True),
                prefix="--polyphen",
                doc="Human only PolyPhen is a tool which predicts possible impact of an amino acid substitution on "
                "the structure and function of a human protein using straightforward physical and comparative "
                "considerations. VEP can output the prediction term, score or both. VEP uses the humVar score "
                "by default - use --humdiv to retrieve the humDiv score. Not used by default",
            ),
            ToolInput(
                "humdiv",
                Boolean(optional=True),
                prefix="--humdiv",
                doc="Human only Retrieve the humDiv PolyPhen prediction instead of the default humVar. "
                "Not used by default",
            ),
            ToolInput(
                "nearest",
                String(optional=True),
                prefix="--nearest",
                doc="""Retrieve the transcript or gene with the nearest protein-coding transcription start site 
                (TSS) to each input variant. Use ""transcript"" to retrieve the transcript stable ID, ""gene"" to 
                retrieve the gene stable ID, or ""symbol"" to retrieve the gene symbol. Note that the nearest 
                TSS may not belong to a transcript that overlaps the input variant, and more than one may be 
                reported in the case where two are equidistant from the input coordinates.

            Currently only available when using a cache annotation source, and requires the Set::IntervalTree perl module.
            Not used by default""",
            ),
            ToolInput(
                "distance",
                Array(Int, optional=True),
                separator=",",
                prefix="--distance",
                doc="Modify the distance up and/or downstream between a variant and a transcript for which VEP will assign the upstream_gene_variant or downstream_gene_variant consequences. Giving one distance will modify both up- and downstream distances; prodiving two separated by commas will set the up- (5') and down - (3') stream distances respectively. Default: 5000",
            ),
            ToolInput(
                "overlaps",
                Boolean(optional=True),
                prefix="--overlaps",
                doc="Report the proportion and length of a transcript overlapped by a structural variant in VCF format.",
            ),
            ToolInput(
                "genePhenotype",
                Boolean(optional=True),
                prefix="--gene_phenotype",
                doc="Indicates if the overlapped gene is associated with a phenotype, disease or trait. See list of phenotype sources. Not used by default",
            ),
            ToolInput(
                "regulatory",
                Boolean(optional=True),
                prefix="--regulatory",
                doc="Look for overlaps with regulatory regions. VEP can also report if a variant falls in a high information position within a transcription factor binding site. Output lines have a Feature type of RegulatoryFeature or MotifFeature. Not used by default",
            ),
            ToolInput(
                "cellType",
                Boolean(optional=True),
                prefix="--cell_type",
                doc="Report only regulatory regions that are found in the given cell type(s). Can be a single cell type or a comma-separated list. The functional type in each cell type is reported under CELL_TYPE in the output. To retrieve a list of cell types, use --cell_type list. Not used by default",
            ),
            ToolInput(
                "individual",
                Array(String, optional=True),
                prefix="--individual",
                separator=",",
                doc='Consider only alternate alleles present in the genotypes of the specified individual(s). May be a single individual, a comma-separated list or "all" to assess all individuals separately. Individual variant combinations homozygous for the given reference allele will not be reported. Each individual and variant combination is given on a separate line of output. Only works with VCF files containing individual genotype data; individual IDs are taken from column headers. Not used by default',
            ),
            ToolInput(
                "phased",
                Boolean(optional=True),
                prefix="--phased",
                doc="Force VCF genotypes to be interpreted as phased. For use with plugins that depend on phased data. Not used by default",
            ),
            ToolInput(
                "alleleNumber",
                Boolean(optional=True),
                prefix="--allele_number",
                doc="Identify allele number from VCF input, where 1 = first ALT allele, 2 = second ALT allele etc. Useful when using --minimal Not used by default",
            ),
            ToolInput(
                "showRefAllele",
                Boolean(optional=True),
                prefix="--show_ref_allele",
                doc='Adds the reference allele in the output. Mainly useful for the VEP "default" and tab-delimited output formats. Not used by default',
            ),
            ToolInput(
                "totalLength",
                Boolean(optional=True),
                prefix="--total_length",
                doc="Give cDNA, CDS and protein positions as Position/Length. Not used by default",
            ),
            ToolInput(
                "numbers",
                Boolean(optional=True),
                prefix="--numbers",
                doc="Adds affected exon and intron numbering to to output. Format is Number/Total. Not used by default",
            ),
            ToolInput(
                "noEscape",
                Boolean(optional=True),
                prefix="--no_escape",
                doc="Don't URI escape HGVS strings. Default = escape",
            ),
            ToolInput(
                "keepCsq",
                Boolean(optional=True),
                prefix="--keep_csq",
                doc="Don't overwrite existing CSQ entry in VCF INFO field. Overwrites by default",
            ),
            ToolInput(
                "vcfInfoField",
                String(optional=True),
                prefix="--vcf_info_field",
                doc='Change the name of the INFO key that VEP write the consequences to in its VCF output. Use "ANN" for compatibility with other tools such as snpEff. Default: CSQ',
            ),
            ToolInput(
                "terms",
                String(optional=True),
                prefix="--terms",
                doc='(-t) The type of consequence terms to output. The Ensembl terms are described here. The Sequence Ontology is a joint effort by genome annotation centres to standardise descriptions of biological sequences. Default = "SO"',
            ),
            ToolInput(
                "noHeaders",
                Boolean(optional=True),
                prefix="--no_headers",
                doc="Don't write header lines in output files. Default = add headers",
            ),
            ToolInput(
                "hgvs",
                Boolean(optional=True),
                prefix="--hgvs",
                doc="Add HGVS nomenclature based on Ensembl stable identifiers to the output. Both coding and protein sequence names are added where appropriate. To generate HGVS identifiers when using --cache or --offline you must use a FASTA file and --fasta. HGVS notations given on Ensembl identifiers are versioned. Not used by default",
            ),
            ToolInput(
                "hgvsg",
                Boolean(optional=True),
                prefix="--hgvsg",
                doc="Add genomic HGVS nomenclature based on the input chromosome name. To generate HGVS identifiers when using --cache or --offline you must use a FASTA file and --fasta. Not used by default",
            ),
            ToolInput(
                "shiftHgvs",
                Boolean(optional=True),
                prefix="--shift_hgvs",
                doc="""Enable or disable 3\' shifting of HGVS notations. When enabled, this causes ambiguous insertions or deletions (typically in repetetive sequence tracts) to be "shifted" to their most 3' possible coordinates (relative to the transcript sequence and strand) before the HGVS notations are calculated; the flag HGVS_OFFSET is set to the number of bases by which the variant has shifted, relative to the input genomic coordinates. Disabling retains the original input coordinates of the variant. Default: 1 (shift)""",
            ),
            ToolInput(
                "transcriptVersion",
                Boolean(optional=True),
                prefix="--transcript_version",
                doc="Add version numbers to Ensembl transcript identifiers",
            ),
            ToolInput(
                "protein",
                Boolean(optional=True),
                prefix="--protein",
                doc="Add the Ensembl protein identifier to the output where appropriate. Not used by default",
            ),
            ToolInput(
                "symbol",
                Boolean(optional=True),
                prefix="--symbol",
                doc="Adds the gene symbol (e.g. HGNC) (where available) to the output. Not used by default",
            ),
            ToolInput(
                "ccds",
                Boolean(optional=True),
                prefix="--ccds",
                doc="Adds the CCDS transcript identifer (where available) to the output. Not used by default",
            ),
            ToolInput(
                "uniprot",
                Boolean(optional=True),
                prefix="--uniprot",
                doc="Adds best match accessions for translated protein products from three UniProt-related databases (SWISSPROT, TREMBL and UniParc) to the output. Not used by default",
            ),
            ToolInput(
                "tsl",
                Boolean(optional=True),
                prefix="--tsl",
                doc="Adds the transcript support level for this transcript to the output. Not used by default. Note: Only available for human on the GRCh38 assembly",
            ),
            ToolInput(
                "appris",
                Boolean(optional=True),
                prefix="--appris",
                doc="Adds the APPRIS isoform annotation for this transcript to the output. Not used by default. Note: Only available for human on the GRCh38 assembly",
            ),
            ToolInput(
                "canonical",
                Boolean(optional=True),
                prefix="--canonical",
                doc="Adds a flag indicating if the transcript is the canonical transcript for the gene. Not used by default",
            ),
            ToolInput(
                "mane",
                Boolean(optional=True),
                prefix="--mane",
                doc="Adds a flag indicating if the transcript is the MANE Select transcript for the gene. Not used by default. Note: Only available for human on the GRCh38 assembly",
            ),
            ToolInput(
                "biotype",
                Boolean(optional=True),
                prefix="--biotype",
                doc="Adds the biotype of the transcript or regulatory feature. Not used by default",
            ),
            ToolInput(
                "domains",
                Boolean(optional=True),
                prefix="--domains",
                doc="Adds names of overlapping protein domains to output. Not used by default",
            ),
            ToolInput(
                "xrefRefseq",
                Boolean(optional=True),
                prefix="--xref_refseq",
                doc="Output aligned RefSeq mRNA identifier for transcript. Not used by default. Note: The RefSeq and Ensembl transcripts aligned in this way MAY NOT, AND FREQUENTLY WILL NOT, match exactly in sequence, exon structure and protein product",
            ),
            ToolInput(
                "synonyms",
                Tsv(optional=True),
                prefix="--synonyms",
                doc="Load a file of chromosome synonyms. File should be tab-delimited with the primary identifier in column 1 and the synonym in column 2. Synonyms allow different chromosome identifiers to be used in the input file and any annotation source (cache, database, GFF, custom file, FASTA file). Not used by default",
            ),
            ToolInput(
                "checkExisting",
                Boolean(optional=True),
                prefix="--check_existing",
                doc="""Checks for the existence of known variants that are co-located with your input. By default the alleles are compared and variants on an allele-specific basis - to compare only coordinates, use --no_check_alleles.

            Some databases may contain variants with unknown (null) alleles and these are included by default; to exclude them use --exclude_null_alleles.

            See this page for more details.

            Not used by default""",
            ),
            ToolInput(
                "checkSvs",
                Boolean(optional=True),
                prefix="--check_svs",
                doc="Checks for the existence of structural variants that overlap your input. Currently requires database access. Not used by default",
            ),
            ToolInput(
                "clinSigAllele",
                Boolean(optional=True),
                prefix="--clin_sig_allele",
                doc="Return allele specific clinical significance. Setting this option to 0 will provide all known clinical significance values at the given locus. Default: 1 (Provide allele-specific annotations)",
            ),
            ToolInput(
                "excludeNullAlleles",
                Boolean(optional=True),
                prefix="--exclude_null_alleles",
                doc="Do not include variants with unknown alleles when checking for co-located variants. Our human database contains variants from HGMD and COSMIC for which the alleles are not publically available; by default these are included when using --check_existing, use this flag to exclude them. Not used by default",
            ),
            ToolInput(
                "noCheckAlleles",
                Boolean(optional=True),
                prefix="--no_check_alleles",
                doc="""When checking for existing variants, by default VEP only reports a co-located variant if none of the input alleles are novel. For example, if your input variant has alleles A/G, and an existing co-located variant has alleles A/C, the co-located variant will not be reported.

            Strand is also taken into account - in the same example, if the input variant has alleles T/G but on the negative strand, then the co-located variant will be reported since its alleles match the reverse complement of input variant.

            Use this flag to disable this behaviour and compare using coordinates alone. Not used by default""",
            ),
            ToolInput(
                "af",
                Boolean(optional=True),
                prefix="--af",
                doc="Add the global allele frequency (AF) from 1000 Genomes Phase 3 data for any known co-located variant to the output. For this and all --af_* flags, the frequency reported is for the input allele only, not necessarily the non-reference or derived allele. Not used by default",
            ),
            ToolInput(
                "maxAf",
                Boolean(optional=True),
                prefix="--max_af",
                doc="Report the highest allele frequency observed in any population from 1000 genomes, ESP or gnomAD. Not used by default",
            ),
            ToolInput(
                "af1kg",
                String(optional=True),
                prefix="--af_1kg",
                doc="Add allele frequency from continental populations (AFR,AMR,EAS,EUR,SAS) of 1000 Genomes Phase 3 to the output. Must be used with --cache. Not used by default",
            ),
            ToolInput(
                "afEsp",
                Boolean(optional=True),
                prefix="--af_esp",
                doc="Include allele frequency from NHLBI-ESP populations. Must be used with --cache. Not used by default",
            ),
            ToolInput(
                "afGnomad",
                Boolean(optional=True),
                prefix="--af_gnomad",
                doc="Include allele frequency from Genome Aggregation Database (gnomAD) exome populations. Note only data from the gnomAD exomes are included; to retrieve data from the additional genomes data set, see this guide. Must be used with --cache Not used by default",
            ),
            ToolInput(
                "afExac",
                Boolean(optional=True),
                prefix="--af_exac",
                doc="Include allele frequency from ExAC project populations. Must be used with --cache. Not used by default. Note: ExAC data has been superceded by gnomAD. This flag remains for those wishing to use older cache versions containing ExAC data.",
            ),
            ToolInput(
                "pubmed",
                Boolean(optional=True),
                prefix="--pubmed",
                doc="Report Pubmed IDs for publications that cite existing variant. Must be used with --cache. Not used by default",
            ),
            ToolInput(
                "failed",
                Boolean(optional=True),
                prefix="--failed",
                doc="When checking for co-located variants, by default VEP will exclude variants that have been flagged as failed. Set this flag to include such variants. Default: 0 (exclude)",
            ),
            ToolInput(
                "gencodeBasic",
                Boolean(optional=True),
                prefix="--gencode_basic",
                doc="Limit your analysis to transcripts belonging to the GENCODE basic set. This set has fragmented or problematic transcripts removed. Not used by default",
            ),
            ToolInput(
                "excludePredicted",
                Boolean(optional=True),
                prefix="--exclude_predicted",
                doc='When using the RefSeq or merged cache, exclude predicted transcripts (i.e. those with identifiers beginning with "XM_" or "XR_").',
            ),
            ToolInput(
                "transcriptFilter",
                Boolean(optional=True),
                prefix="--transcript_filter",
                doc='''ADVANCED Filter transcripts according to any arbitrary set of rules. Uses similar notation to filter_vep.

            You may filter on any key defined in the root of the transcript object; most commonly this will be ""stable_id"":

            --transcript_filter ""stable_id match N[MR]_""''',
            ),
            ToolInput(
                "checkRef",
                Boolean(optional=True),
                prefix="--check_ref",
                doc="Force VEP to check the supplied reference allele against the sequence stored in the Ensembl Core database or supplied FASTA file. Lines that do not match are skipped. Not used by default",
            ),
            ToolInput(
                "lookupRef",
                Boolean(optional=True),
                prefix="--lookup_ref",
                doc="Force overwrite the supplied reference allele with the sequence stored in the Ensembl Core database or supplied FASTA file. Not used by default",
            ),
            ToolInput(
                "dontSkip",
                Boolean(optional=True),
                prefix="--dont_skip",
                doc="Don't skip input variants that fail validation, e.g. those that fall on unrecognised sequences. Combining --check_ref with --dont_skip will add a CHECK_REF output field when the given reference does not match the underlying reference sequence.",
            ),
            ToolInput(
                "allowNonVariant",
                Boolean(optional=True),
                prefix="--allow_non_variant",
                doc="When using VCF format as input and output, by default VEP will skip non-variant lines of input (where the ALT allele is null). Enabling this option the lines will be printed in the VCF output with no consequence data added.",
            ),
            ToolInput(
                "chr",
                Array(String, optional=True),
                prefix="--chr",
                separator=",",
                doc='Select a subset of chromosomes to analyse from your file. Any data not on this chromosome in the input will be skipped. The list can be comma separated, with "-" characters representing an interval. For example, to include chromosomes 1, 2, 3, 10 and X you could use --chr 1-3,10,X Not used by default',
            ),
            ToolInput(
                "codingOnly",
                Boolean(optional=True),
                prefix="--coding_only",
                doc="Only return consequences that fall in the coding regions of transcripts. Not used by default",
            ),
            ToolInput(
                "noIntergenic",
                Boolean(optional=True),
                prefix="--no_intergenic",
                doc="Do not include intergenic consequences in the output. Not used by default",
            ),
            ToolInput(
                "pick",
                Boolean(optional=True),
                prefix="--pick",
                doc="Pick once line or block of consequence data per variant, including transcript-specific columns. Consequences are chosen according to the criteria described here, and the order the criteria are applied may be customised with --pick_order. This is the best method to use if you are interested only in one consequence per variant. Not used by default",
            ),
            ToolInput(
                "pickAllele",
                Boolean(optional=True),
                prefix="--pick_allele",
                doc="Like --pick, but chooses one line or block of consequence data per variant allele. Will only differ in behaviour from --pick when the input variant has multiple alternate alleles. Not used by default",
            ),
            ToolInput(
                "perGene",
                Boolean(optional=True),
                prefix="--per_gene",
                doc="Output only the most severe consequence per gene. The transcript selected is arbitrary if more than one has the same predicted consequence. Uses the same ranking system as --pick. Not used by default",
            ),
            ToolInput(
                "pickAlleleGene",
                Boolean(optional=True),
                prefix="--pick_allele_gene",
                doc="Like --pick_allele, but chooses one line or block of consequence data per variant allele and gene combination. Not used by default",
            ),
            ToolInput(
                "flagPick",
                Boolean(optional=True),
                prefix="--flag_pick",
                doc="As per --pick, but adds the PICK flag to the chosen block of consequence data and retains others. Not used by default",
            ),
            ToolInput(
                "flagPickAllele",
                Boolean(optional=True),
                prefix="--flag_pick_allele",
                doc="As per --pick_allele, but adds the PICK flag to the chosen block of consequence data and retains others. Not used by default",
            ),
            ToolInput(
                "flagPickAlleleGene",
                Boolean(optional=True),
                prefix="--flag_pick_allele_gene",
                doc="As per --pick_allele_gene, but adds the PICK flag to the chosen block of consequence data and retains others. Not used by default",
            ),
            ToolInput(
                "pickOrder",
                Array(String, optional=True),
                prefix="--pick_order",
                separator=",",
                doc="""Customise the order of criteria (and the list of criteria) applied when choosing a block of annotation data with one of the following options: --pick, --pick_allele, --per_gene, --pick_allele_gene, --flag_pick, --flag_pick_allele, --flag_pick_allele_gene. See this page for the default order.
            Valid criteria are: [ canonical appris tsl biotype ccds rank length mane ]. e.g.:

            --pick --pick_order tsl,appris,rank""",
            ),
            ToolInput(
                "mostSevere",
                Boolean(optional=True),
                prefix="--most_severe",
                doc="Output only the most severe consequence per variant. Transcript-specific columns will be left blank. Consequence ranks are given in this table. To include regulatory consequences, use the --regulatory option in combination with this flag. Not used by default",
            ),
            ToolInput(
                "summary",
                Boolean(optional=True),
                prefix="--summary",
                doc="Output only a comma-separated list of all observed consequences per variant. Transcript-specific columns will be left blank. Not used by default",
            ),
            ToolInput(
                "filterCommon",
                Boolean(optional=True),
                prefix="--filter_common",
                doc="Shortcut flag for the filters below - this will exclude variants that have a co-located existing variant with global AF > 0.01 (1%). May be modified using any of the following freq_* filters. Not used by default",
            ),
            ToolInput(
                "checkFrequency",
                Boolean(optional=True),
                prefix="--check_frequency",
                doc="Turns on frequency filtering. Use this to include or exclude variants based on the frequency of co-located existing variants in the Ensembl Variation database. You must also specify all of the --freq_* flags below. Frequencies used in filtering are added to the output under the FREQS key in the Extra field. Not used by default",
            ),
            ToolInput(
                "freqPop",
                String(optional=True),
                prefix="--freq_pop",
                doc="Name of the population to use in frequency filter. This must be one of the following: (1KG_ALL, 1KG_AFR, 1KG_AMR, 1KG_EAS, 1KG_EUR, 1KG_SAS, AA, EA, gnomAD, gnomAD_AFR, gnomAD_AMR, gnomAD_ASJ, gnomAD_EAS, gnomAD_FIN, gnomAD_NFE, gnomAD_OTH, gnomAD_SAS)",
            ),
            ToolInput(
                "freqFreq",
                Float(optional=True),
                prefix="--freq_freq",
                doc="Allele frequency to use for filtering. Must be a float value between 0 and 1",
            ),
            ToolInput(
                "freqGtLt",
                String(optional=True),
                prefix="--freq_gt_lt",
                doc="Specify whether the frequency of the co-located variant must be greater than (gt) or less than (lt) the value specified with --freq_freq",
            ),
            ToolInput(
                "freqFilter",
                String(optional=True),
                prefix="--freq_filter",
                doc="Specify whether to exclude or include only variants that pass the frequency filter",
            ),
            # CADD plugin
            ToolInput("caddReference", Array(VcfTabix, optional=True)),
            # Condel
            ToolInput(
                "condelConfig",
                Directory(optional=True),
                doc="Directory containing CondelPlugin config, in format: '<dir>/condel_SP.conf'",
            ),
            # dbNSFP
            ToolInput("dbnspReference", VcfTabix(optional=True), doc=""),
            ToolInput("dbsnpColumns", Array(String, optional=True)),
            # REVEL
            ToolInput("revelReference", VcfTabix(optional=True)),
            # CUSTOM
            ToolInput("custom1Reference", VcfTabix(optional=True)),
            ToolInput("custom1Columns", Array(String, optional=True)),
            ToolInput("custom2Reference", VcfTabix(optional=True)),
            ToolInput("custom2Columns", Array(String, optional=True)),
        ]
Exemple #18
0
class BedToolsIntersectBedBase(BedToolsToolBase, ABC):
    def bind_metadata(self):

        self.metadata.contributors = ["Jiaan Yu"]
        self.metadata.dateUpdated = date(2020, 2, 26)
        self.metadata.dateCreated = date(2020, 2, 20)
        self.metadata.doi = None
        self.metadata.citation = None
        self.metadata.keywords = ["bedtools", "intersect"]
        self.metadata.documentationUrl = (
            "https://bedtools.readthedocs.io/en/latest/content/tools/intersect.html"
        )
        self.metadata.documentation = """By far, the most common question asked of two sets of genomic features is whether or not any of the features in the two sets “overlap” with one another. This is known as feature intersection. bedtools intersect allows one to screen for overlaps between two sets of genomic features. Moreover, it allows one to have fine control as to how the intersections are reported. bedtools intersect works with both BED/GFF/VCF and BAM files as input."""

    def tool(self):
        return "bedtoolsintersectBed"

    def friendly_name(self):
        return "BEDTools: intersectBed"

    def base_command(self):
        return ["intersectBed"]

    def inputs(self):
        return [
            *self.additional_inputs,
            ToolInput(
                "inputABam",
                Bam(),
                prefix="-a",
                doc="input file a: only bam is supported at the moment",
            ),
            ToolInput(
                "inputBBed",
                Array(Bed()),
                prefix="-b",
                doc=
                "input file b: only bed is supported at the moment. May be followed with multiple databases and/or  wildcard (*) character(s). ",
            ),
        ]

    def outputs(self):
        return [ToolOutput("out", Stdout(Bam))]

    additional_inputs = [
        ToolInput(
            "writeOriginalA",
            Boolean(optional=True),
            prefix="-wa",
            doc="Write the original entry in A for each overlap.",
        ),
        ToolInput(
            "writeOriginalB",
            Boolean(optional=True),
            prefix="-wb",
            doc=
            "Write the original entry in B for each overlap. - Useful for knowing _what_ A overlaps. Restricted by -f  and -r.",
        ),
        ToolInput(
            "leftOuterJoin",
            Boolean(optional=True),
            prefix="-loj",
            doc=
            "Perform a 'left outer join'. That is, for each feature in A report each overlap with B.  If no overlaps are found, report a NULL feature for B.",
        ),
        ToolInput(
            "writeOriginalAB",
            Boolean(optional=True),
            prefix="-wo",
            doc=
            "Write the original A and B entries plus the number of base pairs of overlap between the two features. - Overlaps restricted by -f and -r. Only A features with overlap are reported.",
        ),
        ToolInput(
            "writeABBase",
            Boolean(optional=True),
            prefix="-wao",
            doc=
            "Write the original A and B entries plus the number of base pairs of overlap between the two features. - Overlapping features restricted by -f and -r. However, A features w/o overlap are also reported with a NULL B feature and overlap = 0.",
        ),
        ToolInput(
            "modeu",
            Boolean(optional=True),
            prefix="-u",
            doc=
            "Write the original A entry _once_ if _any_ overlaps found in B. - In other words, just report the fact >=1 hit was found. - Overlaps restricted by -f and -r.",
        ),
        ToolInput(
            "modec",
            Boolean(optional=True),
            prefix="-c",
            doc=
            "For each entry in A, report the number of overlaps with B. - Reports 0 for A entries that have no overlap with B. - Overlaps restricted by -f, -F, -r, and -s.",
        ),
        ToolInput(
            "modeC",
            Boolean(optional=True),
            prefix="-C",
            doc=
            "-C	For each entry in A, separately report the number of - overlaps with each B file on a distinct line. - Reports 0 for A entries that have no overlap with B. - Overlaps restricted by -f, -F, -r, and -s.",
        ),
        ToolInput(
            "modev",
            Boolean(optional=True),
            prefix="-v",
            doc=
            "Only report those entries in A that have _no overlaps_ with B. - Similar to 'grep -v' (an homage).",
        ),
        # ToolInput("ubam")
        ToolInput(
            "strandedness",
            Boolean(optional=True),
            prefix="-s",
            doc=
            "Require same strandedness.  That is, only report hits in B that overlap A on the _same_ strand. - By default, overlaps are reported without respect to strand.",
        ),
        ToolInput(
            "differentStrandedness",
            Boolean(optional=True),
            prefix="-S",
            doc=
            "Require different strandedness.  That is, only report hits in B that overlap A on the _opposite_ strand. - By default, overlaps are reported without respect to strand.",
        ),
        ToolInput(
            "fractionA",
            Float(optional=True),
            prefix="-f",
            doc=
            "Minimum overlap required as a fraction of A. - Default is 1E-9 (i.e., 1bp). - FLOAT (e.g. 0.50)",
        ),
        ToolInput(
            "fractionB",
            Float(optional=True),
            prefix="-F",
            doc=
            "Minimum overlap required as a fraction of B. - Default is 1E-9 (i.e., 1bp). - FLOAT (e.g. 0.50)",
        ),
        ToolInput(
            "reciprocalFraction",
            Boolean(optional=True),
            prefix="-r",
            doc=
            "Require that the fraction overlap be reciprocal for A AND B. - In other words, if -f is 0.90 and -r is used, this requires that B overlap 90% of A and A _also_ overlaps 90% of B.",
        ),
        ToolInput(
            "minFraction",
            Boolean(optional=True),
            prefix="-r",
            doc=
            "Require that the minimum fraction be satisfied for A OR B. - In other words, if -e is used with -f 0.90 and -F 0.10 this requires that either 90% of A is covered OR 10% of  B is covered. Without -e, both fractions would have to be satisfied.",
        ),
        ToolInput(
            "split",
            Boolean(optional=True),
            prefix="-split",
            doc="Treat 'split' BAM or BED12 entries as distinct BED intervals.",
        ),
        ToolInput(
            "genome",
            File(optional=True),
            prefix="-g",
            doc=
            "Provide a genome file to enforce consistent chromosome sort order across input files. Only applies when used with -sorted option.",
        ),
        ToolInput(
            "noNameCheck",
            Boolean(optional=True),
            prefix="-nonamecheck",
            doc=
            "For sorted data, don't throw an error if the file has different naming conventions for the same chromosome. ex. 'chr1' vs 'chr01'.",
        ),
        ToolInput(
            "sorted",
            Boolean(optional=True),
            prefix="-sorted",
            doc=
            "Use the 'chromsweep' algorithm for sorted (-k1,1 -k2,2n) input.",
        ),
        # ToolInput("names", Arrary(list), prefix="-names", doc="When using multiple databases, provide an alias for each that will appear instead of a fileId when also printing the DB record."),
        # ToolInput("fileNames", Array(list), prefix="-filenames", doc="When using multiple databases, show each complete filename instead of a fileId when also printing the DB record."),
        ToolInput(
            "sortOut",
            Boolean(optional=True),
            prefix="-sortout",
            doc=
            "When using multiple databases, sort the output DB hits for each record.",
        ),
        # ToolInput("bed", prefix="-bed", doc="If using BAM input, write output as BED."),
        ToolInput(
            "header",
            Boolean(optional=True),
            prefix="-header",
            doc="Print the header from the A file prior to results.",
        ),
        ToolInput(
            "noBuf",
            Boolean(optional=True),
            prefix="-nobuf",
            doc=
            "Disable buffered output. Using this option will cause each line of output to be printed as it is generated, rather than saved in a buffer. This will make printing large output files noticeably slower, but can be useful in conjunction with other software tools and scripts that need to process one line of bedtools output at a time.",
        ),
        ToolInput(
            "bufMem",
            Int(optional=True),
            prefix="-iobuf",
            doc=
            "Specify amount of memory to use for input buffer. Takes an integer argument. Optional suffixes K/M/G supported. Note: currently has no effect with compressed files.",
        ),
    ]
 def inputs(self):
     return [
         *super().inputs(),
         ToolInput(
             tag="inp",
             input_type=Array(Bam, optional=True),
             prefix="--input",
             separate_value_from_prefix=True,
             prefix_applies_to_all_elements=True,
             doc=InputDocumentation(
                 doc="(-I) BAM/SAM/CRAM file containing reads."
                 " This argument must be specified at least once. Required. "
             ),
         ),
         ToolInput(
             tag="outputFilename",
             input_type=Filename(extension=".bam"),
             prefix="--output",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc="(-O) Write output to this BAM filename Required."),
         ),
         ToolInput(
             tag="reference",
             input_type=FastaWithIndexes(optional=True),
             prefix="--reference",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc="(-R) Reference sequence file Required."),
         ),
         ToolInput(
             tag="addOutputSamProgramRecord",
             input_type=Boolean(optional=True),
             prefix="--add-output-sam-program-record",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-add-output-sam-program-record)  If true, adds a PG tag to created SAM/BAM/CRAM files.  "
                 "Default value: true. Possible values: {true, false} "),
         ),
         ToolInput(
             tag="addOutputVcfCommandLine",
             input_type=Boolean(optional=True),
             prefix="--add-output-vcf-command-line",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-add-output-vcf-command-line)  If true, adds a command line header line to created VCF files."
                 "Default value: true. Possible values: {true, false} "),
         ),
         ToolInput(
             tag="arguments_file",
             input_type=File(optional=True),
             prefix="--arguments_file",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "read one or more arguments files and add them to the command line This argument may be "
                 "specified 0 or more times. Default value: null. "),
         ),
         ToolInput(
             tag="cloudIndexPrefetchBuffer",
             input_type=Int(optional=True),
             prefix="--cloud-index-prefetch-buffer",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-CIPB)  Size of the cloud-only prefetch buffer (in MB; 0 to disable). Defaults to cloudPrefetchBuffer if unset.  Default value: -1. "
             ),
         ),
         ToolInput(
             tag="cloudPrefetchBuffer",
             input_type=Int(optional=True),
             prefix="--cloud-prefetch-buffer",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-CPB)  Size of the cloud-only prefetch buffer (in MB; 0 to disable).  Default value: 40. "
             ),
         ),
         ToolInput(
             tag="createOutputBamIndex",
             input_type=Boolean(optional=True),
             default=True,
             prefix="--create-output-bam-index",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-OBI)  If true, create a BAM/CRAM index when writing a coordinate-sorted BAM/CRAM file.  Default value: true. Possible values: {true, false} "
             ),
         ),
         ToolInput(
             tag="createOutputBamMd5",
             input_type=Boolean(optional=True),
             prefix="--create-output-bam-md5",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-OBM)  If true, create a MD5 digest for any BAM/SAM/CRAM file created  Default value: false. Possible values: {true, false} "
             ),
         ),
         ToolInput(
             tag="createOutputVariantIndex",
             input_type=Boolean(optional=True),
             prefix="--create-output-variant-index",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-OVI)  If true, create a VCF index when writing a coordinate-sorted VCF file.  Default value: true. Possible values: {true, false} "
             ),
         ),
         ToolInput(
             tag="createOutputVariantMd5",
             input_type=Boolean(optional=True),
             prefix="--create-output-variant-md5",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-OVM)  If true, create a a MD5 digest any VCF file created.  Default value: false. Possible values: {true, false} "
             ),
         ),
         ToolInput(
             tag="disableBamIndexCaching",
             input_type=Boolean(optional=True),
             prefix="--disable-bam-index-caching",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-DBIC)  If true, don't cache bam indexes, this will reduce memory requirements but may harm performance if many intervals are specified.  Caching is automatically disabled if there are no intervals specified.  Default value: false. Possible values: {true, false} "
             ),
         ),
         ToolInput(
             tag="disableReadFilter",
             input_type=String(optional=True),
             prefix="--disable-read-filter",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-DF)  Read filters to be disabled before analysis  This argument may be specified 0 or more times. Default value: null. Possible Values: {AllowAllReadsReadFilter}"
             ),
         ),
         ToolInput(
             tag="disableSequenceDictionaryValidation",
             input_type=Boolean(optional=True),
             prefix="--disable-sequence-dictionary-validation",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-disable-sequence-dictionary-validation)  If specified, do not check the sequence dictionaries from our inputs for compatibility. Use at your own risk!  Default value: false. Possible values: {true, false} "
             ),
         ),
         ToolInput(
             tag="doNotFixOverhangs",
             input_type=Boolean(optional=True),
             prefix="--do-not-fix-overhangs",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc="Default value: false. Possible values: {true, false} "
             ),
         ),
         ToolInput(
             tag="excludeIntervals",
             input_type=Boolean(optional=True),
             prefix="--exclude-intervals",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-XL) This argument may be specified 0 or more times. Default value: null. "
             ),
         ),
         ToolInput(
             tag="gatkConfigFile",
             input_type=String(optional=True),
             prefix="--gatk-config-file",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "A configuration file to use with the GATK. Default value: null."
             ),
         ),
         ToolInput(
             tag="gcsMaxRetries",
             input_type=Int(optional=True),
             prefix="--gcs-max-retries",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-gcs-retries)  If the GCS bucket channel errors out, how many times it will attempt to re-initiate the connection  Default value: 20. "
             ),
         ),
         ToolInput(
             tag="gcsProjectForRequesterPays",
             input_type=String(optional=True),
             prefix="--gcs-project-for-requester-pays",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 " Project to bill when accessing 'requester pays' buckets. If unset, these buckets cannot be accessed.  Default value: . "
             ),
         ),
         ToolInput(
             tag="help",
             input_type=Boolean(optional=True),
             prefix="--help",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-h) display the help message Default value: false. Possible values: {true, false}"
             ),
         ),
         ToolInput(
             tag="intervalExclusionPadding",
             input_type=Int(optional=True),
             prefix="--interval-exclusion-padding",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-ixp)  Amount of padding (in bp) to add to each interval you are excluding.  Default value: 0. "
             ),
         ),
         ToolInput(
             tag="intervalMergingRule",
             input_type=Boolean(optional=True),
             prefix="--interval-merging-rule",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-imr)  Interval merging rule for abutting intervals  Default value: ALL. Possible values: {ALL, OVERLAPPING_ONLY} "
             ),
         ),
         ToolInput(
             tag="intervalPadding",
             input_type=Boolean(optional=True),
             prefix="--interval-padding",
             separate_value_from_prefix=True,
             doc=InputDocumentation(doc="(-ip) Default value: 0."),
         ),
         ToolInput(
             tag="intervalSetRule",
             input_type=Boolean(optional=True),
             prefix="--interval-set-rule",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-isr)  Set merging approach to use for combining interval inputs  Default value: UNION. Possible values: {UNION, INTERSECTION} "
             ),
         ),
         ToolInput(
             tag="intervals",
             input_type=String(optional=True),
             prefix="--intervals",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-L) One or more genomic intervals over which to operate This argument may be specified 0 or more times. Default value: null. "
             ),
         ),
         ToolInput(
             tag="lenient",
             input_type=Boolean(optional=True),
             prefix="--lenient",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-LE) Lenient processing of VCF files Default value: false. Possible values: {true, false}"
             ),
         ),
         ToolInput(
             tag="maxBasesInOverhang",
             input_type=Int(optional=True),
             prefix="--max-bases-in-overhang",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 " max number of bases allowed in the overhang  Default value: 40. "
             ),
         ),
         ToolInput(
             tag="maxMismatchesInOverhang",
             input_type=Int(optional=True),
             prefix="--max-mismatches-in-overhang",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 " max number of mismatches allowed in the overhang  Default value: 1. "
             ),
         ),
         ToolInput(
             tag="processSecondaryAlignments",
             input_type=Boolean(optional=True),
             prefix="--process-secondary-alignments",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 " have the walker split secondary alignments (will still repair MC tag without it)  Default value: false. Possible values: {true, false} "
             ),
         ),
         ToolInput(
             tag="quiet",
             input_type=Boolean(optional=True),
             prefix="--QUIET",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "Whether to suppress job-summary info on System.err. Default value: false. Possible values: {true, false} "
             ),
         ),
         ToolInput(
             tag="readFilter",
             input_type=String(optional=True),
             prefix="--read-filter",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-RF) Read filters to be applied before analysis This argument may be specified 0 or more times. Default value: null. Possible Values: {AlignmentAgreesWithHeaderReadFilter, AllowAllReadsReadFilter, AmbiguousBaseReadFilter, CigarContainsNoNOperator, FirstOfPairReadFilter, FragmentLengthReadFilter, GoodCigarReadFilter, HasReadGroupReadFilter, IntervalOverlapReadFilter, LibraryReadFilter, MappedReadFilter, MappingQualityAvailableReadFilter, MappingQualityNotZeroReadFilter, MappingQualityReadFilter, MatchingBasesAndQualsReadFilter, MateDifferentStrandReadFilter, MateOnSameContigOrNoMappedMateReadFilter, MateUnmappedAndUnmappedReadFilter, MetricsReadFilter, NonChimericOriginalAlignmentReadFilter, NonZeroFragmentLengthReadFilter, NonZeroReferenceLengthAlignmentReadFilter, NotDuplicateReadFilter, NotOpticalDuplicateReadFilter, NotSecondaryAlignmentReadFilter, NotSupplementaryAlignmentReadFilter, OverclippedReadFilter, PairedReadFilter, PassesVendorQualityCheckReadFilter, PlatformReadFilter, PlatformUnitReadFilter, PrimaryLineReadFilter, ProperlyPairedReadFilter, ReadGroupBlackListReadFilter, ReadGroupReadFilter, ReadLengthEqualsCigarLengthReadFilter, ReadLengthReadFilter, ReadNameReadFilter, ReadStrandFilter, SampleReadFilter, SecondOfPairReadFilter, SeqIsStoredReadFilter, SoftClippedReadFilter, ValidAlignmentEndReadFilter, ValidAlignmentStartReadFilter, WellformedReadFilter}"
             ),
         ),
         ToolInput(
             tag="readIndex",
             input_type=String(optional=True),
             prefix="--read-index",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-read-index)  Indices to use for the read inputs. If specified, an index must be provided for every read input and in the same order as the read inputs. If this argument is not specified, the path to the index for each input will be inferred automatically.  This argument may be specified 0 or more times. Default value: null. "
             ),
         ),
         ToolInput(
             tag="readValidationStringency",
             input_type=Boolean(optional=True),
             prefix="--read-validation-stringency",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-VS)  Validation stringency for all SAM/BAM/CRAM/SRA files read by this program.  The default stringency value SILENT can improve performance when processing a BAM file in which variable-length data (read, qualities, tags) do not otherwise need to be decoded.  Default value: SILENT. Possible values: {STRICT, LENIENT, SILENT} "
             ),
         ),
         ToolInput(
             tag="refactorCigarString",
             input_type=Boolean(optional=True),
             prefix="--refactor-cigar-string",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-fixNDN)  refactor cigar string with NDN elements to one element  Default value: false. Possible values: {true, false} "
             ),
         ),
         ToolInput(
             tag="secondsBetweenProgressUpdates",
             input_type=Double(optional=True),
             prefix="--seconds-between-progress-updates",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-seconds-between-progress-updates)  Output traversal statistics every time this many seconds elapse  Default value: 10.0. "
             ),
         ),
         ToolInput(
             tag="sequenceDictionary",
             input_type=String(optional=True),
             prefix="--sequence-dictionary",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-sequence-dictionary)  Use the given sequence dictionary as the master/canonical sequence dictionary.  Must be a .dict file.  Default value: null. "
             ),
         ),
         ToolInput(
             tag="sitesOnlyVcfOutput",
             input_type=Boolean(optional=True),
             prefix="--sites-only-vcf-output",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 " If true, don't emit genotype fields when writing vcf file output.  Default value: false. Possible values: {true, false} "
             ),
         ),
         ToolInput(
             tag="skipMappingQualityTransform",
             input_type=Boolean(optional=True),
             prefix="--skip-mapping-quality-transform",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-skip-mq-transform)  skip the 255 -> 60 MQ read transform  Default value: false. Possible values: {true, false}"
             ),
         ),
         ToolInput(
             tag="tmpDir",
             input_type=String(optional=True),
             prefix="--tmp-dir",
             separate_value_from_prefix=True,
             default="tmp/",
             doc=InputDocumentation(
                 doc="Temp directory to use. Default value: null."),
         ),
         ToolInput(
             tag="useJdkDeflater",
             input_type=Boolean(optional=True),
             prefix="--use-jdk-deflater",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-jdk-deflater)  Whether to use the JdkDeflater (as opposed to IntelDeflater)  Default value: false. Possible values: {true, false} "
             ),
         ),
         ToolInput(
             tag="useJdkInflater",
             input_type=Boolean(optional=True),
             prefix="--use-jdk-inflater",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-jdk-inflater)  Whether to use the JdkInflater (as opposed to IntelInflater)  Default value: false. Possible values: {true, false} "
             ),
         ),
         ToolInput(
             tag="verbosity",
             input_type=Boolean(optional=True),
             prefix="--verbosity",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-verbosity)  Control verbosity of logging.  Default value: INFO. Possible values: {ERROR, WARNING, INFO, DEBUG} "
             ),
         ),
         ToolInput(
             tag="version",
             input_type=Boolean(optional=True),
             prefix="--version",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "display the version number for this tool Default value: false. Possible values: {true, false} "
             ),
         ),
         ToolInput(
             tag="disableToolDefaultReadFilters",
             input_type=Boolean(optional=True),
             prefix="--disable-tool-default-read-filters",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-disable-tool-default-read-filters)  Disable all tool default read filters (WARNING: many tools will not function correctly without their default read filters on)  Default value: false. Possible values: {true, false} "
             ),
         ),
         ToolInput(
             tag="maxReadsInMemory",
             input_type=Boolean(optional=True),
             prefix="--max-reads-in-memory",
             separate_value_from_prefix=True,
             doc=InputDocumentation(doc="Default value: 150000."),
         ),
         ToolInput(
             tag="showhidden",
             input_type=Boolean(optional=True),
             prefix="--showHidden",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-showHidden)  display hidden arguments  Default value: false. Possible values: {true, false} "
             ),
         ),
         ToolInput(
             tag="ambigFilterBases",
             input_type=Int(optional=True),
             prefix="--ambig-filter-bases",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "Threshold number of ambiguous bases. If null, uses threshold fraction; otherwise, overrides threshold fraction.  Default value: null.  Cannot be used in conjuction with argument(s) maxAmbiguousBaseFraction"
             ),
         ),
         ToolInput(
             tag="ambigFilterFrac",
             input_type=Double(optional=True),
             prefix="--ambig-filter-frac",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "Threshold fraction of ambiguous bases Default value: 0.05. Cannot be used in conjuction with argument(s) maxAmbiguousBases"
             ),
         ),
         ToolInput(
             tag="maxFragmentLength",
             input_type=Boolean(optional=True),
             prefix="--max-fragment-length",
             separate_value_from_prefix=True,
             doc=InputDocumentation(doc="Default value: 1000000."),
         ),
         ToolInput(
             tag="minFragmentLength",
             input_type=Boolean(optional=True),
             prefix="--min-fragment-length",
             separate_value_from_prefix=True,
             doc=InputDocumentation(doc="Default value: 0."),
         ),
         ToolInput(
             tag="keepIntervals",
             input_type=String(optional=True),
             prefix="--keep-intervals",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "One or more genomic intervals to keep This argument must be specified at least once. Required. "
             ),
         ),
         ToolInput(
             tag="library",
             input_type=String(optional=True),
             prefix="--library",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-library) Name of the library to keep This argument must be specified at least once. Required."
             ),
         ),
         ToolInput(
             tag="maximumMappingQuality",
             input_type=Int(optional=True),
             prefix="--maximum-mapping-quality",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 " Maximum mapping quality to keep (inclusive)  Default value: null. "
             ),
         ),
         ToolInput(
             tag="minimumMappingQuality",
             input_type=Int(optional=True),
             prefix="--minimum-mapping-quality",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 " Minimum mapping quality to keep (inclusive)  Default value: 10. "
             ),
         ),
         ToolInput(
             tag="dontRequireSoftClipsBothEnds",
             input_type=Boolean(optional=True),
             prefix="--dont-require-soft-clips-both-ends",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 " Allow a read to be filtered out based on having only 1 soft-clipped block. By default, both ends must have a soft-clipped block, setting this flag requires only 1 soft-clipped block  Default value: false. Possible values: {true, false} "
             ),
         ),
         ToolInput(
             tag="filterTooShort",
             input_type=Int(optional=True),
             prefix="--filter-too-short",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc="Minimum number of aligned bases Default value: 30."),
         ),
         ToolInput(
             tag="platformFilterName",
             input_type=Boolean(optional=True),
             prefix="--platform-filter-name",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "This argument must be specified at least once. Required."
             ),
         ),
         ToolInput(
             tag="blackListedLanes",
             input_type=String(optional=True),
             prefix="--black-listed-lanes",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "Platform unit (PU) to filter out This argument must be specified at least once. Required."
             ),
         ),
         ToolInput(
             tag="readGroupBlackList",
             input_type=Boolean(optional=True),
             prefix="--read-group-black-list",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "This argument must be specified at least once. Required. "
             ),
         ),
         ToolInput(
             tag="keepReadGroup",
             input_type=String(optional=True),
             prefix="--keep-read-group",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc="The name of the read group to keep Required."),
         ),
         ToolInput(
             tag="maxReadLength",
             input_type=Int(optional=True),
             prefix="--max-read-length",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "Keep only reads with length at most equal to the specified value Required."
             ),
         ),
         ToolInput(
             tag="minReadLength",
             input_type=Int(optional=True),
             prefix="--min-read-length",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "Keep only reads with length at least equal to the specified value Default value: 1."
             ),
         ),
         ToolInput(
             tag="readName",
             input_type=String(optional=True),
             prefix="--read-name",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc="Keep only reads with this read name Required."),
         ),
         ToolInput(
             tag="keepReverseStrandOnly",
             input_type=Boolean(optional=True),
             prefix="--keep-reverse-strand-only",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 " Keep only reads on the reverse strand  Required. Possible values: {true, false} "
             ),
         ),
         ToolInput(
             tag="sample",
             input_type=String(optional=True),
             prefix="--sample",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-sample) The name of the sample(s) to keep, filtering out all others This argument must be specified at least once. Required. "
             ),
         ),
         ToolInput(
             tag="invertSoftClipRatioFilter",
             input_type=Boolean(optional=True),
             prefix="--invert-soft-clip-ratio-filter",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 " Inverts the results from this filter, causing all variants that would pass to fail and visa-versa.  Default value: false. Possible values: {true, false} "
             ),
         ),
         ToolInput(
             tag="softClippedLeadingTrailingRatio",
             input_type=Double(optional=True),
             prefix="--soft-clipped-leading-trailing-ratio",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 " Threshold ratio of soft clipped bases (leading / trailing the cigar string) to total bases in read for read to be filtered.  Default value: null.  Cannot be used in conjuction with argument(s) minimumSoftClippedRatio"
             ),
         ),
         ToolInput(
             tag="softClippedRatioThreshold",
             input_type=Double(optional=True),
             prefix="--soft-clipped-ratio-threshold",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 " Threshold ratio of soft clipped bases (anywhere in the cigar string) to total bases in read for read to be filtered.  Default value: null.  Cannot be used in conjuction with argument(s) minimumLeadingTrailingSoftClippedRatio"
             ),
         ),
     ]
Exemple #20
0
class ScrambleBase(BioinformaticsTool, ABC):
    def tool(self):
        return "scramble"

    def friendly_name(self):
        return "scramble"

    def tool_provider(self):
        return "io_lib"

    def base_command(self):
        return ["scramble"]

    def inputs(self):
        return [
            ToolInput("inputFilename", Bam(), position=200),
            ToolInput("reference",
                      FastaFai(),
                      prefix="-r",
                      doc="Reference sequence file."),
            ToolInput("outputFilename", Filename(extension=".bam")),
            *ScrambleBase.additional_inputs,
        ]

    def arguments(self):
        return [
            ToolArgument("bam", prefix="-I", doc="input data format"),
            ToolArgument("cram", prefix="-O", doc="output data format"),
            ToolArgument(
                "-9",
                doc=
                "compression settings for output cram file (-1=fast,-9=best)"),
            ToolArgument("3.0", prefix="-V", doc="Cram version to output"),
        ]

    def outputs(self):
        return [
            ToolOutput(
                "out",
                Stdout(Cram(), stdoutname=InputSelector("outputFilename")))
        ]

    def memory(self, hints: Dict[str, Any]):
        val = get_value_for_hints_and_ordered_resource_tuple(
            hints, SCRAMBLE_MEM_TUPLE)
        if val:
            return val
        return 16

    def cpus(self, hints: Dict[str, Any]):
        val = get_value_for_hints_and_ordered_resource_tuple(
            hints, SCRAMBLE_CORES_TUPLE)
        if val:
            return val
        return 4

    def bind_metadata(self):
        from datetime import date

        return ToolMetadata(
            contributors=["Matthias De Smet (@mattdsm)"],
            dateCreated=date(2020, 2, 27),
            dateUpdated=date(2020, 2, 27),
            institution="None",
            doi=None,
            keywords=["bam", "cram", "compression"],
            documentationUrl="https://github.com/jkbonfield/io_lib/",
            documentation="scramble: streaming bam to cram compression",
        )

    additional_inputs = [
        ToolInput(
            "range",
            String(optional=True),
            prefix="-R",
            doc="Specifies the refseq:start-end range",
        ),
        ToolInput(
            "maxBases",
            Int(optional=True),
            prefix="-b",
            default=5000000,
            doc="Max. bases per slice, default 5000000.",
        ),
        ToolInput(
            "maxSequences",
            Int(optional=True),
            prefix="-s",
            default=10000,
            doc="Sequences per slice, default 10000.",
        ),
        ToolInput(
            "maxSlicesPerContainer",
            Int(optional=True),
            prefix="-S",
            default=1,
            doc="Slices per container, default 1.",
        ),
        ToolInput(
            "embedReferenceSeuence",
            Boolean(optional=True),
            prefix="-e",
            doc="Embed reference sequence.",
        ),
        ToolInput(
            "nonReferenceBaseEncoding",
            Boolean(optional=True),
            prefix="-x",
            doc="Non-reference based encoding.",
        ),
        ToolInput(
            "multipleReferencesPerSlice",
            Boolean(optional=True),
            prefix="-M",
            doc="Use multiple references per slice.",
        ),
        ToolInput(
            "generateTags",
            Boolean(optional=True),
            prefix="-m",
            doc="Generate MD and NM tags.",
        ),
        ToolInput(
            "lzmaCompression",
            Boolean(optional=True),
            prefix="-Z",
            doc="Also compress using lzma",
        ),
        ToolInput(
            "discardReadNames",
            Boolean(optional=True),
            prefix="-n",
            doc="Discard read names where possible.",
        ),
        ToolInput(
            "preserveAuxTags",
            Boolean(optional=True),
            prefix="-P",
            doc="Preserve all aux tags (incl RG,NM,MD).",
        ),
        ToolInput(
            "preserveAuxTagSizes",
            Boolean(optional=True),
            prefix="-p",
            doc="Preserve aux tag sizes ('i', 's', 'c').",
        ),
        ToolInput(
            "noAddPG",
            Boolean(optional=True),
            prefix="-q",
            doc="Don't add scramble @PG header line.",
        ),
        ToolInput(
            "decodeStop",
            Int(optional=True),
            prefix="-N",
            doc="Stop decoding after 'integer' sequences.",
        ),
        ToolInput(
            "threads",
            Int(optional=True),
            default=CpuSelector(),
            prefix="-t",
            doc="Number of threads. (default = 1)",
        ),
        ToolInput(
            "enableQualityBinning",
            Int(optional=True),
            prefix="-B",
            doc="Enable Illumina 8 quality-binning system (lossy).",
        ),
    ]
Exemple #21
0
class Gatk4MarkDuplicatesBase(Gatk4ToolBase, ABC):
    @classmethod
    def gatk_command(cls):
        return "MarkDuplicates"

    def tool(self):
        return "Gatk4MarkDuplicates"

    def friendly_name(self):
        return "GATK4: Mark Duplicates"

    def cpus(self, hints: Dict[str, Any]):
        val = get_value_for_hints_and_ordered_resource_tuple(
            hints, CORES_TUPLE)
        if val:
            return val
        return 4

    def memory(self, hints: Dict[str, Any]):
        val = get_value_for_hints_and_ordered_resource_tuple(hints, MEM_TUPLE)
        if val:
            return val
        return 8

    def inputs(self):
        # Would be good to include this in the prefix:
        #   If(InputSelector("bam").length().equals(1), InputSelector("bam")[0].basename(), None)

        prefix = FirstOperator([InputSelector("outputPrefix"), "generated"])
        return [
            ToolInput(
                "bam",
                Array(Bam),
                prefix="-I",
                position=10,
                # secondaries_present_as={".bai": "^.bai"},
                doc=
                "One or more input SAM or BAM files to analyze. Must be coordinate sorted.",
            ),
            ToolInput("outputPrefix", String(optional=True)),
            ToolInput(
                "outputFilename",
                Filename(prefix=prefix, suffix=".markduped", extension=".bam"),
                position=10,
                prefix="-O",
                doc="File to write duplication metrics to",
            ),
            ToolInput(
                "metricsFilename",
                Filename(prefix=prefix, suffix=".metrics", extension=".txt"),
                position=10,
                prefix="-M",
                doc="The output file to write marked records to.",
            ),
            *super().inputs(),
            *self.additional_args,
        ]

    def outputs(self):
        return [
            ToolOutput(
                "out",
                BamBai,
                glob=InputSelector("outputFilename"),
                secondaries_present_as={".bai": "^.bai"},
            ),
            ToolOutput("metrics", Tsv(),
                       glob=InputSelector("metricsFilename")),
        ]

    def bind_metadata(self):
        from datetime import date

        return ToolMetadata(
            contributors=["Michael Franklin"],
            dateCreated=date(2018, 12, 24),
            dateUpdated=date(2019, 1, 24),
            institution="Broad Institute",
            doi=None,
            citation=
            "See https://software.broadinstitute.org/gatk/documentation/article?id=11027 for more information",
            keywords=["gatk", "gatk4", "broad", "mark", "duplicates"],
            documentationUrl=
            "https://software.broadinstitute.org/gatk/documentation/tooldocs/current/picard_sam_markduplicates_MarkDuplicates.php",
            documentation="""MarkDuplicates (Picard): Identifies duplicate reads.

This tool locates and tags duplicate reads in a BAM or SAM file, where duplicate reads are 
defined as originating from a single fragment of DNA. Duplicates can arise during sample 
preparation e.g. library construction using PCR. See also EstimateLibraryComplexity for 
additional notes on PCR duplication artifacts. Duplicate reads can also result from a single 
amplification cluster, incorrectly detected as multiple clusters by the optical sensor of the 
sequencing instrument. These duplication artifacts are referred to as optical duplicates.

The MarkDuplicates tool works by comparing sequences in the 5 prime positions of both reads 
and read-pairs in a SAM/BAM file. An BARCODE_TAG option is available to facilitate duplicate
marking using molecular barcodes. After duplicate reads are collected, the tool differentiates 
the primary and duplicate reads using an algorithm that ranks reads by the sums of their 
base-quality scores (default method).

The tool's main output is a new SAM or BAM file, in which duplicates have been identified 
in the SAM flags field for each read. Duplicates are marked with the hexadecimal value of 0x0400, 
which corresponds to a decimal value of 1024. If you are not familiar with this type of annotation, 
please see the following blog post for additional information.

Although the bitwise flag annotation indicates whether a read was marked as a duplicate, 
it does not identify the type of duplicate. To do this, a new tag called the duplicate type (DT) 
tag was recently added as an optional output in the 'optional field' section of a SAM/BAM file. 
Invoking the TAGGING_POLICY option, you can instruct the program to mark all the duplicates (All), 
only the optical duplicates (OpticalOnly), or no duplicates (DontTag). The records within the 
output of a SAM/BAM file will have values for the 'DT' tag (depending on the invoked TAGGING_POLICY), 
as either library/PCR-generated duplicates (LB), or sequencing-platform artifact duplicates (SQ). 
This tool uses the READ_NAME_REGEX and the OPTICAL_DUPLICATE_PIXEL_DISTANCE options as the 
primary methods to identify and differentiate duplicate types. Set READ_NAME_REGEX to null to 
skip optical duplicate detection, e.g. for RNA-seq or other data where duplicate sets are 
extremely large and estimating library complexity is not an aim. Note that without optical 
duplicate counts, library size estimation will be inaccurate.

MarkDuplicates also produces a metrics file indicating the numbers 
of duplicates for both single- and paired-end reads.

The program can take either coordinate-sorted or query-sorted inputs, however the behavior 
is slightly different. When the input is coordinate-sorted, unmapped mates of mapped records 
and supplementary/secondary alignments are not marked as duplicates. However, when the input 
is query-sorted (actually query-grouped), then unmapped mates and secondary/supplementary 
reads are not excluded from the duplication test and can be marked as duplicate reads.

If desired, duplicates can be removed using the REMOVE_DUPLICATE and REMOVE_SEQUENCING_DUPLICATES options."""
            .strip(),
        )

    additional_args = [
        ToolInput(
            "argumentsFile",
            Array(File(), optional=True),
            prefix="--arguments_file",
            position=10,
            doc=
            "read one or more arguments files and add them to the command line",
        ),
        ToolInput(
            "assumeSortOrder",
            String(optional=True),
            prefix="-ASO",
            doc=
            "If not null, assume that the input file has this order even if the header says otherwise. "
            "Exclusion: This argument cannot be used at the same time as ASSUME_SORTED. "
            "The --ASSUME_SORT_ORDER argument is an enumerated type (SortOrder), which can have one of "
            "the following values: [unsorted, queryname, coordinate, duplicate, unknown]",
        ),
        ToolInput(
            "barcodeTag",
            String(optional=True),
            prefix="--BARCODE_TAG",
            doc="Barcode SAM tag (ex. BC for 10X Genomics)",
        ),
        ToolInput(
            "comment",
            Array(String(), optional=True),
            prefix="-CO",
            doc="Comment(s) to include in the output file's header.",
        ),
        # ToolInput(
        #     "compressionLevel",
        #     Int(optional=True),
        #     prefix="--COMPRESSION_LEVEL",
        #     position=11,
        #     doc="Compression level for all compressed files created (e.g. BAM and GELI).",
        # ),
        ToolInput(
            "createIndex",
            Boolean(optional=True),
            prefix="--CREATE_INDEX",
            default=True,
            position=11,
            doc=
            "Whether to create a BAM index when writing a coordinate-sorted BAM file.",
        ),
        ToolInput(
            "createMd5File",
            Boolean(optional=True),
            prefix="--CREATE_MD5_FILE",
            position=11,
            doc=
            "Whether to create an MD5 digest for any BAM or FASTQ files created.",
        ),
        ToolInput(
            "maxRecordsInRam",
            Int(optional=True),
            prefix="--MAX_RECORDS_IN_RAM",
            position=11,
            doc=
            "When writing SAM files that need to be sorted, this will specify the number of "
            "records stored in RAM before spilling to disk. Increasing this number reduces "
            "the number of file handles needed to sort a SAM file, and increases the amount of RAM needed.",
        ),
        ToolInput(
            "quiet",
            Boolean(optional=True),
            prefix="--QUIET",
            position=11,
            doc="Whether to suppress job-summary info on System.err.",
        ),
        ToolInput(
            "tmpDir",
            String(optional=True),
            prefix="--TMP_DIR",
            position=11,
            default="tmp/",
            doc="Undocumented option",
        ),
        ToolInput(
            "useJdkDeflater",
            Boolean(optional=True),
            prefix="--use_jdk_deflater",
            position=11,
            doc="Whether to use the JdkDeflater (as opposed to IntelDeflater)",
        ),
        ToolInput(
            "useJdkInflater",
            Boolean(optional=True),
            prefix="--use_jdk_inflater",
            position=11,
            doc="Whether to use the JdkInflater (as opposed to IntelInflater)",
        ),
        ToolInput(
            "validationStringency",
            String(optional=True),
            prefix="--VALIDATION_STRINGENCY",
            position=11,
            doc=
            "Validation stringency for all SAM files read by this program. Setting stringency to SILENT "
            "can improve performance when processing a BAM file in which variable-length data "
            "(read, qualities, tags) do not otherwise need to be decoded."
            "The --VALIDATION_STRINGENCY argument is an enumerated type (ValidationStringency), "
            "which can have one of the following values: [STRICT, LENIENT, SILENT]",
        ),
        ToolInput(
            "verbosity",
            String(optional=True),
            prefix="--verbosity",
            position=11,
            doc=
            "The --verbosity argument is an enumerated type (LogLevel), which can have "
            "one of the following values: [ERROR, WARNING, INFO, DEBUG]",
        ),
        ToolInput(
            "opticalDuplicatePixelDistance",
            Int(optional=True),
            prefix="--OPTICAL_DUPLICATE_PIXEL_DISTANCE",
            doc=
            "The maximum offset between two duplicate clusters in order to consider them optical duplicates. "
            "The default is appropriate for unpatterned versions of the Illumina platform. For the patterned "
            "flowcell models, 2500 is more appropriate. For other platforms and models, users should experiment "
            "to find what works best.",
        ),
    ]

    def tests(self):
        remote_dir = "https://swift.rc.nectar.org.au/v1/AUTH_4df6e734a509497692be237549bbe9af/janis-test-data/bioinformatics/wgsgermline_data"
        return [
            TTestCase(
                name="basic",
                input={
                    "bam": [f"{remote_dir}/NA12878-BRCA1.merged.bam"],
                    "javaOptions": ["-Xmx6G"],
                    "maxRecordsInRam": 5000000,
                    "createIndex": True,
                    "tmpDir": "./tmp",
                },
                output=BamBai.basic_test(
                    "out",
                    2829000,
                    3780,
                    f"{remote_dir}/NA12878-BRCA1.markduped.bam.flagstat",
                ) + TextFile.basic_test(
                    "metrics",
                    3700,
                    "NA12878-BRCA1\t193\t9468\t164\t193\t46\t7\t1\t0.003137\t7465518",
                    112,
                ),
            )
        ]
Exemple #22
0
class Gatk4MergeSamFilesBase(Gatk4ToolBase, ABC):
    @classmethod
    def gatk_command(cls):
        return "MergeSamFiles"

    def tool(self):
        return "Gatk4MergeSamFiles"

    def friendly_name(self):
        return "GATK4: Merge SAM Files"

    def cpus(self, hints: Dict[str, Any]):
        val = get_value_for_hints_and_ordered_resource_tuple(hints, CORES_TUPLE)
        if val:
            return val
        return 4

    def memory(self, hints: Dict[str, Any]):
        val = get_value_for_hints_and_ordered_resource_tuple(hints, MEM_TUPLE)
        if val:
            return val
        return 8

    def inputs(self):
        return [
            *super().inputs(),
            ToolInput(
                "bams",
                Array(BamBai()),
                prefix="-I",
                prefix_applies_to_all_elements=True,
                doc="The SAM/BAM file to sort.",
                position=10,
            ),
            ToolInput(
                "sampleName",
                String(optional=True),
                doc="Used for naming purposes only",
            ),
            ToolInput(
                "outputFilename",
                Filename(
                    prefix=InputSelector("sampleName"),
                    suffix=".merged",
                    extension=".bam",
                ),
                position=10,
                prefix="-O",
                doc="SAM/BAM file to write merged result to",
            ),
            *self.additional_args,
        ]

    def outputs(self):
        return [
            ToolOutput(
                "out",
                BamBai(),
                glob=InputSelector("outputFilename"),
                secondaries_present_as={".bai": "^.bai"},
            )
        ]

    def bind_metadata(self):
        from datetime import date

        return ToolMetadata(
            contributors=["Michael Franklin"],
            dateCreated=date(2018, 12, 24),
            dateUpdated=date(2019, 1, 24),
            institution="Broad Institute",
            doi=None,
            citation="See https://software.broadinstitute.org/gatk/documentation/article?id=11027 for more information",
            keywords=["gatk", "gatk4", "broad", "merge", "sam"],
            documentationUrl="https://software.broadinstitute.org/gatk/documentation/tooldocs/4.beta.3/org_broadinstitute_hellbender_tools_picard_sam_MergeSamFiles.php",
            documentation="Merges multiple SAM/BAM files into one file",
        )

    additional_args = [
        ToolInput(
            "argumentsFile",
            Array(File(), optional=True),
            prefix="--arguments_file",
            position=10,
            doc="read one or more arguments files and add them to the command line",
        ),
        ToolInput(
            "assumeSorted",
            Boolean(optional=True),
            prefix="-AS",
            doc="If true, assume that the input files are in the same sort order as the requested "
            "output sort order, even if their headers say otherwise.",
        ),
        ToolInput(
            "comment",
            Array(String(), optional=True),
            prefix="-CO",
            doc="Comment(s) to include in the merged output file's header.",
        ),
        ToolInput(
            "mergeSequenceDictionaries",
            Boolean(optional=True),
            prefix="-MSD",
            doc="Merge the sequence dictionaries",
        ),
        ToolInput(
            "sortOrder",
            String(optional=True),
            prefix="-SO",
            position=10,
            doc="The --SORT_ORDER argument is an enumerated type (SortOrder), which can have one of "
            "the following values: [unsorted, queryname, coordinate, duplicate, unknown]",
        ),
        ToolInput(
            "useThreading",
            Boolean(optional=True),
            prefix="--USE_THREADING",
            doc="Option to create a background thread to encode, compress and write to disk the output file. "
            "The threaded version uses about 20% more CPU and decreases runtime by "
            "~20% when writing out a compressed BAM file.",
        ),
        ToolInput(
            "compressionLevel",
            Int(optional=True),
            prefix="--COMPRESSION_LEVEL",
            position=11,
            doc="Compression level for all compressed files created (e.g. BAM and GELI).",
        ),
        ToolInput(
            "createIndex",
            Boolean(optional=True),
            prefix="--CREATE_INDEX",
            position=11,
            doc="Whether to create a BAM index when writing a coordinate-sorted BAM file.",
        ),
        ToolInput(
            "createMd5File",
            Boolean(optional=True),
            prefix="--CREATE_MD5_FILE",
            position=11,
            doc="Whether to create an MD5 digest for any BAM or FASTQ files created.",
        ),
        ToolInput(
            "maxRecordsInRam",
            Int(optional=True),
            prefix="--MAX_RECORDS_IN_RAM",
            position=11,
            doc="When writing SAM files that need to be sorted, this will specify the number of "
            "records stored in RAM before spilling to disk. Increasing this number reduces "
            "the number of file handles needed to sort a SAM file, and increases the amount of RAM needed.",
        ),
        ToolInput(
            "quiet",
            Boolean(optional=True),
            prefix="--QUIET",
            position=11,
            doc="Whether to suppress job-summary info on System.err.",
        ),
        ToolInput(
            "reference",
            FastaWithDict(optional=True),
            prefix="--reference",
            position=11,
            doc="Reference sequence file.",
        ),
        ToolInput(
            "tmpDir",
            String(optional=True),
            prefix="--TMP_DIR",
            position=11,
            default="/tmp/",
            doc="Undocumented option",
        ),
        ToolInput(
            "useJdkDeflater",
            Boolean(optional=True),
            prefix="--use_jdk_deflater",
            position=11,
            doc="Whether to use the JdkDeflater (as opposed to IntelDeflater)",
        ),
        ToolInput(
            "useJdkInflater",
            Boolean(optional=True),
            prefix="--use_jdk_inflater",
            position=11,
            doc="Whether to use the JdkInflater (as opposed to IntelInflater)",
        ),
        ToolInput(
            "validationStringency",
            String(optional=True),
            prefix="--VALIDATION_STRINGENCY",
            position=11,
            doc="Validation stringency for all SAM files read by this program. Setting stringency to SILENT "
            "can improve performance when processing a BAM file in which variable-length data "
            "(read, qualities, tags) do not otherwise need to be decoded."
            "The --VALIDATION_STRINGENCY argument is an enumerated type (ValidationStringency), "
            "which can have one of the following values: [STRICT, LENIENT, SILENT]",
        ),
        ToolInput(
            "verbosity",
            String(optional=True),
            prefix="--verbosity",
            position=11,
            doc="The --verbosity argument is an enumerated type (LogLevel), which can have "
            "one of the following values: [ERROR, WARNING, INFO, DEBUG]",
        ),
    ]

    def tests(self):
        remote_dir = "https://swift.rc.nectar.org.au/v1/AUTH_4df6e734a509497692be237549bbe9af/janis-test-data/bioinformatics/wgsgermline_data"
        return [
            TTestCase(
                name="basic",
                input={
                    "bams": [f"{remote_dir}/NA12878-BRCA1.sorted.bam"],
                    "createIndex": True,
                    "validationStringency": "SILENT",
                    "javaOptions": ["-Xmx6G"],
                    "maxRecordsInRam": 5000000,
                    "tmpDir": "./tmp",
                    "useThreading": True,
                },
                output=BamBai.basic_test(
                    "out",
                    2826968,
                    49688,
                    f"{remote_dir}/NA12878-BRCA1.bam.flagstat",
                    "963a51f7feed5b829319b947961b8a3e",
                    "231c10d0e43766170f5a7cd1b8a6d14e",
                ),
            )
        ]
Exemple #23
0
    def inputs(self) -> List[ToolInput]:
        return [
            ToolInput(
                "steps",
                Array(String),
                position=100,
                doc="""\
ILLUMINACLIP: Cut adapter and other illumina-specific sequences from the read.
SLIDINGWINDOW: Performs a sliding window trimming approach. It starts
scanning at the 5" end and clips the read once the average quality within the window
falls below a threshold.
MAXINFO: An adaptive quality trimmer which balances read length and error rate to
maximise the value of each read
LEADING: Cut bases off the start of a read, if below a threshold quality
TRAILING: Cut bases off the end of a read, if below a threshold quality
CROP: Cut the read to a specified length by removing bases from the end
HEADCROP: Cut the specified number of bases from the start of the read
MINLEN: Drop the read if it is below a specified length
AVGQUAL: Drop the read if the average quality is below the specified level
TOPHRED33: Convert quality scores to Phred-33
TOPHRED64: Convert quality scores to Phred-64
""",
            ),
            ToolInput("sampleName", String, doc="Used to name the output"),
            ToolInput("threads",
                      Int(optional=True),
                      prefix="-threads",
                      position=2),
            ToolInput(
                "phred33",
                Boolean(optional=True),
                prefix="-phred33",
                position=3,
                doc=
                "Use phred + 33 quality score. If no quality encoding is specified, "
                "it will be determined automatically",
            ),
            ToolInput(
                "phred64",
                Boolean(optional=True),
                prefix="-phred64",
                position=3,
                doc=
                "Use phred + 64 quality score. If no quality encoding is specified, "
                "it will be determined automatically",
            ),
            ToolInput(
                "trimLogFilename",
                Filename(prefix="trimlog", extension=".log"),
                prefix="-trimlog",
                position=4,
                doc="""\
Specifying a trimlog file creates a log of all read trimmings, indicating the following details:

    - the read name
    - the surviving sequence length
    - the location of the first surviving base, aka. the amount trimmed from the start
    - the location of the last surviving base in the original read
    - the amount trimmed from the end""",
            ),
        ]
Exemple #24
0
 def inputs(self) -> List[ToolInput]:
     return [
         ToolInput("piscesVersion", String()),
         ToolInput(
             "inputBam",
             BamBai(),
             prefix="-b",
             position=4,
             shell_quote=False,
             doc="Input BAM file",
         ),
         ToolInput(
             "referenceFolder",
             Directory(),
             prefix="--genomefolders",
             position=5,
             shell_quote=False,
             doc="Folder containing reference genome files",
         ),
         ToolInput(
             "outputDir",
             String(),
             prefix="--outfolder",
             position=4,
             shell_quote=False,
             doc="Output directory",
         ),
         ToolInput(
             "intervalBedFile",
             Bed(optional=True),
             prefix="-i",
             position=5,
             shell_quote=False,
             doc="Bed File denoting regions to call variants.",
         ),
         ToolInput(
             "minimumBaseQuality",
             Int(optional=True),
             prefix="--minbq",
             position=5,
             shell_quote=False,
             default=20,
             doc="Minimum base call quality to use base in read. (Default: 20)",
         ),
         ToolInput(
             "callMNVs",
             String(optional=True),
             prefix="--callmnvs",
             position=5,
             shell_quote=False,
             doc="Call Multi Nucleotide Variants (aka Phased SNPs). (Default: false)",
         ),
         ToolInput(
             "outputSBFiles",
             String(optional=True),
             prefix="--outputsbfiles",
             position=5,
             shell_quote=False,
             doc="Boolean Flag to output strand bias files. (Default: false)",
         ),
         *self.pisces_additional_args,
     ]
Exemple #25
0
    def constructor(self):

        self.input(
            "bams",
            Array(self.getFreebayesInputType()),
            doc="All bams to be analysed. Samples can be split over multiple bams as well as multiple samples can be contained in one bam as long as the sample ids are set properly.",
        )

        self.input(
            "reference",
            FastaFai,
            doc="The reference the bams were aligned to, with a fai index.",
        )
        self.input(
            "regionSize",
            int,
            default=10000000,
            doc="the size of the regions, to parallelise the analysis over. This needs to be adjusted if there are lots of samples or very high depth sequencing in the analysis.",
        )

        self.input(
            "normalSample",
            String,
            doc="The sample id of the normal sample, as it is specified in the bam header.",
        )

        # this is the coverage per sample that is the max we will analyse. It will automatically
        # multiplied by the amount of input bams we get
        self.input(
            "skipCov",
            Int(optional=True),
            default=500,
            doc="The depth per sample, at which the variant calling process will skip a region. This is used to ignore regions with mapping issues, like the centromeres as well as heterochromatin. A good value is 3 times the maximum expected coverage.",
        )

        # the same is true for min cov
        self.input(
            "minCov",
            Int(optional=True),
            default=10,
            doc="Minimum coverage over all samples, to still call variants.",
        )

        # this could be a conditional (if the callregions are supplied we use them, otherwise we
        # create them)
        self.step(
            "createCallRegions",
            CreateCallRegions(
                reference=self.reference, regionSize=self.regionSize, equalize=True
            ),
        )

        self.step(
            "callVariants",
            self.getFreebayesTool()(
                bams=self.bams,
                reference=self.reference,
                pooledDiscreteFlag=True,
                gtQuals=True,
                strictFlag=True,
                pooledContinousFlag=True,
                reportMaxGLFlag=True,
                noABPriorsFlag=True,
                maxNumOfAlleles=4,
                noPartObsFlag=True,
                region=self.createCallRegions.regions,
                # here we multiply the skipCov input by the amount of input that we have
                skipCov=(self.skipCov * self.bams.length()),
                # things that are actually default, but janis does not recognize yet
                useDupFlag=False,
                minBaseQual=1,
                minSupMQsum=0,
                minSupQsum=0,
                minCov=self.minCov,
                # now here we are trying to play with the detection limits
                # we set the fraction to be very low, to include ALL of the sites in a potential analysis
                minAltFrac=0.01,
                # and we want at least one sample that has two high quality variants OR multiple
                # lower quality ones
                minAltQSum=70,
                # but we also want to have at least two reads overall with that variants
                # we do not care if they are between samples or if they are in the same sample, but
                # 2 is better than one
                minAltTotal=2,
            ),
            scatter="region",
        )
        # might actually rewrite this once everything works, to not combine the files here, but do
        # all of it scattered and then only combine the final output
        # self.step("combineRegions", VcfCombine(vcf=self.callVariants.out))

        #

        # self.step("compressAll", BGZip(file=self.sortAll.out))
        # self.step("indexAll", Tabix(file=self.compressAll.out))

        self.step(
            "callSomatic",
            CallSomaticFreeBayes(
                vcf=self.callVariants.out, normalSampleName=self.normalSample
            ),
            # added for parallel
            scatter="vcf",
        )

        self.step("combineRegions", VcfCombine(vcf=self.callSomatic.out))

        # should not be necessary here, but just to be save
        self.step(
            "sortSomatic1",
            VcfStreamSort(vcf=self.combineRegions.out, inMemoryFlag=True),
        )

        # no need to compress this here if it leads to problems when we dont have an index for the allelic allelicPrimitves
        self.step(
            "normalizeSomatic1",
            BcfToolsNorm(
                vcf=self.sortSomatic1.out,
                reference=self.reference,
                outputType="v",
                outputFilename="normalised.vcf",
            ),
        )

        self.step(
            "allelicPrimitves",
            VcfAllelicPrimitives(
                vcf=self.normalizeSomatic1.out,
                tagParsed="DECOMPOSED",
                keepGenoFlag=True,
            ),
        )

        self.step("fixSplitLines", VcfFixUp(vcf=self.allelicPrimitves.out))

        self.step(
            "sortSomatic2", VcfStreamSort(vcf=self.fixSplitLines.out, inMemoryFlag=True)
        )

        self.step(
            "normalizeSomatic2",
            BcfToolsNorm(
                vcf=self.sortSomatic2.out,
                reference=self.reference,
                outputType="v",
                outputFilename="normalised.vcf",
            ),
        )

        self.step("uniqueAlleles", VcfUniqAlleles(vcf=self.normalizeSomatic2.out))

        self.step(
            "fixUpFreeBayesMNPs",
            FixUpFreeBayesMNPs(
                vcf=self.uniqueAlleles.out,
            ),
        )

        self.output("somaticOutVcf", source=self.fixUpFreeBayesMNPs)
Exemple #26
0
class PiscesVariantCallerBase(IlluminaToolBase):
    def tool(self) -> str:
        return "PiscesVariantCaller"

    def friendly_name(self) -> str:
        return "Pisces: Variant Caller"

    def bind_metadata(self):
        from datetime import date

        return ToolMetadata(
            contributors=["Miriam M Yeung"],
            dateCreated=date(2021, 8, 19),
            dateUpdated=date(2021, 10, 12),
            institution="Illumina",
            doi=None,
            citation="",
            keywords=["Illumina", "Pisces", "Variant Caller"],
            documentationUrl="",
            documentation="Calls variants",
        )

    def cpus(self, hints: Dict[str, Any]):
        val = get_value_for_hints_and_ordered_resource_tuple(hints, CORES_TUPLE)
        if val:
            return val
        return 4

    def memory(self, hints: Dict[str, Any]):
        val = get_value_for_hints_and_ordered_resource_tuple(hints, MEM_TUPLE)
        if val:
            return val
        return 4

    def base_command(self):
        return None

    def arguments(self):
        return [
            ToolArgument("export TMPDIR=/tmp;", position=1, shell_quote=False),
            ToolArgument("dotnet", position=2, shell_quote=False),
            ToolArgument(
                StringFormatter(
                    "/app/Pisces_v{PISCES_VERSION}/Pisces.dll",
                    PISCES_VERSION=InputSelector("piscesVersion"),
                ),
                position=3,
                shell_quote=False,
            ),
        ]

    def inputs(self) -> List[ToolInput]:
        return [
            ToolInput("piscesVersion", String()),
            ToolInput(
                "inputBam",
                BamBai(),
                prefix="-b",
                position=4,
                shell_quote=False,
                doc="Input BAM file",
            ),
            ToolInput(
                "referenceFolder",
                Directory(),
                prefix="--genomefolders",
                position=5,
                shell_quote=False,
                doc="Folder containing reference genome files",
            ),
            ToolInput(
                "outputDir",
                String(),
                prefix="--outfolder",
                position=4,
                shell_quote=False,
                doc="Output directory",
            ),
            ToolInput(
                "intervalBedFile",
                Bed(optional=True),
                prefix="-i",
                position=5,
                shell_quote=False,
                doc="Bed File denoting regions to call variants.",
            ),
            ToolInput(
                "minimumBaseQuality",
                Int(optional=True),
                prefix="--minbq",
                position=5,
                shell_quote=False,
                default=20,
                doc="Minimum base call quality to use base in read. (Default: 20)",
            ),
            ToolInput(
                "callMNVs",
                String(optional=True),
                prefix="--callmnvs",
                position=5,
                shell_quote=False,
                doc="Call Multi Nucleotide Variants (aka Phased SNPs). (Default: false)",
            ),
            ToolInput(
                "outputSBFiles",
                String(optional=True),
                prefix="--outputsbfiles",
                position=5,
                shell_quote=False,
                doc="Boolean Flag to output strand bias files. (Default: false)",
            ),
            *self.pisces_additional_args,
        ]

    def outputs(self) -> List[ToolOutput]:
        return [
            ToolOutput("vcf", Vcf(), glob=WildcardSelector("*.vcf")),
            ToolOutput(
                "used_options",
                File(optional=True),
                glob=WildcardSelector("PiscesLogs/*.json"),
            ),
            ToolOutput(
                "strandmetrics",
                File(optional=True),
                glob=WildcardSelector("*ReadStrandBias.txt"),
            ),
        ]

    pisces_additional_args = [
        ToolInput(
            "forcedAlleles",
            Vcf(optional=True),
            prefix="--forcedalleles",
            position=5,
            shell_quote=False,
            doc="Path to vcf of alleles where reporting is forced",
        ),
        ToolInput(
            "maxMNVLength",
            Int(optional=True),
            prefix="--maxmnvlength",
            position=5,
            shell_quote=False,
            doc="Maximum lenght of phased SNPs. Must be between 1 - 1000. (Default: 3)",
        ),
        ToolInput(
            "maxGapBetweenMNV",
            Int(optional=True),
            prefix="--maxgapbetweenmnv",
            position=5,
            shell_quote=False,
            doc="Maximum gap allowed between phased SNPs. Must be greater than 0. (Default: 1)",
        ),
        ToolInput(
            "collapseVariants",
            String(optional=True),
            prefix="--collapse",
            position=5,
            shell_quote=False,
            doc="Boolean flag for whether to collapse variants. (Default: true)",
        ),
        ToolInput(
            "collapseFreqThreshold",
            Float(optional=True),
            prefix="--collapsefreqthreshold",
            position=5,
            shell_quote=False,
            doc="when collapsing, minimum frequency of targetted variants. (Default: 0)",
        ),
        ToolInput(
            "collpaseFreqRatioThreshold",
            Float(optional=True),
            prefix="--collapsefreqratiothreshold",
            position=5,
            shell_quote=False,
            doc="When collapsing, minimum ratio requred of target variant frequency to collapsible variant frequency. (Default: 0.5)",
        ),
        ToolInput(
            "priorsPath",
            Vcf(optional=True),
            prefix="--priorspath",
            position=5,
            shell_quote=False,
            doc="Path to vcf file containing known variants, to preferentially reconcile collapsed variants",
        ),
        ToolInput(
            "trimMNVPriors",
            String(optional=True),
            prefix="--trimmnvpriors",
            position=5,
            shell_quote=False,
            doc="Boolean denoting if preceeding bases from the priorsPath VCF shoudl be trimmed. Note: COSMIC convention includeds preceeeding base for a MNV. (Default: false)",
        ),
        ToolInput(
            "coverageMethod",
            String(optional=True),
            prefix="--coveragemethod",
            position=5,
            shell_quote=False,
            doc="'approximate' or 'exact'. Exact is more precise and requires a minimum of 8GB of memory. (Default: approximate)",
        ),
        ToolInput(
            "baseLogName",
            String(optional=True),
            prefix="--baselogname",
            position=5,
            shell_quote=False,
            doc="",
        ),
        ToolInput(
            "debug",
            String(optional=True),
            prefix="-d",
            position=5,
            shell_quote=False,
            doc="Boolean flag for debugging",
        ),
        ToolInput(
            "useStitchedXD",
            String(optional=True),
            prefix="--usestitchedxd",
            position=5,
            shell_quote=False,
            doc="Boolean denoting whether the XD tag (stitched direction) is specified in the bam. ONLY USE IF USING GEMINI TO STITCH BAMS.",
        ),
        ToolInput(
            "trackedAnchorSize",
            Float(optional=True),
            prefix="--trackanchorsize",
            position=5,
            shell_quote=False,
            doc="Max size of anchor tor granularly track, when collecting reference coverage at insertion sites. Higher values == more precise (Default: 5)",
        ),
        ToolInput(
            "chrFilter",
            String(optional=True),
            prefix="--chrfilter",
            position=5,
            shell_quote=False,
            doc="Chromosome to process, will filter out all other chromosomes from output if specified. (Default: None)",
        ),
        ToolInput(
            "outFolder",
            String(optional=True),
            prefix="-o",
            position=4,
            shell_quote=False,
            doc="Ouput folder path",
        ),
        ToolInput(
            "maxThreads",
            Int(optional=True),
            default=CpuSelector(),
            prefix="-t",
            position=4,
            shell_quote=False,
            doc="Maximum number of threads. (Default: 20)",
        ),
        ToolInput(
            "threadByChr",
            String(optional=True),
            prefix="--threadbychr",
            position=5,
            shell_quote=False,
            doc="Parallelize by chromosome. (Default: false)",
        ),
        ToolInput(
            "multiProcess",
            String(optional=True),
            prefix="--multiprocess",
            position=5,
            shell_quote=False,
            doc="When thread by chr, launch separate processes to parallelize. (Default: true)",
        ),
        ## Bam Filtering Options
        ToolInput(
            "minimumMappingQuality",
            Int(),
            prefix="--minmq",
            position=5,
            shell_quote=False,
            default=1,
            doc="Minimum mapping quality to use a read. (Default: 1)",
        ),
        ToolInput(
            "filterDuplicates",
            String(optional=True),
            prefix="--filterduplicates",
            position=5,
            shell_quote=False,
            doc="Boolean Flag to filter out reads marked as duplicates. (Default: true)",
        ),
        ToolInput(
            "onlyUseProperPairs",
            String(optional=True),
            prefix="--pp",
            position=5,
            shell_quote=False,
            doc="Boolean Flag to only use proper pairs. (Default: false)",
        ),
        ## Variant Calling Options
        ToolInput(
            "minimumVariantQualityScore",
            Int(optional=True),
            prefix="--minvariantqscore",
            position=5,
            shell_quote=False,
            doc="Minimum Variant Quality Score to report a variant. (Default: 20)",
        ),
        ToolInput(
            "minimumCoverage",
            Int(optional=True),
            prefix="--mindepth",
            position=5,
            shell_quote=False,
            doc="Minimum depth to call a variant. (Default: 10)",
        ),
        ToolInput(
            "minimumVariantFrequency",
            Float(optional=True),
            prefix="--minimumvariantfrequency",
            position=5,
            shell_quote=False,
            doc="Minimum variant frequency to call a variant. Must be between 0 and 1. (Default: 0.01)",
        ),
        ToolInput(
            "targetLODFrequency",
            Float(optional=True),
            prefix="--targetvf",
            position=5,
            shell_quote=False,
            doc="Target Frequency to call a variant (i.e. to target a 5% allele frequency, we must call down to 2.6%, to capture a 5% allelle 95% of the time). Parameter is used by the Somatic Genotyping Model",
        ),
        ToolInput(
            "variantQualityFilter",
            Int(optional=True),
            prefix="--variantqualityfilter",
            position=5,
            shell_quote=False,
            doc="Threshold for variant quality score filter to report a variant as 'FilteredVariantQScore'. (Default: 30)",
        ),
        ToolInput(
            "minimumVariantFrequencyFilter",
            Float(optional=True),
            prefix="--minvariantfrequencyfilter",
            position=5,
            shell_quote=False,
            doc="Threshold for variant frequency to report a variant as 'FilteredVariantFrequency'. (Default: None)",
        ),
        ToolInput(
            "genotypeQualityFilter",
            Int(optional=True),
            prefix="--gqfilter",
            position=5,
            shell_quote=False,
            doc="Threshold for genotype quality, if below the threshold, variant is reported as 'FilteredGenotype'. Should be greater than 0. (Default: None)",
        ),
        ToolInput(
            "minimumDepthFilter",
            Int(optional=True),
            prefix="--mindepthfilter",
            position=5,
            shell_quote=False,
            doc="Threshold for reporting variants as 'FilteredLowDepth', if below the given threshold. (Default: None)",
        ),
        ToolInput(
            "enableSingleStrandFilter",
            String(optional=True),
            prefix="--ssfilter",
            position=5,
            shell_quote=False,
            doc="Filter variants with coverage limited to a single strand with filter flag 'SB'",
        ),
        ToolInput(
            "strandBiasModel",
            String(optional=True),
            prefix="--sbmodel",
            position=5,
            shell_quote=False,
            doc="Strand Bias Mode. Must be 'poisson|extended'. (Default: extended)",
        ),
        ToolInput(
            "noiseLevelForQModel",
            Int(optional=True),
            prefix="--NoiseLevelForQModel",
            position=5,
            shell_quote=False,
            doc="Noise Level to be used in the quality model for a variant quality score. Which is used to determine false positives. Must be >= 0. (Default: minimum base quality)\nNOTE: If this value is greater than the minBQ, it implies that the variant calls have higher confidence than the recorded BQ.",
        ),
        ToolInput(
            "ploidy",
            String(optional=True),
            prefix="--ploidy",
            position=5,
            shell_quote=False,
            doc="Ploidy model to determine the genotype of variant. Select from 'somatic|diploid|DiploidByAdaptiveGT'. (Default: somatic)",
        ),
        ToolInput(
            "diploidSNVGenotypeParameters",
            String(optional=True),
            prefix="--diploidsnvgenotypeparameters",
            position=5,
            shell_quote=False,
            doc="Comma-separated List of 3 floats in the format A,B,C. All must be between 0 and 1. A = Minimum Allelle frequence to be detected as 0/1(heterozygous), B = Maximum Allele frequence to be detected as 0/1, C = Minimum value for the sum of allells 1 and 2 (i.e. if C is not met the sit is flagged as 'Multiallelic'). (Default: 0.20, 0.70, 0.80)",
        ),
        ToolInput(
            "diploidIndelGenotypeParameters",
            String(optional=True),
            prefix="--diploidindelgenotypeparameters",
            position=5,
            shell_quote=False,
            doc="Comma-separated List of 3 floats in the format A,B,C. All must be between 0 and 1. A = Minimum Allelle frequence to be detected as 0/1(heterozygous), B = Maximum Allele frequence to be detected as 0/1, C = Minimum value for the sum of allells 1 and 2 (i.e. if C is not met the sit is flagged as 'Multiallelic'). (Default: 0.20, 0.70, 0.80)",
        ),
        ToolInput(
            "adaptiveGenotypeParametersSNV",
            String(optional=True),
            prefix="--adaptivegenotypeparameters_snvmodel",
            position=5,
            shell_quote=False,
            doc="Comma-separated list of 4 floats in the format A,B,C,D. (Default: 0.034,0.167,0.499,0.998)",
        ),
        ToolInput(
            "adaptiveGenotypeParametersIndel",
            String(optional=True),
            prefix="--adaptivegenotypeparameters_indelmodel",
            position=5,
            shell_quote=False,
            doc="(Default: 0.037,0.443,0.905)",
        ),
        ToolInput(
            "adaptiveGenotypeParametersSNVPrior",
            String(optional=True),
            prefix="--adaptivegenotypeparameters_snvprior",
            position=5,
            shell_quote=False,
            doc="(Default: 0.729,0.044,0.141,0.087)",
        ),
        ToolInput(
            "adaptiveGenotypeParametersIndelPrior",
            String(optional=True),
            prefix="--adaptivegenotypeparameters_indelprior",
            position=5,
            shell_quote=False,
            doc="(Default: 0.962,0.0266,0.0114)",
        ),
        ToolInput(
            "maximumVariantQualityScore",
            Int(optional=True),
            prefix="--maxvq",
            position=5,
            shell_quote=False,
            doc="Maximum variant quality score possible. (Default: 100)",
        ),
        ToolInput(
            "maximumGenotypeQualityScore",
            Int(optional=True),
            prefix="--maxgq",
            position=5,
            shell_quote=False,
            doc="Maximum genotype quality score possible. (Default: 100)",
        ),
        ToolInput(
            "maximumGenotypePosteriorScore",
            Int(optional=True),
            prefix="--maxgp",
            position=5,
            shell_quote=False,
            doc="Maximum Genotype Posterior score. (Default: 300)",
        ),
        ToolInput(
            "minimumGenotypeQualityScore",
            Int(optional=True),
            prefix="--mingq",
            position=5,
            shell_quote=False,
            doc="Minimum genotype quality score. (Default: 0)",
        ),
        ToolInput(
            "RMxNFilter",
            String(optional=True),
            prefix="--rmxnfilter",
            position=5,
            shell_quote=False,
            doc="Comma-separated list in the format M,N,F, indicating the max length of a repeat region(M), the minimum number of repeatitions (N), to be applied if the variant frequency is less than (F). (Default: 5,8,0.20)",
        ),
        ToolInput(
            "noCallFilter",
            Float(optional=True),
            prefix="--ncfilter",
            position=5,
            shell_quote=False,
            doc="No Call rate filter",
        ),
        ## Vcf Writer options
        ToolInput(
            "gVCF",
            String(optional=True),
            prefix="--gvcf",
            position=5,
            shell_quote=False,
            doc="Output as a gVCF. (Default: false)",
        ),
        ToolInput(
            "crushVCF",
            String(optional=True),
            prefix="--crushvcf",
            position=5,
            shell_quote=False,
            doc="Crush vcf output into one line per loci. (Default: false)",
        ),
        ToolInput(
            "reportNoCalls",
            String(optional=True),
            prefix="--reportnocalls",
            position=5,
            shell_quote=False,
            doc="Report the proportion of no-calls in the output. (Default: false)",
        ),
        ToolInput(
            "reportReadCollapsedReadCount",
            String(optional=True),
            prefix="--reportrccounts",
            position=5,
            shell_quote=False,
            doc="Debugging helper, when BAM files contain X1 & X2 tags, reports collapsed read counts for the categories 'duplex-stitched|duplex-nonstitched|simplex-stitched|simplex-nonstitched'. (Default: false)",
        ),
        ToolInput(
            "reportTemplateStrandCounts",
            String(optional=True),
            prefix="--reporttscounts",
            position=5,
            shell_quote=False,
            doc="Debugging helper, conditional on ReportRcCounts. Reports read counts for different template strands for the categories 'duplex-stitched|duplex-nonstitched|simplex-forward-stitched|simplex-forward-nonstitched|simplex-reverse-stitched|simplex-reverse-nonstitched''",
        ),
        ToolInput(
            "reportSuspiciousCoverageFraction",
            String(optional=True),
            prefix="--reportsuspiciouscoveragefraction",
            position=5,
            shell_quote=False,
            doc="Debugging helper, Reports the fraction of total coverage that is 'suspicious'. i.e. unanchored and bearing some resemblance to an insertion at the site. Note that for spanning varaints, this is start + end coverage, therefore up to double the coverage reported. (Default: false)",
        ),
    ]
Exemple #27
0
class Gatk4HaplotypeCallerBase(Gatk4ToolBase, ABC):
    @classmethod
    def gatk_command(cls):
        return "HaplotypeCaller"

    def tool(self):
        return "Gatk4HaplotypeCaller"

    def friendly_name(self):
        return "GATK4: Haplotype Caller"

    def cpus(self, hints: Dict[str, Any]):
        val = get_value_for_hints_and_ordered_resource_tuple(
            hints, CORES_TUPLE)
        if val:
            return val
        return 1

    def memory(self, hints: Dict[str, Any]):
        val = get_value_for_hints_and_ordered_resource_tuple(hints, MEM_TUPLE)
        if val:
            return val
        return 8

    def inputs(self):
        return [
            *super(Gatk4HaplotypeCallerBase, self).inputs(),
            *Gatk4HaplotypeCallerBase.optional_args,
            ToolInput(
                "inputRead",
                BamBai(),
                doc="BAM/SAM/CRAM file containing reads",
                prefix="--input",
                secondaries_present_as={".bai": "^.bai"},
            ),
            ToolInput(
                "reference",
                FastaWithDict(),
                position=5,
                prefix="--reference",
                doc="Reference sequence file",
            ),
            ToolInput(
                "outputFilename",
                Filename(prefix=InputSelector("inputRead"),
                         extension=".vcf.gz"),
                position=8,
                prefix="--output",
                doc="File to which variants should be written",
            ),
            ToolInput(
                "dbsnp",
                VcfTabix(optional=True),
                position=7,
                prefix="--dbsnp",
                doc="(Also: -D) A dbSNP VCF file.",
            ),
            ToolInput(
                "intervals",
                Bed(optional=True),
                prefix="--intervals",
                doc=
                "-L (BASE) One or more genomic intervals over which to operate",
            ),
            ToolInput(
                "outputBamName",
                Filename(prefix=InputSelector("inputRead"), extension=".bam"),
                position=8,
                prefix="-bamout",
                doc="File to which assembled haplotypes should be written",
            ),
        ]

    def outputs(self):
        return [
            ToolOutput(
                "out",
                CompressedVcf,
                glob=InputSelector("outputFilename"),
                doc="A raw, unfiltered, highly sensitive callset in VCF format. "
                "File to which variants should be written",
            ),
            ToolOutput(
                "bam",
                BamBai,
                glob=InputSelector("outputBamName"),
                doc="File to which assembled haplotypes should be written",
                secondaries_present_as={".bai": "^.bai"},
            ),
        ]

    def bind_metadata(self):
        from datetime import date

        return ToolMetadata(
            contributors=["Michael Franklin"],
            dateCreated=date(2018, 12, 24),
            dateUpdated=date(2019, 1, 24),
            institution="Broad Institute",
            doi=None,
            citation=
            "See https://software.broadinstitute.org/gatk/documentation/article?id=11027 for more information",
            keywords=["gatk", "gatk4", "broad", "haplotype"],
            documentationUrl=
            "https://software.broadinstitute.org/gatk/documentation/tooldocs/current/org_broadinstitute_hellbender_tools_walkers_haplotypecaller_HaplotypeCaller.php#",
            documentation=
            """Call germline SNPs and indels via local re-assembly of haplotypes
    
The HaplotypeCaller is capable of calling SNPs and indels simultaneously via local de-novo assembly of haplotypes 
in an active region. In other words, whenever the program encounters a region showing signs of variation, it 
discards the existing mapping information and completely reassembles the reads in that region. This allows the 
HaplotypeCaller to be more accurate when calling regions that are traditionally difficult to call, for example when 
they contain different types of variants close to each other. It also makes the HaplotypeCaller much better at 
calling indels than position-based callers like UnifiedGenotyper.

In the GVCF workflow used for scalable variant calling in DNA sequence data, HaplotypeCaller runs per-sample to 
generate an intermediate GVCF (not to be used in final analysis), which can then be used in GenotypeGVCFs for joint 
genotyping of multiple samples in a very efficient way. The GVCF workflow enables rapid incremental processing of 
samples as they roll off the sequencer, as well as scaling to very large cohort sizes (e.g. the 92K exomes of ExAC).

In addition, HaplotypeCaller is able to handle non-diploid organisms as well as pooled experiment data. 
Note however that the algorithms used to calculate variant likelihoods is not well suited to extreme allele 
frequencies (relative to ploidy) so its use is not recommended for somatic (cancer) variant discovery. 
For that purpose, use Mutect2 instead.

Finally, HaplotypeCaller is also able to correctly handle the splice junctions that make RNAseq a challenge 
for most variant callers, on the condition that the input read data has previously been processed according 
to our recommendations as documented (https://software.broadinstitute.org/gatk/documentation/article?id=4067).
""".strip(),
        )

    optional_args = [
        ToolInput(
            "pairHmmImplementation",
            String(optional=True),
            prefix="--pair-hmm-implementation",
            doc=
            "The PairHMM implementation to use for genotype likelihood calculations. The various implementations balance a tradeoff of accuracy and runtime. The --pair-hmm-implementation argument is an enumerated type (Implementation), which can have one of the following values: EXACT;ORIGINAL;LOGLESS_CACHING;AVX_LOGLESS_CACHING;AVX_LOGLESS_CACHING_OMP;EXPERIMENTAL_FPGA_LOGLESS_CACHING;FASTEST_AVAILABLE. Implementation:  FASTEST_AVAILABLE",
        ),
        ToolInput(
            "activityProfileOut",
            String(optional=True),
            prefix="--activity-profile-out",
            doc=
            "Output the raw activity profile results in IGV format (default: null)",
        ),
        ToolInput(
            "alleles",
            File(optional=True),
            prefix="--alleles",
            doc=
            "(default: null) The set of alleles at which to genotype when --genotyping_mode "
            "is GENOTYPE_GIVEN_ALLELES",
        ),
        ToolInput(
            "annotateWithNumDiscoveredAlleles",
            Boolean(optional=True),
            prefix="--annotate-with-num-discovered-alleles",
            doc=
            "If provided, we will annotate records with the number of alternate alleles that were "
            "discovered (but not necessarily genotyped) at a given site",
        ),
        ToolInput(
            "annotation",
            Array(String(), optional=True),
            prefix="--annotation",
            doc="-A: One or more specific annotations to add to variant calls",
        ),
        ToolInput(
            "annotationGroup",
            Array(String(), optional=True),
            prefix="--annotation-group",
            doc=
            "-G	One or more groups of annotations to apply to variant calls",
        ),
        ToolInput(
            "annotationsToExclude",
            Array(String(), optional=True),
            prefix="--annotations-to-exclude",
            doc=
            "-AX	One or more specific annotations to exclude from variant calls",
        ),
        ToolInput(
            "arguments_file",
            Array(File(), optional=True),
            prefix="--arguments_file",
            doc=
            "read one or more arguments files and add them to the command line",
        ),
        ToolInput(
            "assemblyRegionOut",
            String(optional=True),
            prefix="--assembly-region-out",
            doc=
            "(default: null) Output the assembly region to this IGV formatted file. Which annotations to "
            "exclude from output in the variant calls. Note that this argument has higher priority than "
            "the -A or -G arguments, so these annotations will be excluded even if they are explicitly "
            "included with the other options.",
        ),
        ToolInput(
            "baseQualityScoreThreshold",
            Int(optional=True),
            prefix="--base-quality-score-threshold",
            doc=
            "(default: 18) Base qualities below this threshold will be reduced to the minimum (6)",
        ),
        ToolInput(
            "cloudIndexPrefetchBuffer",
            Int(optional=True),
            prefix="--cloud-index-prefetch-buffer",
            doc=
            "-CIPB (default: -1) Size of the cloud-only prefetch buffer (in MB; 0 to disable). "
            "Defaults to cloudPrefetchBuffer if unset.",
        ),
        ToolInput(
            "cloudPrefetchBuffer",
            Int(optional=True),
            prefix="--cloud-prefetch-buffer",
            doc=
            "-CPB (default: 40) Size of the cloud-only prefetch buffer (in MB; 0 to disable).",
        ),
        ToolInput(
            "contaminationFractionToFilter",
            Double(optional=True),
            prefix="--contamination-fraction-to-filter",
            doc=
            "-contamination (default: 0.0) Fraction of contamination in sequencing data "
            "(for all samples) to aggressively remove",
        ),
        ToolInput(
            "correctOverlappingQuality",
            Boolean(optional=True),
            prefix="--correct-overlapping-quality",
            doc="Undocumented option",
        ),
        # ToolInput("dbsnp", VcfIdx(optional=True), prefix="--dbsnp", doc="-D (default: null) dbSNP file"),
        ToolInput(
            "disableBamIndexCaching",
            Boolean(optional=True),
            prefix="--disable-bam-index-caching",
            doc=
            "-DBIC. If true, don't cache bam indexes, this will reduce memory requirements but may harm "
            "performance if many intervals are specified. Caching is automatically disabled if "
            "there are no intervals specified.",
        ),
        # ToolInput("disableSequenceDictionaryValidation", Boolean(optional=True), prefix="--disable-sequence-dictionary-validation",
        #           doc="If specified, do not check the sequence dictionaries from our inputs for compatibility. Use at your own risk!"),
        ToolInput(
            "founderId",
            Array(String(), optional=True),
            prefix="--founder-id",
            doc='Samples representing the population "founders"',
        ),
        # ToolInput("gcsMaxRetries", Int(optional=True), prefix="--gcs-max-retries",
        #           doc="-gcs-retries (default: 20) If the GCS bucket channel errors out, "
        #               "how many times it will attempt to re-initiate the connection"),
        # ToolInput("gcsProjectForRequesterPays", String(), prefix="--gcs-project-for-requester-pays",
        #           doc="Project to bill when accessing \"requester pays\" buckets. If unset, these buckets cannot be accessed."),
        ToolInput(
            "genotypingMode",
            String(optional=True),
            prefix="--genotyping-mode",
            doc=
            "(default: DISCOVERY) Specifies how to determine the alternate alleles to use for genotyping. "
            "The --genotyping-mode argument is an enumerated type (GenotypingOutputMode), which can have one "
            "of the following values: DISCOVERY (The genotyper will choose the most likely alternate allele) "
            "or GENOTYPE_GIVEN_ALLELES (Only the alleles passed by the user should be considered).",
        ),
        # ToolInput("graphOutput", DataType(optional=True), prefix="--graph-output", doc="-graph	null	Write debug assembly graph information to this file"),
        ToolInput(
            "heterozygosity",
            Double(optional=True),
            prefix="--heterozygosity",
            doc=
            "(default: 0.001) Heterozygosity value used to compute prior likelihoods for any locus. The "
            "expected heterozygosity value used to compute prior probability that a locus is non-reference. "
            "The default priors are for provided for humans: het = 1e-3 which means that the probability "
            "of N samples being hom-ref at a site is: 1 - sum_i_2N (het / i) Note that heterozygosity as "
            "used here is the population genetics concept: "
            "http://en.wikipedia.org/wiki/Zygosity#Heterozygosity_in_population_genetics . "
            "That is, a hets value of 0.01 implies that two randomly chosen chromosomes from the population "
            "of organisms would differ from each other (one being A and the other B) at a rate of 1 in 100 bp. "
            "Note that this quantity has nothing to do with the likelihood of any given sample having a "
            "heterozygous genotype, which in the GATK is purely determined by the probability of the observed "
            "data P(D | AB) under the model that there may be a AB het genotype. The posterior probability "
            "of this AB genotype would use the het prior, but the GATK only uses this posterior probability "
            "in determining the prob. that a site is polymorphic. So changing the het parameters only "
            "increases the chance that a site will be called non-reference across all samples, but doesn't "
            "actually change the output genotype likelihoods at all, as these aren't posterior probabilities "
            "at all. The quantity that changes whether the GATK considers the possibility of a het genotype "
            "at all is the ploidy, which determines how many chromosomes each individual in the species carries.",
        ),
        ToolInput(
            "heterozygosityStdev",
            Double(optional=True),
            prefix="--heterozygosity-stdev",
            doc=
            "(default 0.01) Standard deviation of heterozygosity for SNP and indel calling.",
        ),
        ToolInput(
            "indelHeterozygosity",
            Double(optional=True),
            prefix="--indel-heterozygosity",
            doc=
            "(default: 1.25E-4) Heterozygosity for indel calling. This argument informs the prior "
            "probability of having an indel at a site. (See heterozygosity)",
        ),
        ToolInput(
            "intervalMergingRule",
            String(optional=True),
            prefix="--interval-merging-rule",
            doc=
            "-imr (default: ALL) Interval merging rule for abutting intervals. By default, the program "
            "merges abutting intervals (i.e. intervals that are directly side-by-side but do not actually "
            "overlap) into a single continuous interval. However you can change this behavior if you want "
            "them to be treated as separate intervals instead. The --interval-merging-rule argument is an "
            "enumerated type (IntervalMergingRule), which can have one of the following values:"
            "[ALL, OVERLAPPING]",
        ),
        ToolInput(
            "maxReadsPerAlignmentStart",
            Int(optional=True),
            prefix="--max-reads-per-alignment-start",
            doc=
            "(default: 50) Maximum number of reads to retain per alignment start position. "
            "Reads above this threshold will be downsampled. Set to 0 to disable.",
        ),
        ToolInput(
            "minBaseQualityScore",
            Int(optional=True),
            prefix="--min-base-quality-score",
            doc=
            "-mbq (default: 10) Minimum base quality required to consider a base for calling",
        ),
        ToolInput(
            "nativePairHmmThreads",
            Int(optional=True),
            prefix="--native-pair-hmm-threads",
            doc=
            "(default: 4) How many threads should a native pairHMM implementation use",
        ),
        ToolInput(
            "nativePairHmmUseDoublePrecision",
            Boolean(optional=True),
            prefix="--native-pair-hmm-use-double-precision",
            doc="use double precision in the native pairHmm. "
            "This is slower but matches the java implementation better",
        ),
        ToolInput(
            "numReferenceSamplesIfNoCall",
            Int(optional=True),
            prefix="--num-reference-samples-if-no-call",
            doc=
            "(default: 0) Number of hom-ref genotypes to infer at sites not present in a panel. When a "
            "variant is not seen in any panel, this argument controls whether to infer (and with what "
            "effective strength) that only reference alleles were observed at that site. "
            'E.g. "If not seen in 1000Genomes, treat it as AC=0, AN=2000".',
        ),
        ToolInput(
            "outputMode",
            String(optional=True),
            prefix="--output-mode",
            doc=
            "(default: EMIT_VARIANTS_ONLY) Specifies which type of calls we should output. The --output-mode "
            "argument is an enumerated type (OutputMode), which can have one of the following values: "
            "[EMIT_VARIANTS_ONLY (produces calls only at variant sites), "
            "EMIT_ALL_CONFIDENT_SITES (produces calls at variant sites and confident reference sites), "
            "EMIT_ALL_SITES (produces calls at any callable site regardless of confidence; "
            "this argument is intended only for point mutations (SNPs) in DISCOVERY mode or "
            "generally when running in GENOTYPE_GIVEN_ALLELES mode; it will by no means produce "
            "a comprehensive set of indels in DISCOVERY mode)]",
        ),
        ToolInput(
            "pedigree",
            File(optional=True),
            prefix="--pedigree",
            doc=
            '-ped (default: null) Pedigree file for determining the population "founders"',
        ),
        ToolInput(
            "populationCallset",
            File(optional=True),
            prefix="--population-callset",
            doc=
            "-population (default: null) Callset to use in calculating genotype priors",
        ),
        ToolInput(
            "sampleName",
            String(optional=True),
            prefix="--sample-name",
            doc=
            "-ALIAS (default: null) Name of single sample to use from a multi-sample bam. You can use this "
            "argument to specify that HC should process a single sample out of a multisample BAM file. "
            "This is especially useful if your samples are all in the same file but you need to run them "
            "individually through HC in -ERC GVC mode (which is the recommended usage). "
            "Note that the name is case-sensitive.",
        ),
        ToolInput(
            "samplePloidy",
            Int(optional=True),
            prefix="--sample-ploidy",
            doc=
            "-ploidy (default: 2) Ploidy (number of chromosomes) per sample. "
            "For pooled data, set to (Number of samples in each pool * Sample Ploidy). "
            "Sample ploidy - equivalent to number of chromosomes per pool. In pooled "
            "experiments this should be = # of samples in pool * individual sample ploidy",
        ),
        ToolInput(
            "sitesOnlyVcfOutput",
            Boolean(optional=True),
            prefix="--sites-only-vcf-output",
            doc=
            "(default: false) If true, don't emit genotype fields when writing vcf file output.",
        ),
        ToolInput(
            "standardMinConfidenceThresholdForCalling",
            Double(optional=True),
            prefix="--standard-min-confidence-threshold-for-calling",
            doc=
            "-stand-call-conf (default: 10.0) The minimum phred-scaled confidence "
            "threshold at which variants should be called",
        ),
        ToolInput(
            "useNewQualCalculator",
            Boolean(optional=True),
            prefix="--use-new-qual-calculator",
            doc=
            "-new-qual If provided, we will use the new AF model instead of the so-called exact model",
        ),
        ToolInput(
            "gvcfGqBands",
            Array(Int, optional=True),
            prefix="-GQB",
            prefix_applies_to_all_elements=True,
            doc=
            "(--gvcf-gq-bands) Exclusive upper bounds for reference confidence GQ"
            " bands (must be in [1, 100] and specified in increasing order)",
        ),
        ToolInput(
            "emitRefConfidence",
            String(optional=True),
            prefix="--emit-ref-confidence",
            doc=
            "(-ERC) Mode for emitting reference confidence scores (For Mutect2, this is a BETA feature)",
        ),
        ToolInput(
            "dontUseSoftClippedBases",
            Boolean(optional=True),
            prefix="--dont-use-soft-clipped-bases",
            doc="Do not analyze soft clipped bases in the reads",
        ),
    ]
Exemple #28
0
 def inputs(self):
     return [
         *super().inputs(),  # cache options
         ToolInput(
             "database",
             Boolean(optional=True),
             prefix="--database",
             doc="Enable VEP to use local or remote databases.",
         ),
         ToolInput(
             "host",
             String(optional=True),
             prefix="--host",
             doc=
             "Manually define the database host to connect to. Users in the US may find connection and transfer "
             'speeds quicker using our East coast mirror, useastdb.ensembl.org. Default = "ensembldb.ensembl.org"',
         ),
         ToolInput(
             "user",
             String(optional=True),
             prefix="--user",
             doc=
             '(-u) Manually define the database username. Default = "anonymous"',
         ),
         ToolInput(
             "password",
             String(optional=True),
             prefix="--password",
             doc=
             "(--pass) Manually define the database password. Not used by default",
         ),
         ToolInput(
             "port",
             Int(optional=True),
             prefix="--port",
             doc="Manually define the database port. Default = 5306",
         ),
         ToolInput(
             "genomes",
             Boolean(optional=True),
             prefix="--genomes",
             doc=
             "Override the default connection settings with those for the Ensembl Genomes public MySQL server. "
             "Required when using any of the Ensembl Genomes species. Not used by default",
         ),
         ToolInput(
             "isMultispecies",
             Boolean(optional=True),
             prefix="--is_multispecies",
             doc=
             "Some of the Ensembl Genomes databases (mainly bacteria and protists) are composed of a collection "
             "of close species. It updates the database connection settings (i.e. the database name) "
             "if the value is set to 1. Default: 0",
         ),
         ToolInput(
             "lrg",
             Boolean(optional=True),
             prefix="--lrg",
             doc=
             "Map input variants to LRG coordinates (or to chromosome coordinates if given in LRG coordinates), "
             "and provide consequences on both LRG and chromosomal transcripts. Not used by default",
         ),
         ToolInput(
             "dbVersion",
             String(optional=True),
             prefix="--db_version",
             doc=
             "Force VEP to connect to a specific version of the Ensembl databases. Not recommended as there "
             "may be conflicts between software and database versions. Not used by default",
         ),
         ToolInput(
             "registry",
             Filename(),
             prefix="--registry",
             doc=
             "Defining a registry file overwrites other connection settings and uses those found in the "
             "specified registry file to connect. Not used by default",
         ),
     ]
Exemple #29
0
    def constructor(self):

        self.input("bams", Array(CramCrai))

        self.input("reference", FastaFai)
        self.input("regionSize", int, default=10000000)

        self.input("normalSample", String)
        self.input("sampleNames", Array(String, optional=True))

        # for the moment this is a bit wonky, because you need to specify something which is
        # affected by the amount of bams that you specify (bam coverage just gets summed up at this
        # location)
        # so the formula at the moment would be nBams * coverage = skipCov
        # which means for 8 bams with an average coverage of 160 you would probably want
        # 8 * 400 = 1600 to be on the save side
        self.input("skipCov", Int(optional=True), default=500)

        # the same is true for min cov
        self.input("minCov", Int(optional=True), default=10)

        # this should be a conditional (if the callregions are supplied we use them, otherwise we
        # create them)
        self.step(
            "createCallRegions",
            CreateCallRegions(reference=self.reference,
                              regionSize=self.regionSize,
                              equalize=True),
        )

        self.step(
            "callVariants",
            FreeBayes(
                bams=self.bams,
                reference=self.reference,
                pooledDiscreteFlag=True,
                gtQuals=True,
                strictFlag=True,
                pooledContinousFlag=True,
                reportMaxGLFlag=True,
                noABPriorsFlag=True,
                maxNumOfAlleles=4,
                noPartObsFlag=True,
                region=self.createCallRegions.regions,
                skipCov=self.skipCov,
                # things that are actually default, but janis does not recognize yet
                useDupFlag=False,
                minBaseQual=1,
                minSupMQsum=0,
                minSupQsum=0,
                minCov=self.minCov,
                # now here we are trying to play with the detection limits
                # we set the fraction to be very low, to include ALL of the sites in a potential analysis
                minAltFrac=0.01,
                # and we want at least one sample that has two high quality variants OR multiple
                # lower quality ones
                minAltQSum=70,
                # but we also want to have at least two reads overall with that variants
                # we do not care if they are between samples or if they are in the same sample, but
                # 2 is better than one
                minAltTotal=2,
            ),
            scatter="region",
        )
        # might actually rewrite this once everything works, to not combine the files here, but do
        # all of it scattered and then only combine the final output
        # self.step("combineRegions", VcfCombine(vcf=self.callVariants.out))

        #

        # self.step("compressAll", BGZip(file=self.sortAll.out))
        # self.step("indexAll", Tabix(file=self.compressAll.out))

        self.step(
            "callSomatic",
            CallSomaticFreeBayes(vcf=self.callVariants.out,
                                 normalSampleName=self.normalSample),
            # added for parallel
            scatter="vcf",
        )

        self.step("combineRegions", VcfCombine(vcf=self.callSomatic.out))

        # should not be necessary here, but just to be save
        self.step(
            "sortSomatic1",
            VcfStreamSort(vcf=self.combineRegions.out, inMemoryFlag=True),
        )

        # no need to compress this here if it leads to problems when we dont have an index for the allelic allelicPrimitves
        self.step(
            "normalizeSomatic1",
            BcfToolsNorm(
                vcf=self.sortSomatic1.out,
                reference=self.reference,
                outputType="v",
                outputFilename="normalised.vcf",
            ),
        )

        self.step(
            "allelicPrimitves",
            VcfAllelicPrimitives(
                vcf=self.normalizeSomatic1.out,
                tagParsed="DECOMPOSED",
                keepGenoFlag=True,
            ),
        )

        self.step("fixSplitLines", VcfFixUp(vcf=self.allelicPrimitves.out))

        self.step("sortSomatic2",
                  VcfStreamSort(vcf=self.fixSplitLines.out, inMemoryFlag=True))

        self.step(
            "normalizeSomatic2",
            BcfToolsNorm(
                vcf=self.sortSomatic2.out,
                reference=self.reference,
                outputType="v",
                outputFilename="normalised.vcf",
            ),
        )

        self.step("uniqueAlleles",
                  VcfUniqAlleles(vcf=self.normalizeSomatic2.out))

        self.step("sortFinal",
                  VcfStreamSort(vcf=self.uniqueAlleles.out, inMemoryFlag=True))

        self.step("uniqVcf", VcfUniq(vcf=self.sortFinal.out))

        self.step("compressFinal", BGZip(file=self.uniqVcf.out))

        self.step("indexFinal", Tabix(inp=self.compressFinal.out))

        self.output("somaticOutVcf", source=self.indexFinal)
Exemple #30
0
class BedToolsGenomeCoverageBedBase(BedToolsToolBase, ABC):
    def bind_metadata(self):

        self.metadata.contributors = ["Jiaan Yu"]
        self.metadata.dateUpdated = date(2020, 4, 1)
        self.metadata.dateCreated = date(2020, 4, 1)
        self.metadata.doi = None
        self.metadata.citation = None
        self.metadata.keywords = ["bedtools", "genomecov", "genomeCoverageBed"]
        self.metadata.documentationUrl = (
            "https://bedtools.readthedocs.io/en/latest/content/tools/genomecov.html"
        )
        self.metadata.documentation = """bedtools genomecov computes histograms (default), per-base reports (-d) and BEDGRAPH (-bg) summaries of feature coverage (e.g., aligned sequences) for a given genome. Note: 1. If using BED/GFF/VCF, the input (-i) file must be grouped by chromosome. A simple sort -k 1,1 in.bed > in.sorted.bed will suffice. Also, if using BED/GFF/VCF, one must provide a genome file via the -g argument. 2. If the input is in BAM (-ibam) format, the BAM file must be sorted by position. Using samtools sort aln.bam aln.sorted will suffice."""

    def tool(self):
        return "bedtoolsgenomeCoverageBed"

    def friendly_name(self):
        return "BEDTools: genomeCoverageBed"

    def base_command(self):
        return ["genomeCoverageBed"]

    def inputs(self):
        return [
            *self.additional_inputs,
            ToolInput(
                "inputBam",
                Bam(optional=True),
                prefix="-ibam",
                doc=
                "Input bam file. Note: BAM _must_ be sorted by position. A 'samtools sort <BAM>' should suffice.",
            ),
            ToolInput(
                "inputBed",
                File(optional=True),
                prefix="-iBed",
                doc=
                "Input bed file. Must be grouped by chromosome. A simple 'sort -k 1,1 <BED> > <BED>.sorted' will suffice.",
            ),
            ToolInput(
                "inputFile",
                File(optional=True),
                prefix="-i",
                doc="Input file, can be gff/vcf.",
            ),
            ToolInput(
                "genome",
                File(optional=True),
                prefix="-g",
                doc=
                "Genome file. The genome file should tab delimited and structured as follows: <chromName><TAB><chromSize>.",
            ),
        ]

    def outputs(self):
        return [ToolOutput("out", Stdout(TextFile))]

    additional_inputs = [
        ToolInput(
            "depth",
            Boolean(optional=True),
            prefix="-d",
            doc=
            "Report the depth at each genome position (with one-based coordinates). Default behavior is to report a histogram.",
        ),
        ToolInput(
            "depthZero",
            Boolean(optional=True),
            prefix="-dz",
            doc=
            "Report the depth at each genome position (with zero-based coordinates). Reports only non-zero positions. Default behavior is to report a histogram.",
        ),
        ToolInput(
            "BedGraphFormat",
            Boolean(optional=True),
            prefix="-bg",
            doc=
            "Report depth in BedGraph format. For details, see: genome.ucsc.edu/goldenPath/help/bedgraph.html",
        ),
        ToolInput(
            "BedGraphFormata",
            Boolean(optional=True),
            prefix="-bga",
            doc=
            "Report depth in BedGraph format, as above (-bg). However with this option, regions with zero coverage are also reported. This allows one to quickly extract all regions of a genome with 0  coverage by applying: 'grep -w 0$' to the output.",
        ),
        ToolInput(
            "split",
            Boolean(optional=True),
            prefix="-split",
            doc=
            "Treat 'split' BAM or BED12 entries as distinct BED intervals when computing coverage. For BAM files, this uses the CIGAR 'N' and 'D' operations to infer the blocks for computing coverage. For BED12 files, this uses the BlockCount, BlockStarts, and BlockEnds fields (i.e., columns 10,11,12).",
        ),
        ToolInput(
            "strand",
            String(optional=True),
            prefix="-strand",
            doc=
            "(STRING): can be + or -. Calculate coverage of intervals from a specific strand. With BED files, requires at least 6 columns (strand is column 6).",
        ),
        ToolInput(
            "pairEnd",
            Boolean(optional=True),
            prefix="-pc",
            doc=
            "Calculate coverage of pair-end fragments. Works for BAM files only",
        ),
        ToolInput(
            "fragmentSize",
            Boolean(optional=True),
            prefix="-fs",
            doc=
            "Force to use provided fragment size instead of read length. Works for BAM files only",
        ),
        ToolInput(
            "du",
            Boolean(optional=True),
            prefix="-du",
            doc=
            "Change strand af the mate read (so both reads from the same strand) useful for strand specific. Works for BAM files only",
        ),
        ToolInput(
            "fivePos",
            Boolean(optional=True),
            prefix="-5",
            doc=
            "Calculate coverage of 5' positions (instead of entire interval).",
        ),
        ToolInput(
            "threePos",
            Boolean(optional=True),
            prefix="-3",
            doc=
            "Calculate coverage of 3' positions (instead of entire interval).",
        ),
        ToolInput(
            "max",
            Int(optional=True),
            prefix="-max",
            doc=
            "Combine all positions with a depth >= max into a single bin in the histogram. Irrelevant for -d and -bedGraph",
        ),
        ToolInput(
            "scale",
            Float(optional=True),
            prefix="-scale",
            doc=
            "Scale the coverage by a constant factor. Each coverage value is multiplied by this factor before being reported. Useful for normalizing coverage by, e.g., reads per million (RPM). Default is 1.0; i.e., unscaled.",
        ),
        ToolInput(
            "trackline",
            Boolean(optional=True),
            prefix="-trackline",
            doc=
            "Adds a UCSC/Genome-Browser track line definition in the first line of the output. - See here for more details about track line definition: http://genome.ucsc.edu/goldenPath/help/bedgraph.html - NOTE: When adding a trackline definition, the output BedGraph can be easily uploaded to the Genome Browser as a custom track, BUT CAN NOT be converted into a BigWig file (w/o removing the first line).",
        ),
        ToolInput(
            "trackopts",
            String(optional=True),
            prefix="-trackopts",
            doc=
            "Writes additional track line definition parameters in the first line. - Example: -trackopts 'name=\"My Track\" visibility=2 color=255,30,30' Note the use of single-quotes if you have spaces in your parameters.",
        ),
    ]

    def tests(self):
        remote_dir = "https://swift.rc.nectar.org.au/v1/AUTH_4df6e734a509497692be237549bbe9af/janis-test-data/bioinformatics/wgsgermline_data"
        return [
            TTestCase(
                name="basic",
                input={
                    "inputBam":
                    f"{remote_dir}/NA12878-BRCA1.markduped.bam.bam",
                    "genome": f"{remote_dir}/NA12878-BRCA1.genome_file.txt",
                },
                output=TextFile.basic_test(
                    "out",
                    7432,
                    "chr17\t0\t83144233\t83257441\t0.99864",
                    220,
                    "f2007353bbd18f0a04eae9499d7c6a91",
                ),
            )
        ]