comparison samtools_stats.xml @ 0:12bc610792b2 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/samtools/samtools_stats commit 22e524ec4416170792a8f8eb1bb283789fff2f61-dirty
author mvdbeek
date Tue, 25 Sep 2018 04:09:34 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:12bc610792b2
1 <tool id="samtools_stats" name="Stats" version="2.0.1">
2 <description>generate statistics for BAM dataset</description>
3 <macros>
4 <import>macros.xml</import>
5 </macros>
6 <expand macro="requirements"/>
7 <expand macro="stdio"/>
8 <expand macro="version_command"/>
9 <command><![CDATA[
10 #if $use_reference.use_ref_selector == "yes":
11 #if $use_reference.reference_source.reference_source_selector == "history":
12 ln -s '${use_reference.reference_source.ref_file}' &&
13 samtools faidx `basename '${use_reference.reference_source.ref_file}'` &&
14 #end if
15 #end if
16
17 samtools stats
18 '${input_file}'
19 --coverage ${coverage_min},${coverage_max},${coverage_step}
20 ${remove_dups}
21
22 #if str( $filter_by_flags.filter_flags ) == "filter":
23 #if $filter_by_flags.require_flags:
24 --required-flag ${sum([int(flag) for flag in str($filter_by_flags.require_flags).split(',')])}
25 #end if
26 #if $filter_by_flags.exclude_flags:
27 --filtering-flag ${sum([int(flag) for flag in str($filter_by_flags.exclude_flags).split(',')])}
28 #end if
29 #end if
30
31 --GC-depth ${gc_depth}
32 --insert-size ${insert_size}
33
34 ## The code below is commented out because using -I/--id options causes the following exception
35 ## Samtools-htslib: init_group_id() header parsing not yet implemented
36 ##if str($read_group) != "":
37 ## -I "${read_group}"
38 ##end if
39
40 #if str($read_length):
41 --read-length ${read_length}
42 #end if
43
44 --most-inserts ${most_inserts}
45 --trim-quality ${trim_quality}
46
47 #if $use_reference.use_ref_selector == "yes":
48 #if $use_reference.reference_source.reference_source_selector != "history":
49 --ref-seq '${use_reference.reference_source.ref_file.fields.path}'
50 #else:
51 --ref-seq '${use_reference.reference_source.ref_file}'
52 #end if
53 #end if
54 > '${output}'
55
56 #if $split_output.split_output_selector == "yes":
57 #set outputs_to_split = str($split_output.generate_tables).split(',')
58 && mkdir split &&
59 echo ${split_output.generate_tables}
60
61 #if 'sn' in $outputs_to_split:
62 && echo "# Summary Numbers" > 'split/Summary numbers.tab' &&
63 echo "" >> 'split/Summary numbers.tab' &&
64 if grep -q ^SN '${output}'; then
65 grep ^SN '${output}' | cut -f 2- >> 'split/Summary numbers.tab';
66 fi
67 #end if
68
69 #if 'ffq' in $outputs_to_split:
70 && echo "# Columns correspond to qualities and rows to cycles. First column is the cycle number\n" > 'split/First Fragment Qualities.tab' &&
71 if grep -q ^FFQ '${output}'; then
72 grep ^FFQ '${output}' | cut -f 2- >> 'split/First Fragment Qualities.tab';
73 fi
74 #end if
75
76 #if 'lfq' in $outputs_to_split:
77 && echo "# Columns correspond to qualities and rows to cycles. First column is the cycle number" > 'split/Last Fragment Qualities.tab' &&
78 if grep -q ^LFQ '${output}'; then
79 grep ^LFQ '${output}' | cut -f 2- >> 'split/Last Fragment Qualities.tab';
80 fi
81 #end if
82
83 #if 'mpc' in $outputs_to_split:
84 && 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' &&
85 if grep -q ^MPC '${output}'; then
86 grep ^MPC '${output}' | cut -f 2- >> 'split/Mismatches per cycle.tab';
87 fi
88 #end if
89
90 #if 'gcf' in $outputs_to_split:
91 && echo "# GC Content of first fragments" > 'split/GC Content of first fragments.tab' &&
92 if grep -q ^GCF '${output}'; then
93 grep ^GCF '${output}' | cut -f 2- >> 'split/GC Content of first fragments.tab';
94 fi
95 #end if
96
97 #if 'gcl' in $outputs_to_split:
98 && echo "# GC Content of last fragments" > 'split/GC Content of last fragments.tab' &&
99 if grep -q ^GCL '${output}'; then
100 grep ^GCL '${output}' | cut -f 2- >> 'split/GC Content of last fragments.tab';
101 fi
102 #end if
103
104 #if 'gcc' in $outputs_to_split:
105 && echo "# ACGT content per cycle. The columns are: cycle, and A,C,G,T counts (percent)" > 'split/ACGT content per cycle.tab' &&
106 if grep -q ^GCC '${output}'; then
107 grep ^GCC '${output}' | cut -f 2- >> 'split/ACGT content per cycle.tab';
108 fi
109 #end if
110
111 #if 'is' in $outputs_to_split:
112 && echo "# Insert sizes. The columns are: insert size, pairs total, inward oriented pairs, outward oriented pairs, other pairs" > 'split/Insert sizes.tab' &&
113 if grep -q ^IS '${output}'; then
114 grep ^IS '${output}' | cut -f 2- >> 'split/Insert sizes.tab';
115 fi
116 #end if
117
118 #if 'rl' in $outputs_to_split:
119 && echo "# Read lengths. The columns are: read length, count" > 'split/Read lengths.tab' &&
120 if grep -q ^RL '${output}'; then
121 grep ^RL '${output}' | cut -f 2- >> 'split/Read lengths.tab';
122 fi
123 #end if
124
125 #if 'id' in $outputs_to_split:
126 && echo "# Indel distribution. The columns are: length, number of insertions, number of deletions" > 'split/Indel distribution.tab' &&
127 if grep -q ^ID '${output}'; then
128 grep ^ID '${output}' | cut -f 2- >> 'split/Indel distribution.tab';
129 fi
130 #end if
131
132 #if 'ic' in $outputs_to_split:
133 && echo "# Indels per cycle. The columns are: cycle, number of insertions (fwd), .. (rev) , number of deletions (fwd), .. (rev)" > 'split/Indels per cycle.tab' &&
134 if grep -q ^IC '${output}'; then
135 grep ^IC '${output}' | cut -f 2- >> 'split/Indels per cycle.tab';
136 fi
137 #end if
138
139 #if 'cov' in $outputs_to_split:
140 && echo "# Coverage distribution" > 'split/Coverage distribution.tab' &&
141 if grep -q ^COV '${output}'; then
142 grep ^COV '${output}' | cut -f 2- >> 'split/Coverage distribution.tab';
143 fi
144 #end if
145
146 #if 'gcd' in $outputs_to_split:
147 && echo "# GC-depth. The columns are: GC%, unique sequence percentiles, 10th, 25th, 50th, 75th and 90th depth percentile" > 'split/GC depth.tab' &&
148 if grep -q ^GCD '${output}'; then
149 grep ^GCD '${output}' | cut -f 2- >> 'split/GC depth.tab';
150 fi
151 #end if
152 #end if
153 ]]></command>
154 <inputs>
155 <param name="input_file" type="data" format="sam,bam" label="BAM file" />
156 <param name="coverage_min" type="integer" value="1" label="Minimum coverage" help="Minimum coverage" />
157 <param name="coverage_max" type="integer" value="1000" label="Maximum coverage" help="Maximum coverage" />
158 <param name="coverage_step" type="integer" value="1" label="Coverage step" help="Step value for coverage" />
159 <param name="remove_dups" argument="--remove-dups" type="boolean" truevalue="--remove-dups" falsevalue="" checked="False"
160 label="Exclude reads marked as duplicates" />
161 <conditional name="split_output">
162 <param name="split_output_selector" type="select" label="Output" help="Select between one single output or separate outputs for each statistics">
163 <option value="no" selected="True">One single summary file</option>
164 <option value="yes">Separate datasets for each statistic</option>
165 </param>
166 <when value="no" />
167 <when value="yes">
168 <param name="generate_tables" type="select" display="checkboxes" multiple="True" label="Desired output files">
169 <option value="sn">Summary numbers</option>
170 <option value="ffq">First Fragment Qualities</option>
171 <option value="lfq">Last Fragment Qualities</option>
172 <option value="mpc">Mismatches per cycle</option>
173 <option value="gcf">GC Content of first fragments</option>
174 <option value="gcl">GC Content of last fragments</option>
175 <option value="gcc">ACGT content per cycle</option>
176 <option value="is">Insert sizes</option>
177 <option value="rl">Read lengths</option>
178 <option value="id">Indel distribution</option>
179 <option value="ic">Indels per cycle</option>
180 <option value="cov">Coverage distribution</option>
181 <option value="gcd">GC depth</option>
182 </param>
183 </when>
184 </conditional>
185 <conditional name="filter_by_flags">
186 <param name="filter_flags" type="select" label="Filter by SAM flags" help="More info on the flags: https://samtools.github.io/hts-specs/SAMv1.pdf">
187 <option value="nofilter" selected="True">Do not filter</option>
188 <option value="filter">Filter by flags to exclude or require</option>
189 </param>
190 <when value="filter">
191 <param name="require_flags" argument="-f" type="select" display="checkboxes" multiple="True" label="Require">
192 <option value="1">Read is paired</option>
193 <option value="2">Read is mapped in a proper pair</option>
194 <option value="4">The read is unmapped</option>
195 <option value="8">The mate is unmapped</option>
196 <option value="16">Read strand</option>
197 <option value="32">Mate strand</option>
198 <option value="64">Read is the first in a pair</option>
199 <option value="128">Read is the second in a pair</option>
200 <option value="256">The alignment or this read is not primary</option>
201 <option value="512">The read fails platform/vendor quality checks</option>
202 <option value="1024">The read is a PCR or optical duplicate</option>
203 </param>
204 <param name="exclude_flags" argument="-F" type="select" display="checkboxes" multiple="True" label="Exclude">
205 <option value="1">Read is paired</option>
206 <option value="2">Read is mapped in a proper pair</option>
207 <option value="4">The read is unmapped</option>
208 <option value="8">The mate is unmapped</option>
209 <option value="16">Read strand</option>
210 <option value="32">Mate strand</option>
211 <option value="64">Read is the first in a pair</option>
212 <option value="128">Read is the second in a pair</option>
213 <option value="256">The alignment or this read is not primary</option>
214 <option value="512">The read fails platform/vendor quality checks</option>
215 <option value="1024">The read is a PCR or optical duplicate</option>
216 </param>
217 </when>
218 <when value="nofilter" />
219
220 </conditional>
221 <param name="gc_depth" argument="--GC-depth" type="float" value="20000" label="Size of GC-depth bins" help="Decreasing bin size increases memory requirement" />
222 <param name="insert_size" argument="--insert-size" type="integer" value="8000" label="Maximum insert size" />
223 <!--
224
225 The -I option of samtools stats returns the following message in version 1.2:
226
227 Samtools-htslib: init_group_id() header parsing not yet implemented
228 Abort trap: 6
229
230 Because of this the section below is commented out until this stats bug is fixed
231
232 <param name="read_group" type="select" optional="true" label="Limit to a specific read group name" >
233 <options>
234 <filter type="data_meta" ref="input_file" key="read_groups" />
235 </options>
236 </param>
237
238 -->
239
240 <param name="read_length" argument="--read-length" type="integer" value="" optional="true" label="Minimum read length to generate statistics for" help="No cutoff if left empty"/>
241 <param name="most_inserts" argument="--most-inserts" type="float" value="0.99" label="Report only the main part of inserts" />
242 <param name="trim_quality" argument="--trim-quality" type="integer" value="0" label="BWA trim parameter" />
243
244 <conditional name="use_reference">
245 <param name="use_ref_selector" argument="--ref-seq" type="select" label="Use reference sequence" help="Required for GC-depth and mismatches-per-cycle calculation">
246 <option value="yes">Use reference</option>
247 <option selected="True" value="no">Do not use reference</option>
248 </param>
249 <when value="yes">
250 <conditional name="reference_source">
251 <param name="reference_source_selector" type="select" label="Choose a reference sequence for GC depth">
252 <option value="cached">Locally cached</option>
253 <option value="history">History</option>
254 </param>
255 <when value="cached">
256 <param name="ref_file" type="select" label="Using genome">
257 <options from_data_table="fasta_indexes">
258 <filter type="data_meta" ref="input_file" key="dbkey" column="1" />
259 </options>
260 </param>
261 </when>
262 <when value="history">
263 <param name="ref_file" type="data" format="fasta" label="Using file" />
264 </when>
265 </conditional>
266 </when>
267 <when value="no" />
268 </conditional>
269
270 </inputs>
271
272 <outputs>
273 <data name="output" format="tabular" label="${tool.name} on ${on_string}">
274 <discover_datasets pattern="(?P&lt;designation&gt;.+)\.tab" ext="tabular" visible="true" directory="split" />
275 </data>
276 </outputs>
277 <tests>
278 <test>
279 <param name="input_file" value="samtools_stats_input.bam" ftype="bam" />
280 <param name="use_ref_selector" value="yes" />
281 <param name="reference_source_selector" value="history" />
282 <param name="ref_file" value="samtools_stats_ref.fa" ftype="fasta" />
283 <output name="output" file="samtools_stats_out1.tab" ftype="tabular" lines_diff="4" />
284 </test>
285 <test>
286 <param name="input_file" value="samtools_stats_input.bam" ftype="bam" />
287 <param name="use_ref_selector" value="yes" />
288 <param name="reference_source_selector" value="history" />
289 <param name="ref_file" value="samtools_stats_ref.fa" ftype="fasta" />
290 <param name="split_output_selector" value="yes" />
291 <param name="generate_tables" value="sn,mpc,gcc" />
292 <output name="output" file="samtools_stats_out2.tab" lines_diff="4">
293 <discovered_dataset designation="Summary numbers" ftype="tabular" file="samtools_stats_out2__sn.tab" />
294 <discovered_dataset designation="ACGT content per cycle" ftype="tabular" file="samtools_stats_out2__gcc.tab" />
295 <discovered_dataset designation="Mismatches per cycle" ftype="tabular" file="samtools_stats_out2__mpc.tab" />
296 </output>
297 </test>
298 </tests>
299 <help><![CDATA[
300 **What it does**
301
302 This tool runs the ``samtools stats`` command.
303 ]]></help>
304 <expand macro="citations"/>
305 </tool>
306