[BioPython] Loading SwissProt to BioSQL

Jonathan Boulais biosql at hotmail.com
Wed Oct 24 20:53:19 UTC 2007


Hello, 

I'm a biologist and quite newb with Biopython. I'm trying to build locally the Swissprot database with BioSQL and I'm having some problems. 
I have installed the latest version from the CVS and I'm using python 2.5 on a Mac Os 10.4. 

First, i get this weird problem. Since I need to connect with MySQL I started to wrote a simple script (Biosql.py) with only this ( from BioSQL import BioSeqDatabase). When I run this script in the terminal : python Biosql.py, I get this message **ImportError: cannot import name BioSeqDatabase**. But the weird thing is if I start a python session in the terminal by simply invoking python and then manually import BioSeqDatabase, it's working ! 
Is there any reason for that ?

Second, I've then decided to continue with the python session since I'm able to import BioSeqDatabse. The connection to MySQL is working fine, but when I'm trying to import the flat file I'm getting this : 


Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/sw/lib/python2.5/site-packages/BioSQL/BioSeqDatabase.py", line 414, in load
    db_loader.load_seqrecord(cur_record)
  File "/sw/lib/python2.5/site-packages/BioSQL/Loader.py", line 30, in load_seqrecord
    bioentry_id = self._load_bioentry_table(record)
  File "/sw/lib/python2.5/site-packages/BioSQL/Loader.py", line 250, in _load_bioentry_table
    version))
  File "/sw/lib/python2.5/site-packages/BioSQL/BioSeqDatabase.py", line 277, in execute
    self.cursor.execute(sql, args or ())
  File "/sw/lib/python2.5/site-packages/MySQLdb/cursors.py", line 151, in execute
    query = query % db.literal(args)
TypeError: not all arguments converted during string formatting


Here's the lines I'm using : 

from BioSQL import BioSeqDatabase
from Bio.SwissProt import SProt

server = BioSeqDatabase.open_database(driver = "MySQLdb", user = "", passwd = "", host = "localhost", db = "bioseqdb")
s_parser = SProt.SequenceParser()
s_iterator = SProt.Iterator(open("path to/uniprot_sprot.dat", "r"), s_parser)
db = server.new_database("Swiss")
db.load(s_iterator)


Does anybody understand this ?

Many thanks if someone can help !

Jonathan




_________________________________________________________________
Envoie un sourire, fais rire, amuse-toi! Employez-le maintenant!
http://www.emoticonesgratuites.ca/?icid=EMFRCA120



More information about the Biopython mailing list