Skip to content

Instantly share code, notes, and snippets.

@jamescasbon
Created September 21, 2011 10:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jamescasbon/1231739 to your computer and use it in GitHub Desktop.
Save jamescasbon/1231739 to your computer and use it in GitHub Desktop.
# quickly fix mapping qualities in samfiles generated by SSAHA2
# mapq 255 is undefined according to spec, but SSAHA2 is not
# following this convention
import pysam
infile = pysam.Samfile( "-", "rb" )
outfile = pysam.Samfile( "-", "wb", template = infile )
for s in infile:
if s.mapq == 255:
s.mapq = 244
outfile.write(s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment