1
# $Id: QueryI.pm,v 1.2 2003/06/04 08:36:37 heikki Exp $
3
# BioPerl module for Bio::DB::QueryI.pm
5
# Cared for by Lincoln Stein <lstein@cshl.org>
7
# Copyright Lincoln Stein
9
# You may distribute this module under the same terms as perl itself
11
# POD documentation - main docs before the code
16
Bio::DB::QueryI - Object Interface to queryable sequence databases
20
# using Bio::DB::Query::GenBank as an example
21
my $query_string = 'Oryza[Organism] AND EST[Keyword]';
22
my $query = Bio::DB::Query::GenBank->new(-db=>'nucleotide',
23
-query=>$query_string);
24
my $count = $query->count;
25
my @ids = $query->ids;
27
# get a genbank database handle
28
$gb = new Bio::DB::GenBank;
29
my $stream = $db->get_Stream_by_query($query);
30
while (my $seq = $stream->next_seq) {
34
# initialize the list yourself
35
my $query = Bio::DB::Query::GenBank->new(-ids=>['X1012','CA12345']);
39
This interface provides facilities for managing sequence queries such
40
as those offered by Entrez. A query object is created by calling
41
new() with a database-specific argument list. From the query object
42
you can either obtain the list of IDs returned by the query, or a
43
count of entries that would be returned. You can pass the query
44
object to a Bio::DB::RandomAccessI object to return the entries
45
themselves as a list or a stream.
51
User feedback is an integral part of the
52
evolution of this and other Bioperl modules. Send
53
your comments and suggestions preferably to one
54
of the Bioperl mailing lists. Your participation
57
bioperl-l@bioperl.org - General discussion
58
http://bioperl.org/MailList.shtml - About the mailing lists
62
Report bugs to the Bioperl bug tracking system to
63
help us keep track the bugs and their resolution.
64
Bug reports can be submitted via email or the
67
bioperl-bugs@bio.perl.org
68
http://bugzilla.bioperl.org/
70
=head1 AUTHOR - Lincoln Stein
76
The rest of the documentation details each of the
77
object methods. Internal methods are usually
82
# Let the code begin...
84
package Bio::DB::QueryI;
90
@ISA = qw(Bio::Root::RootI);
95
Usage : $db = Bio::DB::QueryI->new(@args);
97
Returns : QueryI object
98
Args : -query a query string
99
-ids a list of ids as an arrayref
101
Create new QueryI object. You may initialize with either a query
102
string or with a list of ids. If both ids and a query are provided,
103
the former takes precedence.
105
Subclasses may recognize additional arguments.
112
Usage : $count = $db->count;
113
Function: return count of number of entries retrieved by query
117
Returns the number of entries that are matched by the query.
123
my @ids = $self->ids;
130
Usage : @ids = $db->ids([@ids])
131
Function: get/set matching ids
132
Returns : array of sequence ids
133
Args : (optional) array ref with new set of ids
139
$self->throw_not_implemented;
145
Usage : $query = $db->query([$query])
146
Function: get/set query string
148
Args : (optional) new query string
154
$self->throw_not_implemented;