Mercurial > repos > mahtabm > ensembl
comparison variant_effect_predictor/Bio/DB/QueryI.pm @ 0:1f6dce3d34e0
Uploaded
author | mahtabm |
---|---|
date | Thu, 11 Apr 2013 02:01:53 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:1f6dce3d34e0 |
---|---|
1 # $Id: QueryI.pm,v 1.1 2002/11/20 08:39:03 lstein Exp $ | |
2 # | |
3 # BioPerl module for Bio::DB::QueryI.pm | |
4 # | |
5 # Cared for by Lincoln Stein <lstein@cshl.org> | |
6 # | |
7 # Copyright Lincoln Stein | |
8 # | |
9 # You may distribute this module under the same terms as perl itself | |
10 # | |
11 # POD documentation - main docs before the code | |
12 # | |
13 | |
14 =head1 NAME | |
15 | |
16 Bio::DB::QueryI - Object Interface to queryable sequence databases | |
17 | |
18 =head1 SYNOPSIS | |
19 | |
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; | |
26 | |
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) { | |
31 ... | |
32 } | |
33 | |
34 # initialize the list yourself | |
35 my $query = Bio::DB::Query::GenBank->new(-ids=>['X1012','CA12345']); | |
36 | |
37 =head1 DESCRIPTION | |
38 | |
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. | |
46 | |
47 =head1 FEEDBACK | |
48 | |
49 =head2 Mailing Lists | |
50 | |
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 | |
55 is much appreciated. | |
56 | |
57 bioperl-l@bioperl.org - General discussion | |
58 http://bioperl.org/MailList.shtml - About the mailing lists | |
59 | |
60 =head2 Reporting Bugs | |
61 | |
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 | |
65 web: | |
66 | |
67 bioperl-bugs@bio.perl.org | |
68 http://bugzilla.bioperl.org/ | |
69 | |
70 =head1 AUTHOR - Lincoln Stein | |
71 | |
72 Email lstein@cshl.org | |
73 | |
74 =head1 APPENDIX | |
75 | |
76 The rest of the documentation details each of the | |
77 object methods. Internal methods are usually | |
78 preceded with a _ | |
79 | |
80 =cut | |
81 | |
82 # Let the code begin... | |
83 | |
84 package Bio::DB::QueryI; | |
85 use strict; | |
86 use Bio::Root::RootI; | |
87 | |
88 use vars qw(@ISA $VERSION); | |
89 | |
90 @ISA = qw(Bio::Root::RootI); | |
91 $VERSION = '0.1'; | |
92 | |
93 =head2 new | |
94 | |
95 Title : new | |
96 Usage : $db = Bio::DB::QueryI->new(@args); | |
97 Function: constructor | |
98 Returns : QueryI object | |
99 Args : -query a query string | |
100 -ids a list of ids as an arrayref | |
101 | |
102 Create new QueryI object. You may initialize with either a query | |
103 string or with a list of ids. If both ids and a query are provided, | |
104 the former takes precedence. | |
105 | |
106 Subclasses may recognize additional arguments. | |
107 | |
108 =cut | |
109 | |
110 =head2 count | |
111 | |
112 Title : count | |
113 Usage : $count = $db->count; | |
114 Function: return count of number of entries retrieved by query | |
115 Returns : integer | |
116 Args : none | |
117 | |
118 Returns the number of entries that are matched by the query. | |
119 | |
120 =cut | |
121 | |
122 sub count { | |
123 my $self = shift; | |
124 my @ids = $self->ids; | |
125 scalar @ids; | |
126 } | |
127 | |
128 =head2 ids | |
129 | |
130 Title : ids | |
131 Usage : @ids = $db->ids([@ids]) | |
132 Function: get/set matching ids | |
133 Returns : array of sequence ids | |
134 Args : (optional) array ref with new set of ids | |
135 | |
136 =cut | |
137 | |
138 sub ids { | |
139 my $self = shift; | |
140 $self->throw_not_implemented; | |
141 } | |
142 | |
143 =head2 query | |
144 | |
145 Title : query | |
146 Usage : $query = $db->query([$query]) | |
147 Function: get/set query string | |
148 Returns : string | |
149 Args : (optional) new query string | |
150 | |
151 =cut | |
152 | |
153 sub query { | |
154 my $self = shift; | |
155 $self->throw_not_implemented; | |
156 } | |
157 | |
158 1; |