comparison coverm_contig.xml @ 0:6941d0d453ba draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tools/coverm commit 5a4ee5e5f8eee3a08a1cd2dfd9edf15aacea0a94"
author iuc
date Tue, 26 Apr 2022 15:27:37 +0000
parents
children 688a777e1b19
comparison
equal deleted inserted replaced
-1:000000000000 0:6941d0d453ba
1 <tool id="coverm_contig" name="CoverM-CONTIG" version="@TOOL_VERSION@" python_template_version="3.5">
2 <macros>
3 <import>macros.xml</import>
4 <token name="@INPUT_FORMATS@">fasta,fastq,fastq.gz,fasta.gz</token>
5 <token name="@TOOL_VERSION@">0.2.1</token>
6 </macros>
7 <expand macro="requirements"/>
8 <command><![CDATA[
9 #if $reads.read_type == "single" or $reads.read_type == "interleaved"
10 mkdir -p reads1 &&
11 #set file_paths1 = []
12 #for $input_file in $reads.single
13
14 #set $fname = $input_file.element_identifier.replace(" ","_")
15 #set $file_path = 'reads1/' + $fname
16 ln -s '$input_file' '$file_path' &&
17 $file_paths1.append($file_path)
18 #end for
19 #else if $reads.read_type == "bam"
20 mkdir -p bam &&
21 #set bam_files = []
22 #for $input_file in $reads.bam
23
24 #set $fname = $input_file.element_identifier.replace(" ","_")
25 #set $file_path = 'bam/' + $fname
26 ln -s '$input_file' '$file_path' &&
27 $bam_files.append($file_path)
28 #end for
29 #else if $reads.read_type == "paired"
30 mkdir -p paired_reads1 &&
31 #set fw_reads1 = []
32 #for $input_file in $reads.read1
33
34 #set $fname = $input_file.element_identifier.replace(" ","_")
35 #set $file_path = 'paired_reads1/' + str($fname)
36 ln -s '$input_file' '$file_path' &&
37 $fw_reads1.append($file_path)
38 #end for
39 #set rv_reads1 = []
40 #for $input_file in $reads.read2
41
42 #set $fname = $input_file.element_identifier.replace(" ","_")
43 #set $file_path = 'paired_reads1/' + str($fname)
44 ln -s '$input_file' '$file_path' &&
45 $rv_reads1.append($file_path)
46 #end for
47 #silent $fw_reads1.sort()
48 #silent $rv_reads1.sort()
49 #else
50 mkdir -p paired_reads &&
51 #set paired_reads1 = []
52 #for $i, $input_file in enumerate($reads.paired_reads)
53 #set $file_path = 'paired_reads/fw' + str($i)
54 ln -s '$input_file.forward' '$file_path' &&
55 $paired_reads1.append($file_path)
56 #set $file_path = 'paired_reads/rv' + str($i)
57 ln -s '$input_file.reverse' '$file_path' &&
58 $paired_reads1.append($file_path)
59 #end for
60 #end if
61 #if $add_reads.extra_read.read_type == "single" or $add_reads.extra_read.read_type == "interleaved"
62 mkdir -p add_reads1 &&
63 #set add_file_paths1 = []
64 #for $input_file in $add_reads.extra_read.single
65 #set $fname = $input_file.element_identifier.replace(" ","_")
66 #set $file_path = 'add_reads1/' + $fname
67 ln -s '$input_file' '$file_path' &&
68 $add_file_paths1.append($file_path)
69 #end for
70 #else if $add_reads.extra_read.read_type == "bam"
71 mkdir -p add_bam &&
72 #set add_bam_files = []
73 #for $input_file in $reads.bam
74 #set $fname = $input_file.element_identifier.replace(" ","_")
75 #set $file_path = 'add_bam/' + $fname
76 ln -s '$input_file' '$file_path' &&
77 $add_bam_files.append($file_path)
78 #end for
79 #else if $add_reads.extra_read.read_type == "paired"
80 mkdir -p add_paired_reads1 &&
81 #set add_fw_reads1 = []
82 #for $input_file in $add_reads.extra_read.read1
83 #set $fname = $input_file.element_identifier.replace(" ","_")
84 #set $file_path = 'add_paired_reads1/' + str($fname)
85 ln -s '$input_file' '$file_path' &&
86 $add_fw_reads1.append($file_path)
87 #end for
88 #set add_rv_reads1 = []
89 #for $input_file in $add_reads.extra_read.read2
90 #set $fname = $input_file.element_identifier.replace(" ","_")
91 #set $file_path = 'add_paired_reads1/' + str($fname)
92 ln -s '$input_file' '$file_path' &&
93 $add_rv_reads1.append($file_path)
94 #end for
95 #silent $add_fw_reads1.sort()
96 #silent $add_rv_reads1.sort()
97 #else if $add_reads.extra_read.read_type == "paired_collection"
98 mkdir -p add_paired_reads &&
99 #set add_paired_reads1 = []
100 #for $i, $input_file in enumerate($add_reads.extra_read.paired_reads)
101 #set $ext = $input_file.forward.ext
102 #set $file_path = 'add_paired_reads/fw' + str($i) + '.' + $ext
103 ln -s '$input_file.forward' '$file_path' &&
104 $add_paired_reads1.append($file_path)
105 #set $file_path = 'add_paired_reads/rv' + str($i) + '.' + $ext
106 ln -s '$input_file.reverse' '$file_path' &&
107 $add_paired_reads1.append($file_path)
108 #end for
109 #end if
110
111 #if $reads.ref_fasta_history
112 mkdir -p reference &&
113 #set ref_files = []
114 #for $input_file in $reads.ref_fasta_history
115 #set $fname = $input_file.element_identifier.replace(" ","_")
116 #set $file_path = 'reference/' + $fname
117 ln -s '$input_file' '$file_path' &&
118 $ref_files.append($file_path)
119 #end for
120 #end if
121
122 coverm contig
123 #if $reads.read_type == 'paired'
124 -1
125 #for $read in $fw_reads1
126 '${read}'
127 #end for
128 -2
129 #for $read in $rv_reads1
130 '${read}'
131 #end for
132 #else if $reads.read_type == 'paired_collection'
133 --coupled
134 #for $read in $paired_reads1
135 '${read}'
136 #end for
137 #else if $reads.read_type == 'single'
138 --single
139 #for $read in $file_paths1
140 '${read}'
141 #end for
142 #else if $reads.read_type == 'interleaved'
143 --interleaved
144 #for $read in $file_paths1
145 '${read}'
146 #end for
147 #else if $reads.read_type == 'bam'
148 -b
149 #for $read in $bam_files
150 '${read}'
151 #end for
152 #end if
153
154 #if $add_reads.extra_read.read_type == 'paired'
155 -1
156 #for $read in $add_fw_reads1
157 '${read}'
158 #end for
159 -2
160 #for $read in $add_rv_reads1
161 '${read}'
162 #end for
163 #else if $add_reads.extra_read.read_type == 'paired_collection'
164 --coupled
165 #for $read in $add_paired_reads1
166 '${read}'
167 #end for
168 #else if $add_reads.extra_read.read_type == 'single'
169 --single
170 #for $read in $add_file_paths1
171 '${read}'
172 #end for
173 #else if $add_reads.extra_read.read_type == 'interleaved'
174 --interleaved
175 #for $read in $add_file_paths1
176 '${read}'
177 #end for
178 #else if $add_reads.extra_read.read_type == 'bam'
179 #for $read in $add_bam_files
180 '${read}'
181 #end for
182 #end if
183
184
185 #if $reads.ref_fasta_history:
186 --reference
187 #for $reference in $ref_files
188 '${reference}'
189 #end for
190 #end if
191
192 $shar.sharded
193
194 #if $mapping.mapper:
195 --mapper $mapping.mapper
196 #end if
197 #if $mapping.min_read_aligned_length:
198 --min-read-aligned-length $mapping.min_read_aligned_length
199 #end if
200 #if $mapping.min_read_percent_identity:
201 --min-read-percent-identity $mapping.min_read_percent_identity
202 #end if
203 #if $mapping.min_read_aligned_percent:
204 --min-read-aligned-percent $mapping.min_read_aligned_percent
205 #end if
206 #if $mapping.min_read_aligned_length_pair:
207 --min-read-aligned-length-pair $mapping.min_read_aligned_length_pair
208 #end if
209 #if $mapping.min_read_percent_identity_pair:
210 --min-read-percent-identity-pair $mapping.min_read_percent_identity_pair
211 #end if
212 #if $mapping.min_read_aligned_percent_pair:
213 --min-read-aligned-percent-pair $mapping.min_read_aligned_percent_pair
214 #end if
215 $mapping.proper_pairs_only
216 $mapping.exclude_supplementary
217
218 --methods $cov.relative_abundance $cov.mean $cov.cond_methods.trimmed_mean $cov.covered_bases $cov.covered_fraction
219 $cov.variance $cov.length $cov.count $cov.metabat $cov.coverage_histogram $cov.reads_per_base
220 $cov.rpkm $cov.tpm
221 #if $cov.min_covered_fraction:
222 --min-covered-fraction $cov.min_covered_fraction
223 #end if
224 #if $cov.contig_end_exclusion:
225 --contig-end-exclusion $cov.contig_end_exclusion
226 #end if
227 #if $cov.cond_methods.trimmed_mean
228 #if $cov.cond_methods.trim_min:
229 --trim-min $cov.cond_methods.trim_min
230 #end if
231 #if $cov.cond_methods.trim_max:
232 --trim_max $cov.cond_methods.trim_max
233 #end if
234 #end if
235
236 #if $out.output_format:
237 --output-format $out.output_format
238 #end if
239 --output-file output.tsv
240 --threads \${GALAXY_SLOTS:-1}
241 2> stdout.txt
242 ]]></command>
243 <inputs>
244 <expand macro="reads_for_contig" />
245 <expand macro="add_reads" />
246 <section name="shar" title="Sharding" expanded="false">
247 <param name="sharded" type="boolean" optional="true" truevalue="--sharded" falsevalue="" label="If -b/--bam-files was used: Input BAM files are read-sorted alignments of a set of reads mapped to multiple reference contig sets. Choose the best hit for each read pair. Otherwise if mapping was carried out: Map reads to each reference, choosing the best hit for each pair." />
248 </section>
249 <expand macro="mapping"/>
250 <expand macro="coverage"/>
251 <section name="out" title="Output options" expanded="false">
252 <param name="output_format" type="select" label="Shape of output" help="'Sparse' for long format, 'dense' for species-by-site. Default: dense]">
253 <option value="dense" selected="true">Dense</option>
254 <option value="sparse">Sparse</option>
255 </param>
256 </section>
257 </inputs>
258 <outputs>
259 <data name="output1" format="tsv" from_work_dir="./output.tsv"/>
260 </outputs>
261 <tests>
262 <test>
263 <conditional name="reads">
264 <param name="read_type" value="paired_collection"/>
265 <param name="paired_reads">
266 <collection type="list:paired">
267 <element name="reads_for_seq1_and_seq2..fq">
268 <collection type="paired">
269 <element name="forward" value="reads_for_seq1_and_seq2.1.fq.gz"/>
270 <element name="reverse" value="reads_for_seq1_and_seq2.2.fq.gz"/>
271 </collection>
272 </element>
273 </collection>
274 </param>
275 <param name="ref_fasta_history" value="7seqs.fna"/>
276 </conditional>
277 <output name="output1" file="contig_test1.tsv" ftype="tsv"/>
278 </test>
279 <test>
280 <conditional name="reads">
281 <param name="read_type" value="single"/>
282 <param name="single" value="bad_reads.interleaved.fq"/>
283 <param name="ref_fasta_history" value="2seqs.fasta"/>
284 </conditional>
285 <section name="cov">
286 <param name="contig_end_exclusion" value="0"/>
287 </section>
288 <section name="out">
289 <param name="output_format" value="sparse"/>
290 </section>
291 <output name="output1" file="contig_test2.tsv" ftype="tsv"/>
292 </test>
293 <test>
294 <conditional name="reads">
295 <param name="read_type" value="interleaved"/>
296 <param name="single" value="bad_reads.all.interleaved.fa"/>
297 <param name="ref_fasta_history" value="2seqs.fasta"/>
298 </conditional>
299 <section name="cov">
300 <param name="contig_end_exclusion" value="0"/>
301 </section>
302 <section name="mapping">
303 <param name="min_read_aligned_length_pair" value="300"/>
304 <param name="proper_pairs_only" value="true"/>
305 </section>
306 <section name="out">
307 <param name="output_format" value="sparse"/>
308 </section>
309 <output name="output1" file="contig_test3.tsv" ftype="tsv"/>
310 </test>
311 <test>
312 <conditional name="reads">
313 <param name="read_type" value="paired"/>
314 <param name="read1" value="reads_for_seq1_and_seq2.1.fq.gz"/>
315 <param name="read2" value="reads_for_seq1_and_seq2.2.fq.gz"/>
316 <param name="ref_fasta_history" value="2seqs.fasta"/>
317 </conditional>
318 <section name="add_reads">
319 <conditional name="extra_read">
320 <param name="read_type" value="paired_collection"/>
321 <param name="paired_reads">
322 <collection type="list:paired">
323 <element name="reads_for_seq1_and_seq2..fq">
324 <collection type="paired">
325 <element name="forward" value="reads_for_seq1_and_seq2.1.fq.gz"/>
326 <element name="reverse" value="reads_for_seq1_and_seq2.2.fq.gz"/>
327 </collection>
328 </element>
329 </collection>
330 </param>
331 </conditional>
332 </section>
333 <section name="cov">
334 <param name="contig_end_exclusion" value="0"/>
335 </section>
336 <section name="mapping">
337 <param name="--min-read-percent-identity" value="0.95"/>
338 </section>
339 <output name="output1" file="contig_test4.tsv" ftype="tsv"/>
340 </test>
341 <test>
342 <conditional name="reads">
343 <param name="read_type" value="bam"/>
344 <param name="bam" value="tpm_test.bam"/>
345 </conditional>
346 <section name="cov">
347 <param name="mean" value="true"/>
348 <param name="tpm" value="true"/>
349 </section>
350 <section name="out">
351 <param name="output_format" value="sparse"/>
352 </section>
353 <output name="output1" file="contig_test5.tsv" ftype="tsv"/>
354 </test>
355 </tests>
356 <help><![CDATA[
357 .. class:: infomark
358
359 **Method for calculating coverage**
360
361 Calculation of genome-wise coverage (genome mode) is similar to calculating contig-wise (contig mode) coverage, except that the unit of reporting is per-genome rather than per-contig. For calculation methods which exclude base positions based on their coverage, all positions from all contigs are considered together.
362
363 - Relative abundance: Percentage relative abundance of each genome, and the unmapped read percentage
364 - Mean: Average number of aligned reads overlapping each position on the genome
365 - Trimmed mean: Average number of aligned reads overlapping each position after removing the most deeply and shallowly covered positions.
366 - Covered fraction: Fraction of genome covered by 1 or more reads
367 - Covered bases: Number of bases covered by 1 or more reads
368 - Variance: Variance of coverage depths
369 - Length: Length of each genome in base pairs
370 - Count: Number of reads aligned toq each genome. Note that a single read may be aligned to multiple genomes with supplementary alignments
371 - Reads per base: Number of reads aligned divided by the length of the genome
372 - MetaBAT: Reproduction of the `MetaBAT <https://bitbucket.org/berkeleylab/metabat>`_ tool output
373 - Coverage histogram: Histogram of coverage depths
374 - RPKM: Reads mapped per kilobase of genome, per million mapped reads
375 - TPM: Transcripts Per Million as described in `Li et al 2010 <https://doi.org/10.1093/bioinformatics/btp692>`_
376
377 ]]></help>
378 <expand macro="citation"/>
379 </tool>