Mercurial > repos > peterjc > sample_seqs
annotate tools/sample_seqs/sample_seqs.xml @ 7:86710edcec02 draft
v0.2.5 use <command detect_errors="aggressive"> and other internal changes
author | peterjc |
---|---|
date | Thu, 11 May 2017 12:20:59 -0400 |
parents | 31f5701cd2e9 |
children | 5f505ed46e16 |
rev | line source |
---|---|
7
86710edcec02
v0.2.5 use <command detect_errors="aggressive"> and other internal changes
peterjc
parents:
6
diff
changeset
|
1 <tool id="sample_seqs" name="Sub-sample sequences files" version="0.2.5"> |
0 | 2 <description>e.g. to reduce coverage</description> |
3 <requirements> | |
6
31f5701cd2e9
v0.2.4 Depends on Biopython 1.67 via legacy Tool Shed package or bioconda.
peterjc
parents:
5
diff
changeset
|
4 <requirement type="package" version="1.67">biopython</requirement> |
0 | 5 </requirements> |
7
86710edcec02
v0.2.5 use <command detect_errors="aggressive"> and other internal changes
peterjc
parents:
6
diff
changeset
|
6 <version_command> |
86710edcec02
v0.2.5 use <command detect_errors="aggressive"> and other internal changes
peterjc
parents:
6
diff
changeset
|
7 python $__tool_directory__/sample_seqs.py --version |
86710edcec02
v0.2.5 use <command detect_errors="aggressive"> and other internal changes
peterjc
parents:
6
diff
changeset
|
8 </version_command> |
86710edcec02
v0.2.5 use <command detect_errors="aggressive"> and other internal changes
peterjc
parents:
6
diff
changeset
|
9 <command detect_errors="aggressive"> |
86710edcec02
v0.2.5 use <command detect_errors="aggressive"> and other internal changes
peterjc
parents:
6
diff
changeset
|
10 python $__tool_directory__/sample_seqs.py -f '$input_file.ext' -i '$input_file' -o '$output_file' |
0 | 11 #if str($sampling.type) == "everyNth": |
7
86710edcec02
v0.2.5 use <command detect_errors="aggressive"> and other internal changes
peterjc
parents:
6
diff
changeset
|
12 -n '${sampling.every_n}' |
0 | 13 #elif str($sampling.type) == "percentage": |
7
86710edcec02
v0.2.5 use <command detect_errors="aggressive"> and other internal changes
peterjc
parents:
6
diff
changeset
|
14 -p '${sampling.percent}' |
2 | 15 #else |
7
86710edcec02
v0.2.5 use <command detect_errors="aggressive"> and other internal changes
peterjc
parents:
6
diff
changeset
|
16 -c '${sampling.count}' |
2 | 17 #end if |
18 #if $interleaved | |
19 --interleaved | |
0 | 20 #end if |
21 </command> | |
22 <inputs> | |
23 <param name="input_file" type="data" format="fasta,fastq,sff" label="Sequence file" help="FASTA, FASTQ, or SFF format." /> | |
24 <conditional name="sampling"> | |
25 <param name="type" type="select" label="Sub-sampling approach"> | |
2 | 26 <option value="everyNth">Take every N-th sequence (or pair, e.g. every fifth sequence)</option> |
27 <option value="percentage">Take some percentage of the sequences (or pairs, e.g. 20% will take every fifth sequence)</option> | |
28 <option value="desired_count">Take exactly N sequences (or pairs, e.g. 1000 sequences)</option> | |
0 | 29 <!-- TODO - target coverage etc --> |
30 </param> | |
31 <when value="everyNth"> | |
32 <param name="every_n" value="5" type="integer" min="2" label="N" help="At least 2, e.g. 5 will take every 5th sequence (taking 20% of the sequences)" /> | |
33 </when> | |
34 <when value="percentage"> | |
35 <param name="percent" value="20.0" type="float" min="0" max="100" label="Percentage" help="Between 0 and 100, e.g. 20% will take every 5th sequence" /> | |
36 </when> | |
2 | 37 <when value="desired_count"> |
38 <param name="count" value="1000" type="integer" min="1" label="N" help="Number of unique sequences to pick (between 1 and number itotal n input file)" /> | |
39 </when> | |
0 | 40 </conditional> |
2 | 41 <param name="interleaved" type="boolean" label="Interleaved paired reads" help="This mode keeps paired reads together (e.g. take every 5th read pair)" /> |
0 | 42 </inputs> |
43 <outputs> | |
4 | 44 <data name="output_file" format_source="input_file" metadata_source="input_file" label="${input_file.name} (sub-sampled)"/> |
0 | 45 </outputs> |
46 <tests> | |
47 <test> | |
48 <param name="input_file" value="get_orf_input.Suis_ORF.prot.fasta" /> | |
49 <param name="type" value="everyNth" /> | |
50 <param name="every_n" value="100" /> | |
51 <output name="output_file" file="get_orf_input.Suis_ORF.prot.sample_N100.fasta" /> | |
52 </test> | |
53 <test> | |
54 <param name="input_file" value="ecoli.fastq" /> | |
55 <param name="type" value="everyNth" /> | |
56 <param name="every_n" value="100" /> | |
57 <output name="output_file" file="ecoli.sample_N100.fastq" /> | |
58 </test> | |
59 <test> | |
2 | 60 <param name="input_file" value="ecoli.fastq" /> |
61 <param name="type" value="everyNth" /> | |
62 <param name="every_n" value="100" /> | |
63 <param name="interleaved" value="true" /> | |
64 <output name="output_file" file="ecoli.pair_sample_N100.fastq" /> | |
65 </test> | |
66 <test> | |
0 | 67 <param name="input_file" value="MID4_GLZRM4E04_rnd30_frclip.sff" ftype="sff" /> |
68 <param name="type" value="everyNth" /> | |
69 <param name="every_n" value="5" /> | |
70 <output name="output_file" file="MID4_GLZRM4E04_rnd30_frclip.sample_N5.sff" ftype="sff"/> | |
71 </test> | |
72 <test> | |
73 <param name="input_file" value="get_orf_input.Suis_ORF.prot.fasta" /> | |
74 <param name="type" value="percentage" /> | |
75 <param name="percent" value="1.0" /> | |
76 <output name="output_file" file="get_orf_input.Suis_ORF.prot.sample_N100.fasta" /> | |
77 </test> | |
78 <test> | |
2 | 79 <param name="input_file" value="get_orf_input.Suis_ORF.prot.fasta" /> |
80 <param name="type" value="everyNth" /> | |
81 <param name="every_n" value="100" /> | |
82 <param name="interleaved" value="true" /> | |
83 <output name="output_file" file="get_orf_input.Suis_ORF.prot.pair_sample_N100.fasta" /> | |
84 </test> | |
85 <test> | |
86 <param name="input_file" value="get_orf_input.Suis_ORF.prot.fasta" /> | |
87 <param name="type" value="desired_count" /> | |
88 <param name="count" value="2910" /> | |
89 <output name="output_file" file="get_orf_input.Suis_ORF.prot.fasta" /> | |
90 </test> | |
91 <test> | |
92 <param name="input_file" value="get_orf_input.Suis_ORF.prot.fasta" /> | |
93 <param name="type" value="desired_count" /> | |
94 <param name="count" value="10" /> | |
95 <param name="interleaved" value="true" /> | |
96 <output name="output_file" file="get_orf_input.Suis_ORF.prot.pair_sample_C10.fasta" /> | |
97 </test> | |
98 <test> | |
0 | 99 <param name="input_file" value="ecoli.fastq" /> |
100 <param name="type" value="percentage" /> | |
101 <param name="percent" value="1.0" /> | |
102 <output name="output_file" file="ecoli.sample_N100.fastq" /> | |
103 </test> | |
104 <test> | |
2 | 105 <param name="input_file" value="ecoli.fastq" /> |
106 <param name="type" value="desired_count" /> | |
107 <param name="count" value="10" /> | |
108 <output name="output_file" file="ecoli.sample_C10.fastq" /> | |
109 </test> | |
110 <test> | |
111 <param name="input_file" value="ecoli.sample_C10.fastq" /> | |
112 <param name="type" value="desired_count" /> | |
113 <param name="count" value="10" /> | |
114 <output name="output_file" file="ecoli.sample_C10.fastq" /> | |
115 </test> | |
116 <test> | |
0 | 117 <param name="input_file" value="MID4_GLZRM4E04_rnd30_frclip.sff" ftype="sff" /> |
118 <param name="type" value="percentage" /> | |
119 <param name="percent" value="20.0" /> | |
120 <output name="output_file" file="MID4_GLZRM4E04_rnd30_frclip.sample_N5.sff" ftype="sff"/> | |
3
02c13ef1a669
Uploaded v0.2.1, fixed missing test file, more tests.
peterjc
parents:
2
diff
changeset
|
121 <assert_stderr> |
02c13ef1a669
Uploaded v0.2.1, fixed missing test file, more tests.
peterjc
parents:
2
diff
changeset
|
122 <has_line line="Sampling 20.000% of sequences" /> |
02c13ef1a669
Uploaded v0.2.1, fixed missing test file, more tests.
peterjc
parents:
2
diff
changeset
|
123 <has_line line="Selected 5 records" /> |
02c13ef1a669
Uploaded v0.2.1, fixed missing test file, more tests.
peterjc
parents:
2
diff
changeset
|
124 </assert_stderr> |
0 | 125 </test> |
2 | 126 <test> |
127 <param name="input_file" value="MID4_GLZRM4E04_rnd30_frclip.sff" ftype="sff" /> | |
128 <param name="type" value="everyNth" /> | |
3
02c13ef1a669
Uploaded v0.2.1, fixed missing test file, more tests.
peterjc
parents:
2
diff
changeset
|
129 <param name="every_n" value="5" /> |
2 | 130 <param name="interleaved" value="true" /> |
131 <output name="output_file" file="MID4_GLZRM4E04_rnd30_frclip.pair_sample_N5.sff" ftype="sff"/> | |
3
02c13ef1a669
Uploaded v0.2.1, fixed missing test file, more tests.
peterjc
parents:
2
diff
changeset
|
132 <assert_stderr> |
02c13ef1a669
Uploaded v0.2.1, fixed missing test file, more tests.
peterjc
parents:
2
diff
changeset
|
133 <has_line line="Sampling every 5th sequence" /> |
02c13ef1a669
Uploaded v0.2.1, fixed missing test file, more tests.
peterjc
parents:
2
diff
changeset
|
134 <has_line line="Selected 3 pairs" /> |
02c13ef1a669
Uploaded v0.2.1, fixed missing test file, more tests.
peterjc
parents:
2
diff
changeset
|
135 </assert_stderr> |
2 | 136 </test> |
137 <test> | |
3
02c13ef1a669
Uploaded v0.2.1, fixed missing test file, more tests.
peterjc
parents:
2
diff
changeset
|
138 <param name="input_file" value="MID4_GLZRM4E04_rnd30_frclip.sff" ftype="sff" /> |
2 | 139 <param name="type" value="desired_count" /> |
3
02c13ef1a669
Uploaded v0.2.1, fixed missing test file, more tests.
peterjc
parents:
2
diff
changeset
|
140 <param name="count" value="25" /> |
02c13ef1a669
Uploaded v0.2.1, fixed missing test file, more tests.
peterjc
parents:
2
diff
changeset
|
141 <output name="output_file" file="MID4_GLZRM4E04_rnd30_frclip.sff" ftype="sff"/> |
02c13ef1a669
Uploaded v0.2.1, fixed missing test file, more tests.
peterjc
parents:
2
diff
changeset
|
142 <assert_stderr> |
02c13ef1a669
Uploaded v0.2.1, fixed missing test file, more tests.
peterjc
parents:
2
diff
changeset
|
143 <has_line line="Input file has 25 sequences" /> |
02c13ef1a669
Uploaded v0.2.1, fixed missing test file, more tests.
peterjc
parents:
2
diff
changeset
|
144 <has_line line="Taking all the sequences" /> |
02c13ef1a669
Uploaded v0.2.1, fixed missing test file, more tests.
peterjc
parents:
2
diff
changeset
|
145 <has_line line="Selected 25 records" /> |
02c13ef1a669
Uploaded v0.2.1, fixed missing test file, more tests.
peterjc
parents:
2
diff
changeset
|
146 </assert_stderr> |
2 | 147 </test> |
148 <test> | |
149 <param name="input_file" value="MID4_GLZRM4E04_rnd30_frclip.sff" ftype="sff" /> | |
150 <param name="type" value="desired_count" /> | |
151 <param name="count" value="1" /> | |
152 <output name="output_file" file="MID4_GLZRM4E04_rnd30_frclip.sample_C1.sff" ftype="sff"/> | |
3
02c13ef1a669
Uploaded v0.2.1, fixed missing test file, more tests.
peterjc
parents:
2
diff
changeset
|
153 <assert_stderr> |
02c13ef1a669
Uploaded v0.2.1, fixed missing test file, more tests.
peterjc
parents:
2
diff
changeset
|
154 <has_line line="Input file has 25 sequences" /> |
02c13ef1a669
Uploaded v0.2.1, fixed missing test file, more tests.
peterjc
parents:
2
diff
changeset
|
155 <has_line line="Sampling just first sequence!" /> |
02c13ef1a669
Uploaded v0.2.1, fixed missing test file, more tests.
peterjc
parents:
2
diff
changeset
|
156 <has_line line="Selected 1 records" /> |
02c13ef1a669
Uploaded v0.2.1, fixed missing test file, more tests.
peterjc
parents:
2
diff
changeset
|
157 </assert_stderr> |
02c13ef1a669
Uploaded v0.2.1, fixed missing test file, more tests.
peterjc
parents:
2
diff
changeset
|
158 </test> |
02c13ef1a669
Uploaded v0.2.1, fixed missing test file, more tests.
peterjc
parents:
2
diff
changeset
|
159 <test expect_failure="true" expect_exit_code="1"> |
02c13ef1a669
Uploaded v0.2.1, fixed missing test file, more tests.
peterjc
parents:
2
diff
changeset
|
160 <param name="input_file" value="MID4_GLZRM4E04_rnd30_frclip.sff" ftype="sff" /> |
02c13ef1a669
Uploaded v0.2.1, fixed missing test file, more tests.
peterjc
parents:
2
diff
changeset
|
161 <param name="type" value="desired_count" /> |
02c13ef1a669
Uploaded v0.2.1, fixed missing test file, more tests.
peterjc
parents:
2
diff
changeset
|
162 <param name="count" value="30" /> |
02c13ef1a669
Uploaded v0.2.1, fixed missing test file, more tests.
peterjc
parents:
2
diff
changeset
|
163 <assert_stderr> |
02c13ef1a669
Uploaded v0.2.1, fixed missing test file, more tests.
peterjc
parents:
2
diff
changeset
|
164 <has_line line="Input file has 25 sequences" /> |
02c13ef1a669
Uploaded v0.2.1, fixed missing test file, more tests.
peterjc
parents:
2
diff
changeset
|
165 <has_line line="Requested 30 sequences, but file only has 25." /> |
02c13ef1a669
Uploaded v0.2.1, fixed missing test file, more tests.
peterjc
parents:
2
diff
changeset
|
166 </assert_stderr> |
2 | 167 </test> |
0 | 168 </tests> |
169 <help> | |
170 **What it does** | |
171 | |
172 Takes an input file of sequences (typically FASTA or FASTQ, but also | |
173 Standard Flowgram Format (SFF) is supported), and returns a new sequence | |
2 | 174 file sub-sampling uniformly from this (in the same format, preserving the |
175 input order and selecting sequencing evenly though the input file). | |
0 | 176 |
2 | 177 Several sampling modes are supported, all designed to do non-random |
178 uniform sampling (i.e. evenly through the input file). This allows | |
179 reproducibility, and also works on paired sequence files (run the tool | |
180 twice, once on each file using the same settings). | |
0 | 181 |
2 | 182 By sampling uniformly (evenly) through the file, this avoids any bias |
183 should reads in any part of the file be of lesser quality (e.g. for | |
184 high throughput sequencing the reads at the start and end of the file | |
185 can be of lower quality). | |
186 | |
187 The simplest mode is to take every *N*-th sequence, for example taking | |
0 | 188 every 2nd sequence would sample half the file - while taking every 5th |
189 sequence would take 20% of the file. | |
190 | |
2 | 191 The target count method picks *N* sequences from the input file, which |
192 again will be distributed uniformly (evenly) though the file. This works | |
193 by first counting the number of records, then calculating the desired | |
194 percentage of sequences to take. Note if your input file has exactly | |
195 *N* sequences this selects them all (effectively copying the input file). | |
196 If your input file has less than *N* sequences, this is treated as an | |
197 error. | |
198 | |
199 If you tick the interleaved option, the file is processed as pairs of | |
200 records to ensure your read pairs are not separated by sampling. | |
201 For example using 20% would take every 5th pair of records, or you | |
202 could request 1000 read pairs. | |
203 | |
5
6b71ad5d43fb
v0.2.3 clarified help, internal cleanup of Python script
peterjc
parents:
4
diff
changeset
|
204 If instead of interleaved paired reads you have two matched files (one |
6b71ad5d43fb
v0.2.3 clarified help, internal cleanup of Python script
peterjc
parents:
4
diff
changeset
|
205 for each pair), run the tool twice with the same sampling options to |
6b71ad5d43fb
v0.2.3 clarified help, internal cleanup of Python script
peterjc
parents:
4
diff
changeset
|
206 make to matched smaller files. |
6b71ad5d43fb
v0.2.3 clarified help, internal cleanup of Python script
peterjc
parents:
4
diff
changeset
|
207 |
2 | 208 .. class:: warningmark |
209 | |
5
6b71ad5d43fb
v0.2.3 clarified help, internal cleanup of Python script
peterjc
parents:
4
diff
changeset
|
210 Note interleaved/pair mode does *not* actually check your read names |
2 | 211 match a known pair naming scheme! |
0 | 212 |
213 **Example Usage** | |
214 | |
215 Suppose you have some Illumina paired end data as files ``R1.fastq`` and | |
216 ``R2.fastq`` which give an estimated x200 coverage, and you wish to do a | |
217 *de novo* assembly with a tool like MIRA which recommends lower coverage. | |
5
6b71ad5d43fb
v0.2.3 clarified help, internal cleanup of Python script
peterjc
parents:
4
diff
changeset
|
218 Running the tool twice (on ``R1.fastq`` and ``R2.fastq``) taking every |
6b71ad5d43fb
v0.2.3 clarified help, internal cleanup of Python script
peterjc
parents:
4
diff
changeset
|
219 3rd read would reduce the estimated coverage to about x66, and would |
6b71ad5d43fb
v0.2.3 clarified help, internal cleanup of Python script
peterjc
parents:
4
diff
changeset
|
220 preserve the pairing as well (as two smaller FASTQ files). |
0 | 221 |
2 | 222 Similarly, if you had some Illumina paired end data interleaved into one |
223 file with an estimated x200 coverage, you would run this tool in | |
224 interleaved mode, taking every 3rd read pair. This would again reduce | |
225 the estimated coverage to about x66, while preserving the read pairing. | |
226 | |
227 Suppose you have a transcriptome assembly, and wish to look at the | |
228 species distribution of the top BLAST hits for an initial quality check. | |
229 Rather than using all your sequences, you could pick 1000 only for this. | |
0 | 230 |
231 **Citation** | |
232 | |
233 This tool uses Biopython, so if you use this Galaxy tool in work leading to a | |
234 scientific publication please cite the following paper: | |
235 | |
236 Cock et al (2009). Biopython: freely available Python tools for computational | |
237 molecular biology and bioinformatics. Bioinformatics 25(11) 1422-3. | |
238 http://dx.doi.org/10.1093/bioinformatics/btp163 pmid:19304878. | |
239 | |
240 This tool is available to install into other Galaxy Instances via the Galaxy | |
241 Tool Shed at http://toolshed.g2.bx.psu.edu/view/peterjc/sample_seqs | |
242 </help> | |
2 | 243 <citations> |
244 <citation type="doi">10.1093/bioinformatics/btp163</citation> | |
245 </citations> | |
0 | 246 </tool> |