Advertisement
Guest User

Untitled

a guest
Nov 25th, 2015
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. def fasta_sequences(fasta_filename):
  2. with open(fasta_filename, 'r') as fasta_file:
  3. header, sequence = '', ''
  4. for line in fasta_file:
  5. if line.startswith('>'):
  6. if header:
  7. yield header, sequence
  8. header = line.strip()
  9. sequence = ''
  10. else:
  11. sequence += line.strip()
  12. yield header, sequence
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement