Skip to content

Instantly share code, notes, and snippets.

@wdecoster
Last active June 26, 2017 09:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wdecoster/63626825b203896d4672fc1446d974ba to your computer and use it in GitHub Desktop.
Save wdecoster/63626825b203896d4672fc1446d974ba to your computer and use it in GitHub Desktop.
def aveQual(quals):
'''
Receive the integer quality scores of a read and return the average quality for that read
First convert Phred scores to probabilities, calculate average error probability and convert average back to Phred scale
'''
return -10*math.log(sum([10**(q/-10) for q in quals]) / len(quals), 10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment