comparison samtools_stats.xml @ 1:cc56fc603e53 draft

planemo upload commit 33927a87ba2eee9bf0ecdd376a66241b17b3d734
author devteam
date Tue, 13 Oct 2015 12:56:27 -0400
parents cd6eb75c9819
children 45c568e7f1f9
comparison
equal deleted inserted replaced
0:cd6eb75c9819 1:cc56fc603e53
1 <tool id="samtools_stats" name="Generate statistics" version="1.0.0"> 1 <tool id="samtools_stats" name="Stats" version="2.0">
2 <description>for a BAM or SAM file</description> 2 <description>generate statistics for BAM dataset</description>
3 <requirements> 3 <macros>
4 <requirement type="package" version="1.1">samtools</requirement> 4 <import>macros.xml</import>
5 </requirements> 5 </macros>
6 <version_command>samtools --version | head -n 1 | awk '{ print $2 }'</version_command> 6 <expand macro="requirements"></expand>
7 <expand macro="stdio"></expand>
8 <expand macro="version_command"></expand>
7 <command><![CDATA[ 9 <command><![CDATA[
8 #if $use_reference.use_ref_selector == "yes": 10 #if $use_reference.use_ref_selector == "yes":
9 #if $use_reference.reference_source.reference_source_selector == "history": 11 #if $use_reference.reference_source.reference_source_selector == "history":
10 ln -s "${use_reference.reference_source.ref_file}" && samtools faidx `basename "${use_reference.reference_source.ref_file}"` && samtools stats 12 ln -s "${use_reference.reference_source.ref_file}" && samtools faidx `basename "${use_reference.reference_source.ref_file}"` && samtools stats
11 #else: 13 #else:
25 --filtering-flag ${sum([int(flag) for flag in str($filter_by_flags.exclude_flags).split(',')])} 27 --filtering-flag ${sum([int(flag) for flag in str($filter_by_flags.exclude_flags).split(',')])}
26 #end if 28 #end if
27 #end if 29 #end if
28 --GC-depth ${gc_depth} 30 --GC-depth ${gc_depth}
29 --insert-size ${insert_size} 31 --insert-size ${insert_size}
32
33 ## The code below is commented out because using -I/--id options causes the following exception
34 ## Samtools-htslib: init_group_id() header parsing not yet implemented
35
36 ##if str($read_group) != "":
37 ## -I "${read_group}"
38 ##end if
39
30 #if str($read_length) != "0": 40 #if str($read_length) != "0":
31 --read-length "${read_length}" 41 --read-length "${read_length}"
32 #end if 42 #end if
33 --most-inserts ${most_inserts} 43 --most-inserts ${most_inserts}
34 --trim-quality ${trim_quality} 44 --trim-quality ${trim_quality}
41 #end if 51 #end if
42 > "${output}" 52 > "${output}"
43 #if $split_output.split_output_selector == "yes": 53 #if $split_output.split_output_selector == "yes":
44 #set outputs_to_split = str($split_output.generate_tables).split(',') 54 #set outputs_to_split = str($split_output.generate_tables).split(',')
45 && mkdir split && echo ${split_output.generate_tables} && 55 && mkdir split && echo ${split_output.generate_tables} &&
56
46 #if 'sn' in $outputs_to_split: 57 #if 'sn' in $outputs_to_split:
47 grep -q ^SN "${output}" ; if [ $? = 0 ] ; then grep ^SN "${output}" | cut -f 2- > "split/Summary numbers.tab" ; fi && 58 echo "# Summary Numbers\n" > "split/Summary numbers.tab" &&
48 #end if 59 grep -q ^SN "${output}" ; if [ $? = 0 ] ; then grep ^SN "${output}" | cut -f 2- >> "split/Summary numbers.tab" ; fi &&
60 #end if
61
49 #if 'ffq' in $outputs_to_split: 62 #if 'ffq' in $outputs_to_split:
50 grep -q ^FFQ "${output}" ; if [ $? = 0 ] ; then grep ^FFQ "${output}" | cut -f 2- > "split/First Fragment Qualities.tab" ; fi && 63 echo "# Columns correspond to qualities and rows to cycles. First column is the cycle number\n" > "split/First Fragment Qualities.tab" &&
51 #end if 64 grep -q ^FFQ "${output}" ; if [ $? = 0 ] ; then grep ^FFQ "${output}" | cut -f 2- >> "split/First Fragment Qualities.tab" ; fi &&
65 #end if
66
52 #if 'lfq' in $outputs_to_split: 67 #if 'lfq' in $outputs_to_split:
53 grep -q ^LFQ "${output}" ; if [ $? = 0 ] ; then grep ^LFQ "${output}" | cut -f 2- > "split/Last Fragment Qualities.tab" ; fi && 68 echo "# Columns correspond to qualities and rows to cycles. First column is the cycle number" > "split/Last Fragment Qualities.tab" &&
54 #end if 69 grep -q ^LFQ "${output}" ; if [ $? = 0 ] ; then grep ^LFQ "${output}" | cut -f 2- >> "split/Last Fragment Qualities.tab" ; fi &&
70 #end if
71
55 #if 'mpc' in $outputs_to_split: 72 #if 'mpc' in $outputs_to_split:
56 grep -q ^MPC "${output}" ; if [ $? = 0 ] ; then grep ^MPC "${output}" | cut -f 2- > "split/Mismatches per cycle.tab" ; fi && 73 echo "# Columns correspond to qualities, rows to cycles. First column is the cycle number, second is the number of N's and the rest is the number of mismatches" > "split/Mismatches per cycle.tab" &&
57 #end if 74 grep -q ^MPC "${output}" ; if [ $? = 0 ] ; then grep ^MPC "${output}" | cut -f 2- >> "split/Mismatches per cycle.tab" ; fi &&
75 #end if
76
58 #if 'gcf' in $outputs_to_split: 77 #if 'gcf' in $outputs_to_split:
59 grep -q ^GCF "${output}" ; if [ $? = 0 ] ; then grep ^GCF "${output}" | cut -f 2- > "split/GC Content of first fragments.tab" ; fi && 78 echo "# GC Content of first fragments" > "split/GC Content of first fragments.tab" &&
60 #end if 79 grep -q ^GCF "${output}" ; if [ $? = 0 ] ; then grep ^GCF "${output}" | cut -f 2- >> "split/GC Content of first fragments.tab" ; fi &&
80 #end if
81
61 #if 'gcl' in $outputs_to_split: 82 #if 'gcl' in $outputs_to_split:
62 grep -q ^GCL "${output}" ; if [ $? = 0 ] ; then grep ^GCL "${output}" | cut -f 2- > "split/GC Content of last fragments.tab" ; fi && 83 echo "# GC Content of last fragments" > "split/GC Content of last fragments.tab" &&
63 #end if 84 grep -q ^GCL "${output}" ; if [ $? = 0 ] ; then grep ^GCL "${output}" | cut -f 2- >> "split/GC Content of last fragments.tab" ; fi &&
85 #end if
86
64 #if 'gcc' in $outputs_to_split: 87 #if 'gcc' in $outputs_to_split:
65 grep -q ^GCC "${output}" ; if [ $? = 0 ] ; then grep ^GCC "${output}" | cut -f 2- > "split/ACGT content per cycle.tab" ; fi && 88 echo "# ACGT content per cycle. The columns are: cycle, and A,C,G,T counts (percent)" > "split/ACGT content per cycle.tab" &&
66 #end if 89 grep -q ^GCC "${output}" ; if [ $? = 0 ] ; then grep ^GCC "${output}" | cut -f 2- >> "split/ACGT content per cycle.tab" ; fi &&
90 #end if
91
67 #if 'is' in $outputs_to_split: 92 #if 'is' in $outputs_to_split:
68 grep -q ^IS "${output}" ; if [ $? = 0 ] ; then grep ^IS "${output}" | cut -f 2- > "split/Insert sizes.tab" ; fi && 93 echo "# Insert sizes. The columns are: insert size, pairs total, inward oriented pairs, outward oriented pairs, other pairs" > "split/Insert sizes.tab" &&
69 #end if 94 grep -q ^IS "${output}" ; if [ $? = 0 ] ; then grep ^IS "${output}" | cut -f 2- >> "split/Insert sizes.tab" ; fi &&
95 #end if
96
70 #if 'rl' in $outputs_to_split: 97 #if 'rl' in $outputs_to_split:
71 grep -q ^RL "${output}" ; if [ $? = 0 ] ; then grep ^RL "${output}" | cut -f 2- > "split/Read lengths.tab" ; fi && 98 echo "# Read lengths. The columns are: read length, count" > "split/Read lengths.tab" &&
72 #end if 99 grep -q ^RL "${output}" ; if [ $? = 0 ] ; then grep ^RL "${output}" | cut -f 2- >> "split/Read lengths.tab" ; fi &&
100 #end if
101
73 #if 'id' in $outputs_to_split: 102 #if 'id' in $outputs_to_split:
74 grep -q ^ID "${output}" ; if [ $? = 0 ] ; then grep ^ID "${output}" | cut -f 2- > "split/Indel distribution.tab" ; fi && 103 echo "# Indel distribution. The columns are: length, number of insertions, number of deletions" > "split/Indel distribution.tab" &&
75 #end if 104 grep -q ^ID "${output}" ; if [ $? = 0 ] ; then grep ^ID "${output}" | cut -f 2- >> "split/Indel distribution.tab" ; fi &&
105 #end if
106
76 #if 'ic' in $outputs_to_split: 107 #if 'ic' in $outputs_to_split:
77 grep -q ^IC "${output}" ; if [ $? = 0 ] ; then grep ^IC "${output}" | cut -f 2- > "split/Indels per cycle.tab" ; fi && 108 echo "# Indels per cycle. The columns are: cycle, number of insertions (fwd), .. (rev) , number of deletions (fwd), .. (rev)" > "split/Indels per cycle.tab" &&
78 #end if 109 grep -q ^IC "${output}" ; if [ $? = 0 ] ; then grep ^IC "${output}" | cut -f 2- >> "split/Indels per cycle.tab" ; fi &&
110 #end if
111
79 #if 'cov' in $outputs_to_split: 112 #if 'cov' in $outputs_to_split:
80 grep -q ^COV "${output}" ; if [ $? = 0 ] ; then grep ^COV "${output}" | cut -f 2- > "split/Coverage distribution.tab" ; fi && 113 echo "# Coverage distribution" > "split/Coverage distribution.tab" &&
81 #end if 114 grep -q ^COV "${output}" ; if [ $? = 0 ] ; then grep ^COV "${output}" | cut -f 2- >> "split/Coverage distribution.tab" ; fi &&
115 #end if
116
82 #if 'gcd' in $outputs_to_split: 117 #if 'gcd' in $outputs_to_split:
83 grep -q ^GCD "${output}" ; if [ $? = 0 ] ; then grep ^GCD "${output}" | cut -f 2- > "split/GC depth.tab" ; fi 118 echo "# GC-depth. The columns are: GC%, unique sequence percentiles, 10th, 25th, 50th, 75th and 90th depth percentile" > "split/GC depth.tab" &&
84 #end if 119 grep -q ^GCD "${output}" ; if [ $? = 0 ] ; then grep ^GCD "${output}" | cut -f 2- >> "split/GC depth.tab" ; fi &&
120 #end if
121
122 ## Unix true command below
123
124 true
125
85 #end if 126 #end if
86 ]]></command> 127 ]]></command>
87 <stdio>
88 <exit_code range="1:" level="fatal" description="Error" />
89 </stdio>
90 <inputs> 128 <inputs>
91 <param name="input_file" type="data" format="sam,bam" label="BAM file" /> 129 <param name="input_file" type="data" format="sam,bam" label="BAM file" />
92 <param name="coverage_min" type="integer" value="1" label="Minimum coverage" /> 130 <param name="coverage_min" type="integer" value="1" label="Minimum coverage" help="minimum coverage value for --coverage option"/>
93 <param name="coverage_max" type="integer" value="1000" label="Maximum coverage" /> 131 <param name="coverage_max" type="integer" value="1000" label="Maximum coverage" help="maximum coverage value for --coverage option"/>
94 <param name="coverage_step" type="integer" value="1" label="Coverage step" /> 132 <param name="coverage_step" type="integer" value="1" label="Coverage step" help="step value for --coverage option"/>
95 <param name="remove_dups" type="boolean" truevalue="--remove-dups" falsevalue="" checked="False" label="Exclude reads marked as duplicates" /> 133 <param name="remove_dups" type="boolean" truevalue="--remove-dups" falsevalue="" checked="False" label="Exclude reads marked as duplicates" help="--remove-dups; default = False"/>
96 <conditional name="split_output"> 134 <conditional name="split_output">
97 <param name="split_output_selector" type="select" label="Output"> 135 <param name="split_output_selector" type="select" label="Output" help="Select between a single output or separate outputs for each statistics">
98 <option value="no" selected="True">Output to a summary file</option> 136 <option value="no" selected="True">a single summary file</option>
99 <option value="yes">Extract separate statistics</option> 137 <option value="yes">separate datasets for each statistics</option>
100 </param> 138 </param>
101 <when value="no" /> 139 <when value="no" />
102 <when value="yes"> 140 <when value="yes">
103 <param name="generate_tables" type="select" display="checkboxes" multiple="True" label="Statistics to extract"> 141 <param name="generate_tables" type="select" display="checkboxes" multiple="True" label="Statistics to extract">
104 <option value="sn">Summary numbers</option> 142 <option value="sn">Summary numbers</option>
116 <option value="gcd">GC depth</option> 154 <option value="gcd">GC depth</option>
117 </param> 155 </param>
118 </when> 156 </when>
119 </conditional> 157 </conditional>
120 <conditional name="filter_by_flags"> 158 <conditional name="filter_by_flags">
121 <param name="filter_flags" type="select" label="Set filter by flags"> 159 <param name="filter_flags" type="select" label="Set filter by flags" help="-f and -F options">
122 <option value="nofilter" selected="True">Do not filter</option> 160 <option value="nofilter" selected="True">Do not filter</option>
123 <option value="filter">Filter by flags to exclude or require</option> 161 <option value="filter">Filter by flags to exclude or require</option>
124 </param> 162 </param>
125 <when value="filter"> 163 <when value="filter">
126 <param name="require_flags" type="select" display="checkboxes" multiple="True" label="Require"> 164 <param name="require_flags" type="select" display="checkboxes" multiple="True" label="Require" help="-f">
127 <option value="1">Read is paired</option> 165 <option value="1">Read is paired</option>
128 <option value="2">Read is mapped in a proper pair</option> 166 <option value="2">Read is mapped in a proper pair</option>
129 <option value="4">The read is unmapped</option> 167 <option value="4">The read is unmapped</option>
130 <option value="8">The mate is unmapped</option> 168 <option value="8">The mate is unmapped</option>
131 <option value="16">Read strand</option> 169 <option value="16">Read strand</option>
134 <option value="128">Read is the second in a pair</option> 172 <option value="128">Read is the second in a pair</option>
135 <option value="256">The alignment or this read is not primary</option> 173 <option value="256">The alignment or this read is not primary</option>
136 <option value="512">The read fails platform/vendor quality checks</option> 174 <option value="512">The read fails platform/vendor quality checks</option>
137 <option value="1024">The read is a PCR or optical duplicate</option> 175 <option value="1024">The read is a PCR or optical duplicate</option>
138 </param> 176 </param>
139 <param name="exclude_flags" type="select" display="checkboxes" multiple="True" label="Exclude"> 177 <param name="exclude_flags" type="select" display="checkboxes" multiple="True" label="Exclude" help="-F">
140 <option value="1">Read is paired</option> 178 <option value="1">Read is paired</option>
141 <option value="2">Read is mapped in a proper pair</option> 179 <option value="2">Read is mapped in a proper pair</option>
142 <option value="4">The read is unmapped</option> 180 <option value="4">The read is unmapped</option>
143 <option value="8">The mate is unmapped</option> 181 <option value="8">The mate is unmapped</option>
144 <option value="16">Read strand</option> 182 <option value="16">Read strand</option>
149 <option value="512">The read fails platform/vendor quality checks</option> 187 <option value="512">The read fails platform/vendor quality checks</option>
150 <option value="1024">The read is a PCR or optical duplicate</option> 188 <option value="1024">The read is a PCR or optical duplicate</option>
151 </param> 189 </param>
152 </when> 190 </when>
153 <when value="nofilter" /> 191 <when value="nofilter" />
192
154 </conditional> 193 </conditional>
155 <param name="gc_depth" type="float" value="2000" label="GC-depth bin size" /> 194 <param name="gc_depth" type="float" value="20000" label="GC-depth bin size" help="--GC-depth; decreasing bin size increases memory requirement; default = 20000.0"/>
156 <param name="insert_size" type="integer" value="8000" label="Maximum insert size" /> 195 <param name="insert_size" type="integer" value="8000" label="Maximum insert size" help="--insert-size; default = 8000"/>
157 <param name="read_group" type="text" optional="true" label="Limit to a specific read group name" /> 196
158 <param name="read_length" type="integer" value="0" optional="true" label="Minimum read length to generate statistics for" /> 197 <!--
159 <param name="most_inserts" type="float" value="0.99" label="Report only the main part of inserts" /> 198
160 <param name="trim_quality" type="integer" value="0" label="BWA trim parameter" /> 199 The -I option of samtools stats returns the following message in version 1.2:
200
201 Samtools-htslib: init_group_id() header parsing not yet implemented
202 Abort trap: 6
203
204 Because of this the section below is commented out until this stats bug is fixed
205
206 <param name="read_group" type="select" optional="true" label="Limit to a specific read group name" >
207 <options>
208 <filter type="data_meta" ref="input_file" key="read_groups" />
209 </options>
210 </param>
211
212 -->
213
214 <param name="read_length" type="integer" value="0" label="Minimum read length to generate statistics for" help="--read-length; default = no cutoff"/>
215 <param name="most_inserts" type="float" value="0.99" label="Report only the main part of inserts" help="--most-inserts; default = 0.99"/>
216 <param name="trim_quality" type="integer" value="0" label="BWA trim parameter" help="--trim-quality; default = 0"/>
217
161 <conditional name="use_reference"> 218 <conditional name="use_reference">
162 <param name="use_ref_selector" type="select" label="Use reference sequence"> 219 <param name="use_ref_selector" type="select" label="Use reference sequence" help="--ref-seq; required for GC-depth and mismatches-per-cycle calculation">
163 <option value="yes">Use reference</option> 220 <option value="yes">Use reference</option>
164 <option value="no">Do not use reference</option> 221 <option selected="True" value="no">Do not use reference</option>
165 </param> 222 </param>
166 <when value="yes"> 223 <when value="yes">
167 <conditional name="reference_source"> 224 <conditional name="reference_source">
168 <param name="reference_source_selector" type="select" label="Choose a reference sequence for GC depth"> 225 <param name="reference_source_selector" type="select" label="Choose a reference sequence for GC depth">
169 <option value="cached">Locally cached</option> 226 <option value="cached">Locally cached</option>
180 </when> 237 </when>
181 </conditional> 238 </conditional>
182 </when> 239 </when>
183 <when value="no" /> 240 <when value="no" />
184 </conditional> 241 </conditional>
242
185 </inputs> 243 </inputs>
244
186 <outputs> 245 <outputs>
187 <data format="tabular" name="output" label="${tool.name} on ${on_string}"> 246 <data format="tabular" name="output" label="${tool.name} on ${on_string}">
188 <discover_datasets pattern="(?P&lt;designation&gt;.+)\.tab" ext="tabular" visible="true" directory="split" /> 247 <discover_datasets pattern="(?P&lt;designation&gt;.+)\.tab" ext="tabular" visible="true" directory="split" />
189 </data> 248 </data>
190 </outputs> 249 </outputs>
191 <tests> 250 <tests>
192 <test> 251 <test>
193 <param name="input_file" value="phiX.bam" ftype="bam" /> 252 <param name="input_file" value="samtools_stats_input.bam" ftype="bam" />
194 <param name="use_ref_selector" value="no" /> 253 <param name="use_ref_selector" value="yes" />
195 <output name="output" file="samtools_stats_out1.tab" ftype="tabular" lines_diff="2" /> 254 <param name="reference_source_selector" value="history" />
255 <param name="ref_file" value="samtools_stats_ref.fa" ftype="fasta" />
256 <output name="output" file="samtools_stats_out1.tab" ftype="tabular" lines_diff="4" />
196 </test> 257 </test>
197 <test> 258 <test>
198 <param name="input_file" value="phiX.bam" ftype="bam" /> 259 <param name="input_file" value="samtools_stats_input.bam" ftype="bam" />
199 <param name="use_ref_selector" value="no" /> 260 <param name="use_ref_selector" value="yes" />
261 <param name="reference_source_selector" value="history" />
262 <param name="ref_file" value="samtools_stats_ref.fa" ftype="fasta" />
200 <param name="split_output_selector" value="yes" /> 263 <param name="split_output_selector" value="yes" />
201 <param name="generate_tables" value="sn,gcf,gcl,gcc,cov,gcd" /> 264 <param name="generate_tables" value="sn,mpc,gcc" />
202 <output name="output" file="samtools_stats_out2.tab" lines_diff="2"> 265 <output name="output" file="samtools_stats_out2.tab" lines_diff="4">
203 <discovered_dataset designation="Summary numbers" ftype="tabular" file="samtools_stats_out2/sn.tab" /> 266 <discovered_dataset designation="Summary numbers" ftype="tabular" file="samtools_stats_out2/sn.tab" />
204 <discovered_dataset designation="GC Content of first fragments" ftype="tabular" file="samtools_stats_out2/gcf.tab" />
205 <discovered_dataset designation="GC Content of last fragments" ftype="tabular" file="samtools_stats_out2/gcl.tab" />
206 <discovered_dataset designation="ACGT content per cycle" ftype="tabular" file="samtools_stats_out2/gcc.tab" /> 267 <discovered_dataset designation="ACGT content per cycle" ftype="tabular" file="samtools_stats_out2/gcc.tab" />
207 <discovered_dataset designation="Coverage distribution" ftype="tabular" file="samtools_stats_out2/cov.tab" /> 268 <discovered_dataset designation="Mismatches per cycle" ftype="tabular" file="samtools_stats_out2/mpc.tab" />
208 <discovered_dataset designation="GC depth" ftype="tabular" file="samtools_stats_out2/gcd.tab" />
209 </output> 269 </output>
210 </test> 270 </test>
211 </tests> 271 </tests>
212 <help> 272 <help><![CDATA[
213 **What it does** 273 **What it does**
214 274
215 This tool runs the ``samtools stats`` command in the SAMtools toolkit. 275 This tool runs the ``samtools stats`` command. It has the following options::
216 276
217 Collects statistics from BAM files. The output can be visualized using plot-bamstats. 277 -c, --coverage <int>,<int>,<int> Coverage distribution min,max,step [1,1000,1]
218 278 -d, --remove-dups Exclude from statistics reads marked as duplicates
219 **Citation** 279 -f, --required-flag <str|int> Required flag, 0 for unset. See also `samtools flags` [0]
220 280 -F, --filtering-flag <str|int> Filtering flag, 0 for unset. See also `samtools flags` [0]
221 For the underlying tool, please cite `Li H, Handsaker B, Wysoker A, Fennell T, Ruan J, Homer N, Marth G, Abecasis G, Durbin R; 1000 Genome Project Data Processing Subgroup. The Sequence Alignment/Map format and SAMtools. Bioinformatics. 2009 Aug 15;25(16):2078-9. &lt;http://www.ncbi.nlm.nih.gov/pubmed/19505943&gt;`_ 281 --GC-depth <float> the size of GC-depth bins (decreasing bin size increases memory requirement) [2e4]
222 282 -h, --help This help message
223 283 -i, --insert-size <int> Maximum insert size [8000]
224 If you use this tool in Galaxy, please cite Blankenberg D, et al. *In preparation.* 284 -I, --id <string> Include only listed read group or sample name
225 </help> 285 -l, --read-length <int> Include in the statistics only reads with the given read length []
286 -m, --most-inserts <float> Report only the main part of inserts [0.99]
287 -q, --trim-quality <int> The BWA trimming parameter [0]
288 -r, --ref-seq <file> Reference sequence (required for GC-depth and mismatches-per-cycle calculation). Galaxy
289 will provide options for selecting a reference cached as this Galaxy instance or choosing
290 one from history.
291
292
293 ]]></help>
294 <expand macro="citations"></expand>
226 </tool> 295 </tool>
227 296