| 1 | # | ||
| 2 | # | ||
| 3 | # BioPerl module for wrapping statistics | ||
| 4 | # | ||
| 5 | # Please direct questions and support issues to <bioperl-l@bioperl.org> | ||
| 6 | # | ||
| 7 | # Cared for by Chad Matsalla (bioinformatics1 at dieselwurks dot com) | ||
| 8 | # | ||
| 9 | # Copyright Chad Matsalla | ||
| 10 | # | ||
| 11 | # You may distribute this module under the same terms as perl itself | ||
| 12 | |||
| 13 | # POD documentation - main docs before the code | ||
| 14 | |||
| 15 | =head1 NAME | ||
| 16 | |||
| 17 | Bio::Search::GenericStatistics - An object for statistics | ||
| 18 | |||
| 19 | =head1 SYNOPSIS | ||
| 20 | |||
| 21 | my $void = $obj->set_statistic("statistic_name","statistic_value"); | ||
| 22 | my $value = $obj->get_statistic("statistic_name"); | ||
| 23 | |||
| 24 | =head1 DESCRIPTION | ||
| 25 | |||
| 26 | This is a basic container to hold the statistics returned from a program. | ||
| 27 | |||
| 28 | =head1 FEEDBACK | ||
| 29 | |||
| 30 | =head2 Mailing Lists | ||
| 31 | |||
| 32 | User feedback is an integral part of the evolution of this and other | ||
| 33 | Bioperl modules. Send your comments and suggestions preferably to | ||
| 34 | the Bioperl mailing list. Your participation is much appreciated. | ||
| 35 | |||
| 36 | bioperl-l@bioperl.org - General discussion | ||
| 37 | http://bioperl.org/wiki/Mailing_lists - About the mailing lists | ||
| 38 | |||
| 39 | =head2 Support | ||
| 40 | |||
| 41 | Please direct usage questions or support issues to the mailing list: | ||
| 42 | |||
| 43 | I<bioperl-l@bioperl.org> | ||
| 44 | |||
| 45 | rather than to the module maintainer directly. Many experienced and | ||
| 46 | reponsive experts will be able look at the problem and quickly | ||
| 47 | address it. Please include a thorough description of the problem | ||
| 48 | with code and data examples if at all possible. | ||
| 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 the | ||
| 54 | web: | ||
| 55 | |||
| 56 | https://github.com/bioperl/bioperl-live/issues | ||
| 57 | |||
| 58 | =head1 AUTHOR - Chad Matsalla | ||
| 59 | |||
| 60 | Email bioinformatics1 at dieselwurks dot com | ||
| 61 | |||
| 62 | =head1 CONTRIBUTORS | ||
| 63 | |||
| 64 | Sendu Bala, bix@sendu.me.uk | ||
| 65 | |||
| 66 | =head1 APPENDIX | ||
| 67 | |||
| 68 | The rest of the documentation details each of the object methods. | ||
| 69 | Internal methods are usually preceded with a _ | ||
| 70 | |||
| 71 | =cut | ||
| 72 | |||
| 73 | # Let the code begin... | ||
| 74 | |||
| 75 | package Bio::Search::GenericStatistics; | ||
| 76 | 36 | $Bio::Search::GenericStatistics::VERSION = '1.7.8'; | |
| 77 | 36 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 78 | |||
| 79 | |||
| 80 | 36 | ▶ | use base qw(Bio::Root::Root Bio::Search::StatisticsI); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 81 | |||
| 82 | 152 | ▶ | sub new { |
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||
| 83 | 152 | my ($class, @args) = @_; | |
| 84 | 152 | my $self = $class->SUPER::new(@args); | |
| 85 | 152 | return $self; | |
| 86 | } | ||
| 87 | |||
| 88 | =head2 get_statistic | ||
| 89 | |||
| 90 | Title : get_statistic | ||
| 91 | Usage : $statistic_object->get_statistic($statistic_name); | ||
| 92 | Function: Get the value of a statistic named $statistic_name | ||
| 93 | Returns : A scalar that should be a string | ||
| 94 | Args : A scalar that should be a string | ||
| 95 | |||
| 96 | =cut | ||
| 97 | |||
| 98 | 122 | ▶ | sub get_statistic { |
|
Subroutine
get_statistic: called CC=1 SCAR=0.0
Pod
documented
| |||
| 99 | 122 | my ($self,$arg) = @_; | |
| 100 | 122 | return $self->{stats}->{$arg}; | |
| 101 | } | ||
| 102 | |||
| 103 | =head2 set_statistic | ||
| 104 | |||
| 105 | Title : set_statistic | ||
| 106 | Usage : $statistic_object->set_statistic($statistic_name => $statistic_value); | ||
| 107 | Function: Set the value of a statistic named $statistic_name to $statistic_value | ||
| 108 | Returns : Void | ||
| 109 | Args : A hash containing name=>value pairs | ||
| 110 | |||
| 111 | =cut | ||
| 112 | |||
| 113 | 1182 | ▶ | sub set_statistic { |
|
Subroutine
set_statistic: called CC=1 SCAR=0.0
Pod
documented
| |||
| 114 | 1182 | my ($self,$name,$value) = @_; | |
| 115 | 1182 | $self->{stats}->{$name} = $value; | |
| 116 | } | ||
| 117 | |||
| 118 | =head2 available_statistics | ||
| 119 | |||
| 120 | Title : available_statistics | ||
| 121 | Usage : my @statnames = $statistic_object->available_statistics | ||
| 122 | Function: Returns the names of the available statistics | ||
| 123 | Returns : list of available statistic names | ||
| 124 | Args : none | ||
| 125 | |||
| 126 | =cut | ||
| 127 | |||
| 128 | 5 | ▶ | sub available_statistics { |
|
Subroutine
available_statistics: called CC=1 SCAR=0.0
Pod
documented
| |||
| 129 | 5 | my $self = shift; | |
| 130 | 5 | return keys %{$self->{stats}}; | |
| 131 | } | ||
| 132 | |||
| 133 | 36 | 1; | |