Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

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:

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
Node Status?
node history
Node Type: perlquestion [id://368671]
Approved by castaway
help
Chatterbox?
[Corion]: Hi Discipulus!
[marto]: hopefully you guys are also well :)
[Corion]: marto: Yeah - I'm looking for a week off in a week, even if it'll be a trip to Amsterdam ;)
[Discipulus]: oh thanks, i'm always at well as the ratchet or bucket
[Corion]: But I'm slowly starting to get into programming again - yesterday I translated my talk for YAPC::E (in Amsterdam) to English, and decided to put my Jekyll-clone to rest for the time being
[Corion]: Discipulus++ # being well is like being earnest
[marto]: hopefully next year I'll be in a position to go to Perly things in Europe :)
[Corion]: Maybe I'll use the Real Jekyll a bit to get a feel for how it actually works, and to get annoyed by it ;)
[Corion]: marto: That would be cool :) There is no kids care at Perly events unfortunately, so it's not entirely family friendly
[Corion]: I think I should define a set of (say) five projects through which I rotate from time to time, just to prevent myself from being bored/annoyed by the problems they get stuck in ;)

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2017-07-27 07:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I came, I saw, I ...
























    Results (404 votes). Check out past polls.