Skip to content

Instantly share code, notes, and snippets.

@zvoase
Created January 26, 2009 14:06
Show Gist options
  • Save zvoase/52824 to your computer and use it in GitHub Desktop.
Save zvoase/52824 to your computer and use it in GitHub Desktop.
import fileinput
import sys
from Bio.ExPASy import get_sprot_raw
from Bio.SeqIO import parse
from Bio.SeqIO.FastaIO import FastaWriter
fasta_out = FastaWriter(sys.stdout,
record2title=lambda record: record.id)
for accession_id in fileinput.input():
sprot_file = get_sprot_raw(accession_id)
sprot_records = parse(sprot_file, 'swiss')
for record in sprot_records:
fasta_out.write_record(record)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment