|
0 |
Description: Delay import of Fastaq modules by the python executables
|
|
1 |
Man pages for this package are being automatically created with through the
|
|
2 |
help2man wrapper called usage_to_man. help2man calls the python executables
|
|
3 |
with the -h option and converts the usage into a man page.
|
|
4 |
.
|
|
5 |
The first step done by all the executables is the import of the modules deployed
|
|
6 |
by this package. Since the package is not installed in the system at build time,
|
|
7 |
the man pages would never be properly created.
|
|
8 |
.
|
|
9 |
This patch solves this problem by importing the modules in this package after
|
|
10 |
the argument parsing code.
|
|
11 |
.
|
|
12 |
Upstream prefered to keep the code as it is for styling reasons, which is
|
|
13 |
perfectly reasonable
|
|
14 |
.
|
|
15 |
fastaq (1.5.0-1) UNRELEASED; urgency=low
|
|
16 |
.
|
|
17 |
* Initial release (Closes: #766321)
|
|
18 |
Author: Jorge Soares <j.s.soares@gmail.com>
|
|
19 |
Index: fastaq/scripts/fastaq_capillary_to_pairs
|
|
20 |
===================================================================
|
|
21 |
--- fastaq.orig/scripts/fastaq_capillary_to_pairs
|
|
22 |
+++ fastaq/scripts/fastaq_capillary_to_pairs
|
|
23 |
@@ -1,7 +1,6 @@
|
|
24 |
#!/usr/bin/env python3
|
|
25 |
|
|
26 |
import argparse
|
|
27 |
-from fastaq import tasks
|
|
28 |
|
|
29 |
parser = argparse.ArgumentParser(
|
|
30 |
description = 'Given a fasta/q file of capillary reads, makes an interleaved file of read pairs (where more than read from same ligation, takes the longest read) and a file of unpaired reads. Replaces the .p1k/.q1k part of read names to denote fwd/rev reads with /1 and /2',
|
|
31 |
@@ -9,4 +8,8 @@ parser = argparse.ArgumentParser(
|
|
32 |
parser.add_argument('infile', help='Name of input fasta/q file')
|
|
33 |
parser.add_argument('outprefix', help='Prefix of output files', metavar='outfiles prefix')
|
|
34 |
options = parser.parse_args()
|
|
35 |
+
|
|
36 |
+
|
|
37 |
+from fastaq import tasks
|
|
38 |
+
|
|
39 |
tasks.capillary_to_pairs(options.infile, options.outprefix)
|
|
40 |
Index: fastaq/scripts/fastaq_chunker
|
|
41 |
===================================================================
|
|
42 |
--- fastaq.orig/scripts/fastaq_chunker
|
|
43 |
+++ fastaq/scripts/fastaq_chunker
|
|
44 |
@@ -1,7 +1,6 @@
|
|
45 |
#!/usr/bin/env python3
|
|
46 |
|
|
47 |
import argparse
|
|
48 |
-from fastaq import tasks
|
|
49 |
|
|
50 |
parser = argparse.ArgumentParser(
|
|
51 |
description = 'Splits a multi fasta/q file into separate files. Splits sequences into chunks of a fixed size. Aims for chunk_size chunks in each file, but allows a little extra, so chunk can be up to (chunk_size + tolerance), to prevent tiny chunks made from the ends of sequences',
|
|
52 |
@@ -12,6 +11,10 @@ parser.add_argument('chunk_size', type=i
|
|
53 |
parser.add_argument('tolerance', type=int, help='Tolerance allowed in chunk size')
|
|
54 |
parser.add_argument('--skip_all_Ns', action='store_true', help='Do not output any sequence that consists of all Ns')
|
|
55 |
options = parser.parse_args()
|
|
56 |
+
|
|
57 |
+
|
|
58 |
+from fastaq import tasks
|
|
59 |
+
|
|
60 |
tasks.split_by_fixed_size(
|
|
61 |
options.infile,
|
|
62 |
options.outprefix,
|
|
63 |
Index: fastaq/scripts/fastaq_count_sequences
|
|
64 |
===================================================================
|
|
65 |
--- fastaq.orig/scripts/fastaq_count_sequences
|
|
66 |
+++ fastaq/scripts/fastaq_count_sequences
|
|
67 |
@@ -1,11 +1,14 @@
|
|
68 |
#!/usr/bin/env python3
|
|
69 |
|
|
70 |
import argparse
|
|
71 |
-from fastaq import tasks
|
|
72 |
|
|
73 |
parser = argparse.ArgumentParser(
|
|
74 |
description = 'Counts the number of sequences in a fasta/q file',
|
|
75 |
usage = '%(prog)s <fasta/q in>')
|
|
76 |
parser.add_argument('infile', help='Name of input fasta/q file')
|
|
77 |
options = parser.parse_args()
|
|
78 |
+
|
|
79 |
+
|
|
80 |
+from fastaq import tasks
|
|
81 |
+
|
|
82 |
print(tasks.count_sequences(options.infile))
|
|
83 |
Index: fastaq/scripts/fastaq_deinterleave
|
|
84 |
===================================================================
|
|
85 |
--- fastaq.orig/scripts/fastaq_deinterleave
|
|
86 |
+++ fastaq/scripts/fastaq_deinterleave
|
|
87 |
@@ -1,7 +1,6 @@
|
|
88 |
#!/usr/bin/env python3
|
|
89 |
|
|
90 |
import argparse
|
|
91 |
-from fastaq import tasks
|
|
92 |
|
|
93 |
parser = argparse.ArgumentParser(
|
|
94 |
description = 'Deinterleaves fasta/q file, so that reads are written alternately between two output files',
|
|
95 |
@@ -11,4 +10,8 @@ parser.add_argument('infile', help='Name
|
|
96 |
parser.add_argument('out_fwd', help='Name of output fasta/q file of forwards reads')
|
|
97 |
parser.add_argument('out_rev', help='Name of output fasta/q file of reverse reads')
|
|
98 |
options = parser.parse_args()
|
|
99 |
+
|
|
100 |
+
|
|
101 |
+from fastaq import tasks
|
|
102 |
+
|
|
103 |
tasks.deinterleave(options.infile, options.out_fwd, options.out_rev, fasta_out=options.fasta_out)
|
|
104 |
Index: fastaq/scripts/fastaq_enumerate_names
|
|
105 |
===================================================================
|
|
106 |
--- fastaq.orig/scripts/fastaq_enumerate_names
|
|
107 |
+++ fastaq/scripts/fastaq_enumerate_names
|
|
108 |
@@ -1,7 +1,6 @@
|
|
109 |
#!/usr/bin/env python3
|
|
110 |
|
|
111 |
import argparse
|
|
112 |
-from fastaq import tasks
|
|
113 |
|
|
114 |
parser = argparse.ArgumentParser(
|
|
115 |
description = 'Renames sequences in a file, calling them 1,2,3... etc',
|
|
116 |
@@ -12,6 +11,10 @@ parser.add_argument('--keep_suffix', act
|
|
117 |
parser.add_argument('infile', help='Name of fasta/q file to be read')
|
|
118 |
parser.add_argument('outfile', help='Name of output fasta/q file')
|
|
119 |
options = parser.parse_args()
|
|
120 |
+
|
|
121 |
+
|
|
122 |
+from fastaq import tasks
|
|
123 |
+
|
|
124 |
tasks.enumerate_names(options.infile,
|
|
125 |
options.outfile,
|
|
126 |
start_index=options.start_index,
|
|
127 |
Index: fastaq/scripts/fastaq_expand_nucleotides
|
|
128 |
===================================================================
|
|
129 |
--- fastaq.orig/scripts/fastaq_expand_nucleotides
|
|
130 |
+++ fastaq/scripts/fastaq_expand_nucleotides
|
|
131 |
@@ -1,7 +1,6 @@
|
|
132 |
#!/usr/bin/env python3
|
|
133 |
|
|
134 |
import argparse
|
|
135 |
-from fastaq import tasks
|
|
136 |
|
|
137 |
parser = argparse.ArgumentParser(
|
|
138 |
description = 'Makes all combinations of sequences in input file by using all possibilities of redundant bases. e.g. ART could be AAT or AGT. Assumes input is nucleotides, not amino acids',
|
|
139 |
@@ -9,6 +8,10 @@ parser = argparse.ArgumentParser(
|
|
140 |
parser.add_argument('infile', help='Name of input file. Can be any of FASTA, FASTQ, GFF3, EMBL, GBK, Phylip')
|
|
141 |
parser.add_argument('outfile', help='Name of output file')
|
|
142 |
options = parser.parse_args()
|
|
143 |
+
|
|
144 |
+
|
|
145 |
+from fastaq import tasks
|
|
146 |
+
|
|
147 |
tasks.expand_nucleotides(
|
|
148 |
options.infile,
|
|
149 |
options.outfile,
|
|
150 |
Index: fastaq/scripts/fastaq_extend_gaps
|
|
151 |
===================================================================
|
|
152 |
--- fastaq.orig/scripts/fastaq_extend_gaps
|
|
153 |
+++ fastaq/scripts/fastaq_extend_gaps
|
|
154 |
@@ -1,7 +1,6 @@
|
|
155 |
#!/usr/bin/env python3
|
|
156 |
|
|
157 |
import argparse
|
|
158 |
-from fastaq import tasks
|
|
159 |
|
|
160 |
parser = argparse.ArgumentParser(
|
|
161 |
description = 'Extends the length of all gaps (and trims the start/end of sequences) in a fasta/q file. Does this by replacing a set number of bases either side of each gap with Ns. Any sequence that ends up as all Ns is lost',
|
|
162 |
@@ -10,4 +9,8 @@ parser.add_argument('--trim_number', typ
|
|
163 |
parser.add_argument('infile', help='Name of input fasta/q file')
|
|
164 |
parser.add_argument('outfile', help='Name of output fasta/q file')
|
|
165 |
options = parser.parse_args()
|
|
166 |
+
|
|
167 |
+
|
|
168 |
+from fastaq import tasks
|
|
169 |
+
|
|
170 |
tasks.extend_gaps(options.infile, options.outfile, options.trim_number)
|
|
171 |
Index: fastaq/scripts/fastaq_fasta_to_fastq
|
|
172 |
===================================================================
|
|
173 |
--- fastaq.orig/scripts/fastaq_fasta_to_fastq
|
|
174 |
+++ fastaq/scripts/fastaq_fasta_to_fastq
|
|
175 |
@@ -1,7 +1,6 @@
|
|
176 |
#!/usr/bin/env python3
|
|
177 |
|
|
178 |
import argparse
|
|
179 |
-from fastaq import tasks
|
|
180 |
|
|
181 |
parser = argparse.ArgumentParser(
|
|
182 |
description = 'Given a fasta and qual file, makes a fastq file',
|
|
183 |
@@ -10,4 +9,8 @@ parser.add_argument('fasta', help='Name
|
|
184 |
parser.add_argument('qual', help='Name of input quality scores file', metavar='qual in')
|
|
185 |
parser.add_argument('outfile', help='Name of output fastq file', metavar='fastq out')
|
|
186 |
options = parser.parse_args()
|
|
187 |
+
|
|
188 |
+
|
|
189 |
+from fastaq import tasks
|
|
190 |
+
|
|
191 |
tasks.fasta_to_fastq(options.fasta, options.qual, options.outfile)
|
|
192 |
Index: fastaq/scripts/fastaq_filter
|
|
193 |
===================================================================
|
|
194 |
--- fastaq.orig/scripts/fastaq_filter
|
|
195 |
+++ fastaq/scripts/fastaq_filter
|
|
196 |
@@ -1,7 +1,6 @@
|
|
197 |
#!/usr/bin/env python3
|
|
198 |
|
|
199 |
import argparse
|
|
200 |
-from fastaq import tasks
|
|
201 |
|
|
202 |
parser = argparse.ArgumentParser(
|
|
203 |
description = 'Filters a fasta/q file by sequence length and/or by name matching a regular expression',
|
|
204 |
@@ -14,6 +13,10 @@ parser.add_argument('-v', '--invert', ac
|
|
205 |
parser.add_argument('infile', help='Name of fasta/q file to be filtered')
|
|
206 |
parser.add_argument('outfile', help='Name of output fasta/q file')
|
|
207 |
options = parser.parse_args()
|
|
208 |
+
|
|
209 |
+
|
|
210 |
+from fastaq import tasks
|
|
211 |
+
|
|
212 |
tasks.filter(options.infile,
|
|
213 |
options.outfile,
|
|
214 |
minlength=options.min_length,
|
|
215 |
Index: fastaq/scripts/fastaq_get_ids
|
|
216 |
===================================================================
|
|
217 |
--- fastaq.orig/scripts/fastaq_get_ids
|
|
218 |
+++ fastaq/scripts/fastaq_get_ids
|
|
219 |
@@ -1,7 +1,6 @@
|
|
220 |
#!/usr/bin/env python3
|
|
221 |
|
|
222 |
import argparse
|
|
223 |
-from fastaq import tasks
|
|
224 |
|
|
225 |
parser = argparse.ArgumentParser(
|
|
226 |
description = 'Gets IDs from each sequence in a fasta or fastq file',
|
|
227 |
@@ -9,4 +8,8 @@ parser = argparse.ArgumentParser(
|
|
228 |
parser.add_argument('infile', help='Name of input fasta/q file')
|
|
229 |
parser.add_argument('outfile', help='Name of output file')
|
|
230 |
options = parser.parse_args()
|
|
231 |
+
|
|
232 |
+
|
|
233 |
+from fastaq import tasks
|
|
234 |
+
|
|
235 |
tasks.get_ids(options.infile, options.outfile)
|
|
236 |
Index: fastaq/scripts/fastaq_get_seq_flanking_gaps
|
|
237 |
===================================================================
|
|
238 |
--- fastaq.orig/scripts/fastaq_get_seq_flanking_gaps
|
|
239 |
+++ fastaq/scripts/fastaq_get_seq_flanking_gaps
|
|
240 |
@@ -1,7 +1,6 @@
|
|
241 |
#!/usr/bin/env python3
|
|
242 |
|
|
243 |
import argparse
|
|
244 |
-from fastaq import tasks
|
|
245 |
|
|
246 |
parser = argparse.ArgumentParser(
|
|
247 |
description = 'Gets the sequences either side of gaps in a fasta/q file',
|
|
248 |
@@ -11,4 +10,8 @@ parser.add_argument('--right', type=int,
|
|
249 |
parser.add_argument('infile', help='Name of input fasta/q file')
|
|
250 |
parser.add_argument('outfile', help='Name of output fasta/q file')
|
|
251 |
options = parser.parse_args()
|
|
252 |
+
|
|
253 |
+
|
|
254 |
+from fastaq import tasks
|
|
255 |
+
|
|
256 |
tasks.get_seqs_flanking_gaps(options.infile, options.outfile, options.left, options.right)
|
|
257 |
Index: fastaq/scripts/fastaq_insert_or_delete_bases
|
|
258 |
===================================================================
|
|
259 |
--- fastaq.orig/scripts/fastaq_insert_or_delete_bases
|
|
260 |
+++ fastaq/scripts/fastaq_insert_or_delete_bases
|
|
261 |
@@ -1,9 +1,6 @@
|
|
262 |
#!/usr/bin/env python3
|
|
263 |
|
|
264 |
import argparse
|
|
265 |
-import sys
|
|
266 |
-import random
|
|
267 |
-from fastaq import sequences, utils, intervals
|
|
268 |
|
|
269 |
parser = argparse.ArgumentParser(
|
|
270 |
description = 'Deletes or inserts bases at given position(s) from a fasta/q file',
|
|
271 |
@@ -16,6 +13,11 @@ parser.add_argument('-i','--insert', act
|
|
272 |
parser.add_argument('--insert_range', help='Inserts random bases starting after position P in each sequence of the input file. Inserts start + (n-1)*step bases into sequence n.', metavar='P,start,step')
|
|
273 |
options = parser.parse_args()
|
|
274 |
|
|
275 |
+
|
|
276 |
+import sys
|
|
277 |
+import random
|
|
278 |
+from fastaq import sequences, utils, intervals
|
|
279 |
+
|
|
280 |
test_ops = [int(x is not None) for x in [options.delete, options.insert, options.delete_range, options.insert_range]]
|
|
281 |
|
|
282 |
if sum(test_ops) != 1:
|
|
283 |
Index: fastaq/scripts/fastaq_interleave
|
|
284 |
===================================================================
|
|
285 |
--- fastaq.orig/scripts/fastaq_interleave
|
|
286 |
+++ fastaq/scripts/fastaq_interleave
|
|
287 |
@@ -1,7 +1,6 @@
|
|
288 |
#!/usr/bin/env python3
|
|
289 |
|
|
290 |
import argparse
|
|
291 |
-from fastaq import tasks
|
|
292 |
|
|
293 |
parser = argparse.ArgumentParser(
|
|
294 |
description = 'Interleaves two fasta/q files, so that reads are written alternately first/second in output file',
|
|
295 |
@@ -10,4 +9,8 @@ parser.add_argument('infile_1', help='Na
|
|
296 |
parser.add_argument('infile_2', help='Name of second input fasta/q file')
|
|
297 |
parser.add_argument('outfile', help='Name of output fasta/q file of interleaved reads')
|
|
298 |
options = parser.parse_args()
|
|
299 |
+
|
|
300 |
+
|
|
301 |
+from fastaq import tasks
|
|
302 |
+
|
|
303 |
tasks.interleave(options.infile_1, options.infile_2, options.outfile)
|
|
304 |
Index: fastaq/scripts/fastaq_long_read_simulate
|
|
305 |
===================================================================
|
|
306 |
--- fastaq.orig/scripts/fastaq_long_read_simulate
|
|
307 |
+++ fastaq/scripts/fastaq_long_read_simulate
|
|
308 |
@@ -1,7 +1,6 @@
|
|
309 |
#!/usr/bin/env python3
|
|
310 |
|
|
311 |
import argparse
|
|
312 |
-from fastaq import tasks
|
|
313 |
|
|
314 |
parser = argparse.ArgumentParser(
|
|
315 |
description = 'Simulates long reads from a fasta/q file. Can optionally make insertions into the reads, like pacbio does. If insertions made, coverage calculation is done before the insertions (so total read length may appear longer then expected).',
|
|
316 |
@@ -29,8 +28,11 @@ ins_group = parser.add_argument_group('o
|
|
317 |
ins_group.add_argument('--ins_skip', type=int, help='Insert a random base every --skip bases plus or minus --ins_window. If this option is used, must also use --ins_window.', metavar='INT')
|
|
318 |
ins_group.add_argument('--ins_window', type=int, help='See --ins_skip. If this option is used, must also use --ins_skip.', metavar='INT')
|
|
319 |
|
|
320 |
-
|
|
321 |
options = parser.parse_args()
|
|
322 |
+
|
|
323 |
+
|
|
324 |
+from fastaq import tasks
|
|
325 |
+
|
|
326 |
tasks.make_long_reads(
|
|
327 |
options.infile,
|
|
328 |
options.outfile,
|
|
329 |
Index: fastaq/scripts/fastaq_make_random_contigs
|
|
330 |
===================================================================
|
|
331 |
--- fastaq.orig/scripts/fastaq_make_random_contigs
|
|
332 |
+++ fastaq/scripts/fastaq_make_random_contigs
|
|
333 |
@@ -1,7 +1,6 @@
|
|
334 |
#!/usr/bin/env python3
|
|
335 |
|
|
336 |
import argparse
|
|
337 |
-from fastaq import tasks
|
|
338 |
|
|
339 |
parser = argparse.ArgumentParser(
|
|
340 |
description = 'Makes a multi-fasta file of random sequences, all of the same length. Each base has equal chance of being A,C,G or T',
|
|
341 |
@@ -14,6 +13,10 @@ parser.add_argument('contigs', type=int,
|
|
342 |
parser.add_argument('length', type=int, help='Length of each contig')
|
|
343 |
parser.add_argument('outfile', help='Name of output file')
|
|
344 |
options = parser.parse_args()
|
|
345 |
+
|
|
346 |
+
|
|
347 |
+from fastaq import tasks
|
|
348 |
+
|
|
349 |
tasks.make_random_contigs(
|
|
350 |
options.contigs,
|
|
351 |
options.length,
|
|
352 |
Index: fastaq/scripts/fastaq_merge
|
|
353 |
===================================================================
|
|
354 |
--- fastaq.orig/scripts/fastaq_merge
|
|
355 |
+++ fastaq/scripts/fastaq_merge
|
|
356 |
@@ -1,7 +1,6 @@
|
|
357 |
#!/usr/bin/env python3
|
|
358 |
|
|
359 |
import argparse
|
|
360 |
-from fastaq import tasks
|
|
361 |
|
|
362 |
parser = argparse.ArgumentParser(
|
|
363 |
description = 'Converts multi fasta/q file to single sequence file, preserving original order of sequences',
|
|
364 |
@@ -10,6 +9,10 @@ parser.add_argument('infile', help='Name
|
|
365 |
parser.add_argument('outfile', help='Name of output file')
|
|
366 |
parser.add_argument('-n', '--name', help='Name of sequence in output file [%(default)s]', default='union')
|
|
367 |
options = parser.parse_args()
|
|
368 |
+
|
|
369 |
+
|
|
370 |
+from fastaq import tasks
|
|
371 |
+
|
|
372 |
tasks.merge_to_one_seq(
|
|
373 |
options.infile,
|
|
374 |
options.outfile,
|
|
375 |
Index: fastaq/scripts/fastaq_replace_bases
|
|
376 |
===================================================================
|
|
377 |
--- fastaq.orig/scripts/fastaq_replace_bases
|
|
378 |
+++ fastaq/scripts/fastaq_replace_bases
|
|
379 |
@@ -1,7 +1,6 @@
|
|
380 |
#!/usr/bin/env python3
|
|
381 |
|
|
382 |
import argparse
|
|
383 |
-from fastaq import tasks
|
|
384 |
|
|
385 |
parser = argparse.ArgumentParser(
|
|
386 |
description = 'Replaces all occurences of one letter with another in a fasta/q file',
|
|
387 |
@@ -11,4 +10,8 @@ parser.add_argument('outfile', help='Nam
|
|
388 |
parser.add_argument('old', help='Base to be replaced')
|
|
389 |
parser.add_argument('new', help='Replace with this letter')
|
|
390 |
options = parser.parse_args()
|
|
391 |
+
|
|
392 |
+
|
|
393 |
+from fastaq import tasks
|
|
394 |
+
|
|
395 |
tasks.replace_bases(options.infile, options.outfile, options.old, options.new)
|
|
396 |
Index: fastaq/scripts/fastaq_reverse_complement
|
|
397 |
===================================================================
|
|
398 |
--- fastaq.orig/scripts/fastaq_reverse_complement
|
|
399 |
+++ fastaq/scripts/fastaq_reverse_complement
|
|
400 |
@@ -1,7 +1,6 @@
|
|
401 |
#!/usr/bin/env python3
|
|
402 |
|
|
403 |
import argparse
|
|
404 |
-from fastaq import tasks
|
|
405 |
|
|
406 |
parser = argparse.ArgumentParser(
|
|
407 |
description = 'Reverse complements all sequences in a fasta/q file',
|
|
408 |
@@ -9,4 +8,8 @@ parser = argparse.ArgumentParser(
|
|
409 |
parser.add_argument('infile', help='Name of input fasta/q file')
|
|
410 |
parser.add_argument('outfile', help='Name of output fasta/q file')
|
|
411 |
options = parser.parse_args()
|
|
412 |
+
|
|
413 |
+
|
|
414 |
+from fastaq import tasks
|
|
415 |
+
|
|
416 |
tasks.reverse_complement(options.infile, options.outfile)
|
|
417 |
Index: fastaq/scripts/fastaq_scaffolds_to_contigs
|
|
418 |
===================================================================
|
|
419 |
--- fastaq.orig/scripts/fastaq_scaffolds_to_contigs
|
|
420 |
+++ fastaq/scripts/fastaq_scaffolds_to_contigs
|
|
421 |
@@ -1,7 +1,6 @@
|
|
422 |
#!/usr/bin/env python3
|
|
423 |
|
|
424 |
import argparse
|
|
425 |
-from fastaq import tasks
|
|
426 |
|
|
427 |
parser = argparse.ArgumentParser(
|
|
428 |
description = 'Creates a file of contigs from a file of scaffolds - i.e. breaks at every gap in the input',
|
|
429 |
@@ -10,4 +9,7 @@ parser.add_argument('--number_contigs',
|
|
430 |
parser.add_argument('infile', help='Name of input fasta/q file')
|
|
431 |
parser.add_argument('outfile', help='Name of output contigs file')
|
|
432 |
options = parser.parse_args()
|
|
433 |
+
|
|
434 |
+from fastaq import tasks
|
|
435 |
+
|
|
436 |
tasks.scaffolds_to_contigs(options.infile, options.outfile, number_contigs=options.number_contigs)
|
|
437 |
Index: fastaq/scripts/fastaq_search_for_seq
|
|
438 |
===================================================================
|
|
439 |
--- fastaq.orig/scripts/fastaq_search_for_seq
|
|
440 |
+++ fastaq/scripts/fastaq_search_for_seq
|
|
441 |
@@ -1,7 +1,6 @@
|
|
442 |
#!/usr/bin/env python3
|
|
443 |
|
|
444 |
import argparse
|
|
445 |
-from fastaq import tasks
|
|
446 |
|
|
447 |
parser = argparse.ArgumentParser(
|
|
448 |
description = 'Searches for an exact match on a given string and its reverese complement, in every sequences of a fasta/q file. Case insensitive. Guaranteed to find all hits',
|
|
449 |
@@ -10,4 +9,7 @@ parser.add_argument('infile', help='Name
|
|
450 |
parser.add_argument('outfile', help='Name of outputfile. Tab-delimited output: sequence name, position, strand')
|
|
451 |
parser.add_argument('search_string', help='String to search for in the sequences')
|
|
452 |
options = parser.parse_args()
|
|
453 |
+
|
|
454 |
+from fastaq import tasks
|
|
455 |
+
|
|
456 |
tasks.search_for_seq(options.infile, options.outfile, options.search_string)
|
|
457 |
Index: fastaq/scripts/fastaq_sequence_trim
|
|
458 |
===================================================================
|
|
459 |
--- fastaq.orig/scripts/fastaq_sequence_trim
|
|
460 |
+++ fastaq/scripts/fastaq_sequence_trim
|
|
461 |
@@ -1,7 +1,6 @@
|
|
462 |
#!/usr/bin/env python3
|
|
463 |
|
|
464 |
import argparse
|
|
465 |
-from fastaq import tasks
|
|
466 |
|
|
467 |
parser = argparse.ArgumentParser(
|
|
468 |
description = 'Trims sequences off the start of all sequences in a pair of fasta/q files, whenever there is a perfect match. Only keeps a read pair if both reads of the pair are at least a minimum length after any trimming',
|
|
469 |
@@ -14,6 +13,10 @@ parser.add_argument('outfile_1', help='N
|
|
470 |
parser.add_argument('outfile_2', help='Name of output reverse fasta/q file', metavar='out_2')
|
|
471 |
parser.add_argument('trim_seqs', help='Name of fasta/q file of sequences to search for at the start of each input sequence', metavar='trim_seqs')
|
|
472 |
options = parser.parse_args()
|
|
473 |
+
|
|
474 |
+
|
|
475 |
+from fastaq import tasks
|
|
476 |
+
|
|
477 |
tasks.sequence_trim(
|
|
478 |
options.infile_1,
|
|
479 |
options.infile_2,
|
|
480 |
Index: fastaq/scripts/fastaq_split_by_base_count
|
|
481 |
===================================================================
|
|
482 |
--- fastaq.orig/scripts/fastaq_split_by_base_count
|
|
483 |
+++ fastaq/scripts/fastaq_split_by_base_count
|
|
484 |
@@ -1,7 +1,6 @@
|
|
485 |
#!/usr/bin/env python3
|
|
486 |
|
|
487 |
import argparse
|
|
488 |
-from fastaq import tasks
|
|
489 |
|
|
490 |
parser = argparse.ArgumentParser(
|
|
491 |
description = 'Splits a multi fasta/q file into separate files. Does not split sequences. Puts up to max_bases into each split file. The exception is that any sequence longer than max_bases is put into its own file.',
|
|
492 |
@@ -12,4 +11,8 @@ parser.add_argument('max_bases', type=in
|
|
493 |
parser.add_argument('--max_seqs', type=int, help='Max number of sequences in each output split file [no limit]', metavar='INT')
|
|
494 |
|
|
495 |
options = parser.parse_args()
|
|
496 |
+
|
|
497 |
+
|
|
498 |
+from fastaq import tasks
|
|
499 |
+
|
|
500 |
tasks.split_by_base_count(options.infile, options.outprefix, options.max_bases, options.max_seqs)
|
|
501 |
Index: fastaq/scripts/fastaq_strip_illumina_suffix
|
|
502 |
===================================================================
|
|
503 |
--- fastaq.orig/scripts/fastaq_strip_illumina_suffix
|
|
504 |
+++ fastaq/scripts/fastaq_strip_illumina_suffix
|
|
505 |
@@ -1,7 +1,6 @@
|
|
506 |
#!/usr/bin/env python3
|
|
507 |
|
|
508 |
import argparse
|
|
509 |
-from fastaq import tasks
|
|
510 |
|
|
511 |
parser = argparse.ArgumentParser(
|
|
512 |
description = 'Strips /1 or /2 off the end of every read name in a fasta/q file',
|
|
513 |
@@ -9,4 +8,8 @@ parser = argparse.ArgumentParser(
|
|
514 |
parser.add_argument('infile', help='Name of input fasta/q file')
|
|
515 |
parser.add_argument('outfile', help='Name of output fasta/q file')
|
|
516 |
options = parser.parse_args()
|
|
517 |
+
|
|
518 |
+
|
|
519 |
+from fastaq import tasks
|
|
520 |
+
|
|
521 |
tasks.strip_illumina_suffix(options.infile, options.outfile)
|
|
522 |
Index: fastaq/scripts/fastaq_to_fake_qual
|
|
523 |
===================================================================
|
|
524 |
--- fastaq.orig/scripts/fastaq_to_fake_qual
|
|
525 |
+++ fastaq/scripts/fastaq_to_fake_qual
|
|
526 |
@@ -1,7 +1,6 @@
|
|
527 |
#!/usr/bin/env python3
|
|
528 |
|
|
529 |
import argparse
|
|
530 |
-from fastaq import tasks
|
|
531 |
|
|
532 |
parser = argparse.ArgumentParser(
|
|
533 |
description = 'Makes fake quality scores file from a fasta/q file',
|
|
534 |
@@ -10,6 +9,10 @@ parser.add_argument('infile', help='Name
|
|
535 |
parser.add_argument('outfile', help='Name of output file')
|
|
536 |
parser.add_argument('-q', '--qual', type=int, help='Quality score to assign to all bases [%(default)s]', default=40)
|
|
537 |
options = parser.parse_args()
|
|
538 |
+
|
|
539 |
+
|
|
540 |
+from fastaq import tasks
|
|
541 |
+
|
|
542 |
tasks.fastaq_to_fake_qual(
|
|
543 |
options.infile,
|
|
544 |
options.outfile,
|
|
545 |
Index: fastaq/scripts/fastaq_to_fasta
|
|
546 |
===================================================================
|
|
547 |
--- fastaq.orig/scripts/fastaq_to_fasta
|
|
548 |
+++ fastaq/scripts/fastaq_to_fasta
|
|
549 |
@@ -1,7 +1,6 @@
|
|
550 |
#!/usr/bin/env python3
|
|
551 |
|
|
552 |
import argparse
|
|
553 |
-from fastaq import tasks
|
|
554 |
|
|
555 |
parser = argparse.ArgumentParser(
|
|
556 |
description = 'Converts sequence file to FASTA format',
|
|
557 |
@@ -11,6 +10,10 @@ parser.add_argument('outfile', help='Nam
|
|
558 |
parser.add_argument('-l', '--line_length', type=int, help='Number of bases on each sequence line of output file [%(default)s]', default=60)
|
|
559 |
parser.add_argument('-s', '--strip_after_whitespace', action='store_true', help='Remove everything after first whitesapce in every sequence name')
|
|
560 |
options = parser.parse_args()
|
|
561 |
+
|
|
562 |
+
|
|
563 |
+from fastaq import tasks
|
|
564 |
+
|
|
565 |
tasks.to_fasta(
|
|
566 |
options.infile,
|
|
567 |
options.outfile,
|
|
568 |
Index: fastaq/scripts/fastaq_to_mira_xml
|
|
569 |
===================================================================
|
|
570 |
--- fastaq.orig/scripts/fastaq_to_mira_xml
|
|
571 |
+++ fastaq/scripts/fastaq_to_mira_xml
|
|
572 |
@@ -1,7 +1,6 @@
|
|
573 |
#!/usr/bin/env python3
|
|
574 |
|
|
575 |
import argparse
|
|
576 |
-from fastaq import tasks
|
|
577 |
|
|
578 |
parser = argparse.ArgumentParser(
|
|
579 |
description = 'Creates an xml file from a fasta/q file of reads, for use with Mira assembler',
|
|
580 |
@@ -9,4 +8,8 @@ parser = argparse.ArgumentParser(
|
|
581 |
parser.add_argument('infile', help='Name of input fasta/q file')
|
|
582 |
parser.add_argument('xml_out', help='Name of output xml file')
|
|
583 |
options = parser.parse_args()
|
|
584 |
+
|
|
585 |
+
|
|
586 |
+from fastaq import tasks
|
|
587 |
+
|
|
588 |
tasks.fastaq_to_mira_xml(options.infile, options.xml_out)
|
|
589 |
Index: fastaq/scripts/fastaq_to_orfs_gff
|
|
590 |
===================================================================
|
|
591 |
--- fastaq.orig/scripts/fastaq_to_orfs_gff
|
|
592 |
+++ fastaq/scripts/fastaq_to_orfs_gff
|
|
593 |
@@ -1,7 +1,6 @@
|
|
594 |
#!/usr/bin/env python3
|
|
595 |
|
|
596 |
import argparse
|
|
597 |
-from fastaq import tasks
|
|
598 |
|
|
599 |
parser = argparse.ArgumentParser(
|
|
600 |
description = 'Writes a GFF file of open reading frames from a fasta/q file',
|
|
601 |
@@ -10,4 +9,8 @@ parser.add_argument('--min_length', type
|
|
602 |
parser.add_argument('infile', help='Name of input fasta/q file')
|
|
603 |
parser.add_argument('gff_out', help='Name of output gff file')
|
|
604 |
options = parser.parse_args()
|
|
605 |
+
|
|
606 |
+
|
|
607 |
+from fastaq import tasks
|
|
608 |
+
|
|
609 |
tasks.fastaq_to_orfs_gff(options.infile, options.gff_out, min_length=options.min_length)
|
|
610 |
Index: fastaq/scripts/fastaq_to_perfect_reads
|
|
611 |
===================================================================
|
|
612 |
--- fastaq.orig/scripts/fastaq_to_perfect_reads
|
|
613 |
+++ fastaq/scripts/fastaq_to_perfect_reads
|
|
614 |
@@ -1,10 +1,6 @@
|
|
615 |
#!/usr/bin/env python3
|
|
616 |
|
|
617 |
import argparse
|
|
618 |
-import random
|
|
619 |
-from math import floor, ceil
|
|
620 |
-from fastaq import sequences, utils
|
|
621 |
-import sys
|
|
622 |
|
|
623 |
parser = argparse.ArgumentParser(
|
|
624 |
description = 'Makes perfect paired end fastq reads from a fasta/q file, with insert sizes sampled from a normal distribution. Read orientation is innies. Output is an interleaved fastq file.',
|
|
625 |
@@ -20,6 +16,12 @@ parser.add_argument('--no_n', action='st
|
|
626 |
parser.add_argument('--seed', type=int, help='Seed for random number generator. Default is to use python\'s default', default=None, metavar='INT')
|
|
627 |
options = parser.parse_args()
|
|
628 |
|
|
629 |
+
|
|
630 |
+import random
|
|
631 |
+from math import floor, ceil
|
|
632 |
+from fastaq import sequences, utils
|
|
633 |
+import sys
|
|
634 |
+
|
|
635 |
random.seed(a=options.seed)
|
|
636 |
|
|
637 |
seq_reader = sequences.file_reader(options.infile)
|
|
638 |
Index: fastaq/scripts/fastaq_to_random_subset
|
|
639 |
===================================================================
|
|
640 |
--- fastaq.orig/scripts/fastaq_to_random_subset
|
|
641 |
+++ fastaq/scripts/fastaq_to_random_subset
|
|
642 |
@@ -1,9 +1,6 @@
|
|
643 |
#!/usr/bin/env python3
|
|
644 |
|
|
645 |
-import sys
|
|
646 |
import argparse
|
|
647 |
-import random
|
|
648 |
-from fastaq import sequences, utils
|
|
649 |
|
|
650 |
parser = argparse.ArgumentParser(
|
|
651 |
description = 'Takes a random subset of reads from a fasta/q file and optionally the corresponding read ' +
|
|
652 |
@@ -15,6 +12,11 @@ parser.add_argument('outfile', help='Nam
|
|
653 |
parser.add_argument('probability', type=int, help='Probability of keeping any given read (pair) in [0,100]', metavar='INT')
|
|
654 |
options = parser.parse_args()
|
|
655 |
|
|
656 |
+
|
|
657 |
+import sys
|
|
658 |
+import random
|
|
659 |
+from fastaq import sequences, utils
|
|
660 |
+
|
|
661 |
seq_reader = sequences.file_reader(options.infile)
|
|
662 |
fout = utils.open_file_write(options.outfile)
|
|
663 |
|
|
664 |
Index: fastaq/scripts/fastaq_to_tiling_bam
|
|
665 |
===================================================================
|
|
666 |
--- fastaq.orig/scripts/fastaq_to_tiling_bam
|
|
667 |
+++ fastaq/scripts/fastaq_to_tiling_bam
|
|
668 |
@@ -1,9 +1,6 @@
|
|
669 |
#!/usr/bin/env python3
|
|
670 |
|
|
671 |
import argparse
|
|
672 |
-import sys
|
|
673 |
-import os
|
|
674 |
-from fastaq import sequences, utils
|
|
675 |
|
|
676 |
parser = argparse.ArgumentParser(
|
|
677 |
description = 'Takes a fasta/q file. Makes a BAM file containing perfect (unpaired) reads tiling the whole genome',
|
|
678 |
@@ -17,6 +14,11 @@ parser.add_argument('outfile', help='Nam
|
|
679 |
parser.add_argument('--read_group', help='Add the given read group ID to all reads [%(default)s]' ,default='42')
|
|
680 |
options = parser.parse_args()
|
|
681 |
|
|
682 |
+
|
|
683 |
+import sys
|
|
684 |
+import os
|
|
685 |
+from fastaq import sequences, utils
|
|
686 |
+
|
|
687 |
# make a header first - we need to add the @RG line to the default header made by samtools
|
|
688 |
tmp_empty_file = options.outfile + '.tmp.empty'
|
|
689 |
f = utils.open_file_write(tmp_empty_file)
|
|
690 |
Index: fastaq/scripts/fastaq_to_unique_by_id
|
|
691 |
===================================================================
|
|
692 |
--- fastaq.orig/scripts/fastaq_to_unique_by_id
|
|
693 |
+++ fastaq/scripts/fastaq_to_unique_by_id
|
|
694 |
@@ -1,7 +1,6 @@
|
|
695 |
#!/usr/bin/env python3
|
|
696 |
|
|
697 |
import argparse
|
|
698 |
-from fastaq import tasks
|
|
699 |
|
|
700 |
parser = argparse.ArgumentParser(
|
|
701 |
description = 'Removes duplicate sequences from a fasta/q file, based on their names. If the same name is found more than once, then the longest sequence is kept. Order of sequences is preserved in output',
|
|
702 |
@@ -9,4 +8,8 @@ parser = argparse.ArgumentParser(
|
|
703 |
parser.add_argument('infile', help='Name of input fasta/q file')
|
|
704 |
parser.add_argument('outfile', help='Name of output fasta/q file')
|
|
705 |
options = parser.parse_args()
|
|
706 |
+
|
|
707 |
+
|
|
708 |
+from fastaq import tasks
|
|
709 |
+
|
|
710 |
tasks.to_unique_by_id(options.infile, options.outfile)
|
|
711 |
Index: fastaq/scripts/fastaq_translate
|
|
712 |
===================================================================
|
|
713 |
--- fastaq.orig/scripts/fastaq_translate
|
|
714 |
+++ fastaq/scripts/fastaq_translate
|
|
715 |
@@ -1,7 +1,6 @@
|
|
716 |
#!/usr/bin/env python3
|
|
717 |
|
|
718 |
import argparse
|
|
719 |
-from fastaq import tasks
|
|
720 |
|
|
721 |
parser = argparse.ArgumentParser(
|
|
722 |
description = 'Translates all sequences in a fasta or fastq file. Output is always fasta format',
|
|
723 |
@@ -10,4 +9,8 @@ parser.add_argument('--frame', type=int,
|
|
724 |
parser.add_argument('infile', help='Name of fasta/q file to be translated', metavar='in.fasta/q')
|
|
725 |
parser.add_argument('outfile', help='Name of output fasta file', metavar='out.fasta')
|
|
726 |
options = parser.parse_args()
|
|
727 |
+
|
|
728 |
+
|
|
729 |
+from fastaq import tasks
|
|
730 |
+
|
|
731 |
tasks.translate(options.infile, options.outfile, frame=options.frame)
|
|
732 |
Index: fastaq/scripts/fastaq_trim_Ns_at_end
|
|
733 |
===================================================================
|
|
734 |
--- fastaq.orig/scripts/fastaq_trim_Ns_at_end
|
|
735 |
+++ fastaq/scripts/fastaq_trim_Ns_at_end
|
|
736 |
@@ -1,7 +1,6 @@
|
|
737 |
#!/usr/bin/env python3
|
|
738 |
|
|
739 |
import argparse
|
|
740 |
-from fastaq import tasks
|
|
741 |
|
|
742 |
parser = argparse.ArgumentParser(
|
|
743 |
description = 'Trims any Ns off each sequence in a fasta/q file. Does nothing to gaps in the middle, just trims the ends',
|
|
744 |
@@ -9,4 +8,8 @@ parser = argparse.ArgumentParser(
|
|
745 |
parser.add_argument('infile', help='Name of input fasta/q file')
|
|
746 |
parser.add_argument('outfile', help='Name of output fasta/q file')
|
|
747 |
options = parser.parse_args()
|
|
748 |
+
|
|
749 |
+
|
|
750 |
+from fastaq import tasks
|
|
751 |
+
|
|
752 |
tasks.trim_Ns_at_end(options.infile, options.outfile)
|
|
753 |
Index: fastaq/scripts/fastaq_trim_ends
|
|
754 |
===================================================================
|
|
755 |
--- fastaq.orig/scripts/fastaq_trim_ends
|
|
756 |
+++ fastaq/scripts/fastaq_trim_ends
|
|
757 |
@@ -1,7 +1,6 @@
|
|
758 |
#!/usr/bin/env python3
|
|
759 |
|
|
760 |
import argparse
|
|
761 |
-from fastaq import tasks
|
|
762 |
|
|
763 |
parser = argparse.ArgumentParser(
|
|
764 |
description = 'Trims set number of bases off each sequence in a fasta/q file',
|
|
765 |
@@ -11,4 +10,8 @@ parser.add_argument('start_trim', type=i
|
|
766 |
parser.add_argument('end_trim', type=int, help='Number of bases to trim off end')
|
|
767 |
parser.add_argument('outfile', help='Name of output fasta/q file')
|
|
768 |
options = parser.parse_args()
|
|
769 |
+
|
|
770 |
+
|
|
771 |
+from fastaq import tasks
|
|
772 |
+
|
|
773 |
tasks.trim(options.infile, options.outfile, options.start_trim, options.end_trim)
|