Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

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

by Tanalis (Curate)
on Jun 22, 2004 at 11:05 UTC ( [id://368671]=perlquestion: print w/replies, xml ) Need Help??

Tanalis has asked for the wisdom of the Perl Monks concerning the following question:

Monks,

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_ bioperl.org 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?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://368671]
Approved by castaway
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (3)
As of 2024-03-29 01:51 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found