Graph/WrapList.pm untested

filter: Statementstmt 0.0% 0 / 48 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 13 Podpod 0.0% 0 / 6 totaltotal 0.0% 0 / 69 CC 2 SCAR 9.4
CC
2
Cov
0%
getLeastNonZeroElement
6.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.6
1 package Bio::GMOD::Blast::Graph::WrapList;
2 BEGIN {
3 $Bio::GMOD::Blast::Graph::WrapList::AUTHORITY = 'cpan:RBUELS';
4 }
5 BEGIN {
6 $Bio::GMOD::Blast::Graph::WrapList::VERSION = '0.06';
7 }
8 #####################################################################
9 #
10 # Cared for by Shuai Weng <shuai@genome.stanford.edu>
11 #
12 # Originally created by John Slenk <jces@genome.stanford.edu>
13 #
14 # You may distribute this module under the same terms as perl itself
15 #-----------------------------------------------------------------
16  
17 use Bio::GMOD::Blast::Graph::BaseObj;
18 use Bio::GMOD::Blast::Graph::List;
19 use Bio::GMOD::Blast::Graph::ListEnumerator;
20 use Bio::GMOD::Blast::Graph::ScientificNotation;
21 use Bio::GMOD::Blast::Graph::HitWrapper;
22 use Bio::GMOD::Blast::Graph::MyUtils;
23 use Bio::GMOD::Blast::Graph::MyDebug qw( dmsg dmsgs );
24  
25 @ISA = qw( Bio::GMOD::Blast::Graph::List );
26  
27 sub pValueSorterIncreasing
28 {
29 my( $cmp );
30 my( $aP, $bP );
31  
32 $aP = $a->getP();
33 $bP = $b->getP();
34 $cmp = Bio::GMOD::Blast::Graph::ScientificNotation::cmp( $aP, $bP );
35  
36 return( $cmp );
37 }
38  
39 sub mapHelper
40 {
41 $_->getP();
42 }
43  
44 sub sortByPValue
45 {
46 my( $self ) = shift;
47 my( @ray );
48  
49 @ray = @{$self->getElementsRef()};
50 #dmsgs( "sortByPValue(): before = ", map( mapHelper, @ray ) );
51  
52 @ray = sort pValueSorterIncreasing @ray;
53 #dmsgs( "sortByPValue(): after = ", map( mapHelper, @ray ) );
54  
55 $self->putElementsRef( \@ray );
56 }
57  
58 # really, we're looking at the p value.
59 sub getLeastNonZeroElement
60 {
61 my( $self ) = shift;
62 my( $elem );
63 my( $ref, $te );
64  
65 $ref = $self->getElementsRef();
66 foreach $te ( @{$ref} )
67 {
68 if( ! Bio::GMOD::Blast::Graph::ScientificNotation::isZero( $te->getP() ) )
69 {
70 $elem = $te;
71 last;
72 }
73 }
74  
75 return( $elem );
76 }
77  
78 1;
79  
80  
81 __END__