示例#1
0
 def inputs(self):
     return [
         # ToolInput(tag="version", input_type=Boolean(), prefix="--version", separate_value_from_prefix=True,
         #           doc="show program's version number and exit"),
         # ToolInput(tag="help", input_type=Boolean(), prefix="--help", separate_value_from_prefix=True,
         #           doc="(-h) show this help message and exit"),
         # ToolInput(tag="allhelp", input_type=Boolean(), prefix="--allHelp", separate_value_from_prefix=True,
         #           doc="show all extended/hidden options"),
         ToolInput(
             tag="normalBam",
             input_type=BamBai(),
             prefix="--normalBam=",
             separate_value_from_prefix=False,
             position=1,
             doc="Normal sample BAM or CRAM file. (no default)",
         ),
         ToolInput(
             tag="tumorBam",
             input_type=BamBai(),
             prefix="--tumourBam=",
             separate_value_from_prefix=False,
             position=1,
             doc=
             "(--tumorBam)  Tumor sample BAM or CRAM file. [required] (no default)",
         ),
         ToolInput(
             tag="reference",
             input_type=FastaWithDict(),
             prefix="--referenceFasta=",
             position=1,
             separate_value_from_prefix=False,
             doc=" samtools-indexed reference fasta file [required]",
         ),
         ToolInput(
             tag="rundir",
             input_type=Filename(),
             prefix="--runDir=",
             separate_value_from_prefix=False,
             position=1,
             doc=
             "Name of directory to be created where all workflow scripts and output will be written. "
             "Each analysis requires a separate directory. (default: StrelkaSomaticWorkflow)",
         ),
         ToolInput(
             tag="region",
             input_type=Array(String, optional=True),
             prefix="--region",
             prefix_applies_to_all_elements=True,
             position=1,
             doc=
             "Limit the analysis to one or more genome region(s) for debugging purposes. If this argument "
             "is provided multiple times the union of all specified regions will be analyzed. All regions "
             "must be non-overlapping to get a meaningful result. Examples: '--region chr20' "
             "(whole chromosome), '--region chr2:100-2000 --region chr3:2500-3000' (two regions)'. "
             "If this option is specified (one or more times) together with the 'callRegions' BED file,"
             "then all region arguments will be intersected with the callRegions BED track.",
         ),
         ToolInput(
             tag="config",
             input_type=File(optional=True),
             prefix="--config=",
             separate_value_from_prefix=False,
             position=1,
             doc=
             "provide a configuration file to override defaults in global config file "
             "(/opt/strelka/bin/configureStrelkaSomaticWorkflow.py.ini)",
         ),
         ToolInput(
             tag="outputcallableregions",
             input_type=Boolean(optional=True),
             prefix="--outputCallableRegions",
             position=1,
             separate_value_from_prefix=True,
             doc=
             "Output a bed file describing somatic callable regions of the genome",
         ),
         ToolInput(
             tag="indelCandidates",
             input_type=Array(VcfTabix, optional=True),
             prefix="--indelCandidates=",
             prefix_applies_to_all_elements=True,
             position=1,
             separate_value_from_prefix=False,
             doc=
             "Specify a VCF of candidate indel alleles. These alleles are always evaluated "
             "but only reported in the output when they are inferred to exist in the sample. "
             "The VCF must be tabix indexed. All indel alleles must be left-shifted/normalized, "
             "any unnormalized alleles will be ignored. This option may be specified more than once, "
             "multiple input VCFs will be merged. (default: None)",
         ),
         ToolInput(
             tag="forcedgt",
             input_type=Array(VcfTabix, optional=True),
             prefix="--forcedGT=",
             separate_value_from_prefix=False,
             prefix_applies_to_all_elements=True,
             position=1,
             doc=
             "Specify a VCF of candidate alleles. These alleles are always evaluated and reported even "
             "if they are unlikely to exist in the sample. The VCF must be tabix indexed. All indel "
             "alleles must be left- shifted/normalized, any unnormalized allele will trigger a runtime "
             "error. This option may be specified more than once, multiple input VCFs will be merged. "
             "Note that for any SNVs provided in the VCF, the SNV site will be reported (and for gVCF, "
             "excluded from block compression), but the specific SNV alleles are ignored. (default: None)",
         ),
         ToolInput(
             tag="targeted",
             input_type=Boolean(optional=True),
             prefix="--targeted",
             separate_value_from_prefix=True,
             position=1,
             doc="Set options for other targeted input: "
             "note in particular that this flag turns off high-depth filters",
         ),
         ToolInput(
             tag="exome",
             input_type=Boolean(optional=True),
             prefix="--exome",
             separate_value_from_prefix=True,
             position=1,
             doc=
             "Set options for exome: note in particular that this flag turns off high-depth filters",
         ),
         ToolInput(
             tag="callRegions",
             input_type=BedTabix(optional=True),
             prefix="--callRegions=",
             separate_value_from_prefix=False,
             position=1,
             doc=
             "Optionally provide a bgzip-compressed/tabix-indexed BED file containing the set of "
             "regions to call. No VCF output will be provided outside of these regions. "
             "The full genome will still be used to estimate statistics from the input "
             "(such as expected depth per chromosome). Only one BED file may be specified. "
             "(default: call the entire genome)",
         ),
         ToolInput(
             tag="noisevcf",
             input_type=VcfTabix(optional=True),
             prefix="--noiseVcf=",
             separate_value_from_prefix=False,
             position=1,
             doc=
             "Noise vcf file (submit argument multiple times for more than one file)",
         ),
         ToolInput(
             tag="scansizemb",
             input_type=Int(optional=True),
             prefix="--scanSizeMb=",
             separate_value_from_prefix=False,
             position=1,
             doc=
             "Maximum sequence region size (in megabases) scanned by each "
             "task during genome variant calling. (default: 12)",
         ),
         ToolInput(
             tag="callmemmb",
             input_type=Int(optional=True),
             prefix="--callMemMb=",
             position=1,
             separate_value_from_prefix=False,
             doc=
             "Set variant calling task memory limit (in megabytes). It is not recommended to change the "
             "default in most cases, but this might be required for a sample of unusual depth.",
         ),
         ToolInput(
             tag="retaintempfiles",
             input_type=Boolean(optional=True),
             default=False,
             position=1,
             prefix="--retainTempFiles",
             separate_value_from_prefix=True,
             doc="Keep all temporary files (for workflow debugging)",
         ),
         ToolInput(
             tag="disableevs",
             input_type=Boolean(optional=True),
             prefix="--disableEVS",
             position=1,
             separate_value_from_prefix=True,
             doc="Disable empirical variant scoring (EVS).",
         ),
         ToolInput(
             tag="reportevsfeatures",
             input_type=Boolean(optional=True),
             prefix="--reportEVSFeatures",
             position=1,
             separate_value_from_prefix=True,
             doc=
             " Report all empirical variant scoring features in VCF output.",
         ),
         ToolInput(
             tag="snvscoringmodelfile",
             input_type=File(optional=True),
             prefix="--snvScoringModelFile=",
             position=1,
             separate_value_from_prefix=False,
             doc=" Provide a custom empirical scoring model file for SNVs "
             "(default: /opt/strelka/share/config/somaticSNVScoringM odels.json)",
         ),
         ToolInput(
             tag="indelscoringmodelfile",
             input_type=File(optional=True),
             prefix="--indelScoringModelFile=",
             position=1,
             separate_value_from_prefix=False,
             doc=" Provide a custom empirical scoring model file for indels "
             "(default: /opt/strelka/share/config/somaticInde lScoringModels.json)",
         ),
         ToolInput(
             "mode",
             String(optional=True),
             default="local",
             prefix="--mode",
             position=3,
             shell_quote=False,
             doc="(-m MODE)  select run mode (local|sge)",
         ),
         ToolInput(
             "queue",
             String(optional=True),
             prefix="--queue",
             position=3,
             shell_quote=False,
             doc="(-q QUEUE) specify scheduler queue name",
         ),
         ToolInput(
             "memGb",
             String(optional=True),
             prefix="--memGb",
             position=3,
             shell_quote=False,
             doc=" (-g MEMGB) gigabytes of memory available to run workflow "
             "-- only meaningful in local mode, must be an integer (default: Estimate the total "
             "memory for this node for local mode, 'unlimited' for sge mode)",
         ),
         ToolInput(
             "quiet",
             Boolean(optional=True),
             prefix="--quiet",
             position=3,
             shell_quote=False,
             doc="Don't write any log output to stderr "
             "(but still write to workspace/pyflow.data/logs/pyflow_log.txt)",
         ),
         # ToolInput("mailTo", String(optional=True), prefix="--mailTo", position=3, shell_quote=False,
         #           doc="(-e) send email notification of job completion status to this address "
         #               "(may be provided multiple times for more than one email address)"),
     ]
示例#2
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."
             ),
         ),
     ]
示例#3
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""",
            ),
        ]
示例#4
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]",
        ),
    ]
示例#5
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",
        ),
    ]
示例#6
0
class BedToolsGenomeCoverageBedBase(BedToolsToolBase, ABC):
    def bind_metadata(self):

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

    def tool(self):
        return "bedtoolsgenomeCoverageBed"

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

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

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

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

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

    def tests(self):
        remote_dir = "https://swift.rc.nectar.org.au/v1/AUTH_4df6e734a509497692be237549bbe9af/janis-test-data/bioinformatics/wgsgermline_data"
        return [
            TTestCase(
                name="basic",
                input={
                    "inputBam":
                    f"{remote_dir}/NA12878-BRCA1.markduped.bam.bam",
                    "genome": f"{remote_dir}/NA12878-BRCA1.genome_file.txt",
                },
                output=TextFile.basic_test(
                    "out",
                    7432,
                    "chr17\t0\t83144233\t83257441\t0.99864",
                    220,
                    "f2007353bbd18f0a04eae9499d7c6a91",
                ),
            )
        ]
示例#7
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
     )
示例#8
0
 def inputs(self):
     return [
         # ToolInput(
         #     tag="help",
         #     input_type=Boolean(optional=True),
         #     prefix="--help",
         #     separate_value_from_prefix=True,
         #     doc=InputDocumentation(doc="(-h) show this help message and exit"),
         # ),
         ToolInput(
             tag="samples",
             input_type=Csv(),
             prefix="-samples",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-s)  Path to samples (rows) x genes (columns) csv file representing a raw counts matrix. Note: hg19 only supported currently, use other references at own risk."
             ),
         ),
         ToolInput(
             tag="labels",
             input_type=Csv(optional=True),
             prefix="-labels",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-l)  (Optional) Path to samples true labels. CSV with samples (rows) x [sample id, label] (cols). This will enable re-labelling mode. Note: labels must reflect naming conventions used within this tool. View the ALLSorts GitHub Wiki for further details."
             ),
         ),
         ToolInput(
             tag="destination",
             input_type=String(optional=True),
             prefix="-destination",
             default=".",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-d)  Path to where you want the final report to be saved."
             ),
         ),
         # ToolInput(
         #     tag="test",
         #     input_type=Boolean(optional=True),
         #     prefix="-test",
         #     separate_value_from_prefix=True,
         #     doc=InputDocumentation(
         #         doc="(-t) Test will run a simple logistic regression."
         #     ),
         # ),
         # ToolInput(
         #     tag="train",
         #     input_type=Boolean(optional=True),
         #     prefix="-train",
         #     separate_value_from_prefix=True,
         #     doc=InputDocumentation(
         #         doc="Train a new model. -labels/-l and -samples/-s must be set."
         #     ),
         # ),
         # ToolInput(
         #     tag="model_dir",
         #     input_type=Boolean(optional=True),
         #     prefix="-model_dir",
         #     separate_value_from_prefix=True,
         #     doc=InputDocumentation(
         #         doc="Directory for a new model. -train -t flag must be set."
         #     ),
         # ),
         # ToolInput(
         #     tag="njobs",
         #     input_type=Boolean(optional=True),
         #     prefix="-njobs",
         #     separate_value_from_prefix=True,
         #     doc=InputDocumentation(
         #         doc="(-j)  (int, default=1) Will set n_jobs for all Sklearn estimators/transformers."
         #     ),
         # ),
         # ToolInput(
         #     tag="cv",
         #     input_type=Boolean(optional=True),
         #     prefix="-cv",
         #     separate_value_from_prefix=True,
         #     doc=InputDocumentation(
         #         doc="(int, default=3) If training, how many folds in the cross validation?"
         #     ),
         # ),
         ToolInput(
             tag="verbose",
             input_type=Boolean(optional=True),
             prefix="-verbose",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-v) (flag, default=False) Verbose. Print stage progress."
             ),
         ),
         ToolInput(
             tag="comparison",
             input_type=Boolean(optional=True),
             prefix="-comparison",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc="Rebuild comparisons for labelled visualisations."),
         ),
         ToolInput(
             tag="force",
             input_type=Boolean(optional=True),
             prefix="-force",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-f) (flag, default=False) Force. Bypass warnings without user confirmation."
             ),
         ),
         ToolInput(
             tag="parents",
             input_type=Boolean(optional=True),
             prefix="-parents",
             separate_value_from_prefix=True,
             doc=InputDocumentation(
                 doc=
                 "(-p) Include parent meta-subtypes in predictions. Note: This may remove previously unclassified samples."
             ),
         ),
     ]
示例#9
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(
            "batchSize",
            Int(optional=True),
            prefix="-K",
            position=2,
            shell_quote=False,
            doc=
            "Process INT input bases in each batch regardless of the number of threads in use [10000000*nThreads]. "
            "By default, the batch size is proportional to the number of threads in use. Because the inferred "
            "insert size distribution slightly depends on the batch size, using different number of threads "
            "may produce different output. Specifying this option helps reproducibility.",
        ),
        ToolInput(
            "useSoftClippingForSupplementaryAlignments",
            Boolean(optional=True),
            prefix="-Y",
            position=2,
            shell_quote=False,
            doc=
            "Use soft clipping CIGAR operation for supplementary alignments. By default, BWA-MEM uses soft "
            "clipping for the primary alignment and hard clipping for supplementary alignments.",
        ),
        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",
        ),
    ]
示例#10
0
 def inputs(self) -> List[ToolInput]:
     return [
         ToolInput(
             "outputFilename",
             Filename(extension=".vcf"),
             prefix="OUTPUT=",
             separate_value_from_prefix=False,
             doc="(O=) VCF structural variation calls. Required.",
         ),
         ToolInput(
             "reference",
             FastaWithDict(),
             prefix="REFERENCE_SEQUENCE=",
             separate_value_from_prefix=False,
         ),
         ToolInput(
             "bams",
             Array(BamBai()),
             prefix="INPUT=",
             separate_value_from_prefix=False,
             prefix_applies_to_all_elements=True,
             doc=
             "(I=File Coordinate-sorted input BAM file. Default value: null. "
             "This option may be specified 0 or more times.",
         ),
         ToolInput(
             "assemblyFilename",
             Filename(suffix=".assembled", extension=".bam"),
             prefix="ASSEMBLY=",
             separate_value_from_prefix=False,
             doc=
             "Breakend assemblies which have undergone split read identification Required.",
         ),
         ToolInput(
             "inputLabel",
             String(optional=True),
             prefix="INPUT_LABEL=",
             separate_value_from_prefix=False,
             doc=
             "Input label. Variant calling evidence breakdowns are reported for each label. Default "
             "labels correspond to INPUT filenames. When specifying labels, labels must be provided for "
             "all input files. Default value: null. This option may be specified 0 or more times.",
         ),
         ToolInput(
             "inputMaxFragmentSize",
             Int(optional=True),
             prefix="INPUT_MAX_FRAGMENT_SIZE=",
             separate_value_from_prefix=False,
             doc=
             "Per input maximum concordant fragment size. Default value: null. "
             "This option may be specified 0 or more times.",
         ),
         ToolInput(
             "inputMinFragmentSize",
             Int(optional=True),
             prefix="INPUT_MIN_FRAGMENT_SIZE=",
             separate_value_from_prefix=False,
             doc=
             "Per input minimum concordant fragment size. Default value: null. "
             "This option may be specified 0 or more times.",
         ),
         ToolInput(
             "readPairConcordantPercent",
             Float(optional=True),
             prefix="READ_PAIR_CONCORDANT_PERCENT=",
             separate_value_from_prefix=False,
             doc=
             "Percent of read pairs considered concorant (0.0-1.0). If this is unset, the SAM proper "
             "pair flag is used to determine whether a read is discordantly aligned. Explicit fragment "
             "size specification overrides this setting. Default value: 0.995. "
             "This option can be set to 'null' to clear the default value.",
         ),
         ToolInput(
             "blacklist",
             Bed(optional=True),
             prefix="BLACKLIST=",
             separate_value_from_prefix=False,
             doc=
             "(BL=File) BED blacklist of regions to ignore. Assembly of regions such as high-coverage "
             "centromeric repeats is slow, and if such regions are to be filtered in downstream "
             "analysis anyway, blacklisting those region will improve runtime performance. "
             "For human WGS, the ENCODE DAC blacklist is recommended. Default value: null.",
         ),
         ToolInput(
             "configurationFile",
             File(optional=True),
             prefix="CONFIGURATION_FILE=",
             separate_value_from_prefix=False,
             doc=
             "(C=File) gridss configuration file containing overrides Default value: null.",
         ),
         ToolInput(
             "workerThreads",
             Int(optional=True),
             prefix="WORKER_THREADS=",
             separate_value_from_prefix=False,
             doc=
             "(THREADS=Integer  Number of worker threads to spawn. Defaults to number of cores available. "
             "Note that I/O threads are not included in this worker thread count so CPU usage can be "
             "higher than the number of worker thread. Default value: 6. "
             "This option can be set to 'null' to clear the default value.",
         ),
         ToolInput(
             "workingDir",
             String(optional=True),
             prefix="WORKING_DIR=",
             default=".",
             separate_value_from_prefix=False,
             doc=
             "Directory to place intermediate results directories. Default location is the same "
             "directory as the associated input or output file. Default value: null.",
         ),
         ToolInput(
             "ignoreDuplicates",
             Boolean(optional=True),
             prefix="IGNORE_DUPLICATES=",
             separate_value_from_prefix=False,
             doc=
             "Ignore reads marked as duplicates. Default value: true. This option can be set to 'null' "
             "to clear the default value. Possible values: {true, false}",
         ),
     ]
示例#11
0
class FastQCBase(BioinformaticsTool, ABC):
    def friendly_name(self) -> str:
        return "FastQC"

    def tool(self):
        return "fastqc"

    def base_command(self):
        return "fastqc"

    def tool_provider(self):
        return "FastQC"

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

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

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

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

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

    additional_inputs = [
        ToolInput(
            "outdir",
            String(optional=True),
            default=".",
            prefix="--outdir",
            doc="(-o) Create all output files in the specified output directory. Please note that this "
            "directory must exist as the program will not create it.  If this option is not set then "
            "the output file for each sequence file is created in the same directory as the sequence "
            "file which was processed.",
        ),
        ToolInput(
            "casava",
            Boolean(optional=True),
            prefix="--casava",
            doc="Files come from raw casava output. Files in the same sample group "
            "(differing only by the group number) will be analysed as a set rather than individually. "
            "Sequences with the filter flag set in the header will be excluded from the analysis. "
            "Files must have the same names given to them by casava (including being gzipped and "
            "ending with .gz) otherwise they won't be grouped together correctly.",
        ),
        ToolInput(
            "nano",
            Boolean(optional=True),
            prefix="--nano",
            doc="Files come from naopore sequences and are in fast5 format. In this mode you can pass in "
            "directories to process and the program will take in all fast5 files within those "
            "directories and produce a single output file from the sequences found in all files.",
        ),
        ToolInput(
            "nofilter",
            Boolean(optional=True),
            prefix="--nofilter",
            doc="If running with --casava then don't remove read flagged by casava as poor quality when "
            "performing the QC analysis.",
        ),
        ToolInput(
            "extract",
            Boolean(optional=True),
            prefix="--extract",
            default=True,
            doc="If set then the zipped output file will be uncompressed in the same directory after it has "
            "been created.  By default this option will be set if fastqc is run in non-interactive mode.",
        ),
        ToolInput(
            "java",
            String(optional=True),
            prefix="--java",
            doc="(-j) Provides the full path to the java binary you want to use to launch fastqc. "
            "If not supplied then java is assumed to be in your path.",
        ),
        ToolInput(
            "noextract",
            Boolean(optional=True),
            prefix="--noextract",
            doc="Do not uncompress the output file after creating it.  You should set this option if you do"
            "not wish to uncompress the output when running in non-interactive mode. ",
        ),
        ToolInput(
            "nogroup",
            Boolean(optional=True),
            prefix="--nogroup",
            doc="Disable grouping of bases for reads >50bp. "
            "All reports will show data for every base in the read. "
            "WARNING: Using this option will cause fastqc to crash and burn if you use it on "
            "really long reads, and your plots may end up a ridiculous size. You have been warned! ",
        ),
        ToolInput(
            "format",
            String(optional=True),
            prefix="--format",
            doc="(-f) Bypasses the normal sequence file format detection and forces the program to use the "
            "specified format.  Valid formats are bam,sam,bam_mapped,sam_mapped and fastq ",
        ),
        ToolInput(
            "threads",
            Int(optional=True),
            prefix="--threads",
            default=CpuSelector(),
            doc="(-t) Specifies the number of files which can be processed simultaneously. "
            "Each thread will be allocated 250MB of memory so you shouldn't run more threads than your "
            "available memory will cope with, and not more than 6 threads on a 32 bit machine",
        ),
        ToolInput(
            "contaminants",
            File(optional=True),
            prefix="--contaminants",
            doc="(-c) Specifies a non-default file which contains the list of contaminants to screen "
            "overrepresented sequences against. The file must contain sets of named contaminants in "
            "the form name[tab]sequence.  Lines prefixed with a hash will be ignored.",
        ),
        ToolInput(
            "adapters",
            File(optional=True),
            prefix="--adapters",
            doc="(-a) Specifies a non-default file which contains the list of adapter sequences which will "
            "be explicity searched against the library. The file must contain sets of named adapters in "
            "the form name[tab]sequence. Lines prefixed with a hash will be ignored.",
        ),
        ToolInput(
            "limits",
            File(optional=True),
            prefix="--limits",
            doc="(-l) Specifies a non-default file which contains a set of criteria which will be used to "
            "determine the warn/error limits for the various modules.  This file can also be used to "
            "selectively  remove some modules from the output all together. "
            "The format needs to mirror the default limits.txt file found in the Configuration folder.",
        ),
        ToolInput(
            "kmers",
            Int(optional=True),
            prefix="--kmers",
            doc="(-k) Specifies the length of Kmer to look for in the Kmer content module. "
            "Specified Kmer length must be between 2 and 10. Default length is 7 if not specified. ",
        ),
        ToolInput(
            "quiet",
            Boolean(optional=True),
            prefix="--quiet",
            doc="(-q) Supress all progress messages on stdout and only report errors.",
        ),
        ToolInput(
            "dir",
            String(optional=True),
            prefix="--dir",
            doc="(-d) Selects a directory to be used for temporary files written when generating report images."
            "Defaults to system temp directory if not specified.",
        ),
    ]
示例#12
0
    def constructor(self):

        self.input("normalBam", CramCrai)
        self.input("tumorBams", Array(CramCrai))

        self.input("reference", FastaFai)

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

        self.input("sampleNames", Array(String, optional=True))
        self.input("minAD", Int(optional=True), default=2)

        self.step(
            "step1",
            Strelka2PassWorkflowStep1(
                normalBam=self.normalBam,
                tumorBam=self.tumorBams,
                reference=self.reference,
                callRegions=self.callRegions,
                exome=self.exome,
                configStrelka=self.configStrelka,
            ),
            scatter="tumorBam",
        )

        self.step(
            "step2",
            Strelka2PassWorkflowStep2(
                normalBam=self.normalBam,
                tumorBam=self.tumorBams,
                reference=self.reference,
                callRegions=self.callRegions,
                strelkaSNVs=self.step1.snvs,
                indelCandidates=self.step1.candIndels,
                # as soon as janis allows flattening of arguments, we need this
                # indelCandidates=self.step1.indels,
                exome=self.exome,
                configStrelka=self.configStrelka,
            ),
            scatter="tumorBam",
        )

        self.step(
            "refilterSNVs",
            RefilterStrelka2Calls(
                inputFiles=self.step2.snvs,
                sampleNames=self.sampleNames,
                minAD=self.minAD,
            ),
        )
        self.step("compressSNVs",
                  BGZip(file=self.refilterSNVs.out),
                  scatter="file")
        self.step("indexSNVs", Tabix(inp=self.compressSNVs.out), scatter="inp")

        self.step(
            "refilterINDELs",
            RefilterStrelka2Calls(
                inputFiles=self.step2.indels,
                sampleNames=self.sampleNames,
                minAD=self.minAD,
            ),
        )
        self.step("compressINDELs",
                  BGZip(file=self.refilterINDELs.out),
                  scatter="file")
        self.step("indexINDELs",
                  Tabix(inp=self.compressINDELs.out),
                  scatter="inp")

        self.output(
            "snvs",
            Array(VcfTabix),
            source=self.indexSNVs,
            output_folder=self.sampleNames,
        )
        self.output(
            "indels",
            Array(VcfTabix),
            source=self.indexINDELs,
            output_folder=self.sampleNames,
        )

        # optional output from manta, but we know it will be created
        self.output("svs",
                    source=self.step1.somaticSVs,
                    output_folder=self.sampleNames)
示例#13
0
class Gatk4FastqToSamBase(Gatk4ToolBase, ABC):
    @classmethod
    def gatk_command(cls):
        return "FastqToSam"

    def tool(self):
        return "Gatk4FastqToSam"

    def friendly_name(self):
        return "GATK4: Convert a FASTQ file to an unaligned BAM or SAM 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(
                "fastqR1",
                FastqGz(),
                prefix="--FASTQ",
                prefix_applies_to_all_elements=True,
                doc="Input fastq file (optionally gzipped) for single end data, or first read in paired end data.",
                position=10,
            ),
            ToolInput(
                "fastqR2",
                FastqGz(optional=True),
                prefix="--FASTQ2",
                prefix_applies_to_all_elements=True,
                doc="Input fastq file (optionally gzipped) for single end data, or first read in paired end data.",
                position=10,
            ),
            ToolInput(
                "sampleName",
                String(optional=True),
                prefix="--SAMPLE_NAME",
                prefix_applies_to_all_elements=True,
                doc="Input fastq file (optionally gzipped) for single end data, or first read in paired end 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(2020, 2, 26),
            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/360037226792-FastqToSam-Picard-",
            documentation="Converts a FASTQ file to an unaligned BAM or SAM file.",
        )

    additional_args = [
        ToolInput(
            "allowAndIgnoreEmptyLines",
            Boolean(optional=True),
            prefix="--ALLOW_AND_IGNORE_EMPTY_LINES",
            position=11,
            doc="Allow (and ignore) empty lines",
        ),
        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(
            "comment",
            Array(String(), optional=True),
            prefix="--COMMENT",
            position=11,
            doc="Comment(s) to include in the merged output file's header.",
        ),
        ToolInput(
            "description",
            Array(String(), optional=True),
            prefix="--DESCRIPTION",
            position=11,
            doc="Inserted into the read group header",
        ),
        ToolInput(
            "libraryName",
            Array(String(), optional=True),
            prefix="--LIBRARY_NAME",
            position=11,
            doc="The library name to place into the LB attribute in the read group header",
        ),
        ToolInput(
            "maxQ",
            Int(optional=True),
            prefix="--MAX_Q",
            position=11,
            doc="Maximum quality allowed in the input fastq. An exception will be thrown if a quality is greater than this value.",
        ),
        ToolInput(
            "minQ",
            Int(optional=True),
            prefix="--MIN_Q",
            position=11,
            doc="Minimum quality allowed in the input fastq. An exception will be thrown if a quality is less than this value.",
        ),
        ToolInput(
            "platform",
            String(optional=True),
            prefix="--PLATFORM",
            position=11,
            doc="The platform type (e.g. ILLUMINA, SOLID) to insert into the read group header.",
        ),
        ToolInput(
            "platformModel",
            String(optional=True),
            prefix="--PLATFORM_MODEL",
            position=11,
            doc="Platform model to insert into the group header (free-form text providing further details of the platform/technology used).",
        ),
        ToolInput(
            "platformUnit",
            String(optional=True),
            prefix="--PLATFORM_UNIT",
            position=11,
            doc="The expected orientation of proper read pairs.",
        ),
        ToolInput(
            "predictedInsertSize",
            Int(optional=True),
            prefix="--PREDICTED_INSERT_SIZE",
            position=11,
            doc="Predicted median insert size, to insert into the read group header.",
        ),
        ToolInput(
            "programGroup",
            String(optional=True),
            prefix="--PROGRAM_GROUP",
            position=11,
            doc="Program group to insert into the read group header.",
        ),
        ToolInput(
            "readGroupName",
            String(optional=True),
            prefix="--READ_GROUP_NAME",
            position=11,
            doc="Read group name.",
        ),
        ToolInput(
            "runDate",
            String(optional=True),
            prefix="--RUN_DATE",
            position=11,
            doc="Date the run was produced, to insert into the read group header",
        ),
        ToolInput(
            "sequencingCenter",
            String(optional=True),
            prefix="--SEQUENCING_CENTER",
            position=11,
            doc="The sequencing center from which the data originated.",
        ),
        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(
            "useSequenctialFastqs",
            Boolean(optional=True),
            prefix="--USE_SEQUENTIAL_FASTQS",
            position=11,
            doc="Use sequential fastq files with the suffix _###.fastq or _###.fastq.gz.",
        ),
        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]",
        ),
    ]
示例#14
0
class featureCountsBase(SubreadToolBase, ABC):
    def tool(self):
        return "featureCounts"

    @classmethod
    def subread_command(cls):
        return "featureCounts"

    def inputs(self):
        return [
            *self.additional_inputs,
            ToolInput(
                "bam",
                Array(Bam),
                position=10,
                doc=
                "A list of SAM or BAM format files. They can be either name or location sorted. If no files provided, <stdin> input is expected. Location-sorted paired-end reads are automatically sorted by read names.",
            ),
            ToolInput(
                "outputFilename",
                Filename(extension=".txt"),
                prefix="-o",
                doc=
                "Name of output file including read counts. A separate file including summary statistics of counting results is also included in the output ('<string>.summary'). Both files are in tab delimited format.",
            ),
            ToolInput(
                "annotationFile",
                File,
                prefix="-a",
                doc=
                "Name of an annotation file. GTF/GFF format by default. See -F option for more format information. Inbuilt annotations (SAF format) is available in 'annotation' directory of the package. Gzipped file is also accepted.",
            ),
        ]

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

    def friendly_name(self):
        return "featureCounts"

    def bind_metadata(self):
        from datetime import date

        return ToolMetadata(
            contributors=["Jiaan Yu"],
            dateCreated=date(2020, 7, 16),
            dateUpdated=date(2020, 7, 16),
            institution="Walter and Eliza Hall Institute of Medical Research",
            doi=None,
            citation=None,
            keywords=["subread", "featureCounts"],
            documentationUrl=
            "https://www.rdocumentation.org/packages/Rsubread/versions/1.22.2/topics/featureCounts",
            documentation=
            """FeatureCounts: A General-Purpose Read Summarization Function
This function assigns mapped sequencing reads to genomic features""".strip(),
        )

    additional_inputs = [
        ToolInput(
            "format",
            String(optional=True),
            prefix="-F",
            doc=
            "Specify format of the provided annotation file. Acceptable formats include 'GTF' (or compatible GFF format) and 'SAF'. 'GTF' by default.  For SAF format, please refer to Users Guide.",
        ),
        ToolInput(
            "featureType",
            Array(String(), optional=True),
            prefix="-t",
            separator=",",
            doc=
            "Specify feature type(s) in a GTF annotation. If multiple types are provided, they should be separated by ',' with no space in between. 'exon' by default. Rows in the annotation with a matched feature will be extracted and used for read mapping.",
        ),
        ToolInput(
            "attributeType",
            String(optional=True),
            prefix="-g",
            doc=
            "Specify attribute type in GTF annotation. 'gene_id' by default. Meta-features used for read counting will be extracted from annotation using the provided value.",
        ),
        ToolInput(
            "extraAttributes",
            Array(String(), optional=True),
            separator=",",
            prefix="--extraAttributes",
            doc=
            "Extract extra attribute types from the provided GTF annotation and include them in the counting output. These attribute types will not be used to group features. If more than one attribute type is provided they should be separated by comma.",
        ),
        ToolInput(
            "chromsomeAlias",
            String(optional=True),
            prefix="-A",
            doc=
            "Provide a chromosome name alias file to match chr names inannotation with those in the reads. This should be a two-column comma-delimited text file. Its first column should include chr names in the annotation and its second column should include chr names in the reads. Chr names are case sensitive. No column header should be included in the file.",
        ),
        ToolInput(
            "featureLevel",
            Boolean(optional=True),
            prefix="-f",
            doc=
            "Perform read counting at feature level (eg. counting reads for exons rather than genes).",
        ),
        ToolInput(
            "overlap",
            Boolean(optional=True),
            prefix="-O",
            doc=
            "Assign reads to all their overlapping meta-features (or features if -f is specified).",
        ),
        ToolInput(
            "minOverlap",
            Int(optional=True),
            prefix="--minOverlap",
            doc=
            "Minimum number of overlapping bases in a read that isrequired for read assignment. 1 by default. Number ofoverlapping bases is counted from both reads if pairedend. If a negative value is provided, then a gap of upto specified size will be allowed between read and the feature that the read is assigned to.",
        ),
        ToolInput(
            "fracOverlap",
            Float(optional=True),
            prefix="--fracOverlap",
            doc=
            "Minimum fraction of overlapping bases in a read that isrequired for read assignment. Value should be within range [0,1]. 0 by default. Number of overlapping bases is counted from both reads if paired end. Both this option and '--minOverlap' option need to be satisfied for read assignment.",
        ),
        ToolInput(
            "fracOverlapFeature",
            Float(optional=True),
            prefix="--fracOverlapFeature",
            doc=
            "Minimum fraction of overlapping bases in a feature that is required for read assignment. Value should be within range [0,1]. 0 by default.",
        ),
        ToolInput(
            "largestOverlap",
            Boolean(optional=True),
            prefix="--largestOverlap",
            doc=
            "Assign reads to a meta-feature/feature that has the  largest number of overlapping bases.",
        ),
        ToolInput(
            "nonOverlap",
            Int(optional=True),
            prefix="--nonOverlap",
            doc=
            "Maximum number of non-overlapping bases in a read (or a read pair) that is allowed when being assigned to a feature. No limit is set by default.",
        ),
        ToolInput(
            "nonOverlapFeature",
            Int(optional=True),
            prefix="--nonOverlapFeature",
            doc=
            "Maximum number of non-overlapping bases in a feature that is allowed in read assignment. No limit is set by default.",
        ),
        ToolInput(
            "readExtensionFive",
            Int(optional=True),
            prefix="--readExtension5",
            doc="Reads are extended upstream by <int> bases from their 5' end.",
        ),
        ToolInput(
            "readExtensionThree",
            String(optional=True),
            prefix="--readExtension3",
            doc="Reads are extended upstream by <int> bases from their 3' end.",
        ),
        ToolInput(
            "readToPos",
            String(optional=True),
            prefix="--read2pos",
            doc=
            "Reduce reads to their 5' most base or 3' most base. Read counting is then performed based on the single base the read is reduced to.",
        ),
        ToolInput(
            "multiMapping",
            Boolean(optional=True),
            prefix="-M",
            doc=
            "Multi-mapping reads will also be counted. For a multi-mapping read, all its reported alignments will be counted. The 'NH' tag in BAM/SAM input is used to detect multi-mapping reads.",
        ),
        ToolInput(
            "fration",
            Boolean(optional=True),
            prefix="--fraction",
            doc=
            "Assign fractional counts to features. This option must be used together with '-M' or '-O' or both. When '-M' is specified, each reported alignment from a multi-mapping read (identified via 'NH' tag) will carry a fractional count of 1/x, instead of 1 (one), where x is the total number of alignments reported for the same read. When '-O' is specified, each overlapping feature will receive a fractional count of 1/y, where y is the total number of features overlapping with the read. When both '-M' and '-O' are specified, each alignment will carry a fractional count of 1/(x*y).",
        ),
        ToolInput(
            "quality",
            String(optional=True),
            prefix="-Q",
            doc=
            "The minimum mapping quality score a read must satisfy in order to be counted. For paired-end reads, at least one end should satisfy this criteria. 0 by default.",
        ),
        ToolInput(
            "splitOnly",
            Boolean(optional=True),
            prefix="--splitOnly",
            doc=
            "Count split alignments only (ie. alignments with CIGAR string containing 'N'). An example of split alignments is exon-spanning reads in RNA-seq data.",
        ),
        ToolInput(
            "nonSplitOnly",
            Boolean(optional=True),
            prefix="--nonSplitOnly",
            doc=
            "If specified, only non-split alignments (CIGAR strings do not contain letter 'N') will be counted. All the other alignments will be ignored.",
        ),
        ToolInput(
            "primary",
            Boolean(optional=True),
            prefix="--primary",
            doc=
            "Count primary alignments only. Primary alignments are identified using bit 0x100 in SAM/BAM FLAG field.",
        ),
        ToolInput(
            "ignoreDup",
            Boolean(optional=True),
            prefix="--ignoreDup",
            doc=
            "Ignore duplicate reads in read counting. Duplicate reads are identified using bit Ox400 in BAM/SAM FLAG field. The whole read pair is ignored if one of the reads is a duplicate read for paired end data.",
        ),
        ToolInput(
            "strandness",
            String(optional=True),
            prefix="-",
            doc=
            "Perform strand-specific read counting. A single integer value (applied to all input files) or a string of comma-separated values (applied to each corresponding input file) should be provided. Possible values include: 0 (unstranded), 1 (stranded) and 2 (reversely stranded). Default value is 0 (ie. unstranded read counting carried out for all input files).",
        ),
        ToolInput(
            "junction",
            String(optional=True),
            prefix="-J",
            doc=
            "Count number of reads supporting each exon-exon junction. Junctions were identified from those exon-spanning reads in the input (containing 'N' in CIGAR string). Counting results are saved to a file named '<output_file>.jcounts'",
        ),
        ToolInput(
            "genome",
            File(optional=True),
            prefix="-G",
            doc=
            "Provide the name of a FASTA-format file that contains thereference sequences used in read mapping that produced the provided SAM/BAM files. This optional argument can be used with '-J' option to improve read counting for junctions.",
        ),
        ToolInput(
            "pairEnd",
            Boolean(optional=True),
            prefix="-p",
            doc=
            "If specified, fragments (or templates) will be counted instead of reads. This option is only applicable for paired-end reads; single-end reads are always counted as reads.",
        ),
        ToolInput(
            "both",
            Boolean(optional=True),
            prefix="-B",
            doc="Only count read pairs that have both ends aligned.",
        ),
        ToolInput(
            "pairEndDistance",
            Boolean(optional=True),
            prefix="-P",
            doc=
            "Check validity of paired-end distance when counting read  pairs. Use -d and -D to set thresholds.",
        ),
        ToolInput(
            "minDistance",
            Int(optional=True),
            prefix="-d",
            doc="Minimum fragment/template length, 50 by default.",
        ),
        ToolInput(
            "maxDistance",
            Int(optional=True),
            prefix="-D",
            doc="Maximum fragment/template length, 600 by default.",
        ),
        ToolInput(
            "countRead",
            Boolean(optional=True),
            prefix="-C",
            doc=
            "Do not count read pairs that have their two ends mapping to different chromosomes or mapping to same chromosome but on different strands.",
        ),
        ToolInput(
            "doNotSort",
            Boolean(optional=True),
            prefix="--donotsort",
            doc=
            "Do not sort reads in BAM/SAM input. Note that reads from the same pair are required to be located next to each other in the input.",
        ),
        ToolInput(
            "threads",
            Int(optional=True),
            prefix="-T",
            doc="Number of the threads. 1 by default.",
        ),
        ToolInput(
            "byReadGroup",
            Boolean(optional=True),
            prefix="--byReadGroup",
            doc=
            "Assign reads by read group. 'RG' tag is required to be present in the input BAM/SAM files.",
        ),
        ToolInput(
            "longRead",
            Boolean(optional=True),
            prefix="-L",
            doc=
            "Count long reads such as Nanopore and PacBio reads. Long read counting can only run in one thread and only reads (not read-pairs) can be counted. There is no limitation on the number of 'M' operations allowed in a CIGAR string in long read counting.",
        ),
        ToolInput(
            "outputFormat",
            String(optional=True),
            prefix="-R",
            doc=
            "Output detailed assignment results for each read or read-pair. Results are saved to a file that is in one of the following formats: CORE, SAM and BAM. See Users Guide for more info about these formats.",
        ),
        ToolInput(
            "outputDirectory",
            String(optional=True),
            prefix="--Rpath",
            doc=
            "Specify a directory to save the detailed assignment results. If unspecified, the directory where counting results are saved is used.",
        ),
        ToolInput(
            "tmpDir",
            String(optional=True),
            prefix="--tmpDir",
            doc=
            "Directory under which intermediate files are saved (later removed). By default, intermediate files will be saved to the directory specified in '-o' argument.",
        ),
        ToolInput(
            "maxMOp",
            Int(optional=True),
            prefix="--maxMOp",
            doc=
            "Maximum number of 'M' operations allowed in a CIGAR string. 10 by default. Both 'X' and '=' are treated as 'M' and adjacent 'M' operations are merged in the CIGAR string.",
        ),
    ]
示例#15
0
class Gatk4MergeSamFilesBase(Gatk4ToolBase, ABC):
    @classmethod
    def gatk_command(cls):
        return "MergeSamFiles"

    def tool(self):
        return "Gatk4MergeSamFiles"

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

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

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

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

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

    def bind_metadata(self):
        from datetime import date

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

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

    def tests(self):
        remote_dir = "https://swift.rc.nectar.org.au/v1/AUTH_4df6e734a509497692be237549bbe9af/janis-test-data/bioinformatics/wgsgermline_data"
        return [
            TTestCase(
                name="basic",
                input={
                    "bams": [f"{remote_dir}/NA12878-BRCA1.sorted.bam"],
                    "createIndex": True,
                    "validationStringency": "SILENT",
                    "javaOptions": ["-Xmx6G"],
                    "maxRecordsInRam": 5000000,
                    "tmpDir": "./tmp",
                    "useThreading": True,
                },
                output=BamBai.basic_test(
                    "out",
                    2826968,
                    49688,
                    f"{remote_dir}/NA12878-BRCA1.bam.flagstat",
                    "963a51f7feed5b829319b947961b8a3e",
                    "231c10d0e43766170f5a7cd1b8a6d14e",
                ),
            )
        ]
    def constructor(self):

        self.input("normal_bam", BamBai)
        self.input("tumor_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.normal_bam,
                tumorBam=self.tumor_bam,
                reference=self.reference,
                callRegions=self.intervals,
                exome=self.is_exome,
                config=self.manta_config,
            ),
        )
        self.step(
            "strelka",
            StrelkaSomatic_2_9_10(
                indelCandidates=self.manta.candidateSmallIndels,
                normalBam=self.normal_bam,
                tumorBam=self.tumor_bam,
                reference=self.reference,
                callRegions=self.intervals,
                exome=self.is_exome,
                config=self.strelka_config,
            ),
        )
        self.step(
            "concatvcf",
            ConcatStrelkaSomaticVcf(
                headerVcfs=[self.strelka.snvs, self.strelka.indels],
                contentVcfs=[self.strelka.snvs, self.strelka.indels],
            ),
        )
        self.step("sortvcf", BcfToolsSort_1_9(vcf=self.concatvcf.out))
        self.step(
            "splitnormalisevcf",
            SplitMultiAllele(vcf=self.sortvcf.out, reference=self.reference),
        )
        self.step(
            "extractaddp",
            ExtractStrelkaSomaticADDP_0_1_1(vcf=self.splitnormalisevcf.out),
        )

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

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

        self.input("sample_name", String)
        self.input("reference", FastaWithDict)
        self.input("reference_alt", File)
        self.input("fastq", FastqGzPair)

        ## BWA options for UMI commenting
        self.input("addumis", Boolean(optional=True))

        # Pipe adapters
        self.input("cutadapt_adapter", Array(str, optional=True))
        self.input("cutadapt_removeMiddle3Adapter", Array(str, optional=True))

        # Steps
        self.step(
            "cutadapt",
            CutAdapt_2_4(
                fastq=self.fastq,
                adapter=self.cutadapt_adapter,
                front=None,
                removeMiddle5Adapter=None,
                removeMiddle3Adapter=self.cutadapt_removeMiddle3Adapter,
                qualityCutoff=15,
                minimumLength=50,
                outputPrefix=self.sample_name,
            ),
        )

        self.step(
            "bwamempostalt",
            BwaMem_PostAlt_SamToolsView(
                reads=self.cutadapt.out,
                sampleName=self.sample_name,
                reference=self.reference,
                markShorterSplits=True,
                reference_alt=self.reference_alt,
                appendComments=self.addumis,
            ),
        )

        self.step(
            "addumitags",
            AddUmiTagsToBam(
                input_bam=self.bwamempostalt.out,
                out_bam="./" + self.sample_name + ".umitag.bam",
            ),
        )

        self.step(
            "sortsam",
            Gatk4SortSam_4_1_2(
                bam=self.addumitags.out,
                sortOrder="coordinate",
                createIndex=True,
                validationStringency="SILENT",
                maxRecordsInRam=5000000,
                tmpDir=".",
            ),
        )

        self
        # Outputs
        self.output("out", source=self.sortsam)
示例#20
0
class BedToolsCoverageBedBase(BedToolsToolBase, ABC):
    def bind_metadata(self):

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

    def tool(self):
        return "bedtoolsCoverageBed"

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

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

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

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

    additional_inputs = [
        ToolInput(
            "strandedness",
            Boolean(optional=True),
            prefix="-s",
            doc=
            "Require same strandedness.  That is, only report hits in B that overlap A on the _same_ strand. - By default, overlaps are reported without respect to strand.",
        ),
        ToolInput(
            "differentStrandedness",
            Boolean(optional=True),
            prefix="-S",
            doc=
            "Require different strandedness.  That is, only report hits in B that overlap A on the _opposite_ strand. - By default, overlaps are reported without respect to strand.",
        ),
        ToolInput(
            "fractionA",
            Float(optional=True),
            prefix="-f",
            doc=
            "Minimum overlap required as a fraction of A. - Default is 1E-9 (i.e., 1bp). - FLOAT (e.g. 0.50)",
        ),
        ToolInput(
            "fractionB",
            Float(optional=True),
            prefix="-F",
            doc=
            "Minimum overlap required as a fraction of B. - Default is 1E-9 (i.e., 1bp). - FLOAT (e.g. 0.50)",
        ),
        ToolInput(
            "reciprocalFraction",
            Boolean(optional=True),
            prefix="-r",
            doc=
            "Require that the fraction overlap be reciprocal for A AND B. - In other words, if -f is 0.90 and -r is used, this requires that B overlap 90% of A and A _also_ overlaps 90% of B.",
        ),
        ToolInput(
            "minFraction",
            Boolean(optional=True),
            prefix="-r",
            doc=
            "Require that the minimum fraction be satisfied for A OR B. - In other words, if -e is used with -f 0.90 and -F 0.10 this requires that either 90% of A is covered OR 10% of  B is covered. Without -e, both fractions would have to be satisfied.",
        ),
        ToolInput(
            "split",
            Boolean(optional=True),
            prefix="-split",
            doc="Treat 'split' BAM or BED12 entries as distinct BED intervals.",
        ),
        ToolInput(
            "genome",
            File(optional=True),
            prefix="-g",
            doc=
            "Provide a genome file to enforce consistent chromosome sort order across input files. Only applies when used with -sorted option.",
        ),
        ToolInput(
            "noNameCheck",
            Boolean(optional=True),
            prefix="-nonamecheck",
            doc=
            "For sorted data, don't throw an error if the file has different naming conventions for the same chromosome. ex. 'chr1' vs 'chr01'.",
        ),
        ToolInput(
            "sorted",
            Boolean(optional=True),
            prefix="-sorted",
            doc=
            "Use the 'chromsweep' algorithm for sorted (-k1,1 -k2,2n) input.",
        ),
        ToolInput(
            "header",
            Boolean(optional=True),
            prefix="-header",
            doc="Print the header from the A file prior to results.",
        ),
        ToolInput(
            "noBuf",
            Boolean(optional=True),
            prefix="-nobuf",
            doc=
            "Disable buffered output. Using this option will cause each line of output to be printed as it is generated, rather than saved in a buffer. This will make printing large output files noticeably slower, but can be useful in conjunction with other software tools and scripts that need to process one line of bedtools output at a time.",
        ),
        ToolInput(
            "bufMem",
            Int(optional=True),
            prefix="-iobuf",
            doc=
            "Specify amount of memory to use for input buffer. Takes an integer argument. Optional suffixes K/M/G supported. Note: currently has no effect with compressed files.",
        ),
    ]
示例#21
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)),
        ]
示例#22
0
class BedToolsIntersectBedBase(BedToolsToolBase, ABC):
    def bind_metadata(self):

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

    def tool(self):
        return "bedtoolsintersectBed"

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

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

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

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

    additional_inputs = [
        ToolInput(
            "writeOriginalA",
            Boolean(optional=True),
            prefix="-wa",
            doc="Write the original entry in A for each overlap.",
        ),
        ToolInput(
            "writeOriginalB",
            Boolean(optional=True),
            prefix="-wb",
            doc=
            "Write the original entry in B for each overlap. - Useful for knowing _what_ A overlaps. Restricted by -f  and -r.",
        ),
        ToolInput(
            "leftOuterJoin",
            Boolean(optional=True),
            prefix="-loj",
            doc=
            "Perform a 'left outer join'. That is, for each feature in A report each overlap with B.  If no overlaps are found, report a NULL feature for B.",
        ),
        ToolInput(
            "writeOriginalAB",
            Boolean(optional=True),
            prefix="-wo",
            doc=
            "Write the original A and B entries plus the number of base pairs of overlap between the two features. - Overlaps restricted by -f and -r. Only A features with overlap are reported.",
        ),
        ToolInput(
            "writeABBase",
            Boolean(optional=True),
            prefix="-wao",
            doc=
            "Write the original A and B entries plus the number of base pairs of overlap between the two features. - Overlapping features restricted by -f and -r. However, A features w/o overlap are also reported with a NULL B feature and overlap = 0.",
        ),
        ToolInput(
            "modeu",
            Boolean(optional=True),
            prefix="-u",
            doc=
            "Write the original A entry _once_ if _any_ overlaps found in B. - In other words, just report the fact >=1 hit was found. - Overlaps restricted by -f and -r.",
        ),
        ToolInput(
            "modec",
            Boolean(optional=True),
            prefix="-c",
            doc=
            "For each entry in A, report the number of overlaps with B. - Reports 0 for A entries that have no overlap with B. - Overlaps restricted by -f, -F, -r, and -s.",
        ),
        ToolInput(
            "modeC",
            Boolean(optional=True),
            prefix="-C",
            doc=
            "-C	For each entry in A, separately report the number of - overlaps with each B file on a distinct line. - Reports 0 for A entries that have no overlap with B. - Overlaps restricted by -f, -F, -r, and -s.",
        ),
        ToolInput(
            "modev",
            Boolean(optional=True),
            prefix="-v",
            doc=
            "Only report those entries in A that have _no overlaps_ with B. - Similar to 'grep -v' (an homage).",
        ),
        # ToolInput("ubam")
        ToolInput(
            "strandedness",
            Boolean(optional=True),
            prefix="-s",
            doc=
            "Require same strandedness.  That is, only report hits in B that overlap A on the _same_ strand. - By default, overlaps are reported without respect to strand.",
        ),
        ToolInput(
            "differentStrandedness",
            Boolean(optional=True),
            prefix="-S",
            doc=
            "Require different strandedness.  That is, only report hits in B that overlap A on the _opposite_ strand. - By default, overlaps are reported without respect to strand.",
        ),
        ToolInput(
            "fractionA",
            Float(optional=True),
            prefix="-f",
            doc=
            "Minimum overlap required as a fraction of A. - Default is 1E-9 (i.e., 1bp). - FLOAT (e.g. 0.50)",
        ),
        ToolInput(
            "fractionB",
            Float(optional=True),
            prefix="-F",
            doc=
            "Minimum overlap required as a fraction of B. - Default is 1E-9 (i.e., 1bp). - FLOAT (e.g. 0.50)",
        ),
        ToolInput(
            "reciprocalFraction",
            Boolean(optional=True),
            prefix="-r",
            doc=
            "Require that the fraction overlap be reciprocal for A AND B. - In other words, if -f is 0.90 and -r is used, this requires that B overlap 90% of A and A _also_ overlaps 90% of B.",
        ),
        ToolInput(
            "minFraction",
            Boolean(optional=True),
            prefix="-r",
            doc=
            "Require that the minimum fraction be satisfied for A OR B. - In other words, if -e is used with -f 0.90 and -F 0.10 this requires that either 90% of A is covered OR 10% of  B is covered. Without -e, both fractions would have to be satisfied.",
        ),
        ToolInput(
            "split",
            Boolean(optional=True),
            prefix="-split",
            doc="Treat 'split' BAM or BED12 entries as distinct BED intervals.",
        ),
        ToolInput(
            "genome",
            File(optional=True),
            prefix="-g",
            doc=
            "Provide a genome file to enforce consistent chromosome sort order across input files. Only applies when used with -sorted option.",
        ),
        ToolInput(
            "noNameCheck",
            Boolean(optional=True),
            prefix="-nonamecheck",
            doc=
            "For sorted data, don't throw an error if the file has different naming conventions for the same chromosome. ex. 'chr1' vs 'chr01'.",
        ),
        ToolInput(
            "sorted",
            Boolean(optional=True),
            prefix="-sorted",
            doc=
            "Use the 'chromsweep' algorithm for sorted (-k1,1 -k2,2n) input.",
        ),
        # ToolInput("names", Arrary(list), prefix="-names", doc="When using multiple databases, provide an alias for each that will appear instead of a fileId when also printing the DB record."),
        # ToolInput("fileNames", Array(list), prefix="-filenames", doc="When using multiple databases, show each complete filename instead of a fileId when also printing the DB record."),
        ToolInput(
            "sortOut",
            Boolean(optional=True),
            prefix="-sortout",
            doc=
            "When using multiple databases, sort the output DB hits for each record.",
        ),
        # ToolInput("bed", prefix="-bed", doc="If using BAM input, write output as BED."),
        ToolInput(
            "header",
            Boolean(optional=True),
            prefix="-header",
            doc="Print the header from the A file prior to results.",
        ),
        ToolInput(
            "noBuf",
            Boolean(optional=True),
            prefix="-nobuf",
            doc=
            "Disable buffered output. Using this option will cause each line of output to be printed as it is generated, rather than saved in a buffer. This will make printing large output files noticeably slower, but can be useful in conjunction with other software tools and scripts that need to process one line of bedtools output at a time.",
        ),
        ToolInput(
            "bufMem",
            Int(optional=True),
            prefix="-iobuf",
            doc=
            "Specify amount of memory to use for input buffer. Takes an integer argument. Optional suffixes K/M/G supported. Note: currently has no effect with compressed files.",
        ),
    ]
示例#23
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"
             ),
         ),
     ]
示例#24
0
 def inputs(self) -> List[ToolInput]:
     return [
         ToolInput(
             "bam",
             BamBai(),
             prefix="--bam",
             position=1,
             shell_quote=False,
             doc=
             "Sample BAM or CRAM file. May be specified more than once, multiple inputs will be treated "
             "as each BAM file representing a different sample. [required] (no default)",
         ),
         ToolInput(
             "reference",
             FastaWithDict(),
             prefix="--referenceFasta",
             position=1,
             shell_quote=False,
             doc="samtools-indexed reference fasta file [required]",
         ),
         ToolInput(
             "relativeStrelkaDirectory",
             String(optional=True),
             default="strelka_dir",
             prefix="--runDir",
             position=1,
             shell_quote=False,
             doc=
             "Name of directory to be created where all workflow scripts and output will be written. "
             "Each analysis requires a separate directory.",
         ),
         ToolInput(
             "ploidy",
             VcfTabix(optional=True),
             prefix="--ploidy",
             position=1,
             shell_quote=False,
             doc=
             "Provide ploidy file in VCF. The VCF should include one sample column per input sample "
             "labeled with the same sample names found in the input BAM/CRAM RG header sections. "
             "Ploidy should be provided in records using the FORMAT/CN field, which are interpreted "
             "to span the range [POS+1, INFO/END]. Any CN value besides 1 or 0 will be treated as 2. "
             "File must be tabix indexed. (no default)",
         ),
         ToolInput(
             "noCompress",
             VcfTabix(optional=True),
             prefix="--noCompress",
             position=1,
             shell_quote=False,
             doc=
             "Provide BED file of regions where gVCF block compression is not allowed. "
             "File must be bgzip- compressed/tabix-indexed. (no default)",
         ),
         ToolInput(
             "callContinuousVf",
             String(optional=True),
             prefix="--callContinuousVf",
             doc="Call variants on CHROM without a ploidy prior assumption, "
             "issuing calls with continuous variant frequencies (no default)",
         ),
         ToolInput(
             "rna",
             Boolean(optional=True),
             prefix="--rna",
             position=1,
             shell_quote=False,
             doc="Set options for RNA-Seq input.",
         ),
         ToolInput(
             "indelCandidates",
             VcfTabix(optional=True),
             prefix="--indelCandidates",
             position=1,
             shell_quote=False,
             doc=
             "Specify a VCF of candidate indel alleles. These alleles are always evaluated but only "
             "reported in the output when they are inferred to exist in the sample. "
             "The VCF must be tabix indexed. All indel alleles must be left-shifted/normalized, "
             "any unnormalized alleles will be ignored. This option may be specified more than once, "
             "multiple input VCFs will be merged. (default: None)",
         ),
         ToolInput(
             "forcedGT",
             VcfTabix(optional=True),
             prefix="--forcedGT",
             position=1,
             shell_quote=False,
             doc=
             "Specify a VCF of candidate alleles. These alleles are always evaluated and reported even "
             "if they are unlikely to exist in the sample. The VCF must be tabix indexed. "
             "All indel alleles must be left- shifted/normalized, any unnormalized allele will "
             "trigger a runtime error. This option may be specified more than once, multiple input "
             "VCFs will be merged. Note that for any SNVs provided in the VCF, the SNV site will "
             "be reported (and for gVCF, excluded from block compression), "
             "but the specific SNV alleles are ignored. (default: None)",
         ),
         ToolInput(
             "exome",
             Boolean(optional=True),
             prefix="--exome",
             position=1,
             shell_quote=False,
             doc=
             "Set options for exome note in particular that this flag turns off high-depth filters",
         ),
         ToolInput(
             "targeted",
             Boolean(optional=True),
             prefix="--exome",
             position=1,
             shell_quote=False,
             doc="Set options for other targeted input: "
             "note in particular that this flag turns off high-depth filters",
         ),
         ToolInput(
             tag="callRegions",
             input_type=BedTabix(optional=True),
             prefix="--callRegions=",
             separate_value_from_prefix=False,
             position=1,
             doc=
             "Optionally provide a bgzip-compressed/tabix-indexed BED file containing the set of "
             "regions to call. No VCF output will be provided outside of these regions. "
             "The full genome will still be used to estimate statistics from the input "
             "(such as expected depth per chromosome). Only one BED file may be specified. "
             "(default: call the entire genome)",
         ),
         # ToolInput("version", Boolean(optional=True), prefix="--version", position=3, shell_quote=False,
         #           doc="show program's version number and exit"),
         # ToolInput("help", Boolean(optional=True), prefix="--help", position=3, shell_quote=False,
         #           doc="(-h) show this help message and exit"),
         ToolInput(
             "mode",
             String(optional=True),
             default="local",
             prefix="--mode",
             position=3,
             shell_quote=False,
             doc="(-m MODE)  select run mode (local|sge)",
         ),
         ToolInput(
             "queue",
             String(optional=True),
             prefix="--queue",
             position=3,
             shell_quote=False,
             doc="(-q QUEUE) specify scheduler queue name",
         ),
         ToolInput(
             "memGb",
             String(optional=True),
             prefix="--memGb",
             position=3,
             shell_quote=False,
             doc=" (-g MEMGB) gigabytes of memory available to run workflow "
             "-- only meaningful in local mode, must be an integer (default: Estimate the total "
             "memory for this node for local mode, 'unlimited' for sge mode)",
         ),
         # ToolInput("dryRun", Boolean(optional=True), prefix="--dryRun", position=3, shell_quote=False,
         #           doc="dryRun (-d,) workflow code without actually running command-tasks"),
         ToolInput(
             "quiet",
             Boolean(optional=True),
             prefix="--quiet",
             position=3,
             shell_quote=False,
             doc="Don't write any log output to stderr "
             "(but still write to workspace/pyflow.data/logs/pyflow_log.txt)",
         ),
         ToolInput(
             "mailTo",
             String(optional=True),
             prefix="--mailTo",
             position=3,
             shell_quote=False,
             doc=
             "(-e) send email notification of job completion status to this address "
             "(may be provided multiple times for more than one email address)",
         ),
     ]
示例#25
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,
                ),
            )
        ]
示例#26
0
class VcfToolsvcftoolsBase(VcfToolsToolBase, ABC):
    def tool(self):
        return "VcfTools"

    @classmethod
    def vcftools_command(cls):
        return "vcftools"

    def inputs(self):
        return [
            # bcf is not supported yet
            ToolInput(
                "vcf",
                Vcf(),
                prefix="--vcf",
                doc="This option defines the VCF file to be processed. VCFtools expects files in VCF format v4.0, v4.1 or v4.2. The latter two are supported  with  some  small limitations. If the user provides a dash character '-' as a file name, the program expects a VCF file to be piped in through standard in.",
            ),
            ToolInput(
                "outputFilename",
                Filename(),
                prefix="--out",
                doc='<output_prefix>. This option defines the output filename prefix for all files generated by vcftools. For example, if <prefix> is set to output_filename, then all output files will be of the form output_filename.*** . If this option is omitted, all output files will have the prefix "out." in the current working directory.',
            ),
            *self.additional_inputs,
        ]

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

    def friendly_name(self):
        return "VcfTools"

    def bind_metadata(self):
        from datetime import date

        return ToolMetadata(
            contributors=["Jiaan Yu"],
            dateCreated=date(2020, 5, 22),
            dateUpdated=date(2020, 5, 22),
            institution="VCFtools",
            doi=None,
            citation=None,
            keywords=["vcftools"],
            documentationUrl="https://vcftools.github.io/man_latest.html",
            documentation="""NAME
vcftools v0.1.16 − Utilities for the variant call format (VCF) and binary variant call format (BCF)

SYNOPSIS
vcftools [ --vcf FILE | --gzvcf FILE | --bcf FILE] [ --out OUTPUT PREFIX ] [ FILTERING OPTIONS ] [ OUTPUT OPTIONS ]

DESCRIPTION
vcftools is a suite of functions for use on genetic variation data in the form of VCF and BCF files. The tools provided will be used mainly to summarize data, run calculations on data, filter out data, and convert data into other useful file formats.
""".strip(),
        )

    additional_inputs = [
        ToolInput(
            "removeFileteredAll",
            Boolean(optional=True),
            prefix="--remove-filtered-all",
            position=1,
            shell_quote=False,
            doc="Removes all sites with a FILTER flag other than PASS.",
        ),
        ToolInput(
            "recode",
            Boolean(optional=True),
            prefix="--recode",
            position=1,
            shell_quote=False,
            doc="",
        ),
        ToolInput(
            "recodeINFOAll",
            Boolean(optional=True),
            prefix="--recode-INFO-all",
            position=1,
            shell_quote=False,
            doc="These options can be used with the above recode options to define an INFO key name to keep in the output  file.  This  option can be used multiple times to keep more of the INFO fields. The second option is used to keep all INFO values in the original file.",
        )
        # tbc
    ]
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 """
示例#28
0
class ScrambleBase(BioinformaticsTool, ABC):
    def tool(self):
        return "scramble"

    def friendly_name(self):
        return "scramble"

    def tool_provider(self):
        return "io_lib"

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

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

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

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

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

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

    def bind_metadata(self):
        from datetime import date

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

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

    @classmethod
    def samtools_command(cls):
        return "view"

    def inputs(self):
        return [
            *super(SamToolsViewBase, self).inputs(),
            *SamToolsViewBase.additional_inputs,
            ToolInput("sam", UnionType(Sam(), Bam(), Cram()), position=10),
            ToolInput(
                "reference",
                FastaWithDict(optional=True),
                position=6,
                prefix="-T",
                doc=
                "A FASTA format reference FILE, optionally compressed by bgzip and ideally indexed "
                "by samtools faidx. If an index is not present, one will be generated for you.",
            ),
            ToolInput(
                "outputFilename",
                Filename(
                    prefix=InputSelector("sam", remove_file_extension=True),
                    extension=".bam",
                ),
                position=5,
                prefix="-o",
                doc="Output to FILE [stdout].",
            ),
            ToolInput(
                "regions",
                Array(String, optional=True),
                position=11,
                doc=
                "Region specifications after the input filename to restrict output to only those alignments which "
                "overlap the specified region(s). Use of region specifications requires a coordinate-sorted and "
                "indexed input file (in BAM or CRAM format)",
            ),
        ]

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

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

    def bind_metadata(self):
        self.metadata = ToolMetadata(
            contributors=["Michael Franklin"],
            dateCreated=date(2018, 12, 24),
            dateUpdated=date(2019, 1, 24),
            institution="Samtools",
            doi=None,
            citation=None,  # find citation
            keywords=["samtools", "view"],
            documentationUrl=
            "http://www.htslib.org/doc/samtools.html#COMMANDS_AND_OPTIONS",
            documentation=
            """Ensure SAMTOOLS.SORT is inheriting from parent metadata
        
---------------------------------------------------------------------------------------------------
    
With no options or regions specified, prints all alignments in the specified input alignment file 
(in SAM, BAM, or CRAM format) to standard output in SAM format (with no header).

You may specify one or more space-separated region specifications after the input filename to 
restrict output to only those alignments which overlap the specified region(s). 
Use of region specifications requires a coordinate-sorted and indexed input file (in BAM or CRAM format)."""
            .strip(),
        )
        return self.metadata

    def arguments(self):
        return [
            ToolArgument(
                "-S",
                position=2,
                doc=
                "Ignored for compatibility with previous samtools versions. Previously this option was "
                "required if input was in SAM format, but now the correct format is automatically "
                "detected by examining the first few characters of input.",
            ),
            ToolArgument("-h",
                         position=3,
                         doc="Include the header in the output."),
            ToolArgument("-b", position=4, doc="Output in the BAM format."),
        ]

    additional_inputs = [
        ToolInput(
            "cramOutput",
            Boolean(optional=True),
            position=5,
            prefix="-C",
            doc="Output in the CRAM format (requires -T).",
        ),
        ToolInput(
            "compressedBam",
            Boolean(optional=True),
            position=5,
            prefix="-1",
            doc="Enable fast BAM compression (implies -b).",
        ),
        ToolInput(
            "uncompressedBam",
            Boolean(optional=True),
            position=5,
            prefix="-u",
            doc=
            "Output uncompressed BAM. This option saves time spent on compression/decompression and is "
            "thus preferred when the output is piped to another samtools command.",
        ),
        ToolInput(
            "onlyOutputHeader",
            Boolean(optional=True),
            position=5,
            prefix="-H",
            doc="Output the header only.",
        ),
        ToolInput(
            "countAlignments",
            Boolean(optional=True),
            position=5,
            prefix="-c",
            doc=
            "Instead of printing the alignments, only count them and print the total number. "
            "All filter options, such as -f, -F, and -q, are taken into account.",
        ),
        # ToolInput("", Boolean(), position=5, prefix="-?", doc="Output long help and exit immediately."),
        ToolInput(
            "writeAlignments",
            File(optional=True),
            position=5,
            prefix="-U",
            doc=
            "Write alignments that are not selected by the various filter options to FILE. "
            "When this option is used, all alignments (or all alignments intersecting the regions specified) "
            "are written to either the output file or this file, but never both.",
        ),
        ToolInput(
            "inputTSV",
            File(optional=True),
            position=5,
            prefix="-t",
            doc=
            "A tab-delimited FILE. Each line must contain the reference name in the first column and the "
            "length of the reference in the second column, with one line for each distinct reference. "
            "Any additional fields beyond the second column are ignored. This file also defines the order "
            "of the reference sequences in sorting. If you run: `samtools faidx <ref.fa>', the resulting "
            "index file <ref.fa>.fai can be used as this FILE.",
        ),
        ToolInput(
            "onlyOverlapping",
            File(optional=True),
            position=5,
            prefix="-L",
            doc="Only output alignments overlapping the input BED FILE [null].",
        ),
        ToolInput(
            "useMultiRegionIterator",
            Boolean(optional=True),
            position=5,
            prefix="-M",
            doc=
            "Use the multi-region iterator on the union of the BED file and command-line region arguments. "
            "This avoids re-reading the same regions of files so can sometimes be much faster. "
            "Note this also removes duplicate sequences. Without this a sequence that overlaps multiple "
            "regions specified on the command line will be reported multiple times.",
        ),
        ToolInput(
            "outputAlignmentsInReadGroup",
            String(optional=True),
            position=5,
            prefix="-r",
            doc=
            "Output alignments in read group STR [null]. Note that records with no RG tag will also be "
            "output when using this option. This behaviour may change in a future release.",
        ),
        ToolInput(
            "outputAlignmentsInFileReadGroups",
            File(optional=True),
            position=5,
            prefix="-R",
            doc=
            "Output alignments in read groups listed in FILE [null]. Note that records with no RG tag "
            "will also be output when using this option. This behaviour may change in a future release.",
        ),
        ToolInput(
            "mapqThreshold",
            Int(optional=True),
            position=5,
            prefix="-q",
            doc="Skip alignments with MAPQ smaller than INT [0].",
        ),
        ToolInput(
            "outputAlignmentsInLibrary",
            String(optional=True),
            position=5,
            prefix="-l",
            doc="Only output alignments in library STR [null].",
        ),
        ToolInput(
            "outputAlignmentsMeetingCIGARThreshold",
            Int(optional=True),
            position=5,
            prefix="-m",
            doc=
            "Only output alignments with number of CIGAR bases consuming query sequence ≥ INT [0]",
        ),
        ToolInput(
            "outputAlignmentsWithBitsSet",
            String(optional=True),
            position=5,
            prefix="-f",
            doc=
            "Only output alignments with all bits set in INT present in the FLAG field. "
            "INT can be specified in hex by beginning with `0x' (i.e. /^0x[0-9A-F]+/) or "
            "in octal by beginning with `0' (i.e. /^0[0-7]+/) [0].",
        ),
        ToolInput(
            "doNotOutputAlignmentsWithBitsSet",
            String(optional=True),
            position=5,
            prefix="-F",
            doc=
            "Do not output alignments with any bits set in INT present in the FLAG field. "
            "INT can be specified in hex by beginning with `0x' (i.e. /^0x[0-9A-F]+/) or "
            "in octal by beginning with `0' (i.e. /^0[0-7]+/) [0].",
        ),
        ToolInput(
            "doNotOutputAlignmentsWithAllBitsSet",
            String(optional=True),
            position=5,
            prefix="-G",
            doc=
            "Do not output alignments with all bits set in INT present in the FLAG field. "
            "This is the opposite of -f such that -f12 -G12 is the same as no filtering at all. "
            "INT can be specified in hex by beginning with `0x' (i.e. /^0x[0-9A-F]+/) or "
            "in octal by beginning with `0' (i.e. /^0[0-7]+/) [0].",
        ),
        ToolInput(
            "readTagToExclude",
            String(optional=True),
            position=5,
            prefix="-x",
            doc="Read tag to exclude from output (repeatable) [null]",
        ),
        ToolInput(
            "collapseBackwardCIGAR",
            Boolean(optional=True),
            position=5,
            prefix="-B",
            doc="Collapse the backward CIGAR operation.",
        ),
        ToolInput(
            "subsamplingProportion",
            Float(optional=True),
            position=5,
            prefix="-s",
            doc=
            "Output only a proportion of the input alignments. This subsampling acts in the same "
            "way on all of the alignment records in the same template or read pair, so it never "
            "keeps a read but not its mate. The integer and fractional parts of the -s INT.FRAC "
            "option are used separately: the part after the decimal point sets the fraction of "
            "templates/pairs to be kept, while the integer part is used as a seed that influences "
            "which subset of reads is kept.",
        ),
        ToolInput(
            "threads",
            Int(optional=True),
            position=5,
            prefix="-@",
            doc=
            "Number of BAM compression threads to use in addition to main thread [0].",
        ),
    ]

    # def tests(self):
    #     return [
    #         TTestCase(
    #             name="basic",
    #             input={
    #                 "sam": os.path.join(
    #                     BioinformaticsTool.test_data_path(), "small.bam"
    #                 ),
    #             },
    #             output=[
    #                 TTestExpectedOutput(
    #                     tag="out",
    #                     preprocessor=TTestPreprocessor.FileMd5,
    #                     operator=operator.eq,
    #                     expected_value="54be668168b91eb1c04929b9305c1ac7",
    #                 ),
    #             ],
    #         )
    #     ]

    def tests(self):
        return [
            TTestCase(
                name="basic",
                input={
                    "sam":
                    os.path.join(
                        BioinformaticsTool.test_data_path(),
                        "wgsgermline_data",
                        "NA12878-BRCA1.bwamem.stdout",
                    ),
                    "reference":
                    os.path.join(
                        BioinformaticsTool.test_data_path(),
                        "wgsgermline_data",
                        "Homo_sapiens_assembly38.chr17.fasta",
                    ),
                    "threads":
                    16,
                },
                output=Bam.basic_test(
                    "out",
                    2740774,
                    os.path.join(
                        BioinformaticsTool.test_data_path(),
                        "wgsgermline_data",
                        "NA12878-BRCA1.bam.flagstat",
                    ),
                    "9a6af420f287df52a122ac723f41b535",
                ),
            ),
            TTestCase(
                name="minimal",
                input={
                    "sam":
                    os.path.join(
                        BioinformaticsTool.test_data_path(),
                        "wgsgermline_data",
                        "NA12878-BRCA1.bwamem.stdout",
                    ),
                    "reference":
                    os.path.join(
                        BioinformaticsTool.test_data_path(),
                        "wgsgermline_data",
                        "Homo_sapiens_assembly38.chr17.fasta",
                    ),
                    "threads":
                    16,
                },
                output=self.minimal_test(),
            ),
        ]