[BioSQL-l] find_by_query() usage ?

albert vilella vilella at bio.ub.es
Fri Jul 11 18:35:22 EDT 2003


Hi all,

somebody posted a question some months ago about querying a BioSQL
database:

> Hi all,
> 
> I just managed to load some whole genomes into my BioSQL compliant
> database, but now I run into troubles when trying to retrieve them
> with the following script Perl script:
> 
> <snip>
> my $dbadap= Bio::DB::BioDB->new(
> 				-database => 'biosql',
> 				-dbname => $dbname,
> 				-user => $dbuser,
> 				-host => $dbhost,
> 				-driver => $dbdriver);
> 
> my $objadap=$dbadap->get_object_adaptor("Bio::SeqI");
> 
> my $query=Bio::DB::Query::BioQuery->new(); 
> 
> my $result=$objadap->find_by_query();
> 
> foreach my $obj ($result->each_Object()) {
>     print "Id : $obj->display_id\n";
> }
> </snip>

I'm in a similar situation. I find that the simplest example (from
query.t) is not working:

<snip>
my $sqlgen = Bio::DB::Query::SqlGenerator->new(-query => $query);
$query = Bio::DB::Query::BioQuery->new();
$mapper = Bio::DB::BioSQL::mysql::BasePersistenceAdaptorDriver->new();

$query->selectelts(["accession_number","version"]);
$query->datacollections(["Bio::PrimarySeqI"]);
$tquery = $query->translate_query($mapper);
$sql = $sqlgen->generate_sql($tquery);

my $dbadap= Bio::DB::BioDB->new(
				-database => 'biosql',
				-dbname   => 'biosql',
				-user => 'root',
				-driver => 'mysql');

my $objadap=$dbadap->get_object_adaptor("Bio::SeqI");

my $result=$objadap->find_by_query();

foreach my $obj ($result->each_Object()) {
    print "Id : $obj->display_id\n";
}
</snip>

Can't call method "translate_query" on an undefined value at
/usr/lib/perl5/site_perl/5.8.0/Bio/DB/BioSQL/BaseDriver.pm line 1097.

Maybe I'm missing something. Any help?

I find particularly tricky the mapping (as in $mapper) of the tables in
biosql. Where can I find info about this?

One example is if I'm trying to get the aminoacidic sequence of a CDS
(located as a seqfeature_qualifier_value of type 15) by it's gene
modifier (like /gene="rpL31"). How would that query be constructed?

Thanks in advance,

Albert


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://pw600a.bioperl.org/pipermail/biosql-l/attachments/20030711/09596bf6/attachment.bin


More information about the BioSQL-l mailing list