2 # BioPerl module for Bio::DB::QueryI.pm
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
6 # Cared for by Lincoln Stein <lstein@cshl.org>
8 # Copyright Lincoln Stein
10 # You may distribute this module under the same terms as perl itself
12 # POD documentation - main docs before the code
17 Bio::DB::QueryI - Object Interface to queryable sequence databases
21 # using Bio::DB::Query::GenBank as an example
22 my $query_string = 'Oryza[Organism] AND EST[Keyword]';
23 my $query = Bio::DB::Query::GenBank->new(-db=>'nucleotide',
24 -query=>$query_string);
25 my $count = $query->count;
26 my @ids = $query->ids;
28 # get a genbank database handle
29 $gb = Bio::DB::GenBank->new();
30 my $stream = $db->get_Stream_by_query($query);
31 while (my $seq = $stream->next_seq) {
35 # initialize the list yourself
36 my $query = Bio::DB::Query::GenBank->new(-ids=>['X1012','CA12345']);
40 This interface provides facilities for managing sequence queries such
41 as those offered by Entrez. A query object is created by calling
42 new() with a database-specific argument list. From the query object
43 you can either obtain the list of IDs returned by the query, or a
44 count of entries that would be returned. You can pass the query
45 object to a Bio::DB::RandomAccessI object to return the entries
46 themselves as a list or a stream.
52 User feedback is an integral part of the
53 evolution of this and other Bioperl modules. Send
54 your comments and suggestions preferably to one
55 of the Bioperl mailing lists. Your participation
58 bioperl-l@bioperl.org - General discussion
59 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
63 Please direct usage questions or support issues to the mailing list:
65 I<bioperl-l@bioperl.org>
67 rather than to the module maintainer directly. Many experienced and
68 reponsive experts will be able look at the problem and quickly
69 address it. Please include a thorough description of the problem
70 with code and data examples if at all possible.
74 Report bugs to the Bioperl bug tracking system to help us keep track
75 the bugs and their resolution. Bug reports can be submitted via the
78 https://github.com/bioperl/bioperl-live/issues
80 =head1 AUTHOR - Lincoln Stein
86 The rest of the documentation details each of the
87 object methods. Internal methods are usually
92 # Let the code begin...
94 package Bio
::DB
::QueryI
;
98 use base
qw(Bio::Root::RootI);
103 Usage : $db = Bio::DB::QueryI->new(@args);
104 Function: constructor
105 Returns : QueryI object
106 Args : -query a query string
107 -ids a list of ids as an arrayref
109 Create new QueryI object. You may initialize with either a query
110 string or with a list of ids. If both ids and a query are provided,
111 the former takes precedence.
113 Subclasses may recognize additional arguments.
120 Usage : $count = $db->count;
121 Function: return count of number of entries retrieved by query
125 Returns the number of entries that are matched by the query.
131 my @ids = $self->ids;
138 Usage : @ids = $db->ids([@ids])
139 Function: get/set matching ids
140 Returns : array of sequence ids
141 Args : (optional) array ref with new set of ids
147 $self->throw_not_implemented;
153 Usage : $query = $db->query([$query])
154 Function: get/set query string
156 Args : (optional) new query string
162 $self->throw_not_implemented;