Last active
June 26, 2017 09:58
-
-
Save wdecoster/63626825b203896d4672fc1446d974ba to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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