Skip to content

Instantly share code, notes, and snippets.

@mdshw5
Last active February 20, 2016 12:39
Show Gist options
  • Save mdshw5/1c024b5c73b1e5ff9275 to your computer and use it in GitHub Desktop.
Save mdshw5/1c024b5c73b1e5ff9275 to your computer and use it in GitHub Desktop.
biostars 177781
import pyfaidx
with pyfaidx.Fasta("file.fa") as peg_fasta:
with open("file.sorted.fa", 'w') as sorted_fasta:
for id in sorted(peg_fasta.keys()):
sorted_fasta.write('>' + peg_fasta[id].long_name)
sorted_fasta.write(str(peg_fasta[id]))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment