[BioSQL-l] query problem

Marc Logghe Marc.Logghe at devgen.com
Mon Nov 10 08:46:05 EST 2003



> -----Original Message-----
> From: Hilmar Lapp [mailto:hlapp at gnf.org]
> Sent: Monday, November 10, 2003 1:01 AM
> To: Marc Logghe
> Cc: OBDA BioSQL (E-mail)
> Subject: Re: [BioSQL-l] query problem
> seqfeature has two foreign keys to term, one for type 
> ($feature->primary_tag) and one for source ($feature->source_tag). 
> Without context, the OR mapper cannot know which one you're referring 
> to in a join. The mechanism for supplying context is appending the 
> contextual keyword to the alias of the ambiguous parent, delimited by 
> '::'. For seqfeature's foreign keys to term, the context keywords are 
> primary_tag and source_tag. I.e., you need to write
> 
> 	...,
> 	"Bio::Ontology::TermI=>Bio::SeqFeatureI t",
> 	...
> 
> as
> 
> 	...,
> 	"Bio::Ontology::TermI=>Bio::SeqFeatureI t::primary_tag",
> 	...
> 
Pfuuu, I could't have found out that for myself. Thanks a lot.
Unfortunatly in my case it did not work. The resulting SQL looked like:
SELECT f.oid, f.display_name, f.rank, f.ent_oid, f.type_trm_oid, f.source_trm_oid FROM seqfeature f, bioentry s, term t, biodatabase db WHERE f.ent_oid = s.oid AND f. = t.oid AND s.db_oid = db.oid AND (db.name = 'test' AND t.name = 'source' AND s.accession = 'ABC')
Note the "f. = t.oid"
Tried this with a freshly installed bioperl-db from cvs (MAIN trunk) to rule out version problems.


Something else. In another experiment I tried the following:


$query->datacollections(
                         [
                           "Bio::PrimarySeqI e",
                           "Bio::Annotation::Comment cmt",
                           "BioNamespace=>Bio::PrimarySeqI db",
                           "Bio::PrimarySeqI=>Bio::Annotation::Comment"
                         ]
);
$query->where(
  [ "db.namespace = 'test'", "cmt.text like 'Current target*'" ] );



------------- EXCEPTION  -------------
MSG: slot 'name' not mapped to column for table biodatabase
STACK Bio::DB::Query::BioQuery::_map_slot_to_col /usr/lib/perl5/site_perl/5.6.1/Bio/DB/Query/BioQuery.pm:487
STACK Bio::DB::Query::BioQuery::_map_constraint_slots_to_columns /usr/lib/perl5/site_perl/5.6.1/Bio/DB/Query/BioQuery.pm:369
STACK Bio::DB::Query::BioQuery::_map_constraint_slots_to_columns /usr/lib/perl5/site_perl/5.6.1/Bio/DB/Query/BioQuery.pm:355
STACK Bio::DB::Query::BioQuery::translate_query /usr/lib/perl5/site_perl/5.6.1/Bio/DB/Query/BioQuery.pm:305
STACK Bio::DB::BioSQL::BaseDriver::translate_query /usr/lib/perl5/site_perl/5.6.1/Bio/DB/BioSQL/BaseDriver.pm:1182
STACK Bio::DB::BioSQL::BasePersistenceAdaptor::find_by_query /usr/lib/perl5/site_perl/5.6.1/Bio/DB/BioSQL/BasePersistenceAdaptor.pm:1198
STACK toplevel ./edit_bioentry.pl:56

--------------------------------------

I don't know whether this is due to a bug or abuse of the API from my side but, I managed to 'fix' it.
In Bio::DB::BioSQL::BaseDriver I added the key/value pair "name" => "name" to the 'biodatabase' key of %slot_attribute_map.
This fixed it, but a similar exception occurred after that (MSG: slot 'comment_text' not mapped to column for table anncomment). Everything was fine after adding comment_text => 'comment_text' pair.

Thanks a lot for the help !!!!
Regards,
Marc



More information about the BioSQL-l mailing list