t/AlignIO/AlignIO.t: fix number of tests in plan (fixup c523e6bed866)
[bioperl-live.git] / Bio / Search / GenericStatistics.pm
blob451f46fbd0d820438b8c3c5a7622c310439cc126
1 #
3 # BioPerl module for wrapping statistics
5 # Please direct questions and support issues to <bioperl-l@bioperl.org>
7 # Cared for by Chad Matsalla (bioinformatics1 at dieselwurks dot com)
9 # Copyright Chad Matsalla
11 # You may distribute this module under the same terms as perl itself
13 # POD documentation - main docs before the code
15 =head1 NAME
17 Bio::Search::GenericStatistics - An object for statistics
19 =head1 SYNOPSIS
21 my $void = $obj->set_statistic("statistic_name","statistic_value");
22 my $value = $obj->get_statistic("statistic_name");
24 =head1 DESCRIPTION
26 This is a basic container to hold the statistics returned from a program.
28 =head1 FEEDBACK
30 =head2 Mailing Lists
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.
36 bioperl-l@bioperl.org - General discussion
37 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
39 =head2 Support
41 Please direct usage questions or support issues to the mailing list:
43 I<bioperl-l@bioperl.org>
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.
50 =head2 Reporting Bugs
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:
56 https://github.com/bioperl/bioperl-live/issues
58 =head1 AUTHOR - Chad Matsalla
60 Email bioinformatics1 at dieselwurks dot com
62 =head1 CONTRIBUTORS
64 Sendu Bala, bix@sendu.me.uk
66 =head1 APPENDIX
68 The rest of the documentation details each of the object methods.
69 Internal methods are usually preceded with a _
71 =cut
73 # Let the code begin...
75 package Bio::Search::GenericStatistics;
76 use strict;
79 use base qw(Bio::Root::Root Bio::Search::StatisticsI);
81 sub new {
82 my ($class, @args) = @_;
83 my $self = $class->SUPER::new(@args);
84 return $self;
87 =head2 get_statistic
89 Title : get_statistic
90 Usage : $statistic_object->get_statistic($statistic_name);
91 Function: Get the value of a statistic named $statistic_name
92 Returns : A scalar that should be a string
93 Args : A scalar that should be a string
95 =cut
97 sub get_statistic {
98 my ($self,$arg) = @_;
99 return $self->{stats}->{$arg};
102 =head2 set_statistic
104 Title : set_statistic
105 Usage : $statistic_object->set_statistic($statistic_name => $statistic_value);
106 Function: Set the value of a statistic named $statistic_name to $statistic_value
107 Returns : Void
108 Args : A hash containing name=>value pairs
110 =cut
112 sub set_statistic {
113 my ($self,$name,$value) = @_;
114 $self->{stats}->{$name} = $value;
117 =head2 available_statistics
119 Title : available_statistics
120 Usage : my @statnames = $statistic_object->available_statistics
121 Function: Returns the names of the available statistics
122 Returns : list of available statistic names
123 Args : none
125 =cut
127 sub available_statistics {
128 my $self = shift;
129 return keys %{$self->{stats}};