comparison extract_kraken_reads.xml @ 0:d491c23394f9 draft default tip

"planemo upload for repository https://github.com/jvolkening/galaxy-tools/tree/master/tools/krakentools"
author jvolkening
date Thu, 30 Sep 2021 17:54:31 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:d491c23394f9
1 <tool id="krakentools_extract_kraken_reads" name="Extract Kraken Reads By ID" version="@TOOL_VERSION@+galaxy@VERSION_SUFFIX@" profile="17.09">
2 <description>Extract reads that were classified by the Kraken family at specified taxonomic IDs</description>
3 <macros>
4 <import>macros.xml</import>
5 </macros>
6 <expand macro="requirements" />
7 <expand macro="stdio" />
8 <version_command>echo -n @TOOL_VERSION@</version_command>
9
10 <command detect_errors="exit_code"><![CDATA[
11
12 #if $library.type == 'paired':
13 #set input_1 = $library.input_1
14 #set input_2 = $library.input_2
15 #else if $library.type == 'paired_collection'
16 #set input_1 = $library.input_1.forward
17 #set input_2 = $library.input_1.reverse
18 #else
19 #set input_1 = $library.input_1
20 #end if
21
22 ## do not quote $taxid
23 extract_kraken_reads.py
24
25 -k '$results'
26 -s '$input_1'
27 -o '$output_1'
28 --taxid $taxid
29 --max '$max'
30 $include_parents
31 $include_children
32 $exclude
33 $fastq_output
34 #if str( $library.type ) != "single":
35 -s2 '$input_2'
36 -o2 '$output_2'
37 #end if
38 #if $include_parents or $include_children:
39 --report $report
40 #end if
41
42 ]]></command>
43 <inputs>
44
45 <!-- Reads -->
46 <conditional name="library">
47 <param name="type" type="select" label="Single or paired reads?">
48 <option value="single">Single</option>
49 <option value="paired">Paired</option>
50 <option value="paired_collection">Paired Collection</option>
51 </param>
52
53 <when value="single">
54 <param name="input_1" format="fastq,fastqsanger,fasta" type="data" label="FASTQ/A file" help="FASTQ or FASTQ input reads" />
55 </when>
56
57 <when value="paired">
58 <param name="input_1" format="fastq,fastqsanger,fasta" type="data" label="FASTQ/A forward file" help="FASTQ or FASTQ input reads" />
59 <param name="input_2" format="fastq,fastqsanger,fasta" type="data" label="FASTQ/A reverse file" help="FASTQ or FASTQ input reads" />
60 </when>
61
62 <when value="paired_collection">
63 <param name="input_1" format="fastq,fastqsanger,fasta" type="data_collection" collection_type="paired" label="Paired Collection" help="FASTQ or FASTA read pair collection" />
64 </when>
65
66 </conditional>
67 <param name="results" argument="-k" format="tabular" type="data" label="Results" help="Results (classification) file from Kraken/KrakenUniq/Kraken2" />
68 <param name="report" argument="--report" format="tabular" type="data" label="Report" optional="True" help="Report file from Kraken/KrakenUniq/Kraken2" />
69
70 <param name="taxid" argument="--taxid" type="text" value="" label="Taxonomic ID(s) to match" help="Space-delimited list of taxonomic IDs for which to extract matching reads">
71 <validator type="regex" message="Enter a space-separated list of numeric tax IDs">^\d+[\d ]*$</validator>
72 </param>
73 <param name="max" argument="--max" type="integer" value="100000000" min="1" label="Maximum reads to save" help="Maximum number of reads to save for each ID" />
74 <param name="exclude" argument="--exclude" type="boolean" value="False" truevalue="--exclude" falsevalue="" label="Invert output" help="Instead of finding reads that match given taxonomic IDs, find all reads that DO NOT match given IDs" />
75 <param name="fastq_output" argument="--fastq-output" type="boolean" value="False" truevalue="--fastq-output" falsevalue="" label="Output as FASTQ" help="Write output as FASTQ instead of the default FASTA" />
76 <param name="include_parents" argument="--include-parents" type="boolean" value="False" truevalue="--include-parents" falsevalue="" label="Include parents" help="Include reads classified at parent levels of the specified tax IDs" />
77 <param name="include_children" argument="--include-children" type="boolean" value="False" truevalue="--include-children" falsevalue="" label="Include children" help="Include reads classified more specifically than the specified tax IDs" />
78
79 </inputs>
80
81 <outputs>
82 <data name="output_1" format="fasta" metadata_source="input_1" label="${tool.name} on ${on_string}: forward reads">
83 <change_format>
84 <when input="fastq_output" value="True" format="fastqsanger" />
85 </change_format>
86 </data>
87 <data name="output_2" format="fasta" metadata_source="input_2" label="${tool.name} on ${on_string}: reverse reads" >
88 <filter>(library['type'] == 'paired' or library['type'] == 'paired_collection')</filter>
89 <change_format>
90 <when input="fastq_output" value="True" format="fastqsanger" />
91 </change_format>
92 </data>
93 </outputs>
94
95 <tests>
96 <!-- test Kraken2 input, single input -->
97 <test>
98 <param name="input_1" value="R1.fq.gz" ftype="fastqsanger"/>
99 <param name="library|type" value="single"/>
100 <param name="results" value="kraken2.results" ftype="tabular"/>
101 <param name="taxid" value="11176"/>
102 <output name="output_1" file="out1.k2.11176.fa"/>
103 </test>
104 <!-- test paired input -->
105 <test>
106 <param name="input_1" value="R1.fq.gz" ftype="fastqsanger"/>
107 <param name="input_2" value="R2.fq.gz" ftype="fastqsanger"/>
108 <param name="library|type" value="paired"/>
109 <param name="results" value="kraken2.results" ftype="tabular"/>
110 <param name="taxid" value="11176"/>
111 <output name="output_1" file="out1.k2.11176.fa"/>
112 <output name="output_2" file="out2.k2.11176.fa"/>
113 </test>
114 <!-- test paired collection input -->
115 <test>
116 <param name="input_1">
117 <collection type="paired">
118 <element name="forward" value="R1.fq.gz" ftype="fastqsanger"/>
119 <element name="reverse" value="R2.fq.gz" ftype="fastqsanger"/>
120 </collection>
121 </param>
122 <param name="library|type" value="paired_collection"/>
123 <param name="results" value="kraken2.results" ftype="tabular"/>
124 <param name="taxid" value="11176"/>
125 <output name="output_1" file="out1.k2.11176.fa"/>
126 <output name="output_2" file="out2.k2.11176.fa"/>
127 </test>
128 <!-- test Kraken1 input, include children -->
129 <test>
130 <param name="input_1" value="R1.fq.gz" ftype="fastqsanger"/>
131 <param name="library|type" value="single"/>
132 <param name="results" value="kraken1.results" ftype="tabular"/>
133 <param name="report" value="kraken1.report" ftype="tabular"/>
134 <param name="taxid" value="11176"/>
135 <param name="include_children" value="True"/>
136 <output name="output_1" file="out1.k1.11176.children.fa"/>
137 </test>
138 <!-- test exclude -->
139 <test>
140 <param name="input_1" value="R1.fq.gz" ftype="fastqsanger"/>
141 <param name="library|type" value="single"/>
142 <param name="results" value="kraken1.results" ftype="tabular"/>
143 <param name="report" value="kraken1.report" ftype="tabular"/>
144 <param name="taxid" value="10386"/>
145 <param name="include_children" value="True"/>
146 <param name="exclude" value="True"/>
147 <output name="output_1" file="out1.k1.e10386.children.fa"/>
148 </test>
149 <!-- test max -->
150 <test>
151 <param name="input_1" value="R1.fq.gz" ftype="fastqsanger"/>
152 <param name="library|type" value="single"/>
153 <param name="results" value="kraken2.results" ftype="tabular"/>
154 <param name="taxid" value="11176"/>
155 <param name="max" value="2"/>
156 <output name="output_1" file="out1.k2.11176.max2.fa"/>
157 </test>
158 <!-- test include parents -->
159 <test>
160 <param name="input_1" value="R1.fq.gz" ftype="fastqsanger"/>
161 <param name="library|type" value="single"/>
162 <param name="results" value="kraken2.results" ftype="tabular"/>
163 <param name="taxid" value="11176"/>
164 <param name="include_parents" value="True"/>
165 <param name="report" value="kraken2.report" ftype="tabular"/>
166 <output name="output_1" file="out1.k2.11176.parents.fa"/>
167 </test>
168 <!-- test multiple tax IDs-->
169 <test>
170 <param name="input_1" value="R1.fq.gz" ftype="fastqsanger"/>
171 <param name="library|type" value="single"/>
172 <param name="results" value="kraken2.results" ftype="tabular"/>
173 <param name="taxid" value="10386 11176"/>
174 <param name="exclude" value="True"/>
175 <param name="include_parents" value="True"/>
176 <param name="report" value="kraken2.report" ftype="tabular"/>
177 <output name="output_1" file="out1.k2.exclude_both.fa"/>
178 </test>
179 <!-- test multiple tax IDs-->
180 <test expect_failure="True">
181 <param name="input_1" value="R1.fq.gz" ftype="fastqsanger"/>
182 <param name="library|type" value="single"/>
183 <param name="results" value="kraken2.results" ftype="tabular"/>
184 <param name="taxid" value="10386 f5"/>
185 </test>
186 <!-- test FASTQ output -->
187 <test>
188 <param name="input_1" value="R1.fq.gz" ftype="fastqsanger"/>
189 <param name="library|type" value="single"/>
190 <param name="results" value="kraken2.results" ftype="tabular"/>
191 <param name="taxid" value="11176"/>
192 <param name="fastq_output" value="True"/>
193 <output name="output_1" file="out1.k2.11176.fq"/>
194 </test>
195
196 </tests>
197
198 <help><![CDATA[
199
200 .. class:: infomark
201
202 **What it does**
203
204 -------------------
205
206 After running Kraken, Kraken2, or KrakenUniq, users may use the
207 `extract_kraken_reads.py` program to extract the FASTA or FASTQ reads
208 classified as a specific taxonomy ID. For example, this program can be used to
209 extract all bacterial reads or only reads assigned to Escherichia coli. Users
210 must provide (at minimum) the original sequence file(s), at least one taxonomy
211 ID, and the Kraken output file.
212
213 -------------------
214
215 **Command-line arguments**
216
217 -------------------
218
219 The following command-line usage corresponds with the Galaxy wrapper
220 parameters::
221
222 usage: extract_kraken_reads.py [-h] -k KRAKEN_FILE -s SEQ_FILE1
223 [-s2 SEQ_FILE2] -t TAXID [TAXID ...] -o
224 OUTPUT_FILE [-o2 OUTPUT_FILE2] [--append]
225 [--noappend] [--max MAX_READS] [-r REPORT_FILE]
226 [--include-parents] [--include-children]
227 [--exclude] [--fastq-output]
228
229 optional arguments:
230 -h, --help show this help message and exit
231 -k KRAKEN_FILE Kraken output file to parse
232 -s SEQ_FILE1, -s1 SEQ_FILE1, -1 SEQ_FILE1, -U SEQ_FILE1
233 FASTA/FASTQ File containing the raw sequence letters.
234 -s2 SEQ_FILE2, -2 SEQ_FILE2
235 2nd FASTA/FASTQ File containing the raw sequence
236 letters (paired).
237 -t TAXID [TAXID ...], --taxid TAXID [TAXID ...]
238 Taxonomy ID[s] of reads to extract (space-delimited)
239 -o OUTPUT_FILE, --output OUTPUT_FILE
240 Output FASTA/Q file containing the reads and sample
241 IDs
242 -o2 OUTPUT_FILE2, --output2 OUTPUT_FILE2
243 Output FASTA/Q file containig the second pair of reads
244 [required for paired input]
245 --max MAX_READS Maximum number of reads to save [default: 100,000,000]
246 -r REPORT_FILE, --report REPORT_FILE
247 Kraken report file. [required only if --include-
248 parents/children is specified]
249 --include-parents Include reads classified at parent levels of the
250 specified taxids
251 --include-children Include reads classified more specifically than the
252 specified taxids
253 --exclude Instead of finding reads matching specified taxids,
254 finds all reads NOT matching specified taxids
255 --fastq-output Print output FASTQ reads [requires input FASTQ,
256 default: output is FASTA]
257
258 --------------------
259
260 **More Information**
261
262 --------------------
263
264 Author: Jennifer Lu
265
266 See the `online documentation`_
267
268 .. _`online documentation`: https://ccb.jhu.edu/software/krakentools/index.shtml?t=extractreads
269
270 --------------------
271
272 **Galaxy Wrapper Development**
273
274 --------------------
275
276 Author: Jeremy Volkening
277
278 ]]></help>
279
280 <expand macro="citations" />
281
282 </tool>