zvoase (owner)

Revisions

  • f9174d zvoase Mon Jan 26 06:13:12 -0800 2009
  • 3e242f Mon Jan 26 06:10:30 -0800 2009
  • 9530dc Mon Jan 26 06:06:15 -0800 2009
gist: 52824 Download_button fork
public
Public Clone URL: git://gist.github.com/52824.git
Embed All Files: show embed
swiss2fasta.py #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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)