| 1 | # | ||||||||||
| 2 | # BioPerl module for Bio::Search::Result::HMMERResult | ||||||||||
| 3 | # | ||||||||||
| 4 | # Please direct questions and support issues to <bioperl-l@bioperl.org> | ||||||||||
| 5 | # | ||||||||||
| 6 | # Cared for by Jason Stajich <jason@bioperl.org> | ||||||||||
| 7 | # | ||||||||||
| 8 | # Copyright Jason Stajich | ||||||||||
| 9 | # | ||||||||||
| 10 | # You may distribute this module under the same terms as perl itself | ||||||||||
| 11 | |||||||||||
| 12 | # POD documentation - main docs before the code | ||||||||||
| 13 | |||||||||||
| 14 | =head1 NAME | ||||||||||
| 15 | |||||||||||
| 16 | Bio::Search::Result::HMMERResult - A Result object for HMMER results | ||||||||||
| 17 | |||||||||||
| 18 | =head1 SYNOPSIS | ||||||||||
| 19 | |||||||||||
| 20 | use Bio::Search::Result::HMMERResult; | ||||||||||
| 21 | my $result = Bio::Search::Result::HMMERResult->new | ||||||||||
| 22 | ( -hmm_name => 'pfam', | ||||||||||
| 23 | -sequence_file => 'roa1.pep', | ||||||||||
| 24 | -hits => \@hits); | ||||||||||
| 25 | |||||||||||
| 26 | # generally we use Bio::SearchIO to build these objects | ||||||||||
| 27 | use Bio::SearchIO; | ||||||||||
| 28 | my $in = Bio::SearchIO->new(-format => 'hmmer', | ||||||||||
| 29 | -file => 'result.hmmer'); | ||||||||||
| 30 | while( my $result = $in->next_result ) { | ||||||||||
| 31 | print $result->query_name, " ", $result->algorithm, " ", $result->num_hits(), " hits\n"; | ||||||||||
| 32 | } | ||||||||||
| 33 | |||||||||||
| 34 | =head1 DESCRIPTION | ||||||||||
| 35 | |||||||||||
| 36 | This is a specialization of L<Bio::Search::Result::GenericResult>. | ||||||||||
| 37 | There are a few extra methods, specifically L<sequence_file>, | ||||||||||
| 38 | L<hmm_name>, L<next_models>, and L<models>. | ||||||||||
| 39 | |||||||||||
| 40 | =head1 FEEDBACK | ||||||||||
| 41 | |||||||||||
| 42 | =head2 Mailing Lists | ||||||||||
| 43 | |||||||||||
| 44 | User feedback is an integral part of the evolution of this and other | ||||||||||
| 45 | Bioperl modules. Send your comments and suggestions preferably to | ||||||||||
| 46 | the Bioperl mailing list. Your participation is much appreciated. | ||||||||||
| 47 | |||||||||||
| 48 | bioperl-l@bioperl.org - General discussion | ||||||||||
| 49 | http://bioperl.org/wiki/Mailing_lists - About the mailing lists | ||||||||||
| 50 | |||||||||||
| 51 | =head2 Support | ||||||||||
| 52 | |||||||||||
| 53 | Please direct usage questions or support issues to the mailing list: | ||||||||||
| 54 | |||||||||||
| 55 | I<bioperl-l@bioperl.org> | ||||||||||
| 56 | |||||||||||
| 57 | rather than to the module maintainer directly. Many experienced and | ||||||||||
| 58 | reponsive experts will be able look at the problem and quickly | ||||||||||
| 59 | address it. Please include a thorough description of the problem | ||||||||||
| 60 | with code and data examples if at all possible. | ||||||||||
| 61 | |||||||||||
| 62 | =head2 Reporting Bugs | ||||||||||
| 63 | |||||||||||
| 64 | Report bugs to the Bioperl bug tracking system to help us keep track | ||||||||||
| 65 | of the bugs and their resolution. Bug reports can be submitted via the | ||||||||||
| 66 | web: | ||||||||||
| 67 | |||||||||||
| 68 | https://github.com/bioperl/bioperl-live/issues | ||||||||||
| 69 | |||||||||||
| 70 | =head1 AUTHOR - Jason Stajich | ||||||||||
| 71 | |||||||||||
| 72 | Email jason@bioperl.org | ||||||||||
| 73 | |||||||||||
| 74 | =head1 APPENDIX | ||||||||||
| 75 | |||||||||||
| 76 | The rest of the documentation details each of the object methods. | ||||||||||
| 77 | Internal methods are usually preceded with a _ | ||||||||||
| 78 | |||||||||||
| 79 | =cut | ||||||||||
| 80 | |||||||||||
| 81 | # Let the code begin... | ||||||||||
| 82 | |||||||||||
| 83 | package Bio::Search::Result::HMMERResult; | ||||||||||
| 84 | 3 | $Bio::Search::Result::HMMERResult::VERSION = '1.7.3'; | |||||||||
| 85 | 3 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 86 | |||||||||||
| 87 | 3 | ▶ | use base qw(Bio::Search::Result::GenericResult); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 88 | |||||||||||
| 89 | =head2 new | ||||||||||
| 90 | |||||||||||
| 91 | Title : new | ||||||||||
| 92 | Usage : my $obj = Bio::Search::Result::HMMERResult->new(); | ||||||||||
| 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 | 37 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=3 SCAR=11.2
Pod
documented
| |||||||||||
| 116 | 37 | my($class,@args) = @_; | |||||||||
| 117 | 37 | my $self = $class->SUPER::new(@args); | |||||||||
| 118 | |||||||||||
| 119 | 37 | my ($hmm,$seqfile) = $self->_rearrange([qw(HMM_NAME SEQUENCE_FILE)], | |||||||||
| 120 | @args); | ||||||||||
| 121 | |||||||||||
| 122 | 37 | ▶ | defined( $seqfile) && $self->sequence_file($seqfile); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 123 | 37 | ▶ | defined( $hmm) && $self->hmm_name($hmm); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 124 | |||||||||||
| 125 | 37 | 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 | 50 | ▶ | sub hmm_name{ | ||||||||
|
Subroutine
hmm_name: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 141 | 50 | my ($self,$value) = @_; | |||||||||
| 142 | 50 | ▶ | if( defined $value) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 143 | 37 | $self->{'_hmm_name'} = $value; | |||||||||
| 144 | } | ||||||||||
| 145 | 50 | 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 | 50 | ▶ | sub sequence_file{ | ||||||||
|
Subroutine
sequence_file: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||
| 161 | 50 | my ($self,$value) = @_; | |||||||||
| 162 | 50 | ▶ | if( defined $value) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 163 | 37 | $self->{'_sequence_file'} = $value; | |||||||||
| 164 | } | ||||||||||
| 165 | 50 | 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 | 1107 | ▶ | sub next_model{ shift->next_hit } | ||||||||
|
Subroutine
next_model: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 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 | 0 | ▶ | sub models{ shift->hits } | ||||||||
|
Subroutine
models: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 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 | 0 | ▶ | sub rewind{ | ||||||||
|
Subroutine
rewind: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 385 | 0 | my ($self) = @_; | |||||||||
| 386 | 0 | $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 | 3 | 1; | |||||||||