[BioSQL-l] query problem

Marc Logghe Marc.Logghe at devgen.com
Sat Nov 8 18:13:12 EST 2003


Hi,
I'm having some problems in creating a correct query. What I am trying to do is fetching a persistent feature object with primary_tag 'source' of a seq object with accesssion 'ABC' belonging to namespace 'test'. I have tried this using the following code snippet:
my $adp    = $db->get_object_adaptor('Bio::SeqFeatureI');
$adp->verbose(1);
my $query  = Bio::DB::Query::BioQuery->new();
my $mapper = Bio::DB::BioSQL::Oracle::BasePersistenceAdaptorDriver->new();

$query->datacollections(
                         [
                           "Bio::SeqFeatureI f",
                           "Bio::SeqI=>Bio::SeqFeatureI s",
                       #    "Bio::Ontology::TermI=>Bio::SeqFeatureI t",
                           "BioNamespace=>Bio::PrimarySeqI db",
                         ]
);

$query->where( [ "db.namespace = 'test'", "f.primary_tag = 'source'", "s.accession_number = 'ABC'"] );

This did not work as I expected however. Seems like f.primary_tag is mapped to type_trm_id, so I had to pass it the value 11 instead.
So, I guessed "Bio::Ontology::TermI=>Bio::SeqFeatureI t" had to be added to the datacollections in order to get to the value 'source' with the where clause:
$query->where( [ "db.namespace = 'test'", "t.name = 'source'", "s.accession_number = 'ABC'"] );
This did not work neither, because the generated sql was not OK:
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.trm_oid = t.oid AND s.db_oid = db.oid AND (db.name = 'test' AND t.name = 'source' AND s.accession = 'ABC')''])
As far as I can see 'f.trm_oid = t.oid' should read 'f.type_trm_oid = t.oid' ?
I am pretty new to the API and schema, so I guess it is more probable that I am missing something here.

Regards,
Marc




More information about the BioSQL-l mailing list