File Coverage

Bio/Search/GenericStatistics.pm
Criterion Covered Total %
statement 16 16 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod 4 4 100.0
total 26 26 100.0


line stmt bran cond sub pod time code
1             #
2             #
3             # BioPerl module for wrapping statistics
4             #
5             # Please direct questions and support issues to
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
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 29     29   94 use strict;
  29         30  
  29         771  
77              
78              
79 29     29   88 use base qw(Bio::Root::Root Bio::Search::StatisticsI);
  29         26  
  29         10990  
80              
81             sub new {
82 246     246 1 419 my ($class, @args) = @_;
83 246         687 my $self = $class->SUPER::new(@args);
84 246         593 return $self;
85             }
86              
87             =head2 get_statistic
88              
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
94              
95             =cut
96              
97             sub get_statistic {
98 357     357 1 337 my ($self,$arg) = @_;
99 357         1257 return $self->{stats}->{$arg};
100             }
101              
102             =head2 set_statistic
103              
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
109              
110             =cut
111              
112             sub set_statistic {
113 2479     2479 1 1943 my ($self,$name,$value) = @_;
114 2479         4170 $self->{stats}->{$name} = $value;
115             }
116              
117             =head2 available_statistics
118              
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
124              
125             =cut
126              
127             sub available_statistics {
128 7     7 1 12 my $self = shift;
129 7         8 return keys %{$self->{stats}};
  7         48  
130             }
131              
132             1;