Skip to content

Instantly share code, notes, and snippets.

@mdshw5
Created July 4, 2014 11:36
Show Gist options
  • Save mdshw5/83ff25e4ad8814f9b3a1 to your computer and use it in GitHub Desktop.
Save mdshw5/83ff25e4ad8814f9b3a1 to your computer and use it in GitHub Desktop.
biostars 105388
from pyfaidx import Fasta, wrap_sequence
fa = Fasta('multi.fasta')
for seq in fa:
with open('{}.fa'.format(seq.name), 'w') as out:
out.write('>{}\n'.format(seq.name))
for line in wrap_sequence(70, str(seq)):
out.write(line)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment