[BioSQL-l] python
Yves Bastide
Yves.Bastide at irisa.fr
Mon Dec 8 09:47:53 EST 2003
[kept bioSQL cc'ed, f'up to biopython-dev at biopython.org]
christen wrote:
> Hi there
>
> I am a new comer to python and biosql
>
> I have tried to get working biosql under mysql and python as ewplained in
> Basic BioSQL with Biopoython
OK, mysql vs. postgresql issues.
> I have donwloaded the latest version of both, and tried the example with
> cor6_6.gb
>
> then I got numerous problems
>
> I fixed the first one by changing line 104 in cursors from
> if args is None:
> to :
> if args is None or args=='':
>
Where's this line? "args is None" looks like something done to allow the
empty string; the usual way (to mean what you're using) would be "if not
args:"
> then in Loader, in def _load_reference(self, reference, rank, bioentry_id):,
> i made the following changes (in particular replaced JOIN by INNER JOIN)
> if reference.medline_id:
> sql="SELECT reference_id" \
> " FROM reference INNER JOIN dbxref ON reference .dbxref_id
> = dbxref.dbxref_id" \
> " WHERE ((dbname = 'MEDLINE') AND (accession = %s))"
> refs =
> self.adaptor.execute_and_fetch_col0(sql,reference.medline_id)
>
JOIN -> INNER JOIN: ok
using (field) -> on t1.field = t2.field: *sigh* ok
But are the extraneous parentheses really needed?
>
> Now, I have one more pb:
>
> Traceback (most recent call last):
> File "C:\Python23\RC_databases\rc_BioSQL_GenBank.py", line 21,
> in -toplevel-
> db.load(iterator)
> File "C:\Python23\lib\site-packages\BioSQL\BioSeqDatabase.py", line 343,
> in load
> db_loader.load_seqrecord(cur_record)
> File "C:\Python23\lib\site-packages\BioSQL\Loader.py", line 46, in
> load_seqrecord
> self._load_seqfeature(seq_feature, seq_feature_num, bioentry_id)
> File "C:\Python23\lib\site-packages\BioSQL\Loader.py", line 366, in
> _load_seqfeature
> self._load_seqfeature_locations(feature, seqfeature_id)
> File "C:\Python23\lib\site-packages\BioSQL\Loader.py", line 409, in
> _load_seqfeature_locations
> self._insert_seqfeature_location(feature, 1, seqfeature_id)
> File "C:\Python23\lib\site-packages\BioSQL\Loader.py", line 430, in
> _insert_seqfeature_location
> self.adaptor.execute(sql, (seqfeature_id, start, end, strand, rank))
> File "C:\Python23\lib\site-packages\BioSQL\BioSeqDatabase.py", line 223,
> in execute
> self.cursor.execute(sql, args)
> File "C:\Python23\lib\site-packages\MySQLdb\cursors.py", line 95, in
> execute
> return self._execute(query, args)
> File "C:\Python23\lib\site-packages\MySQLdb\cursors.py", line 119, in
> _execute
> self.errorhandler(self, exc, value)
> File "C:\Python23\Lib\site-packages\MySQLdb\connections.py", line 33, in
> defaulterrorhandler
> raise errorclass, errorvalue
> OperationalError: (1048, "Le champ 'strand' ne peut \xeatre vide (null)")
Hilmar: seems like there's a buglet in biosqldb-pg.sql: strand is
missing the NOT NULL.
Richard:
Loader.py, line 424
- strand = feature.strand
+ strand = feature.strand or 0
should do the trick
>
>
> I am for the time being only trying some quick and dirty (like modification
> of cursor instead of loader I guess...) changes to try to get it working
> My questions are :
> Is there somebody else having trouble, or do you I miss something ?
> If I did it right, Is there somebody else trying to fix these problems ?
It seems like you're the first trying these things with MySQL since they
were last changed. Thanks for the report!
> If things need some help, it would be very nice to have some clear
> description of biosql structure. I have not been able to find it. Somebody
> could help ?
>
> thanks in advance
De rien,
>
> Richard CHRISTEN
> Champion de saut en largeur
> UMR6543 CNRS - Université de Nice Sophia Antipolis
>
> Centre de Biochimie
> Parc Valrose
> 06108 Nice cedex2
>
> tel 33 - 492 076 947
> fax 33 - 492 076 408
>
yves
More information about the BioSQL-l
mailing list