changeset 0:0ad5327b80cc draft

"planemo upload commit 61f6c8e7f32f170ad7e66e46dd74e8c5d361a722"
author jjohnson
date Sun, 21 Feb 2021 23:40:53 +0000
parents
children b7795c2f0b81
files fgbio_call_molecular_consensus_reads.xml macros.xml
diffstat 2 files changed, 163 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fgbio_call_molecular_consensus_reads.xml	Sun Feb 21 23:40:53 2021 +0000
@@ -0,0 +1,107 @@
+<tool id="fgbio_call_molecular_consensus_reads" name="fgbio CallMolecularConsensusReads" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" python_template_version="3.5">
+    <description>Calls consensus sequences from reads with the same unique molecular tag</description>
+    <macros>
+        <import>macros.xml</import>
+    </macros>
+    <expand macro="requirements" />
+    <version_command>fgbio --version</version_command>
+    <command detect_errors="exit_code"><![CDATA[
+        fgbio CallMolecularConsensusReads
+        --input '$input'
+        --min-reads=$min_reads
+        --output '$output'
+        ## optional settings
+        #if $filter_options.max_reads:
+            --max-reads=$filter_options.max_reads
+        #end if
+        #if $filter_options.error_rate_pre_umi
+            --error-rate-pre-umi=$filter_options.error_rate_pre_umi
+        #end if
+        #if $filter_options.error_rate_post_umi
+            --error-rate-post-umi=$filter_options.error_rate_post_umi
+        #end if
+        #if $filter_options.min_input_base_quality
+            --min-input-base-quality=$filter_options.min_input_base_quality
+        #end if
+
+        #if $bam_options.read-name-prefix
+            --read-name-prefix='$bam_options.read-name-prefix'
+        #end if
+        #if $bam_options.tag
+            --tag=$bam_options.tag
+        #end if
+        #if $bam_options.read_group_id
+            --read-group-id=$bam_options.read_group_id
+        #end if
+        #if $bam_options.output_per_base_tags
+            --output-per-base-tags=$bam_options.output_per_base_tags
+        #end if
+        #if $output_rejects
+            --rejects='$rejects'
+        #end if
+    ]]></command>
+    <inputs>
+        <param name="input" type="data" format="bam" label="Fastq files corresponding to each sequencing read"/>
+        <param argument="--min-reads" type="integer" value="" min="1" label="Minimum number of reads to produce a consensus base" help="Default: 1"/>
+
+        <section name="filter_options" title="Optional Filter Settings" expanded="false">
+            <param argument="--max-reads" type="integer" value="" min="1" label="Maximum number of reads to to use when building a consensus" 
+                   help="If more than this many reads are present in a tag family, the family is randomly downsampled to exactly max-reads reads."/>
+            <param argument="--error-rate-pre-umi" type="integer" value="" min="1" label="Phred-scaled error rate for an error prior to the UMIs being integrated" help="Default: 45"/>
+            <param argument="--error-rate-post-umi" type="integer" value="" min="1" label="Phred-scaled error rate for an error post the UMIs being integrated" help="Default: 40"/>
+            <param argument="--min-input-base-quality" type="integer" value="" min="1" label="Ignore bases in raw reads that have Q below this value" help="Default: 10"/>
+        </section>
+
+        <section name="bam_options" title="BAM Settings" expanded="false">
+            <param argument="--read-name-prefix" type="text" value="" label="Prefix for all consensus read names"/> 
+            <param argument="--tag" type="text" value="" label="The SAM attribute with the unique molecule tag" help="Default: MI"> 
+                <expand macro="sam_tag_validator"/>
+            </param>
+            <param argument="--read-group-id" type="text" value="" optional="true" label="The new read group ID for all the consensus reads" help="Default: A"/>
+            <param argument="--output-per-base-tags" type="select" value="" optional="true" label="Produce tags on consensus reads that contain per-base information">
+                <option value="true">Yes</option>
+                <option value="flse">Yes</option>
+            </param>
+        </section>
+        <expand macro="sam_sort_order" />
+        <param argument="output_rejects" type="boolean" truevalue="true" falsevalue="false" checked="false" label="Output tag family size counts"/>
+    </inputs>
+    <outputs>
+        <data name="rejects" format="bam" >
+            <filter>output_rejects == True</filter>
+        </data>
+        <data name="output" format="bam" />
+    </outputs>
+    <help><![CDATA[
+**fgbio CallMolecularConsensusReads**
+
+Calls consensus sequences from reads with the same unique molecular tag.
+
+Reads with the same unique molecular tag are examined base-by-base to assess the likelihood of each base in the source molecule. The likelihood model is as follows:
+
+  1. First, the base qualities are adjusted. The base qualities are assumed to represent the probability of a sequencing error (i.e. the sequencer observed the wrong base present on the cluster/flowcell/well). The base quality scores are converted to probabilities incorporating a probability representing the chance of an error from the time the unique molecular tags were integrated to just prior to sequencing. The resulting probability is the error rate of all processes from right after integrating the molecular tag through to the end of sequencing.
+  2. Next, a consensus sequence is called for all reads with the same unique molecular tag base-by-base. For a given base position in the reads, the likelihoods that an A, C, G, or T is the base for the underlying source molecule respectively are computed by multiplying the likelihood of each read observing the base position being considered. The probability of error (from 1.) is used when the observed base does not match the hypothesized base for the underlying source molecule, while one minus that probability is used otherwise. The computed likelihoods are normalized by dividing them by the sum of all four likelihoods to produce a posterior probability, namely the probability that the source molecule was an A, C, G, or T from just after integrating molecular tag through to sequencing, given the observations. The base with the maximum posterior probability as the consensus call, and the posterior probability is used as its raw base quality.
+  3. Finally, the consensus raw base quality is modified by incorporating the probability of an error prior to integrating the unique molecular tags. Therefore, the probability used for the final consensus base quality is the posterior probability of the source molecule having the consensus base given the observed reads with the same molecular tag, all the way from sample extraction and through sample and library preparation, through preparing the library for sequencing (e.g. amplification, target selection), and finally, through sequencing.
+This tool assumes that reads with the same tag are grouped together (consecutive in the file). Also, this tool calls each end of a pair independently, and does not jointly call bases that overlap within a pair. Insertion or deletion errors in the reads are not considered in the consensus model.
+
+Particular attention should be paid to setting the --min-reads parameter as this can have a dramatic effect on both results and runtime. For libraries with low duplication rates (e.g. 100-300X exomes libraries) in which it is desirable to retain singleton reads while making consensus reads from sets of duplicates, --min-reads=1 is appropriate. For libraries with high duplication rates where it is desirable to only produce consensus reads supported by 2+ reads to allow error correction, --min-reads=2 or higher is appropriate. After generation, consensus reads can be further filtered using the FilterConsensusReads tool. As such it is always safe to run with --min-reads=1 and filter later, but filtering at this step can improve performance significantly.
+
+Consensus reads have a number of additional optional tags set in the resulting BAM file. The tags break down into those that are single-valued per read:
+
+  - consensus depth      [cD] (int)  : the maximum depth of raw reads at any point in the consensus read
+  - consensus min depth  [cM] (int)  : the minimum depth of raw reads at any point in the consensus read
+  - consensus error rate [cE] (float): the fraction of bases in raw reads disagreeing with the final consensus calls
+
+And those that have a value per base:
+
+  - consensus depth  [cd] (short[]): the count of bases contributing to the consensus read at each position
+  - consensus errors [ce] (short[]): the number of bases from raw reads disagreeing with the final consensus base
+
+The per base depths and errors are both capped at 32,767. In all cases no-calls (Ns) and bases below the --min-input-base-quality are not counted in tag value calculations.
+
+
+
+http://fulcrumgenomics.github.io/fgbio/tools/latest/CallMolecularConsensusReads.html
+    ]]></help>
+    <expand macro="citations" />
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/macros.xml	Sun Feb 21 23:40:53 2021 +0000
@@ -0,0 +1,56 @@
+<macros>
+    <token name="@TOOL_VERSION@">1.3.0</token>
+    <token name="@VERSION_SUFFIX@">0</token>
+    <xml name="requirements">
+        <requirements>
+            <requirement type="package" version="@TOOL_VERSION@">fgbio</requirement>
+            <yield/>
+        </requirements>
+    </xml>
+    <token name="@READ_STRUCTURE_PATTERN@">(([1-9][0-9]*[TBMS])*([+]|[1-9][0-9]*)[TBMS])</token>
+    <token name="@READ_STRUCTURES_PATTERN@">@READ_STRUCTURE_PATTERN@(\s@READ_STRUCTURE_PATTERN@)*</token>
+    <xml name="read_structures_validator">
+            <validator type="regex" message="">^@READ_STRUCTURES_PATTERN@$</validator>
+    </xml>
+    <xml name="sam_tag_validator">
+            <validator type="regex" message="">^[A-Za-z][A-Za-z]$</validator>
+    </xml>
+    <xml name="sam_sort_order">
+        <param argument="--sort-order" type="select" optional="true" label="Sort BAM by">
+            <option value="Coordinate">Coordinate</option>
+            <option value="Queryname">Queryname</option>
+            <option value="Random">Random</option>
+            <option value="RandomQuery">RandomQuery</option>
+        </param>
+    </xml>
+
+    <token name="@READ_STRUCTURES_HELP@"><![CDATA[
+**Read Structures**
+
+Read structures are made up of <number><operator> pairs much like the CIGAR string in BAM files. Four kinds of operators are recognized:
+
+    T identifies a template read
+    B identifies a sample barcode read
+    M identifies a unique molecular index read
+    S identifies a set of bases that should be skipped or ignored
+
+The last <number><operator> pair may be specified using a + sign instead of number to denote “all remaining bases”. This is useful if, e.g., fastqs have been trimmed and contain reads of varying length. For example to convert a paired-end run with an index read and where the first 5 bases of R1 are a UMI and the second five bases are monotemplate you might specify:
+
+:: 
+
+    --input r1.fq r2.fq i1.fq --read-structures 5M5S+T +T +B
+
+Alternative if you know your reads are of fixed length you could specify:
+
+:: 
+
+    --input r1.fq r2.fq i1.fq --read-structures 5M5S65T 75T 8B
+
+
+]]></token>
+    <xml name="citations">
+        <citations>
+            <yield />
+        </citations>
+    </xml>
+</macros>