Inspired by solutions posted at biostar, here is my contribution to this simple sequencing file format conversion.
## fastq_to_fa.py import sys from Bio.SeqIO.QualityIO import FastqGeneralIterator for title, seq, qual in FastqGeneralIterator(sys.stdin) : print(">%s\\n%s" % (title,seq))
Usage:
cat reads.fastq | fastq_to_fa.py
If you need to simply extract sequences…that is also simple!
## flattenFastq.py for title, seq, qual in FastqGeneralIterator(sys.stdin) : print("%s" % (seq))