Mercurial > repos > mahtabm > ensembl
comparison variant_effect_predictor/Bio/Search/Result/HMMERResult.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: HMMERResult.pm,v 1.3 2002/10/22 07:45:18 lapp Exp $ | |
2 # | |
3 # BioPerl module for Bio::Search::Result::HMMERResult | |
4 # | |
5 # Cared for by Jason Stajich <jason@bioperl.org> | |
6 # | |
7 # Copyright Jason Stajich | |
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 =head1 NAME | |
14 | |
15 Bio::Search::Result::HMMERResult - A Result object for HMMER results | |
16 | |
17 =head1 SYNOPSIS | |
18 | |
19 use Bio::Search::Result::HMMERResult; | |
20 my $result = new Bio::Search::Result::HMMERResult | |
21 ( -hmm_name => 'pfam', | |
22 -sequence_file => 'roa1.pep', | |
23 -hits => \@hits); | |
24 | |
25 # generally we use Bio::SearchIO to build these objects | |
26 use Bio::SearchIO; | |
27 my $in = new Bio::SearchIO(-format => 'hmmer', | |
28 -file => 'result.hmmer'); | |
29 while( my $result = $in->next_result ) { | |
30 print $result->query_name, " ", $result->algorithm, " ", $result->num_hits(), " hits\n"; | |
31 } | |
32 | |
33 =head1 DESCRIPTION | |
34 | |
35 This is a specialization of L<Bio::Search::Result::GenericResult>. | |
36 There are a few extra methods, specifically L<sequence_file>, | |
37 L<hmm_name>, L<next_models>, and L<models>. | |
38 | |
39 =head1 FEEDBACK | |
40 | |
41 =head2 Mailing Lists | |
42 | |
43 User feedback is an integral part of the evolution of this and other | |
44 Bioperl modules. Send your comments and suggestions preferably to | |
45 the Bioperl mailing list. Your participation is much appreciated. | |
46 | |
47 bioperl-l@bioperl.org - General discussion | |
48 http://bioperl.org/MailList.shtml - About the mailing lists | |
49 | |
50 =head2 Reporting Bugs | |
51 | |
52 Report bugs to the Bioperl bug tracking system to help us keep track | |
53 of the bugs and their resolution. Bug reports can be submitted via | |
54 email or the web: | |
55 | |
56 bioperl-bugs@bioperl.org | |
57 http://bugzilla.bioperl.org/ | |
58 | |
59 =head1 AUTHOR - Jason Stajich | |
60 | |
61 Email jason@bioperl.org | |
62 | |
63 Describe contact details here | |
64 | |
65 =head1 CONTRIBUTORS | |
66 | |
67 Additional contributors names and emails here | |
68 | |
69 =head1 APPENDIX | |
70 | |
71 The rest of the documentation details each of the object methods. | |
72 Internal methods are usually preceded with a _ | |
73 | |
74 =cut | |
75 | |
76 | |
77 # Let the code begin... | |
78 | |
79 | |
80 package Bio::Search::Result::HMMERResult; | |
81 use vars qw(@ISA); | |
82 use strict; | |
83 | |
84 use Bio::Search::Result::GenericResult; | |
85 | |
86 | |
87 @ISA = qw(Bio::Search::Result::GenericResult ); | |
88 | |
89 =head2 new | |
90 | |
91 Title : new | |
92 Usage : my $obj = new Bio::Search::Result::HMMERResult(); | |
93 Function: Builds a new Bio::Search::Result::HMMERResult object | |
94 Returns : Bio::Search::Result::HMMERResult | |
95 Args : -hmm_name => string, name of hmm file | |
96 -sequence_file => name of the sequence file | |
97 | |
98 plus Bio::Search::Result::GenericResult parameters | |
99 | |
100 -query_name => Name of query Sequence | |
101 -query_accession => Query accession number (if available) | |
102 -query_description => Description of query sequence | |
103 -query_length => Length of query sequence | |
104 -database_name => Name of database | |
105 -database_letters => Number of residues in database | |
106 -database_entries => Number of entries in database | |
107 -parameters => hash ref of search parameters (key => value) | |
108 -statistics => hash ref of search statistics (key => value) | |
109 -algorithm => program name (blastx) | |
110 -algorithm_version => version of the algorithm (2.1.2) | |
111 -program_reference => literature reference string for this algorithm | |
112 | |
113 =cut | |
114 | |
115 sub new { | |
116 my($class,@args) = @_; | |
117 my $self = $class->SUPER::new(@args); | |
118 | |
119 my ($hmm,$seqfile) = $self->_rearrange([qw(HMM_NAME SEQUENCE_FILE)], | |
120 @args); | |
121 | |
122 defined( $seqfile) && $self->sequence_file($seqfile); | |
123 defined( $hmm) && $self->hmm_name($hmm); | |
124 | |
125 return $self; | |
126 } | |
127 | |
128 | |
129 =head2 hmm_name | |
130 | |
131 Title : hmm_name | |
132 Usage : $obj->hmm_name($newval) | |
133 Function: Get/Set the value of hmm_name | |
134 Returns : value of hmm_name | |
135 Args : newvalue (optional) | |
136 | |
137 | |
138 =cut | |
139 | |
140 sub hmm_name{ | |
141 my ($self,$value) = @_; | |
142 if( defined $value) { | |
143 $self->{'_hmm_name'} = $value; | |
144 } | |
145 return $self->{'_hmm_name'}; | |
146 } | |
147 | |
148 | |
149 =head2 sequence_file | |
150 | |
151 Title : sequence_file | |
152 Usage : $obj->sequence_file($newval) | |
153 Function: Get/Set the value of sequence_file | |
154 Returns : value of sequence_file | |
155 Args : newvalue (optional) | |
156 | |
157 | |
158 =cut | |
159 | |
160 sub sequence_file{ | |
161 my ($self,$value) = @_; | |
162 if( defined $value) { | |
163 $self->{'_sequence_file'} = $value; | |
164 } | |
165 return $self->{'_sequence_file'}; | |
166 | |
167 } | |
168 | |
169 | |
170 =head2 next_model | |
171 | |
172 Title : next_model | |
173 Usage : my $domain = $result->next_model | |
174 Function: Returns the next domain - this | |
175 is an alias for next_hit | |
176 Returns : L<Bio::Search::Hit::HitI> object | |
177 Args : none | |
178 | |
179 | |
180 =cut | |
181 | |
182 sub next_model{ shift->next_hit } | |
183 | |
184 =head2 models | |
185 | |
186 Title : models | |
187 Usage : my @domains = $result->models; | |
188 Function: Returns the list of HMM models seen - this | |
189 is an alias for hits() | |
190 Returns : Array of L<Bio::Search::Hit::HitI> objects | |
191 Args : none | |
192 | |
193 | |
194 =cut | |
195 | |
196 sub models{ shift->hits } | |
197 | |
198 =head2 Bio::Search::Result::GenericResult inherited methods | |
199 | |
200 =cut | |
201 | |
202 =head2 algorithm | |
203 | |
204 Title : algorithm | |
205 Usage : my $r_type = $hsp->algorithm | |
206 Function: Obtain the name of the algorithm used to obtain the Result | |
207 Returns : string (e.g., BLASTP) | |
208 Args : [optional] scalar string to set value | |
209 | |
210 =cut | |
211 | |
212 =head2 algorithm_version | |
213 | |
214 Title : algorithm_version | |
215 Usage : my $r_version = $hsp->algorithm_version | |
216 Function: Obtain the version of the algorithm used to obtain the Result | |
217 Returns : string (e.g., 2.1.2) | |
218 Args : [optional] scalar string to set algorithm version value | |
219 | |
220 =cut | |
221 | |
222 =head2 Bio::Search::Result::ResultI interface methods | |
223 | |
224 Bio::Search::Result::ResultI implementation | |
225 | |
226 =head2 next_hit | |
227 | |
228 Title : next_hit | |
229 Usage : while( $hit = $result->next_hit()) { ... } | |
230 Function: Returns the next available Hit object, representing potential | |
231 matches between the query and various entities from the database. | |
232 Returns : a Bio::Search::Hit::HitI object or undef if there are no more. | |
233 Args : none | |
234 | |
235 | |
236 =cut | |
237 | |
238 =head2 query_name | |
239 | |
240 Title : query_name | |
241 Usage : $id = $result->query_name(); | |
242 Function: Get the string identifier of the query used by the | |
243 algorithm that performed the search. | |
244 Returns : a string. | |
245 Args : [optional] new string value for query name | |
246 | |
247 =cut | |
248 | |
249 =head2 query_accession | |
250 | |
251 Title : query_accession | |
252 Usage : $id = $result->query_accession(); | |
253 Function: Get the accession (if available) for the query sequence | |
254 Returns : a string | |
255 Args : [optional] new string value for accession | |
256 | |
257 =cut | |
258 | |
259 =head2 query_length | |
260 | |
261 Title : query_length | |
262 Usage : $id = $result->query_length(); | |
263 Function: Get the length of the query sequence | |
264 used in the search. | |
265 Returns : a number | |
266 Args : [optional] new integer value for query length | |
267 | |
268 =cut | |
269 | |
270 =head2 query_description | |
271 | |
272 Title : query_description | |
273 Usage : $id = $result->query_description(); | |
274 Function: Get the description of the query sequence | |
275 used in the search. | |
276 Returns : a string | |
277 Args : [optional] new string for the query description | |
278 | |
279 =cut | |
280 | |
281 =head2 database_name | |
282 | |
283 Title : database_name | |
284 Usage : $name = $result->database_name() | |
285 Function: Used to obtain the name of the database that the query was searched | |
286 against by the algorithm. | |
287 Returns : a scalar string | |
288 Args : [optional] new string for the db name | |
289 | |
290 =cut | |
291 | |
292 =head2 database_letters | |
293 | |
294 Title : database_letters | |
295 Usage : $size = $result->database_letters() | |
296 Function: Used to obtain the size of database that was searched against. | |
297 Returns : a scalar integer (units specific to algorithm, but probably the | |
298 total number of residues in the database, if available) or undef if | |
299 the information was not available to the Processor object. | |
300 Args : [optional] new scalar integer for number of letters in db | |
301 | |
302 | |
303 =cut | |
304 | |
305 =head2 database_entries | |
306 | |
307 Title : database_entries | |
308 Usage : $num_entries = $result->database_entries() | |
309 Function: Used to obtain the number of entries contained in the database. | |
310 Returns : a scalar integer representing the number of entities in the database | |
311 or undef if the information was not available. | |
312 Args : [optional] new integer for the number of sequence entries in the db | |
313 | |
314 | |
315 =cut | |
316 | |
317 =head2 get_parameter | |
318 | |
319 Title : get_parameter | |
320 Usage : my $gap_ext = $report->get_parameter('gapext') | |
321 Function: Returns the value for a specific parameter used | |
322 when running this report | |
323 Returns : string | |
324 Args : name of parameter (string) | |
325 | |
326 =cut | |
327 | |
328 =head2 available_parameters | |
329 | |
330 Title : available_parameters | |
331 Usage : my @params = $report->available_paramters | |
332 Function: Returns the names of the available parameters | |
333 Returns : Return list of available parameters used for this report | |
334 Args : none | |
335 | |
336 =cut | |
337 | |
338 =head2 get_statistic | |
339 | |
340 Title : get_statistic | |
341 Usage : my $gap_ext = $report->get_statistic('kappa') | |
342 Function: Returns the value for a specific statistic available | |
343 from this report | |
344 Returns : string | |
345 Args : name of statistic (string) | |
346 | |
347 =cut | |
348 | |
349 =head2 available_statistics | |
350 | |
351 Title : available_statistics | |
352 Usage : my @statnames = $report->available_statistics | |
353 Function: Returns the names of the available statistics | |
354 Returns : Return list of available statistics used for this report | |
355 Args : none | |
356 | |
357 =cut | |
358 | |
359 =head2 Bio::Search::Result::GenericResult specific methods | |
360 | |
361 =cut | |
362 | |
363 =head2 add_hit | |
364 | |
365 Title : add_hit | |
366 Usage : $report->add_hit($hit) | |
367 Function: Adds a HitI to the stored list of hits | |
368 Returns : Number of HitI currently stored | |
369 Args : Bio::Search::Hit::HitI | |
370 | |
371 =cut | |
372 | |
373 =head2 rewind | |
374 | |
375 Title : rewind | |
376 Usage : $result->rewind; | |
377 Function: Allow one to reset the Hit iteration to the beginning | |
378 Since this is an in-memory implementation | |
379 Returns : none | |
380 Args : none | |
381 | |
382 =cut | |
383 | |
384 sub rewind{ | |
385 my ($self) = @_; | |
386 $self->{'_hitindex'} = 0; | |
387 } | |
388 | |
389 | |
390 =head2 add_parameter | |
391 | |
392 Title : add_parameter | |
393 Usage : $report->add_parameter('gapext', 11); | |
394 Function: Adds a parameter | |
395 Returns : none | |
396 Args : key - key value name for this parama | |
397 value - value for this parameter | |
398 | |
399 =cut | |
400 | |
401 =head2 add_statistic | |
402 | |
403 Title : add_statistic | |
404 Usage : $report->add_statistic('lambda', 2.3); | |
405 Function: Adds a parameter | |
406 Returns : none | |
407 Args : key - key value name for this parama | |
408 value - value for this parameter | |
409 | |
410 =cut | |
411 | |
412 =head2 num_hits | |
413 | |
414 Title : num_hits | |
415 Usage : my $hitcount= $result->num_hits | |
416 Function: returns the number of hits for this query result | |
417 Returns : integer | |
418 Args : none | |
419 | |
420 | |
421 =cut | |
422 | |
423 =head2 hits | |
424 | |
425 Title : hits | |
426 Usage : my @hits = $result->hits | |
427 Function: Returns the available hits for this Result | |
428 Returns : Array of L<Bio::Search::Hit::HitI> objects | |
429 Args : none | |
430 | |
431 | |
432 =cut | |
433 | |
434 =head2 program_reference | |
435 | |
436 Title : program_reference | |
437 Usage : $obj->program_reference($newval) | |
438 Function: | |
439 Returns : value of the literature reference for the algorithm | |
440 Args : newvalue (optional) | |
441 | |
442 | |
443 =cut | |
444 | |
445 1; |