[Bioperl-l] proposed query interface to Web-based sequence entry databases

Jason Stajich jason@cgt.mc.duke.edu
Mon, 18 Nov 2002 21:20:46 -0500 (EST)


On Mon, 18 Nov 2002, Lincoln Stein wrote:

> Hi,
>
> I'm doing the search interface to Entrez's eutils now.  This facility
> will allow people to create a query using Entrez query language and
> either get the count of entries returned, get the list of returned IDs
> (not accessions, unfortunately), or get the entries themselves.
>
> How does this API look?  I'm trying to keep it very basic.
>
> Lincoln
>
> PS: implementing this will require some surgery to WebDBSeqI, but I
> promise not to break anything.
>

Please do!  I'm not opposed to any changes here as long as we keep the
Bio::DB::RandomAccessI interface intact.  If you can see a better way to
do all of the implementation I'm more than happy to have the details
change.  We got trapped in this ratchet of doing all sorts of clever
things to abstract how different cgi scripts were returning data.  Now
that things appear to have cleaned up a little on the data front we may
want to redo this object in a more direct way.


API looks sensible
> # $Id$
> #
> # BioPerl module for Bio::DB::QueryI.pm
> #
> # Cared for by Lincoln Stein <lstein@cshl.org>
> #
> # Copyright Lincoln Stein
> #
> # You may distribute this module under the same terms as perl itself
> #
> # POD documentation - main docs before the code
> #
>
> =head1 NAME
>
> Bio::DB::QueryI - Object Interface to queryable sequence databases
>
> =head1 SYNOPSIS
>
>    # using Bio::DB::Query::GenBank as an example
>    my $query_string = 'Oryza[Organism] and EST[Keyword]';
>    my $query = Bio::DB::Query::GenBank->new(-db=>'nucleotide',
>                                             -query=>$query_string);
>    my $count = $query->count;
>    my @ids   = $query->get_Ids;
>
>    # get a genbank database handle
>    $gb = new Bio::DB::GenBank;
>    my $stream = $db->get_Stream_by_query($query);
>    while (my $seq = $stream->next_seq) {
>       ...
>    }
>
>    # initialize the list yourself
>    my $query = Bio::DB::Query::GenBank->new(-ids=>['X1012','CA12345']);
>
> =head1 DESCRIPTION
>
> This interface provides facilities for managing sequence queries such
> as those offered by Entrez.  A query object is created by calling
> new() with a database-specific argument list. From the query object
> you can either obtain the list of IDs returned by the query, or a
> count of entries that would be returned.  You can pass the query
> object to a Bio::DB::RandomAccessI object to return the entries
> themselves as a list or a stream.
>
> =head1 FEEDBACK
>
> =head2 Mailing Lists
>
> User feedback is an integral part of the
> evolution of this and other Bioperl modules. Send
> your comments and suggestions preferably to one
> of the Bioperl mailing lists. Your participation
> is much appreciated.
>
>   bioperl-l@bioperl.org              - General discussion
>   http://bioperl.org/MailList.shtml  - About the mailing lists
>
> =head2 Reporting Bugs
>
> Report bugs to the Bioperl bug tracking system to
> help us keep track the bugs and their resolution.
> Bug reports can be submitted via email or the
> web:
>
>   bioperl-bugs@bio.perl.org
>   http://bugzilla.bioperl.org/
>
> =head1 AUTHOR - Lincoln Stein
>
> Email lstein@cshl.org
>
> =head1 APPENDIX
>
> The rest of the documentation details each of the
> object methods. Internal methods are usually
> preceded with a _
>
> =cut
>
> # Let the code begin...
>
> package Bio::DB::QueryI;
> use strict;
> use vars qw(@ISA $VERSION);
>
> @ISA = (Bio::Root::RootI);
> $VERSION = '0.1';
>
> sub new {
>   my ($class, @args) = @_;
>   my $self = $class->SUPER::new(@args);
> }
>
> sub count   { }
> sub ids { }
> sub query { }
>
> 1;
>
>
>

-- 
Jason Stajich
Duke University
jason at cgt.mc.duke.edu