comparison samtools_stats.xml @ 0:cd6eb75c9819 draft

Uploaded initial tool definition.
author devteam
date Mon, 20 Oct 2014 14:56:49 -0400
parents
children cc56fc603e53
comparison
equal deleted inserted replaced
-1:000000000000 0:cd6eb75c9819
1 <tool id="samtools_stats" name="Generate statistics" version="1.0.0">
2 <description>for a BAM or SAM file</description>
3 <requirements>
4 <requirement type="package" version="1.1">samtools</requirement>
5 </requirements>
6 <version_command>samtools --version | head -n 1 | awk '{ print $2 }'</version_command>
7 <command><![CDATA[
8 #if $use_reference.use_ref_selector == "yes":
9 #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
11 #else:
12 samtools stats
13 #end if
14 #else:
15 samtools stats
16 #end if
17 "${input_file}"
18 --coverage ${coverage_min},${coverage_max},${coverage_step}
19 ${remove_dups}
20 #if str( $filter_by_flags.filter_flags ) == "filter":
21 #if $filter_by_flags.require_flags:
22 --required-flag ${sum([int(flag) for flag in str($filter_by_flags.require_flags).split(',')])}
23 #end if
24 #if $filter_by_flags.exclude_flags:
25 --filtering-flag ${sum([int(flag) for flag in str($filter_by_flags.exclude_flags).split(',')])}
26 #end if
27 #end if
28 --GC-depth ${gc_depth}
29 --insert-size ${insert_size}
30 #if str($read_length) != "0":
31 --read-length "${read_length}"
32 #end if
33 --most-inserts ${most_inserts}
34 --trim-quality ${trim_quality}
35 #if $use_reference.use_ref_selector == "yes":
36 #if $use_reference.reference_source.reference_source_selector != "history":
37 --ref-seq "${use_reference.reference_source.ref_file.fields.path}"
38 #else:
39 --ref-seq "${use_reference.reference_source.ref_file}"
40 #end if
41 #end if
42 > "${output}"
43 #if $split_output.split_output_selector == "yes":
44 #set outputs_to_split = str($split_output.generate_tables).split(',')
45 && mkdir split && echo ${split_output.generate_tables} &&
46 #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 &&
48 #end if
49 #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 &&
51 #end if
52 #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 &&
54 #end if
55 #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 &&
57 #end if
58 #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 &&
60 #end if
61 #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 &&
63 #end if
64 #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 &&
66 #end if
67 #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 &&
69 #end if
70 #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 &&
72 #end if
73 #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 &&
75 #end if
76 #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 &&
78 #end if
79 #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 &&
81 #end if
82 #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
84 #end if
85 #end if
86 ]]></command>
87 <stdio>
88 <exit_code range="1:" level="fatal" description="Error" />
89 </stdio>
90 <inputs>
91 <param name="input_file" type="data" format="sam,bam" label="BAM file" />
92 <param name="coverage_min" type="integer" value="1" label="Minimum coverage" />
93 <param name="coverage_max" type="integer" value="1000" label="Maximum coverage" />
94 <param name="coverage_step" type="integer" value="1" label="Coverage step" />
95 <param name="remove_dups" type="boolean" truevalue="--remove-dups" falsevalue="" checked="False" label="Exclude reads marked as duplicates" />
96 <conditional name="split_output">
97 <param name="split_output_selector" type="select" label="Output">
98 <option value="no" selected="True">Output to a summary file</option>
99 <option value="yes">Extract separate statistics</option>
100 </param>
101 <when value="no" />
102 <when value="yes">
103 <param name="generate_tables" type="select" display="checkboxes" multiple="True" label="Statistics to extract">
104 <option value="sn">Summary numbers</option>
105 <option value="ffq">First Fragment Qualities</option>
106 <option value="lfq">Last Fragment Qualities</option>
107 <option value="mpc">Mismatches per cycle</option>
108 <option value="gcf">GC Content of first fragments</option>
109 <option value="gcl">GC Content of last fragments</option>
110 <option value="gcc">ACGT content per cycle</option>
111 <option value="is">Insert sizes</option>
112 <option value="rl">Read lengths</option>
113 <option value="id">Indel distribution</option>
114 <option value="ic">Indels per cycle</option>
115 <option value="cov">Coverage distribution</option>
116 <option value="gcd">GC depth</option>
117 </param>
118 </when>
119 </conditional>
120 <conditional name="filter_by_flags">
121 <param name="filter_flags" type="select" label="Set filter by flags">
122 <option value="nofilter" selected="True">Do not filter</option>
123 <option value="filter">Filter by flags to exclude or require</option>
124 </param>
125 <when value="filter">
126 <param name="require_flags" type="select" display="checkboxes" multiple="True" label="Require">
127 <option value="1">Read is paired</option>
128 <option value="2">Read is mapped in a proper pair</option>
129 <option value="4">The read is unmapped</option>
130 <option value="8">The mate is unmapped</option>
131 <option value="16">Read strand</option>
132 <option value="32">Mate strand</option>
133 <option value="64">Read is the first in a pair</option>
134 <option value="128">Read is the second in a pair</option>
135 <option value="256">The alignment or this read is not primary</option>
136 <option value="512">The read fails platform/vendor quality checks</option>
137 <option value="1024">The read is a PCR or optical duplicate</option>
138 </param>
139 <param name="exclude_flags" type="select" display="checkboxes" multiple="True" label="Exclude">
140 <option value="1">Read is paired</option>
141 <option value="2">Read is mapped in a proper pair</option>
142 <option value="4">The read is unmapped</option>
143 <option value="8">The mate is unmapped</option>
144 <option value="16">Read strand</option>
145 <option value="32">Mate strand</option>
146 <option value="64">Read is the first in a pair</option>
147 <option value="128">Read is the second in a pair</option>
148 <option value="256">The alignment or this read is not primary</option>
149 <option value="512">The read fails platform/vendor quality checks</option>
150 <option value="1024">The read is a PCR or optical duplicate</option>
151 </param>
152 </when>
153 <when value="nofilter" />
154 </conditional>
155 <param name="gc_depth" type="float" value="2000" label="GC-depth bin size" />
156 <param name="insert_size" type="integer" value="8000" label="Maximum insert size" />
157 <param name="read_group" type="text" optional="true" label="Limit to a specific read group name" />
158 <param name="read_length" type="integer" value="0" optional="true" label="Minimum read length to generate statistics for" />
159 <param name="most_inserts" type="float" value="0.99" label="Report only the main part of inserts" />
160 <param name="trim_quality" type="integer" value="0" label="BWA trim parameter" />
161 <conditional name="use_reference">
162 <param name="use_ref_selector" type="select" label="Use reference sequence">
163 <option value="yes">Use reference</option>
164 <option value="no">Do not use reference</option>
165 </param>
166 <when value="yes">
167 <conditional name="reference_source">
168 <param name="reference_source_selector" type="select" label="Choose a reference sequence for GC depth">
169 <option value="cached">Locally cached</option>
170 <option value="history">History</option>
171 </param>
172 <when value="cached">
173 <param name="ref_file" type="select" label="Using genome">
174 <options from_data_table="fasta_indexes" />
175 <filter type="data_meta" ref="input_file" key="dbkey" column="1" />
176 </param>
177 </when>
178 <when value="history">
179 <param name="ref_file" type="data" format="fasta" label="Using file" />
180 </when>
181 </conditional>
182 </when>
183 <when value="no" />
184 </conditional>
185 </inputs>
186 <outputs>
187 <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" />
189 </data>
190 </outputs>
191 <tests>
192 <test>
193 <param name="input_file" value="phiX.bam" ftype="bam" />
194 <param name="use_ref_selector" value="no" />
195 <output name="output" file="samtools_stats_out1.tab" ftype="tabular" lines_diff="2" />
196 </test>
197 <test>
198 <param name="input_file" value="phiX.bam" ftype="bam" />
199 <param name="use_ref_selector" value="no" />
200 <param name="split_output_selector" value="yes" />
201 <param name="generate_tables" value="sn,gcf,gcl,gcc,cov,gcd" />
202 <output name="output" file="samtools_stats_out2.tab" lines_diff="2">
203 <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" />
207 <discovered_dataset designation="Coverage distribution" ftype="tabular" file="samtools_stats_out2/cov.tab" />
208 <discovered_dataset designation="GC depth" ftype="tabular" file="samtools_stats_out2/gcd.tab" />
209 </output>
210 </test>
211 </tests>
212 <help>
213 **What it does**
214
215 This tool runs the ``samtools stats`` command in the SAMtools toolkit.
216
217 Collects statistics from BAM files. The output can be visualized using plot-bamstats.
218
219 **Citation**
220
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;`_
222
223
224 If you use this tool in Galaxy, please cite Blankenberg D, et al. *In preparation.*
225 </help>
226 </tool>
227