[BioPython] Re: [BioSQL-l] BioSQL&Python&SwissProt

Brad Chapman chapmanb at uga.edu
Tue May 18 06:11:46 EDT 2004


Hi Tamas;

> I tried to load swissprot.dat file into the biosql schema.
> It resulted in AttributeError.
[...]
> It seems for me that the Loader try to find the record.id, but 
> SProt.Record does not have an 'id'.
> What is the solution? 

The BioSQL loader uses an iterator of generic SeqRecord objects to
load the database. You are using the RecordParser, which generates
Swissprot specific Record objects. The solution is to use the
SequenceParser instead, so you should just need to modify one line
of your code:

> parser   = SProt.RecordParser()

to:

parser = SProt.SequenceParser()

This should work better for you. Another option, which is less well
tested, is to use the SeqRecord.io system to get an iterator:

from Bio import SeqRecord
iterator = SeqRecord.io.readFile(open("path_to/uniprot_sprot.dat"))

Just another option. We appreciate the report on this -- to be
honest BioSQL has not been well tested with Swissprot entries, so we
are happy to hear about people working on this and reporting
problems.

Hope this helps.
Brad


More information about the BioPython mailing list