root/galaxy-central/tools/fastq/fastq_to_fasta.py

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

import galaxy-central

行番号 
1#Dan Blankenberg
2import sys
3from galaxy_utils.sequence.fastq import fastqReader
4from galaxy_utils.sequence.fasta import fastaWriter
5
6def main():
7    input_filename = sys.argv[1]
8    output_filename = sys.argv[2]
9    input_type = sys.argv[3] or 'sanger' #input type should ordinarily be unnecessary
10   
11    num_reads = None
12    fastq_read = None
13    out = fastaWriter( open( output_filename, 'wb' ) )
14    for num_reads, fastq_read in enumerate( fastqReader( open( input_filename ), format = input_type ) ):
15        out.write( fastq_read )
16    out.close()
17    if num_reads is None:
18        print "No valid FASTQ reads could be processed."
19    else:
20        print "%i FASTQ reads were converted to FASTA." % ( num_reads + 1 )
21   
22if __name__ == "__main__": main()
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。