Skip to content

Instantly share code, notes, and snippets.



Last active Dec 17, 2015
What would you like to do?
Gerdus Van Zyl's PyPy optimized version. See
def main():
file = open("Homo_sapiens.GRCh37.67.dna_rm.chromosome.Y.fa","rb")
gcCount = 0
atCount = 0
while 1:
lines = file.readlines(10000)
if not lines:
for line in lines:
if line and not line[0] == ">":
atCount += line.count("A") + line.count("T")
gcCount += line.count('G') + line.count("C")
totalBaseCount = gcCount + atCount
gcFraction = float(gcCount) / float(totalBaseCount)
print gcFraction * 100
if __name__ == '__main__':
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.