[BioPython] Loading SwissProt to BioSQL

Peter biopython at maubp.freeserve.co.uk
Wed Oct 24 21:22:05 UTC 2007


Jonathan Boulais wrote:
> from Bio.SwissProt import SProt
> s_parser = SProt.SequenceParser()
> s_iterator = SProt.Iterator(open("path to/uniprot_sprot.dat", "r"), s_parser)

This won't help with the database issue, but you should also be able to 
load the SwissProt text file with Bio.SeqIO:

from Bio import SeqIO
s_iterator = SeqIO.parse(open("path/to/uniprot_sprot.dat"), "swiss")

This in fact will call the Bio.SwissProt.SProt module internally, and 
get it to return SeqRecord objects.

The Bio.SeqIO interface is meant to make it easy to switch the input 
file format (e.g. GenBank or EMBL).

Peter




More information about the Biopython mailing list