root/galaxy-central/tools/next_gen_conversion/fastq_conversions.py

リビジョン 2, 1.3 KB (コミッタ: hatakeyama, 14 年 前)

import galaxy-central

行番号 
1#!/usr/bin/env python
2
3"""
4Performs various conversions around Sanger FASTQ data
5
6usage: %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
13usage: %prog command input_file output_file
14"""
15
16import os, sys, tempfile
17from galaxy import eggs
18import pkg_resources; pkg_resources.require( "bx-python" )
19from bx.cookbook import doc_optparse
20
21def stop_err( msg ):
22    sys.stderr.write( "%s\n" % msg )
23    sys.exit()
24 
25def __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
41if __name__=="__main__": __main__()
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。