Retrieve amino acids from fasta file and include its overall percentage for only the top 5 results
I want to display the amino acid, count and percentage for the top 5 but I can only manage the count and the amino acid with the script described below. How could I update this? L: 139002 (10.7%) A: 123885 (9.6%) G: 95475 (7.4%) V: 91683 (7.1%) I: 77836 (6.0%) #!/usr/bin/env python3 def FASTA(filename): try: f = open(filename) except IOError: print ("The file, %s, does not exist" % filename) return order = [] sequences = {} counts = {} for line in f: if line.startswith('>'): name = line[1:].rstrip('\n') # name = name.replace('_', ' ') order.append(name) sequences[name] = '' else: sequences[nam
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.