1 | #!/usr/bin/env python |
---|
2 | |
---|
3 | """ |
---|
4 | Performs various conversions around Sanger FASTQ data |
---|
5 | |
---|
6 | usage: %prog [options] |
---|
7 | -c, --command=c: Command to run |
---|
8 | -i, --input=i: Input file to be converted |
---|
9 | -o, --outputFastqsanger=o: FASTQ Sanger converted output file for sol2std |
---|
10 | -s, --outputFastqsolexa=s: FASTQ Solexa converted output file |
---|
11 | -f, --outputFasta=f: FASTA converted output file |
---|
12 | |
---|
13 | usage: %prog command input_file output_file |
---|
14 | """ |
---|
15 | |
---|
16 | import os, sys, tempfile |
---|
17 | from galaxy import eggs |
---|
18 | import pkg_resources; pkg_resources.require( "bx-python" ) |
---|
19 | from bx.cookbook import doc_optparse |
---|
20 | |
---|
21 | def stop_err( msg ): |
---|
22 | sys.stderr.write( "%s\n" % msg ) |
---|
23 | sys.exit() |
---|
24 | |
---|
25 | def __main__(): |
---|
26 | #Parse Command Line |
---|
27 | options, args = doc_optparse.parse( __doc__ ) |
---|
28 | |
---|
29 | cmd = "fq_all2std.pl %s %s > %s" |
---|
30 | if options.command == 'sol2std': |
---|
31 | cmd = cmd % (options.command, options.input, options.outputFastqsanger) |
---|
32 | elif options.command == 'std2sol': |
---|
33 | cmd = cmd % (options.command, options.input, options.outputFastqsolexa) |
---|
34 | elif options.command == 'fq2fa': |
---|
35 | cmd = cmd % (options.command, options.input, options.outputFasta) |
---|
36 | try: |
---|
37 | os.system(cmd) |
---|
38 | except Exception, eq: |
---|
39 | stop_err("Error converting data format.\n" + str(eq)) |
---|
40 | |
---|
41 | if __name__=="__main__": __main__() |
---|