Created
July 3, 2014 13:53
-
-
Save mdshw5/5edaf8b340d07f9575b9 to your computer and use it in GitHub Desktop.
biostars 105338
This file contains hidden or 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
from pyfaidx import Fasta, wrap_sequence | |
key_fn = lambda x: ' '.join(x.replace('len=', '').split()[:2]) | |
fa = Fasta('multi.fasta', key_function = key_fn) | |
with open('out.fasta', 'w') as out: | |
for seq in Fasta: | |
out.write('>{name}\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