Mercurial > repos > iuc > mosdepth
comparison mosdepth.xml @ 0:b08cd2e5e61a draft default tip
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/mosdepth commit e1c7e5f10bb679ae9987bb63aece4b8b006d3b76
author | iuc |
---|---|
date | Mon, 31 Jul 2023 06:09:19 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:b08cd2e5e61a |
---|---|
1 <tool id="mosdepth" name="mosdepth" version="@TOOL_VERSION@+galaxy0" profile="21.05"> | |
2 <description>- fast and flexible depth coverage calculation</description> | |
3 <macros> | |
4 <xml name="bam_identifier"> | |
5 <!-- this is based on section 1.2.1 of the SAM/BAM specification https://samtools.github.io/hts-specs/SAMv1.pdf --> | |
6 <sanitizer invalid_char="'"> | |
7 <valid initial="string.ascii_letters,string.digits,string.punctuation"> | |
8 <remove value="{" /> | |
9 <remove value="}" /> | |
10 <remove value="=" /> | |
11 <remove value="*" /> | |
12 <remove value="`" /> | |
13 <remove value=")" /> | |
14 <remove value="<" /> | |
15 <remove value="'" /> | |
16 <remove value='"' /> | |
17 <remove value="(" /> | |
18 <remove value="\" /> | |
19 <remove value="[" /> | |
20 <remove value=">" /> | |
21 <remove value="]" /> | |
22 <remove value="," /> | |
23 <yield /> | |
24 </valid> | |
25 </sanitizer> | |
26 <validator type="regex">([0-9A-Za-z!#$%&+./:;?@^_|~-][0-9A-Za-z!#$%&*+./:;=?@^_|~-]*)?</validator> | |
27 </xml> | |
28 <token name="@TOOL_VERSION@">0.3.4</token> | |
29 </macros> | |
30 <requirements> | |
31 <requirement type="package" version="@TOOL_VERSION@">mosdepth</requirement> | |
32 <requirement type="package" version="1.12">gzip</requirement> | |
33 </requirements> | |
34 <command detect_errors="exit_code"><![CDATA[ | |
35 #if $advanced.options == "yes" and len($advanced.quantize) | |
36 #set $quantize_depths = [] | |
37 #for $i, $quant_group in enumerate($advanced.quantize) | |
38 #set $quantize_depths = $quantize_depths + [str ($quant_group.quant_group_mindepth)] | |
39 #set $quant_group_name = str($quant_group.quant_group_name) | |
40 export MOSDEPTH_Q${i}=$quant_group.quant_group_name && | |
41 #end for | |
42 #set $quant_groups_depths_str = ":".join($quantize_depths) + ':' | |
43 #end if | |
44 ln -s '$input_alignment' input_alignment && | |
45 #if $input_alignment.is_of_type('bam'): | |
46 ln -s '${input_alignment.metadata.bam_index}' input_alignment.bai && | |
47 #elif $input_alignment.is_of_type('cram'): | |
48 ln -s '${input_alignment.metadata.cram_index}' input_alignment.crai && | |
49 #end if | |
50 mosdepth -t \${GALAXY_SLOTS:-1} | |
51 #if $window.window_mode == 'window' | |
52 --by $window.window_size | |
53 #elif $window.window_mode == 'bed' | |
54 --by '$window.region_file' | |
55 #end if | |
56 $per_base_coverage | |
57 #if $advanced.options == "yes" | |
58 #if str($advanced.chrom) | |
59 --chrom '$advanced.chrom' | |
60 #end if | |
61 #if $advanced.exclude_flag | |
62 --flag $advanced.exclude_flag | |
63 #end if | |
64 #if $advanced.include_flag | |
65 --include-flag $advanced.include_flag | |
66 #end if | |
67 --mapq $advanced.mapq | |
68 $advanced.no_fast | |
69 #if str($advanced.thresholds) | |
70 --thresholds '$advanced.thresholds' | |
71 #end if | |
72 $advanced.use_median | |
73 #if str($advanced.read_groups) | |
74 --read-groups '$read_groups' | |
75 #end if | |
76 #if len($advanced.quantize) | |
77 --quantize '$quant_groups_depths_str' | |
78 #end if | |
79 #end if | |
80 output input_alignment | |
81 #if $per_base_coverage | |
82 && gunzip output.per-base.bed.gz | |
83 #end if | |
84 #if $window.window_mode == "bed" or $window.window_mode == "window" | |
85 && gunzip output.regions.bed.gz | |
86 #end if | |
87 #if $advanced.options == "yes" | |
88 #if str($advanced.thresholds) | |
89 && gunzip output.thresholds.bed.gz | |
90 #end if | |
91 #if len($advanced.quantize) | |
92 && gunzip output.quantized.bed.gz | |
93 #end if | |
94 #end if | |
95 ]]></command> | |
96 <inputs> | |
97 <param name="input_alignment" type="data" format="bam,cram" label="Input BAM (or CRAM)" help="BAM or CRAM format mapped reads" /> | |
98 <param argument="--no-per-base" name="per_base_coverage" type="boolean" truevalue="" falsevalue="--no-per-base" checked="false" label="Output per base depth" help="Skipping depth output for individual bases substantially decreases runtime" /> | |
99 <conditional name="window"> | |
100 <param name="window_mode" type="select" label="Compute depth by region" help="A BED file or window size can be provided to compute average depth by region"> | |
101 <option value="no">Don't compute depth by region</option> | |
102 <option value="window">Compute average depth using a fixed size window</option> | |
103 <option value="bed">Compute depth in regions specified by a BED file</option> | |
104 </param> | |
105 <when value="no"> | |
106 </when> | |
107 <when value="window"> | |
108 <param name="window_size" type="integer" min="2" value="400" label="Window size for region calculation" help="Average depth will be computed for non-overlapping regions of this size" /> | |
109 </when> | |
110 <when value="bed"> | |
111 <param name="region_file" type="data" format="bed" label="BED file specifying regions" help="Average depth will be computed for regions specified in the BED file. If the BED file has a 4th column, it is used for the region name" /> | |
112 </when> | |
113 </conditional> | |
114 <conditional name="advanced"> | |
115 <param name="options" type="select" label="Advanced Options"> | |
116 <option value="no" selected="true">Hide Advanced Options</option> | |
117 <option value="yes">Show Advanced Options</option> | |
118 </param> | |
119 <when value="no"> | |
120 </when> | |
121 <when value="yes"> | |
122 <param argument="--chrom" type="text" label="Restrict depth calculations to chromosome" optional="true" help="Enter a chromosome name to only count depth for reads mapping to this chromosome"> | |
123 <expand macro="bam_identifier" /> | |
124 </param> | |
125 <param argument="--flag" name="exclude_flag" type="integer" min="0" value="0" label="Exclude reads with these bits set in FLAG" help="Exclude reads where any of these bits are set in the value of the read flags column" /> | |
126 <param argument="--include-flag" type="integer" min="1" optional="true" label="Only include reads with these bits set in FLAG" help="Only include reads where any of these bits are set in the value of the read flags column" /> | |
127 <param argument="--fast-mode" name="no_fast" type="boolean" truevalue="" falsevalue="-x" label="Disable fast mode" help="Fast mode doesn't look up internal cigar operations or correct mate overlaps. Disabling it is not recommended" /> | |
128 <param argument="--mapq" type="integer" min="0" value="0" label="Minimum mapping quality" help="Reads with a mapping quality lower than this value are ignored" /> | |
129 <param argument="--thresholds" type="text" value="" label="Specify thresholds for output when using region output" help="The number of bases covered by these thresholds will be reported. Multiple thresholds can be separated by commas"> | |
130 <sanitizer invalid_char=""> | |
131 <valid initial="string.digits"> | |
132 <add value="," /> | |
133 </valid> | |
134 </sanitizer> | |
135 <validator type="regex">[0-9,]*</validator> | |
136 </param> | |
137 <param argument="--use-median" type="boolean" truevalue="--use-median" falsevalue="" checked="false" label="Use median depth of region" help="When computing depth of region, use median of depth rather than mean" /> | |
138 <param argument="--read-groups" type="text" value="" label="" help="only calculate depth for these comma-separated read groups IDs"> | |
139 <!-- while read group IDs are not well specified in the BAM specification, they appear to be like IDs but with spaces allowed --> | |
140 <expand macro="bam_identifier"> | |
141 <add value=" " /> | |
142 </expand> | |
143 </param> | |
144 <repeat name="quantize" title="Read depth thresholds for depth-defined regions"> | |
145 <param name="quant_group_mindepth" type="integer" min="0" value="0" label="Minimum depth for depth-defined region" help="Regions with this depth or lower will be included in this depth-defined region" /> | |
146 <param name="quant_group_name" type="text" label="Depth-defined region name" help="Name include in BED output for regions in this depth-defined region"> | |
147 <sanitizer invalid_char=""> | |
148 <valid initial="string.letters,string.digits"> | |
149 <add value="_" /> | |
150 </valid> | |
151 </sanitizer> | |
152 <validator type="regex">[0-9a-zA-Z_]*</validator> | |
153 </param> | |
154 </repeat> | |
155 </when> | |
156 </conditional> | |
157 </inputs> | |
158 <outputs> | |
159 <data name="output_global_dist" format="tabular" from_work_dir="output.mosdepth.global.dist.txt" label="mosdepth depth distribution on ${on_string}" /> | |
160 <data name="output_summary" format="tabular" from_work_dir="output.mosdepth.summary.txt" label="mosdepth summary on ${on_string}"> | |
161 <actions> | |
162 <action type="metadata" name="column_names" default="chrom,length,bases,mean,min,max" /> | |
163 </actions> | |
164 </data> | |
165 <data name="output_region_dist" format="tabular" from_work_dir="output.mosdepth.region.dist.txt" label="mosdepth region depth distribution on ${on_string}"> | |
166 <filter>window['window_mode'] == "bed" or window['window_mode'] == "window"</filter> | |
167 </data> | |
168 <data name="output_per_base_depth" format="bedgraph" from_work_dir="output.per-base.bed" label="mosdepth per base depth on ${on_string}"> | |
169 <filter>per_base_coverage</filter> | |
170 </data> | |
171 <data name="output_regions_bed" format="bed" from_work_dir="output.regions.bed" label="mosdepth regions BED on ${on_string}"> | |
172 <filter>window['window_mode'] == "bed" or window['window_mode'] == "window"</filter> | |
173 </data> | |
174 <data name="output_quantized_bed" format="bed" from_work_dir="output.quantized.bed" label="mosdepth quantized BED on ${on_string}"> | |
175 <filter>advanced['options'] == "yes" and len(advanced['quantize'])</filter> | |
176 </data> | |
177 <data name="output_thresholds_bed" format="bed" from_work_dir="output.thresholds.bed" label="mosdepth thresholds BED on ${on_string}"> | |
178 <filter>advanced['options'] == "yes" and advanced['thresholds']</filter> | |
179 </data> | |
180 </outputs> | |
181 <tests> | |
182 <!-- test 1 --> | |
183 <test expect_num_outputs="2"> | |
184 <param name="input_alignment" value="input.bam" ftype="bam" /> | |
185 <output name="output_summary" file="output_summary.tabular" ftype="tabular" /> | |
186 <output name="output_global_dist" file="output_distribution.tabular" ftype="tabular" /> | |
187 </test> | |
188 <!-- test 2 --> | |
189 <test expect_num_outputs="3"> | |
190 <param name="input_alignment" value="input.bam" ftype="bam" /> | |
191 <param name="per_base_coverage" value="True" /> | |
192 <output name="output_per_base_depth" file="output_per_base_depth.bed" ftype="bedgraph" /> | |
193 </test> | |
194 <!-- test 3 --> | |
195 <test expect_num_outputs="4"> | |
196 <param name="input_alignment" value="input.bam" ftype="bam" /> | |
197 <conditional name="window"> | |
198 <param name="window_mode" value="bed" /> | |
199 <param name="region_file" value="input_regions.bed" ftype="bed" /> | |
200 </conditional> | |
201 <output name="output_region_dist" file="output_region_distribution_bed.tabular" ftype="tabular" /> | |
202 <output name="output_summary" file="output_region_summary.tabular" ftype="tabular" /> | |
203 <output name="output_regions_bed" file="output_region_depths.bed" ftype="bed" /> | |
204 </test> | |
205 <!-- test 4 --> | |
206 <test expect_num_outputs="4 "> | |
207 <param name="input_alignment" value="input.bam" ftype="bam" /> | |
208 <conditional name="window"> | |
209 <param name="window_mode" value="window" /> | |
210 <param name="window_size" value="200" /> | |
211 </conditional> | |
212 <output name="output_region_dist" file="output_region_distribution.tabular" ftype="tabular" /> | |
213 <output name="output_summary" file="output_region_summary_windowed.tabular" ftype="tabular" /> | |
214 <output name="output_regions_bed" file="output_window_depths.bed" ftype="bed" /> | |
215 </test> | |
216 <!-- test 5 --> | |
217 <test expect_num_outputs="4"> | |
218 <param name="input_alignment" value="input.bam" ftype="bam" /> | |
219 <conditional name="window"> | |
220 <param name="window_mode" value="window" /> | |
221 <param name="window_size" value="200" /> | |
222 </conditional> | |
223 <conditional name="advanced"> | |
224 <param name="options" value="yes" /> | |
225 <param name="use_median" value="yes" /> | |
226 </conditional> | |
227 <output name="output_region_dist" file="output_region_distribution_median.tabular" ftype="tabular" /> | |
228 <output name="output_summary" file="output_region_summary_windowed_median.tabular" ftype="tabular" /> | |
229 <output name="output_regions_bed" file="output_window_depths_median.bed" ftype="bed" /> | |
230 </test> | |
231 <!-- test 6 --> | |
232 <test expect_num_outputs="3"> | |
233 <param name="input_alignment" value="input.bam" ftype="bam" /> | |
234 <conditional name="advanced"> | |
235 <param name="options" value="yes" /> | |
236 <repeat name="quantize"> | |
237 <param name="quant_group_mindepth" value="0" /> | |
238 <param name="quant_group_name" value="NO_COVERAGE" /> | |
239 </repeat> | |
240 <repeat name="quantize"> | |
241 <param name="quant_group_mindepth" value="1" /> | |
242 <param name="quant_group_name" value="LOW_COVERAGE" /> | |
243 </repeat> | |
244 <repeat name="quantize"> | |
245 <param name="quant_group_mindepth" value="20" /> | |
246 <param name="quant_group_name" value="SUFFICIENT_COVERAGE" /> | |
247 </repeat> | |
248 </conditional> | |
249 <output name="output_quantized_bed" file="output_quantized.bed" ftype="bed" /> | |
250 </test> | |
251 <!-- test 7 --> | |
252 <test expect_num_outputs="5"> | |
253 <param name="input_alignment" value="input.bam" ftype="bam" /> | |
254 <conditional name="window"> | |
255 <param name="window_mode" value="bed" /> | |
256 <param name="region_file" value="input_regions.bed" ftype="bed" /> | |
257 </conditional> | |
258 <conditional name="advanced"> | |
259 <param name="options" value="yes" /> | |
260 <param name="thresholds" value="20,40" /> | |
261 </conditional> | |
262 <output name="output_thresholds_bed" file="output_thresholds.bed" ftype="bed" /> | |
263 </test> | |
264 <!-- test 7 --> | |
265 <test expect_num_outputs="2"> | |
266 <param name="input_alignment" value="input.cram" ftype="cram" /> | |
267 <output name="output_summary" file="output_summary.tabular" ftype="tabular" /> | |
268 <output name="output_global_dist" file="output_distribution.tabular" ftype="tabular" /> | |
269 </test> | |
270 </tests> | |
271 <help><![CDATA[ | |
272 mosdepth_ is a tool for fast and flexible calculation of read depths from BAM or CRAM files. | |
273 | |
274 It can compute: | |
275 | |
276 * mean (or median) depth in fixed sized windows | |
277 * mean (or median) depth in regions specified by a BED file | |
278 * per base depths | |
279 * a histogram of read depths | |
280 * the mean or median coverage histogram for windows / regions | |
281 * a distribution of proportion of based covered over a particular threshold | |
282 * a BED format report on regions that are defined by coverage thresholds | |
283 | |
284 By default only a summary and depth histogram is computed, but the other options mentioned above can | |
285 be enabled using different options in the "Compute depth by region" selector and some of the Advanced | |
286 options. | |
287 | |
288 .. _mosdepth: https://github.com/brentp/mosdepth | |
289 ]]></help> | |
290 <citations> | |
291 <citation type="doi">10.1093/bioinformatics/btx699</citation> | |
292 </citations> | |
293 </tool> |