comparison fastq_to_fasta.py @ 0:3571553aeb20 draft

Imported from capsule None
author devteam
date Mon, 27 Jan 2014 09:27:22 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:3571553aeb20
1 #Dan Blankenberg
2 import sys
3 from galaxy_utils.sequence.fastq import fastqReader
4 from galaxy_utils.sequence.fasta import fastaWriter
5
6 def 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
22 if __name__ == "__main__": main()