Skip to content

Instantly share code, notes, and snippets.

@mkweskin
Created April 6, 2017 19:00
Show Gist options
  • Save mkweskin/cb26ef13801ce864b28b1fcfb38a453e to your computer and use it in GitHub Desktop.
Save mkweskin/cb26ef13801ce864b28b1fcfb38a453e to your computer and use it in GitHub Desktop.
Gives the average Q value for each sequence in a fastq
#!/usr/bin/env python
import numpy as np
from Bio import SeqIO
for record in SeqIO.parse("test_R1.fq", "fastq"):
print ('{}\t{}'.format(record.id, np.mean(record.letter_annotations["phred_quality"])))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment