Skip to content

Instantly share code, notes, and snippets.

@mdshw5
Created March 22, 2018 01:16
Show Gist options
  • Save mdshw5/5cb686a027f805eada61b2b521ab3f13 to your computer and use it in GitHub Desktop.
Save mdshw5/5cb686a027f805eada61b2b521ab3f13 to your computer and use it in GitHub Desktop.
biostars 305027
from simplesam import Reader
with Reader(open("input.sam")) as sam, open("output.fastq", "w") as fastq:
for read in sam:
fastq.write("@%s\n" % read.qname)
fastq.write("%s\n" % read.seq)
fastq.write("+\n")
fastq.write("%s\n" % read.qual)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment