[BioPython] Problems with BioSQL/postgres/Genbank

Christopher Hart christopher.e.hart at gmail.com
Mon Jul 18 00:15:08 EDT 2005


Hello,

when following this tutorial:
http://www.biopython.org/docs/biosql/python_biosql_basic.html

I'm getting this error:

IntegrityError: ERROR:  insert or update on table "bioentry" violates
foreign key constraint "fktaxon_bioentry"

On closer inspection within the pdb, the taxon_id is set to 0,
regardless of what it should be from the genbank file.  I've tried
loading several genbank files, and the taxon_id is always set to 0.
Although I can circumvent this problem by adding an taxon_id 0 to the
taxon table within the biosqldb, this is obviously a suboptimal
solution.  Any suggestions?

Specifics of my setup are as follows:

I was trying to try out the BioSQL module to load some genbank
sequences in.  I've installed postgres 8.0, and the latest CVS
checkouts of both biopython and biosql.  I'm attaching to postgres
through psycopg.

And here is the full traceback:

------Begin paste----------
In [8]:db.load(iterator)
---------------------------------------------------------------------------
psycopg.IntegrityError                            Traceback (most
recent call last)

/home/hart/<console>

/home/hart/python-home-packages/lib/python/BioSQL/BioSeqDatabase.py in
load(self, record_iterator)
    412                 break
    413             num_records += 1
--> 414             db_loader.load_seqrecord(cur_record)
    415
    416         return num_records

/home/hart/python-home-packages/lib/python/BioSQL/Loader.py in
load_seqrecord(self, record)
     35         """Load a Biopython SeqRecord into the database.
     36         """
---> 37         bioentry_id = self._load_bioentry_table(record)
     38         self._load_bioentry_date(record, bioentry_id)
     39         self._load_biosequence(record, bioentry_id)

/home/hart/python-home-packages/lib/python/BioSQL/Loader.py in
_load_bioentry_table(self, record)
    249          %s,
    250          %s)"""
--> 251         self.adaptor.execute(sql, (self.dbid,
    252                                    taxon_id,
    253                                    record.name,

/home/hart/python-home-packages/lib/python/BioSQL/BioSeqDatabase.py in
execute(self, sql, args)
    275         """Just execute an sql command.
    276         """
--> 277         self.cursor.execute(sql, args or ())
    278
    279     def get_subseq_as_string(self, seqid, start, end):

IntegrityError: ERROR:  insert or update on table "bioentry" violates
foreign key constraint "fktaxon_bioentry"
DETAIL:  Key (taxon_id)=(0) is not present in table "taxon".


        INSERT INTO bioentry (
         biodatabase_id,
         taxon_id,
         name,
         accession,
         identifier,
         division,
         description,
         version)
        VALUES (
         7,
         '0',
         'ATCOR66M',
         'X55053',
         '16229',
         'PLN',
         'A.thaliana cor6.6 mRNA.',
         1)
> /home/hart/python-home-packages/lib/python/BioSQL/BioSeqDatabase.py(277)execute()
-> self.cursor.execute(sql, args or ())

---end paste----

Thanks,
Chris



More information about the BioPython mailing list