Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options

Retrieving Search Results from a Bio::DB::GenBank Query

by Tanalis (Curate)
on Jun 22, 2004 at 11:05 UTC ( #368671=perlquestion: print w/replies, xml ) Need Help??
Tanalis has asked for the wisdom of the Perl Monks concerning the following question:


I am currently making use of the Bio::DB::GenBank module from BioPerl to conduct searches for medical terms across a number of databases in turn.

Using the docs as a guide, I have written the following subroutine which should make this possible:

sub search { my ( $db, @keywords ) = @_; my ( $gb, $query, $seqio ); $gb = new Bio::DB::GenBank; $query = Bio::DB::Query::GenBank->new( -query => join(" ", @keywords), -db => $db ); $seqio = $gb->get_Stream_by_query($query); print "Search for [", join(" ", @keywords), "] on $db returned ", +$query->count, " results.\n"; while ( my $seq = $seqio->next_seq() ) { # do something with the data } }

I am encountering problems when trying to extract each sequence object from the stream, however, in that calls to $seqio->next_seq() never seem to return an object. I am certain data is being retrieved from the database (the count of records retrieved and obtained from $query is > 0).

Has anyone made use of this module and had a similar problem? If so, can you suggest a way to correct the issue?

Thanks in advance,

Replies are listed 'Best First'.
Re: Retrieving Search Results from a Bio::DB::GenBank Query
by stajich (Chaplain) on Jun 22, 2004 at 12:40 UTC
    We really suggest you post your question to the bioperl mailing list - bioperl-l _at_ as that is where the bioperl developers hang out.

    What version of Bioperl? What specific keywords did you use and db? Do you want to join your keywords together with an AND instead of space?

    I can run things fine on the following query which gets barley ESTs. I am using bioperl-live code from CVS but I also tested it with the bioperl 1.4 release as well and it worked great.

    &search('nucleotide','txid4512[orgn] AND gbdiv_est[PROP]');
    And I also made your loop actually do something
    my $i; while ( my $seq = $seqio->next_seq() ) { # do something with the data print $seq->display_id, "\n"; last if $i++ > 5; }

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://368671]
Approved by castaway
[ambrus]: "you are far more likely to be squished between two other dudes" => wait, really? aren't most planes, weighted by people traveling on it, so narrow that there are only two or three seats on each side of the one corridor, so only one third of the people ge
[ambrus]: t squished between two other people?
holli is about to take the first hit since a month and this weed is strong shit. Should my head explode, someone call 911.
[ambrus]: And even when I traveled on a big plane for a long flight, it had 3 seats, then corridor, then 4 seats, then corridor, then 3 seats, so less than half of the people sit between two other dudes.

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (10)
As of 2017-12-18 13:39 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (486 votes). Check out past polls.