comparison samtools_stats/samtools_stats.xml @ 0:a115324acff0 draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tool_collections/samtools commit 17bfa0739bf7c72cf92de0d7013437dff2bbba7f-dirty
author matthias
date Fri, 22 Feb 2019 16:05:18 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:a115324acff0
1 <tool id="samtools_stats" name="Samtools stats" version="2.0.2+galaxy1">
2 <description>generate statistics for BAM dataset</description>
3 <macros>
4 <import>macros.xml</import>
5 </macros>
6 <expand macro="requirements">
7 <requirement type="package" version="5.2.3">gnuplot</requirement>
8 <requirement type="package" version="5.26">perl</requirement>
9 </expand>
10 <expand macro="stdio"/>
11 <expand macro="version_command"/>
12 <command><![CDATA[
13 @ADDTHREADS@
14 @PREPARE_IDX@
15 @PREPARE_FASTA_IDX@
16 samtools stats
17 #if $coverage_cond.coverage_select == 'yes':
18 --coverage ${coverage_cond.coverage_min},${coverage_cond.coverage_max},${coverage_cond.coverage_step}
19 #end if
20 ${remove_dups}
21 #if str( $filter_by_flags.filter_flags ) == "filter":
22 #if $filter_by_flags.require_flags:
23 #set $filter = $filter_by_flags.require_flags
24 @FLAGS@
25 --required-flag $flags
26 #end if
27 #if $filter_by_flags.exclude_flags:
28 #set $filter = $filter_by_flags.exclude_flags
29 @FLAGS@
30 --filtering-flag $flags
31 #end if
32 #end if
33 #if str($gc_depth):
34 --GC-depth ${gc_depth}
35 #end if
36 #if str($insert_size):
37 --insert-size ${insert_size}
38 #end if
39 ## The code below is commented out because using -I/--id options causes
40 ## in samtools up to 1.9 the following exception
41 ## Samtools-htslib: init_group_id() header parsing not yet implemented
42 ##if str($read_group) != "":
43 ## -I "${read_group}"
44 ##end if
45 #if str($read_length):
46 --read-length ${read_length}
47 #end if
48 #if str($most_inserts):
49 --most-inserts ${most_inserts}
50 #end if
51 #if str($trim_quality):
52 --trim-quality ${trim_quality}
53 #end if
54
55 #if $reffa != None:
56 --ref-seq '$reffa'
57 #end if
58 ## TODO currently not implemented in Galaxy
59 ## generates STR_VALUE.bamstat where STR is given by -P and VALUE is a value of the TAG given by -S
60 ## needs some discover data sets action...
61 ## -P, --split-prefix STR
62 ## -S, --split TAG
63 $sparse
64 @REGIONS_FILE@
65 $remove_overlaps
66 #if str($cov_threshold):
67 -g $cov_threshold
68 #end if
69 -@ \$addthreads
70 infile
71 @REGIONS_MANUAL@
72 > '$output'
73
74 #if $cond_plot.select_plot=='yes':
75 && plot-bamstats '$output' $cond_plot.log -p '${html_file.files_path}'/
76 && mv '${html_file.files_path}'/index.html '${html_file}'
77 #end if
78
79 #if $split_output_cond.split_output_selector == "yes":
80 #set outputs_to_split = str($split_output_cond.generate_tables).split(',')
81 && mkdir split
82 #for s in str($split_output_cond.generate_tables).split(','):
83 && name=`cat '$output' | grep '\^$s' | cut -d'.' -f 1 | sed 's/^# //'`
84 && awk '/\^/{out=0} /\^$s/{out=1} {if(out==1){print $0}}' '$output' | sed 's/Use `grep .*` to extract this part.//' | sed 's/$s\t//' > "split/\$name.tab"
85 #end for
86 #end if
87 ]]></command>
88 <inputs>
89 <param name="input" type="data" format="sam,bam,cram" label="BAM file" />
90 <conditional name="coverage_cond">
91 <param name="coverage_select" type="select" label="Set coverage distribution">
92 <option value="no" selected="True">No</option>
93 <option value="yes">Yes</option>
94 </param>
95 <when value="no"/>
96 <when value="yes">
97 <param name="coverage_min" type="integer" value="1" label="Minimum coverage" help="Minimum coverage" />
98 <param name="coverage_max" type="integer" value="1000" label="Maximum coverage" help="Maximum coverage" />
99 <param name="coverage_step" type="integer" value="1" label="Coverage step" help="Step value for coverage" />
100 </when>
101 </conditional>
102 <param name="remove_dups" argument="--remove-dups" type="boolean" truevalue="--remove-dups" falsevalue="" checked="False" label="Exclude reads marked as duplicates" />
103 <conditional name="split_output_cond">
104 <param name="split_output_selector" type="select" label="Output" help="Select between one single output or separate outputs for each statistics">
105 <option value="no" selected="True">One single summary file</option>
106 <option value="yes">Separate datasets for each statistic</option>
107 </param>
108 <when value="no" />
109 <when value="yes">
110 <param name="generate_tables" type="select" display="checkboxes" multiple="True" label="Desired output files">
111 <option value="SN">Summary numbers</option>
112 <option value="FFQ">First Fragment Qualities</option>
113 <option value="LFQ">Last Fragment Qualities</option>
114 <option value="MPC">Mismatches per cycle</option>
115 <option value="GCF">GC Content of first fragments</option>
116 <option value="GCL">GC Content of last fragments</option>
117 <option value="GCC">ACGT content per cycle</option>
118 <option value="FBC">ACGT content per cycle for first fragments</option>
119 <option value="LBC">ACGT content per cycle for last fragments</option>
120 <option value="IS">Insert sizes</option>
121 <option value="RL">Read lengths</option>
122 <option value="FRL">Read lengths for first fragments</option>
123 <option value="LRL">Read lengths for last fragments</option>
124 <option value="ID">Indel distribution</option>
125 <option value="IC">Indels per cycle</option>
126 <option value="COV">Coverage distribution</option>
127 <option value="GCD">GC depth</option>
128 </param>
129 </when>
130 </conditional>
131 <conditional name="filter_by_flags">
132 <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">
133 <option value="nofilter" selected="True">Do not filter</option>
134 <option value="filter">Filter by flags to exclude or require</option>
135 </param>
136 <when value="filter">
137 <param name="require_flags" argument="-f" type="select" display="checkboxes" multiple="True" label="Require">
138 <expand macro="flag_options" />
139 </param>
140 <param name="exclude_flags" argument="-F" type="select" display="checkboxes" multiple="True" label="Exclude">
141 <expand macro="flag_options" />
142 </param>
143 </when>
144 <when value="nofilter" />
145
146 </conditional>
147 <!-- TODO I would like to set the default values of float and int parameters as on the samtools stats help page, but then the tests don't work. Hence I leave the optional and give the defaults in the help -->
148 <param name="gc_depth" argument="--GC-depth" type="float" optional="True" label="Size of GC-depth bins" help="Decreasing bin size increases memory requirement. default=2e4" />
149 <param name="insert_size" argument="--insert-size" type="integer" optional="True" label="Maximum insert size" help="default=8000" />
150 <!--
151 The -I option of samtools stats returns the following message up to version 1.9:
152 Samtools-htslib: init_group_id() header parsing not yet implemented
153 Because of this the section below is commented out until this stats bug is fixed
154 <param name="read_group" type="select" optional="true" label="Limit to a specific read group name" >
155 <options>
156 <filter type="data_meta" ref="input" key="read_groups" />
157 </options>
158 </param>
159 -->
160 <param name="read_length" argument="--read-length" type="integer" optional="true" label="Minimum read length to generate statistics for" help="No cutoff if left empty" />
161 <param name="most_inserts" argument="--most-inserts" type="float" optional="true" label="Report only the main part of inserts" help="default=0.99" />
162 <param name="trim_quality" argument="--trim-quality" type="integer" optional="true" label="BWA trim parameter" help="default=0" />
163
164 <conditional name="addref_cond">
165 <param name="addref_select" type="select" label="Use a reference sequence" help="Required for GC-depth and mismatches-per-cycle calculation">
166 <option value="no">No</option>
167 <option value="cached">Locally cached</option>
168 <option value="history">History</option>
169 </param>
170 <when value="no"/>
171 <when value="cached">
172 <param name="ref" type="select" label="Using genome">
173 <options from_data_table="fasta_indexes">
174 <filter type="data_meta" ref="input" key="dbkey" column="1" />
175 </options>
176 </param>
177 </when>
178 <when value="history">
179 <param name="ref" type="data" format="fasta" label="Using file" />
180 </when>
181 </conditional>
182 <!-- unfortunately -t takes tabular and not bed like view (otherwise a macro might have simplified this) -->
183
184 <expand macro="regions_macro"/>
185
186 <param name="sparse" argument="-x/--sparse" type="boolean" truevalue="-x" falsevalue="" checked="False" label="Suppress absence of insertions" help="Suppress outputting IS rows where there are no insertions."/>
187 <param name="remove_overlaps" argument="-p/--remove-overlaps" type="boolean" truevalue="-p" falsevalue="" checked="False" label="Remove overlaps of paired-end reads from coverage and base count computations" />
188 <param name="cov_threshold" argument="-g/--cov-threshold" optional="true" type="integer" label="Only bases with coverage above this value will be included in the target percentage computation" />
189 <conditional name="cond_plot">
190 <param name="select_plot" type="select" label="Generate plots with plot-bamstats">
191 <option value="no" selected="True">No</option>
192 <option value="yes">Yes</option>
193 </param>
194 <when value="no"/>
195 <when value="yes">
196 <param name="log" argument="-l/--log-y" type="boolean" truevalue="-l" falsevalue="" checked="False" label="log scale insert size plot" help="Set the Y axis scale of the Insert Size plot to log 10"/>
197 </when>
198 </conditional>
199 </inputs>
200
201 <outputs>
202 <data name="output" format="tabular" label="${tool.name} on ${on_string}">
203 <discover_datasets directory="split" pattern="(?P&lt;designation&gt;.+)\.tab" format="tabular" visible="true" assign_primary_output="true"/>
204 <filter>split_output_cond['split_output_selector'] == 'no'</filter>
205 </data>
206 <collection name="output_collection" type="list" label="${tool.name} on ${on_string}">
207 <discover_datasets directory="split" pattern="(?P&lt;designation&gt;.+)\.tab" format="tabular" visible="false"/>
208 <filter>split_output_cond['split_output_selector'] == 'yes'</filter>
209 </collection>
210 <data format="html" name="html_file" label="${tool.name} on ${on_string}: plot-bamstats">
211 <filter>cond_plot['select_plot']=='yes'</filter>
212 </data>
213 </outputs>
214 <tests>
215 <!-- https://github.com/samtools/samtools/blob/9ce8c64493f7ea3fa69bc5c1ac980b1a8e3dcf1f/test/test.pl#L2402 -->
216 <test>
217 <param name="input" value="1_map_cigar.sam" ftype="sam" />
218 <conditional name="addref_cond">
219 <param name="addref_select" value="history" />
220 <param name="ref" value="test.fa" ftype="fasta" />
221 </conditional>
222 <output name="output" file="1.stats.expected" ftype="tabular" lines_diff="3" />
223 </test>
224 <!-- test_cmd($opts,out=>'stat/1.stats.expected',cmd=>"$$opts{bin}/samtools stats -r $$opts{path}/stat/test.fa $$opts{path}/stat/1_map_cigar.sam | tail -n+4", exp_fix=>$efix);-->
225 <test>
226 <param name="input" value="2_equal_cigar_full_seq.sam" ftype="sam" />
227 <conditional name="addref_cond">
228 <param name="addref_select" value="history" />
229 <param name="ref" value="test.fa" ftype="fasta" />
230 </conditional>
231 <output name="output" file="2.stats.expected" ftype="tabular" lines_diff="3" />
232 </test>
233 <!-- test_cmd($opts,out=>'stat/2.stats.expected',cmd=>"$$opts{bin}/samtools stats -r $$opts{path}/stat/test.fa $$opts{path}/stat/2_equal_cigar_full_seq.sam | tail -n+4", exp_fix=>$efix);-->
234 <!-- test_cmd($opts,out=>'stat/3.stats.expected',cmd=>"$$opts{bin}/samtools stats -r $$opts{path}/stat/test.fa $$opts{path}/stat/3_map_cigar_equal_seq.sam | tail -n+4", exp_fix=>$efix);-->
235 <!-- test_cmd($opts,out=>'stat/4.stats.expected',cmd=>"$$opts{bin}/samtools stats -r $$opts{path}/stat/test.fa $$opts{path}/stat/4_X_cigar_full_seq.sam | tail -n+4", exp_fix=>$efix);-->
236 <!-- test_cmd($opts,out=>'stat/5.stats.expected',cmd=>"$$opts{bin}/samtools stats -r $$opts{path}/stat/test.fa $$opts{path}/stat/5_insert_cigar.sam | tail -n+4", exp_fix=>$efix); -->
237 <test>
238 <param name="input" value="5_insert_cigar.sam" ftype="sam" />
239 <param name="insert_size" value="0" />
240 <conditional name="addref_cond">
241 <param name="addref_select" value="history" />
242 <param name="ref" value="test.fa" ftype="fasta" />
243 </conditional>
244 <output name="output" file="6.stats.expected" ftype="tabular" lines_diff="3" />
245 </test>
246 <!-- test_cmd($opts,out=>'stat/6.stats.expected',cmd=>"$$opts{bin}/samtools stats -r $$opts{path}/stat/test.fa -i 0 $$opts{path}/stat/5_insert_cigar.sam | tail -n+4", exp_fix=>$efix); -->
247 <!-- test_cmd($opts,out=>'stat/7.stats.expected',cmd=>"$$opts{bin}/samtools stats -r $$opts{path}/stat/test.fa $$opts{path}/stat/7_supp.sam | tail -n+4", exp_fix=>$efix); -->
248 <!-- test_cmd($opts,out=>'stat/8.stats.expected',cmd=>"$$opts{bin}/samtools stats -r $$opts{path}/stat/test.fa $$opts{path}/stat/8_secondary.sam | tail -n+4", exp_fix=>$efix);-->
249 <!-- test_cmd($opts,out=>'stat/9.stats.expected',cmd=>"$$opts{bin}/samtools stats -S RG -r $$opts{path}/stat/test.fa $$opts{path}/stat/1_map_cigar.sam | tail -n+4", exp_fix=>$efix,out_map=>{"stat/1_map_cigar.sam_s1_a_1.bamstat"=>"stat/1_map_cigar.sam_s1_a_1.expected.bamstat"},hskip=>3);-->
250 <!-- test_cmd($opts,out=>'stat/10.stats.expected',cmd=>"$$opts{bin}/samtools stats -S RG -r $$opts{path}/stat/test.fa $$opts{path}/stat/10_map_cigar.sam | tail -n+4", exp_fix=>$efix,out_map=>{"stat/10_map_cigar.sam_s1_a_1.bamstat"=>"stat/10_map_cigar.sam_s1_a_1.expected.bamstat", "stat/10_map_cigar.sam_s1_b_1.bamstat"=>"stat/10_map_cigar.sam_s1_b_1.expected.bamstat"},hskip=>3);-->
251 <test>
252 <param name="input" value="11_target.sam" ftype="sam" />
253 <conditional name="addref_cond">
254 <param name="addref_select" value="no" />
255 </conditional>
256 <conditional name="cond_region">
257 <param name="select_region" value="tab"/>
258 <param name="targetregions" value="11.stats.targets" ftype="tabular" />
259 </conditional>
260 <output name="output" file="11.stats.expected" ftype="tabular" lines_diff="3" />
261 </test>
262 <!-- test_cmd($opts,out=>'stat/11.stats.expected',cmd=>"$$opts{bin}/samtools stats -t $$opts{path}/stat/11.stats.targets $$opts{path}/stat/11_target.sam | tail -n+4", exp_fix=>$efix); -->
263
264 <test>
265 <param name="input" value="11_target.bam" ftype="bam" />
266 <conditional name="addref_cond">
267 <param name="addref_select" value="no" />
268 </conditional>
269 <conditional name="cond_region">
270 <param name="select_region" value="text"/>
271 <param name="regions_repeat_0|region" value="ref1:10-24"/>
272 <param name="regions_repeat_1|region" value="ref1:30-46"/>
273 <param name="regions_repeat_2|region" value="ref1:39-56"/>
274 </conditional>
275 <output name="output" file="11.stats.expected" ftype="tabular" lines_diff="3" />
276 </test>
277 <!-- test_cmd($opts,out=>'stat/11.stats.expected',cmd=>"$$opts{bin}/samtools stats $$opts{path}/stat/11_target.bam ref1:10-24 ref1:30-46 ref1:39-56 | tail -n+4", exp_fix=>$efix);
278 -->
279 <test>
280 <param name="input" value="11_target.sam" ftype="sam" />
281 <conditional name="addref_cond">
282 <param name="addref_select" value="no" />
283 </conditional>
284 <conditional name="cond_region">
285 <param name="select_region" value="tab"/>
286 <param name="targetregions" value="11.stats.targets" ftype="tabular" />
287 </conditional>
288 <param name="cov_threshold" value="4" />
289 <output name="output" file="11.stats.g4.expected" ftype="tabular" lines_diff="3" />
290 </test>
291 <!-- test_cmd($opts,out=>'stat/11.stats.g4.expected',cmd=>"$$opts{bin}/samtools stats -g 4 -t $$opts{path}/stat/11.stats.targets $$opts{path}/stat/11_target.sam | tail -n+4", exp_fix=>$efix);-->
292 <test>
293 <param name="input" value="11_target.bam" ftype="bam" />
294 <conditional name="addref_cond">
295 <param name="addref_select" value="no" />
296 </conditional>
297 <conditional name="cond_region">
298 <param name="select_region" value="text"/>
299 <param name="regions_repeat_0|region" value="ref1:10-24"/>
300 <param name="regions_repeat_1|region" value="ref1:30-46"/>
301 <param name="regions_repeat_2|region" value="ref1:39-56"/>
302 </conditional>
303 <param name="cov_threshold" value="4" />
304 <output name="output" file="11.stats.g4.expected" ftype="tabular" lines_diff="3" />
305 </test>
306 <!-- test_cmd($opts,out=>'stat/11.stats.g4.expected',cmd=>"$$opts{bin}/samtools stats -g 4 $$opts{path}/stat/11_target.bam ref1:10-24 ref1:30-46 ref1:39-56 | tail -n+4", exp_fix=>$efix); -->
307 <test>
308 <param name="input" value="12_overlaps.bam" ftype="bam" />
309 <conditional name="addref_cond">
310 <param name="addref_select" value="no" />
311 </conditional>
312 <conditional name="cond_region">
313 <param name="select_region" value="tab"/>
314 <param name="targetregions" value="12_3reads.bed" ftype="tabular" />
315 </conditional>
316 <output name="output" file="12.3reads.overlap.expected" ftype="tabular" lines_diff="3" />
317 </test>
318 <!-- test_cmd($opts,out=>'stat/12.3reads.overlap.expected',cmd=>"$$opts{bin}/samtools stats $$opts{path}/stat/12_overlaps.bam -t $$opts{path}/stat/12_3reads.bed | tail -n+4", exp_fix=>$efix);-->
319 <test>
320 <param name="input" value="12_overlaps.bam" ftype="bam" />
321 <conditional name="addref_cond">
322 <param name="addref_select" value="no" />
323 </conditional>
324 <conditional name="cond_region">
325 <param name="select_region" value="tab"/>
326 <param name="targetregions" value="12_3reads.bed" ftype="tabular" />
327 </conditional>
328 <param name="remove_overlaps" value="-p"/>
329 <output name="output" file="12.3reads.nooverlap.expected" ftype="tabular" lines_diff="3" />
330 </test>
331 <!-- test_cmd($opts,out=>'stat/12.3reads.nooverlap.expected',cmd=>"$$opts{bin}/samtools stats $$opts{path}/stat/12_overlaps.bam -p -t $$opts{path}/stat/12_3reads.bed | tail -n+4", exp_fix=>$efix);-->
332 <test>
333 <param name="input" value="12_overlaps.bam" ftype="bam" />
334 <conditional name="addref_cond">
335 <param name="addref_select" value="no" />
336 </conditional>
337 <conditional name="cond_region">
338 <param name="select_region" value="tab"/>
339 <param name="targetregions" value="12_2reads.bed" ftype="tabular" />
340 </conditional>
341 <output name="output" file="12.2reads.overlap.expected" ftype="tabular" lines_diff="3" />
342 </test>
343 <!-- test_cmd($opts,out=>'stat/12.2reads.overlap.expected',cmd=>"$$opts{bin}/samtools stats $$opts{path}/stat/12_overlaps.bam -t $$opts{path}/stat/12_2reads.bed | tail -n+4", exp_fix=>$efix);-->
344 <test>
345 <param name="input" value="12_overlaps.bam" ftype="bam" />
346 <conditional name="addref_cond">
347 <param name="addref_select" value="no" />
348 </conditional>
349 <conditional name="cond_region">
350 <param name="select_region" value="tab"/>
351 <param name="targetregions" value="12_2reads.bed" ftype="tabular" />
352 </conditional>
353 <param name="remove_overlaps" value="-p"/>
354 <output name="output" file="12.2reads.nooverlap.expected" ftype="tabular" lines_diff="3" />
355 </test>
356 <!-- test_cmd($opts,out=>'stat/12.2reads.nooverlap.expected',cmd=>"$$opts{bin}/samtools stats $$opts{path}/stat/12_overlaps.bam -p -t $$opts{path}/stat/12_2reads.bed | tail -n+4", exp_fix=>$efix);-->
357 <test>
358 <param name="input" value="samtools_stats_input.bam" ftype="bam" />
359 <conditional name="addref_cond">
360 <param name="addref_select" value="history" />
361 <param name="ref" value="samtools_stats_ref.fa" ftype="fasta" />
362 </conditional>
363 <conditional name="cond_plot">
364 <param name="select_plot" value="yes"/>
365 </conditional>
366 <output name="output" file="samtools_stats_out1.tab" ftype="tabular" lines_diff="2" />
367 </test>
368 <test>
369 <param name="input" value="samtools_stats_input.bam" ftype="bam" />
370 <conditional name="addref_cond">
371 <param name="addref_select" value="history" />
372 <param name="ref" value="samtools_stats_ref.fa" ftype="fasta" />
373 </conditional>
374 <conditional name="split_output_cond">
375 <param name="split_output_selector" value="yes" />
376 <param name="generate_tables" value="SN,MPC,GCC" />
377 </conditional>
378 <output_collection name="output_collection" type="list">
379 <element name="ACGT content per cycle" ftype="tabular" file="samtools_stats_out1__gcc.tab"/>
380 <element name="Mismatches per cycle and quality" ftype="tabular" file="samtools_stats_out1__mpc.tab" />
381 <element name="Summary Numbers" ftype="tabular" file="samtools_stats_out1__sn.tab" />
382 </output_collection>
383 </test>
384 </tests>
385 <help><![CDATA[
386 **What it does**
387
388 This tool runs the ``samtools stats`` command.
389 ]]></help>
390 <expand macro="citations"/>
391 </tool>
392