示例#1
0
 def inputs(self):
     return [
         ToolInput("vcf", CompressedVcf, position=1, localise_file=True),
         ToolInput(
             tag="csi",
             input_type=Boolean(optional=True),
             prefix="--csi",
             doc=
             "(-c) generate CSI-format index for VCF/BCF files [default]",
         ),
         ToolInput(
             tag="force",
             input_type=Boolean(optional=True),
             prefix="--force",
             doc="(-f) overwrite index if it already exists",
         ),
         ToolInput(
             tag="minShift",
             input_type=Int(optional=True),
             prefix="--min-shift",
             doc=
             "(-m) set minimal interval size for CSI indices to 2^INT [14]",
         ),
         # ToolInput(
         #     tag="outputFilename",
         #     input_type=Filename(suffix=".indexed", extension=".vcf.gz"),
         #     prefix="--output-file",
         #     doc="(-o) optional output index file name",
         # ),
         ToolInput(
             tag="tbi",
             input_type=Boolean(optional=True),
             default=True,
             prefix="--tbi",
             doc="(-t) generate TBI-format index for VCF files",
         ),
         ToolInput(
             tag="threads",
             input_type=Int(optional=True),
             default=CpuSelector(),
             prefix="--threads",
             doc="sets the number of threads [0]",
         ),
         ToolInput(
             tag="nrecords",
             input_type=Boolean(optional=True),
             prefix="--nrecords",
             doc="(-n) print number of records based on existing index file",
         ),
         ToolInput(
             tag="stats",
             input_type=Boolean(optional=True),
             prefix="--stats",
             doc="(-s) print per contig stats based on existing index file",
         ),
     ]
示例#2
0
 def test_bind_boolean_as_default(self):
     ti = ToolInput("tag",
                    Boolean(optional=True),
                    prefix="--amazing",
                    default=True)
     resp = wdl.translate_command_input(ti).get_string()
     self.assertEqual(
         '~{true="--amazing" false="" select_first([tag, true])}', resp)
 def inputs(self):
     return [
         *StarAlignerBase.additional_inputs,
         ToolInput("help", Boolean(optional=True), prefix="--help", doc="help page"),
         ToolInput(
             "runThreadN",
             Int(optional=True),
             default=CpuSelector(),
             prefix="--runThreadN",
             doc="int: number of threads to run STAR. Default: 1.",
         ),
         ToolInput(
             "genomeDir",
             Directory(optional=True),
             prefix="--genomeDir",
             doc="string: path to the directory where genome files are stored (for –runMode alignReads) or will be generated (for –runMode generateGenome). Default: ./GenomeDir",
         ),
         ToolInput(
             "readFilesIn",
             Array(FastqGz, optional=True),
             prefix="--readFilesIn",
             separator=",",
             doc="string(s): paths to files that contain input read1 (and, if needed, read2). Default: Read1,Read2.",
         ),
         ToolInput(
             "outFileNamePrefix",
             Filename(),
             prefix="--outFileNamePrefix",
             doc="string: output files name prefix (including full or relative path). Can only be defined on the command line.",
         ),
         ToolInput(
             "outSAMtype",
             Array(String(), optional=True),
             prefix="--outSAMtype",
             separator=" ",
             prefix_applies_to_all_elements=False,
             doc='strings: type of SAM/BAM output. 1st word: "BAM": outputBAMwithoutsorting, "SAM": outputSAMwithoutsorting, "None": no SAM/BAM output. 2nd,3rd: "Unsorted": standard unsorted. "SortedByCoordinate": sorted by coordinate. This option will allocate extra memory for sorting which can be specified by –limitBAMsortRAM.',
         ),
         ToolInput(
             "outSAMunmapped",
             String(optional=True),
             prefix="--outSAMunmapped",
             doc="string(s): output of unmapped reads in the SAM format",
         ),
         ToolInput(
             "outSAMattributes",
             String(optional=True),
             prefix="--outSAMattributes",
             doc="string: a string of desired SAM attributes, in the order desired for the output SAM",
         ),
         ToolInput(
             "readFilesCommand",
             String(optional=True),
             prefix="--readFilesCommand",
             doc="string(s): command line to execute for each of the input file. This command should generate FASTA or FASTQ text and send it to stdout",
         ),
     ]
示例#4
0
 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 constructor(self):

        self.input("bam", BamBai)
        self.input("reference", FastaWithDict)

        # optional
        self.input("intervals", BedTabix(optional=True))
        self.input("is_exome", Boolean(optional=True))
        self.input("manta_config", File(optional=True))
        self.input("strelka_config", File(optional=True))

        self.step(
            "manta",
            Manta_1_5_0(
                bam=self.bam,
                reference=self.reference,
                callRegions=self.intervals,
                exome=self.is_exome,
                config=self.manta_config,
            ),
        )

        self.step(
            "strelka",
            StrelkaGermline_2_9_10(
                bam=self.bam,
                reference=self.reference,
                callRegions=self.intervals,
                exome=self.is_exome,
                config=self.strelka_config,
            ),
        )

        # normalise and filter "PASS" variants
        self.step(
            "splitnormalisevcf",
            SplitMultiAllele(
                vcf=self.strelka.variants.as_type(CompressedVcf),
                reference=self.reference,
            ),
        )

        self.step(
            "filterpass",
            VcfToolsvcftoolsLatest(
                vcf=self.splitnormalisevcf.out,
                removeFileteredAll=True,
                recode=True,
                recodeINFOAll=True,
            ),
        )

        self.output("sv", source=self.manta.diploidSV)
        self.output("variants", source=self.strelka.variants)
        self.output("out", source=self.filterpass.out)
示例#6
0
 def inputs(self):
     return [
         ToolInput("file", File(optional=True)),
         ToolInput("files", Array(File(), optional=True), position=1),
         ToolInput(
             "number_output",
             Boolean(optional=True),
             prefix="-n",
             doc="Number the output lines, starting at 1.",
         ),
         ToolInput(
             "number_non_blank",
             Boolean(optional=True),
             prefix="-b",
             doc="Number the non-blank output lines, starting at 1.",
         ),
         ToolInput(
             "disable_output_buffer",
             Boolean(optional=True),
             prefix="-u",
             doc="Disable output buffering.",
         ),
         ToolInput(
             "squeeze",
             Boolean(optional=True),
             prefix="-s",
             doc=
             "Squeeze multiple adjacent empty lines, causing the output to be single spaced.",
         ),
         ToolInput(
             "display_nonprint_and_eol_chars",
             Boolean(optional=True),
             prefix="-e",
             doc=
             "Display non-printing characters (see the -v option), and display "
             "a dollar sign (`$') at the end of each line.",
         ),
         ToolInput(
             "display_nonprint_and_tab_chars",
             Boolean(optional=True),
             prefix="-t",
             doc=
             "Display non-printing characters (see the -v option), and display tab characters as `^I'.",
         ),
         ToolInput(
             "display_nonprint_chars",
             Boolean(optional=True),
             prefix="-v",
             doc=
             "Display non-printing characters so they are visible.  Control characters print as `^X' for "
             "control-X; the delete character (octal 0177) prints as `^?'.  Non-ASCII characters (with the"
             " high bit set) are printed as `M-' (for meta) followed by the character for the low 7 bits.",
         ),
     ]
示例#7
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).",
         ),
     ]
示例#8
0
 def inputs(self):
     return [
         ToolInput("inp", String(), position=1),
         ToolInput(
             "include_newline",
             Boolean(optional=True),
             prefix="-n",
             doc="Do not print the trailing newline character.  This may also be achieved by appending `\c' to "
             "the end of the string, as is done by iBCS2 compatible systems.  Note that this option as well as the "
             "effect of `\c' are implementation-defined in IEEE Std 1003.1-2001 (``POSIX.1'') as amended by "
             "Cor. 1-2002.  Applications aiming for maximum portability are strongly encouraged to use printf(1) "
             "to suppress the newline character.",
         ),
     ]
    def constructor(self):

        self.input("normalBam", CramCrai)
        self.input("tumorBam", CramCrai)

        self.input("reference", FastaFai)
        self.input("callRegions", BedTabix(optional=True))
        self.input("exome", Boolean(optional=True), default=False)
        self.input("configStrelka", File(optional=True))

        self.step(
            "manta",
            Manta(
                bam=self.normalBam,
                tumorBam=self.tumorBam,
                reference=self.reference,
                callRegions=self.callRegions,
                exome=self.exome,
            ),
        )
        self.step(
            "strelka",
            Strelka(
                indelCandidates=self.manta.candidateSmallIndels,
                normalBam=self.normalBam,
                tumorBam=self.tumorBam,
                reference=self.reference,
                callRegions=self.callRegions,
                exome=self.exome,
                config=self.configStrelka,
            ),
        )
        self.step(
            "normaliseSNVs",
            BcfToolsNorm(vcf=self.strelka.snvs, reference=self.reference),
        )
        self.step("indexSNVs", BcfToolsIndex(vcf=self.normaliseSNVs.out))

        self.step(
            "normaliseINDELs",
            BcfToolsNorm(vcf=self.strelka.indels, reference=self.reference),
        )
        self.step("indexINDELs", BcfToolsIndex(vcf=self.normaliseINDELs.out))

        self.output("diploid", source=self.manta.diploidSV)
        self.output("candIndels", source=self.manta.candidateSmallIndels)
        self.output("indels", source=self.indexINDELs.out)
        self.output("snvs", source=self.indexSNVs.out)
        self.output("somaticSVs", source=self.manta.somaticSVs)
示例#10
0
 def inputs(self):
     return [
         ToolInput("vcf", Vcf, position=3),
         ToolInput(
             "inMemoryFlag",
             Boolean(optional=True),
             prefix="-a",
             default=False,
             doc="load all sites and then sort in memory",
         ),
         ToolInput(
             "windowSize",
             Int(optional=True),
             prefix="-w",
             doc="number of sites to sort (default 10000)",
         ),
     ]
 def inputs(self):
     return [
         # it can read CompressedVcf as well, but yea unionTypes are not a thing yet
         ToolInput(tag="vcf", input_type=Vcf, prefix="-i", doc="input vcf"),
         ToolInput(
             tag="outputFilename",
             input_type=Filename(extension=".vcf"),
             prefix="-o",
             doc="output file name (default: reassembled.vcf.bgz)",
         ),
         ToolInput(
             tag="uncompressed",
             input_type=Boolean(optional=True),
             prefix="-o",
             doc="output file name (default: reassembled.vcf.bgz)",
         ),
     ]
示例#12
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",
         ),
     ]
    def constructor(self):
        self.input("normal_bam", BamBai)
        self.input("tumor_bam", BamBai)
        self.input("normal_name", String)
        self.input("tumor_name", String)
        self.input("snps_dbsnp", File)

        # optional
        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))

        self.add_snp_pileup()
        self.add_run_facets()
    def constructor(self):

        self.input("normalBam", self.getStrelka2InputType())
        self.input("tumorBam", self.getStrelka2InputType())

        self.input("reference", FastaFai)
        self.input("callRegions", BedTabix(optional=True))
        self.input("exome", Boolean(optional=True), default=False)
        self.input("configStrelka", File(optional=True))

        self.input("indelCandidates", Array(VcfTabix))
        self.input("strelkaSNVs", Array(VcfTabix))
        # self.input("strelkaIndels", Array(VcfTabix))

        self.step(
            "strelka2pass",
            self.getStrelka2Tool()(
                indelCandidates=self.indelCandidates,
                # indelCandidates=self.strelkaIndels,
                forcedgt=self.strelkaSNVs,
                normalBam=self.normalBam,
                tumorBam=self.tumorBam,
                reference=self.reference,
                callRegions=self.callRegions,
                exome=self.exome,
                config=self.configStrelka,
            ),
        )
        self.step(
            "normaliseSNVs",
            BcfToolsNorm(vcf=self.strelka2pass.snvs, reference=self.reference),
        )
        self.step("indexSNVs", BcfToolsIndex(vcf=self.normaliseSNVs.out))

        self.step(
            "normaliseINDELs",
            BcfToolsNorm(vcf=self.strelka2pass.indels,
                         reference=self.reference),
        )
        self.step("indexINDELs", BcfToolsIndex(vcf=self.normaliseINDELs.out))

        self.output("indels", source=self.indexINDELs.out)
        self.output("snvs", source=self.indexSNVs.out)
示例#15
0
    def constructor(self):

        self.input("bam", BamBai)
        self.input("reference", FastaWithDict)
        self.input("intervals", BedTabix(optional=True))
        self.input("is_exome", Boolean(optional=True))

        self.step(
            "manta",
            Manta_1_5_0(
                bam=self.bam,
                reference=self.reference,
                callRegions=self.intervals,
                exome=self.is_exome,
            ),
        )

        self.step(
            "strelka",
            StrelkaGermline_2_9_10(
                bam=self.bam,
                reference=self.reference,
                indelCandidates=self.manta.candidateSmallIndels,
                callRegions=self.intervals,
                exome=self.is_exome,
            ),
        )

        self.step(
            "bcfview",
            BcfToolsView_1_5(file=self.strelka.variants,
                             applyFilters=["PASS"]),
        )

        self.step(
            "split_multi_allele",
            SplitMultiAllele(vcf=self.bcfview.out, reference=self.reference),
        )

        self.output("diploid", source=self.manta.diploidSV)
        self.output("variants", source=self.strelka.variants)
        self.output("out", source=self.split_multi_allele.out)
 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))
示例#17
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",
                ),
            )
        ]
示例#18
0
 def inputs(self):
     return [
         ToolInput(
             "index",
             KallistoIdx,
             prefix="-i",
             position=2,
             doc="Filename for the kallisto index to be constructed",
         ),
         ToolInput(
             "outdir",
             Filename,
             prefix="-o",
             position=3,
             doc="directory to put outputs in",
         ),
         ToolInput("fastq",
                   Array(Fastq),
                   position=4,
                   doc="FASTQ files to process"),
         ToolInput(
             "bias",
             Boolean(optional=True),
             prefix="--bias",
             doc="Perform sequence based bias correction",
         ),
         ToolInput(
             "fusion",
             Boolean(optional=True),
             prefix="--fusion",
             doc="Search for fusions for Pizzly",
         ),
         ToolInput(
             "single",
             Boolean(optional=True),
             prefix="--single",
             doc="Quantify single-end reads",
         ),
         ToolInput(
             "overhang",
             Boolean(optional=True),
             prefix="--single-overhang",
             doc=
             "Include reads where unobserved rest of fragment is predicted to lie outside a transcript",
         ),
         ToolInput(
             "fr_stranded",
             Boolean(optional=True),
             prefix="--fr-stranded",
             doc="Strand specific reads, first read forward",
         ),
         ToolInput(
             "rf_stranded",
             Boolean(optional=True),
             prefix="--rf-stranded",
             doc="Strand specific reads, first read reverse",
         ),
         ToolInput(
             "fragment_length",
             Double(optional=True),
             prefix="-l",
             doc="Estimated average fragment length",
         ),
         ToolInput(
             "fragment_sd",
             Double(optional=True),
             prefix="-s",
             doc="Estimated standard deviation of fragment length",
         ),
     ]
示例#19
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",
        ),
    ]
示例#20
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""",
            ),
        ]
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 """
示例#22
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,
                ),
            )
        ]
示例#23
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",
        ),
    ]
示例#24
0
 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"
             ),
         ),
     ]
示例#25
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]",
        ),
    ]
示例#26
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)),
        ]
示例#27
0
 def test_bind_boolean_as_default(self):
     ti = ToolInput("tag", Boolean(optional=True), prefix="--amazing", default=True)
     resp = wdl.translate_command_input(ti, None).get_string()
     self.assertEqual(
         '${true="--amazing" false="" if defined(tag) then tag else true}', resp
     )
示例#28
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",
        ),
    ]
示例#29
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",
        ),
    ]
示例#30
0
 def inputs(self):
     return [
         ToolInput(
             "vcf",
             Vcf,
             position=1,
             doc="VCF to filter",
         ),
         ToolInput(
             tag="info_filter",
             input_type=String(optional=True),
             prefix="--info-filter",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-f) specifies a filter to apply to the info fields of records, "
                 "removes alleles which do not pass the filter"),
         ),
         ToolInput(
             tag="genotype_filter",
             input_type=String(optional=True),
             prefix="--genotype-filter",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-g) specifies a filter to apply to the genotype fields of records"
             ),
         ),
         ToolInput(
             tag="keep_info",
             input_type=Boolean(optional=True),
             prefix="--keep-info",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-k) used in conjunction with '-g', keeps variant info, but removes genotype"
             ),
         ),
         ToolInput(
             tag="filter_sites",
             input_type=Boolean(optional=True),
             prefix="--filter-sites",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc="(-s) filter entire records, not just alleles"),
         ),
         ToolInput(
             tag="tag_pass",
             input_type=String(optional=True),
             prefix="--tag-pass",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-t) tag vcf records as positively filtered with this tag, print all records"
             ),
         ),
         ToolInput(
             tag="tag_fail",
             input_type=String(optional=True),
             prefix="--tag-fail",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-F) tag vcf records as negatively filtered with this tag, print all records"
             ),
         ),
         ToolInput(
             tag="append_filter",
             input_type=Boolean(optional=True),
             prefix="--append-filter",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-A) append the existing filter tag, don't just replace it"
             ),
         ),
         ToolInput(
             tag="allele_tag",
             input_type=String(optional=True),
             prefix="--allele-tag",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-a) apply -t on a per-allele basis. adds or sets the corresponding INFO field tag"
             ),
         ),
         ToolInput(
             tag="invert",
             input_type=Boolean(optional=True),
             prefix="--invert",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc="(-v) inverts the filter, e.g. grep -v"),
         ),
         ToolInput(
             tag="use_logical_or",
             input_type=Boolean(optional=True),
             prefix="--or",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc="(-o) use logical OR instead of AND to combine filters"
             ),
         ),
         ToolInput(
             tag="region",
             input_type=Array(BedTabix, optional=True),
             prefix="--region",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-r) specify a region on which to target the filtering, requires a BGZF compressed file "
                 "which has been indexed with tabix.  any number of regions may be specified."
             ),
         ),
     ]