Bio/Search/Iteration/GenericIteration.pm

filter: Statementstmt 51.3% 133 / 259 Branchbran 34.8% 30 / 86 Conditioncond 34.7% 8 / 23 MC/DCmcdc 0.0% 0 / 13 Subroutinesub 59.2% 16 / 27 Podpod 100% 24 / 24 totaltotal 48.8% 211 / 432 CC 62 SCAR 29.9
CC
62
Cov
46%
add_hit
90.0
new
31.8
converged
20.0
CRAP 19.8
« Bio/Location/Split.pm ↑ Summary Bio/Align/PairwiseStatistics.pm »
1 #
2 # BioPerl module for Bio::Search::Iteration::GenericIteration
3 #
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
5 #
6 # Cared for by Steve Chervitz <sac@bioperl.org>
7 #
8 # Copyright Steve Chervitz
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 # TODO: Consider calling this BlastIteration (strongly) and maybe simplifying IterationI.
15  
16 =head1 NAME
17  
18 Bio::Search::Iteration::GenericIteration - A generic implementation of the Bio::Search::Iteration::IterationI interface.
19  
20 =head1 SYNOPSIS
21  
22 use Bio::Search::Iteration::GenericIteration;
23 my $it = Bio::Search::GenericIteration->new(
24 -number => 1,
25 -converged => 0,
26 -newhits_unclassified => [@newhits_unclass],
27 -newhits_below => [@newhits_below_threshold],
28 -newhits_not_below => [@newhits_not_below_threshold],
29 -oldhits_below => [@oldhits_below_threshold],
30 -oldhits_newly_below => [@oldhits_newly_below_threshold],
31 -oldhits_not_below => [@oldhits_not_below_threshold],
32 );
33  
34 # TODO: Describe how to configure a SearchIO stream so that it generates
35 # GenericIteration objects.
36  
37  
38 =head1 DESCRIPTION
39  
40 This module acts as a container for Bio::Search::Hit::HitI objects,
41 allowing a Search::Result::ResultI object to partition its hits based
42 on which iteration the hit occurred in (e.g., a PSI-BLAST round).
43  
44 Unless you're writing a parser, you won't ever need to create a
45 GenericIteration or any other IterationI-implementing object. If you use
46 the SearchIO system, IterationI objects are created automatically from
47 a SearchIO stream which returns Bio::Search::Result::ResultI objects
48 and you get the IterationI objects via the ResultI API.
49  
50 For documentation on what you can do with GenericIteration (and other IterationI
51 objects), please see the API documentation in
52 L<Bio::Search::Iteration::IterationI|Bio::Search::Iteration::IterationI>.
53  
54 Bio::Search::Iteration::GenericIteration is similar in spirit to the deprecated
55 Bio::Tools::BPlite::Iteration modules in bioperl releases prior to 1.6, except
56 that Bio::Search::Iteration::GenericIteration is a pure container, without any
57 parsing functionality as is in Bio::Tools::BPlite::Iteration.
58  
59 =head1 FEEDBACK
60  
61 =head2 Mailing Lists
62  
63 User feedback is an integral part of the evolution of this and other
64 Bioperl modules. Send your comments and suggestions preferably to
65 the Bioperl mailing list. Your participation is much appreciated.
66  
67 bioperl-l@bioperl.org - General discussion
68 http://bioperl.org/wiki/Mailing_lists - About the mailing lists
69  
70 =head2 Support
71  
72 Please direct usage questions or support issues to the mailing list:
73  
74 I<bioperl-l@bioperl.org>
75  
76 rather than to the module maintainer directly. Many experienced and
77 reponsive experts will be able look at the problem and quickly
78 address it. Please include a thorough description of the problem
79 with code and data examples if at all possible.
80  
81 =head2 Reporting Bugs
82  
83 Report bugs to the Bioperl bug tracking system to help us keep track
84 of the bugs and their resolution. Bug reports can be submitted via the
85 web:
86  
87 https://github.com/bioperl/bioperl-live/issues
88  
89 =head1 AUTHOR - Steve Chervitz
90  
91 Email sac@bioperl.org
92  
93 =head1 APPENDIX
94  
95 The rest of the documentation details each of the object methods.
96 Internal methods are usually preceded with a _
97  
98 =cut
99  
100  
101 # Let the code begin...
102  
103  
104 package Bio::Search::Iteration::GenericIteration;
105 12 $Bio::Search::Iteration::GenericIteration::VERSION = '1.7.8';
106 12 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
107  
108  
109 12 ▶use base qw(Bio::Root::Root Bio::Search::Iteration::IterationI);
Subroutine BEGIN: called CC=1 SCAR=0.0
110  
111 =head2 new
112  
113 Title : new
114 Usage : my $obj = Bio::Search::Iteration->new(%args);
115 Function: Builds a new Bio::Search::Iteration object
116 Returns : Bio::Search::Iteration::GenericIteration object
117 Args : -number => integer for the number of this iteration (required)
118 -converged => boolean value whether or not the iteration converged
119 -newhits_unclassified => array reference to hits that were not found
120 in a previous iteration for the iteration and have not been
121 classified with regard to the inclusion threshold
122  
123 # The following are only used for PSI-BLAST reports:
124  
125 -newhits_below => array reference to hits were not found in a
126 previous iteration and are below the inclusion threshold.
127 -newhits_not_below => array reference to hits that were not found in a
128 previous iteration below threshold that and are not below
129 the inclusion threshold threshold.
130 -oldhits_below => array reference to hits that were found
131 in a previous iteration below inclusion threshold and are
132 still below threshold in the current iteration.
133 -oldhits_newly_below => array reference to hits that were found
134 in a previous iteration above threshold but are below
135 threshold in the current iteration.
136 -oldhits_not_below => array reference to hits that were found in a
137 previous iteration above threshold that and are still above
138 the inclusion threshold threshold.
139  
140 -hit_factory => Bio::Factory::ObjectFactoryI capable of making
141 Bio::Search::Hit::HitI objects
142  
143 =cut
144  
145 40 ▶sub new {
Subroutine new: called CC=16 SCAR=34.6
Pod documented
146 40 my($class,@args) = @_;
147  
148 40 my $self = $class->SUPER::new(@args);
149 40 my ($number, $newhits_unclassified, $newhits_below, $newhits_not_below,
150 $oldhits_below, $oldhits_newly_below, $oldhits_not_below, $converged,
151 $h_f) =
152 $self->_rearrange([qw(NUMBER
153 NEWHITS_UNCLASSIFIED
154 NEWHITS_BELOW
155 NEWHITS_NOT_BELOW
156 OLDHITS_BELOW
157 OLDHITS_NEWLY_BELOW
158 OLDHITS_NOT_BELOW
159 CONVERGED
160 HIT_FACTORY
161 )], @args);
162  
163 40 ▶ if( ! defined $number ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $number) { } 0 40 40
164 0 $self->throw(-class=>'Bio::Root::BadParameter',
165 -text=>"Iteration number not specified.");
166 } else {
167 40 $self->number($number);
168 }
169  
170 40 ▶ defined $converged && $self->converged($converged);
Branch: 1 branch
BranchTrueFalseTotal
defined $converged and $self->converged($converged) 0 40 40
171  
172 # TODO: Performance optimization test calling add_hit() vs. simple assignment:
173 # push @{$self->{'_hits_new'}}, @{$newhits};
174 # vs.
175 # foreach(@{$newhits_below}) {$self->add_hit(-hit=>$_, -old=>0, -below=>1);}
176  
177 40 ▶ if(defined $newhits_unclassified ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newhits_unclassified) { } 0 40 40
178 0 ▶ if( ref($newhits_unclassified) =~ /ARRAY/i) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref($newhits_unclassified) =~ /ARRAY/i) { } 0 0 0
179 0 push @{$self->{'_newhits_unclassified'}}, @{$newhits_unclassified};
180 } else {
181 0 $self->throw(-class=>'Bio::Root::BadParameter',
182 -text=>"Parameter NEWHITS is not an array ref: $newhits_unclassified");
183 }
184 } else {
185 40 $self->{'_newhits_unclassified'} = [];
186 }
187  
188 40 ▶ if(defined $newhits_below ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newhits_below) { } 40 0 40
189 40 ▶ if( ref($newhits_below) =~ /ARRAY/i) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref($newhits_below) =~ /ARRAY/i) { } 40 0 40
190 40 push @{$self->{'_newhits_below_threshold'}}, @{$newhits_below};
191 } else {
192 0 $self->throw(-class=>'Bio::Root::BadParameter',
193 -text=>"Parameter NEWHITS_BELOW is not an array ref: $newhits_below");
194 }
195 } else {
196 0 $self->{'_newhits_below_threshold'} = [];
197 }
198  
199 40 ▶ if(defined $newhits_not_below ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $newhits_not_below) { } 40 0 40
200 40 ▶ if( ref($newhits_not_below) =~ /ARRAY/i) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref($newhits_not_below) =~ /ARRAY/i) { } 40 0 40
201 40 push @{$self->{'_newhits_not_below_threshold'}}, @{$newhits_not_below};
202 } else {
203 0 $self->throw(-class=>'Bio::Root::BadParameter',
204 -text=>"Parameter NEWHITS_NOT_BELOW is not an array ref: $newhits_not_below");
205 }
206 } else {
207 0 $self->{'_newhits_not_below_threshold'} = [];
208 }
209  
210 40 ▶ if(defined $oldhits_below ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $oldhits_below) { } 40 0 40
211 40 ▶ if( ref($oldhits_below) =~ /ARRAY/i) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref($oldhits_below) =~ /ARRAY/i) { } 40 0 40
212 40 push @{$self->{'_oldhits_below_threshold'}}, @{$oldhits_below};
213 } else {
214 0 $self->throw(-class=>'Bio::Root::BadParameter',
215 -text=>"Parameter OLDHITS_BELOW is not an array ref: $oldhits_below");
216 }
217 } else {
218 0 $self->{'_oldhits_below_threshold'} = [];
219 }
220  
221 40 ▶ if(defined $oldhits_newly_below ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $oldhits_newly_below) { } 40 0 40
222 40 ▶ if( ref($oldhits_newly_below) =~ /ARRAY/i) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref($oldhits_newly_below) =~ /ARRAY/i) { } 40 0 40
223 40 push @{$self->{'_oldhits_newly_below_threshold'}}, @{$oldhits_newly_below};
224 } else {
225 0 $self->throw(-class=>'Bio::Root::BadParameter',
226 -text=>"Parameter OLDHITS_NEWLY_BELOW is not an array ref: $oldhits_newly_below");
227 }
228 } else {
229 0 $self->{'_oldhits_newly_below_threshold'} = [];
230 }
231  
232 40 ▶ if(defined $oldhits_not_below ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $oldhits_not_below) { } 40 0 40
233 40 ▶ if( ref($oldhits_not_below) =~ /ARRAY/i) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref($oldhits_not_below) =~ /ARRAY/i) { } 40 0 40
234 40 push @{$self->{'_oldhits_not_below_threshold'}}, @{$oldhits_not_below};
235 } else {
236 0 $self->throw(-class=>'Bio::Root::BadParameter',
237 -text=>"Parameter OLDHITS_NOT_BELOW is not an array ref: $oldhits_not_below");
238 }
239 } else {
240 0 $self->{'_oldhits_not_below_threshold'} = [];
241 }
242
243 40 ▶ $self->hit_factory($h_f) if $h_f;
Branch: 1 branch
BranchTrueFalseTotal
if $h_f 40 0 40
244
245 40 return $self;
246 }
247  
248  
249 =head2 number
250  
251 See documentation in Bio::Search::Iteration::IterationI.
252  
253 =cut
254  
255 40 ▶sub number {
Subroutine number: called CC=4 SCAR=15.0
Pod documented
256 40 my ($self,$value) = @_;
257 40 my $previous = $self->{'_number'};
258 40 ▶ if( defined $value || ! defined $previous ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value or not defined $previous) 40 0 40
Condition33%1/3
defined $value or not defined $previous
l!l&&r!l&&!r
4000
MC/DC0%0/2
defined $value or not defined $previous
defined $value not defined $previous
Truth table33%1/3
A or not(B)
A= defined $valueB= not defined $previous
ABresult
1X1
011
000
259 40 ▶ $value = $previous = '' unless defined $value;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value 0 40 40
260 40 $self->{'_number'} = $value;
261 }
262 40 return $previous;
263 }
264  
265 =head2 converged
266  
267 See documentation in Bio::Search::Iteration::IterationI.
268  
269 =cut
270  
271 0 ▶sub converged {
Subroutine converged: not called CC=4 SCAR=30.0
Pod documented
272 0 my ($self,$value) = @_;
273 0 my $previous = $self->{'_converged'};
274 0 ▶ if( defined $value || ! defined $previous ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $value or not defined $previous) 0 0 0
Condition0%0/3
defined $value or not defined $previous
l!l&&r!l&&!r
000
MC/DC0%0/2
defined $value or not defined $previous
defined $value not defined $previous
Truth table0%0/3
A or not(B)
A= defined $valueB= not defined $previous
ABresult
1X1
011
000
275 0 ▶ $value = $previous = '' unless defined $value;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $value 0 0 0
276 0 $self->{'_converged'} = $value;
277 }
278 0 return $previous;
279 }
280  
281  
282 =head2 hit_factory
283  
284 Title : hit_factory
285 Usage : $hit->hit_factory($hit_factory)
286 Function: Get/set the factory used to build HitI objects if necessary.
287 Returns : Bio::Factory::ObjectFactoryI
288 Args : Bio::Factory::ObjectFactoryI
289  
290 =cut
291  
292 310 ▶sub hit_factory {
Subroutine hit_factory: called CC=3 SCAR=11.0
Pod documented
293 310 my $self = shift;
294 310 ▶ if (@_) { $self->{_hit_factory} = shift }
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 40 270 310
295 310 ▶ return $self->{_hit_factory} || return;
Condition50%1/2
$self->{'_hit_factory'} || (return)
l!l
3100
MC/DC0%0/1
$self->{'_hit_factory'} || (return)
$self->{'_hit_factory'}
Truth table50%1/2
A
A= $self->{'_hit_factory'}
Aresult
11
00
296 }
297  
298 =head2 next_hit
299  
300 This iterates through all old hits as returned by L<oldhits>
301 followed by all new hits as returned by L<newhits>.
302  
303 For more documentation see L<Bio::Search::Iteration::IterationI::next_hit()|Bio::Search::Iteration::IterationI>.
304  
305 =cut
306  
307 730 ▶sub next_hit {
Subroutine next_hit: called CC=2 SCAR=6.9
Pod documented
308 730 my ($self) = @_;
309  
310 730 ▶ unless($self->{'_hit_queue_started'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"_hit_queue_started"}) 37 693 730
311 37 $self->{'_hit_queue'} = ( [$self->oldhits(), $self->newhits()] );
312 37 $self->{'_hit_queue_started'} = 1;
313 }
314 730 return shift @{$self->{'_hit_queue'}};
315 }
316  
317 =head2 next_hit_new
318  
319 See documentation in L<Bio::Search::Iteration::IterationI::next_hit_new()|Bio::Search::Iteration::IterationI>.
320  
321 =cut
322  
323 0 ▶sub next_hit_new {
Subroutine next_hit_new: not called CC=2 SCAR=17.9
Pod documented
324 0 my ($self) = @_;
325  
326 0 ▶ unless($self->{'_hit_queue_new_started'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"_hit_queue_new_started"}) 0 0 0
327 0 $self->{'_hit_queue_new'} = [$self->newhits()];
328 0 $self->{'_hit_queue_new_started'} = 1;
329 }
330 0 return shift @{$self->{'_hit_queue_new'}};
331 }
332  
333 =head2 next_hit_old
334  
335 See documentation in L<Bio::Search::Iteration::IterationI::next_hit_old()|Bio::Search::Iteration::IterationI>.
336  
337 =cut
338  
339 0 ▶sub next_hit_old {
Subroutine next_hit_old: not called CC=2 SCAR=17.9
Pod documented
340 0 my ($self,$found_again) = @_;
341  
342 0 ▶ unless($self->{'_hit_queue_old_started'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"_hit_queue_old_started"}) 0 0 0
343 0 $self->{'_hit_queue_old'} = [$self->oldhits()];
344 0 $self->{'_hit_queue_old_started'} = 1;
345 }
346 0 return shift @{$self->{'_hit_queue_old'}};
347 }
348  
349 =head2 rewind
350  
351 Title : rewind
352 Usage : $iteration->rewind;
353 Function: Allow one to reset the Hit iterators to the beginning
354 Since this is an in-memory implementation
355 Returns : none
356 Args : none
357  
358 =cut
359  
360 5 ▶sub rewind {
Subroutine rewind: called CC=2 SCAR=6.9
Pod documented
361 5 my $self = shift;
362 5 $self->{'_hit_queue_started'} = 0;
363 5 $self->{'_hit_queue_new_started'} = 0;
364 5 $self->{'_hit_queue_old_started'} = 0;
365 5 foreach ($self->hits) {
366 82 $_->rewind;
367 }
368 }
369  
370  
371 =head2 num_hits
372  
373 See documentation in L<Bio::Search::Iteration::IterationI::num_hits()|Bio::Search::Iteration::IterationI>.
374  
375 =cut
376  
377 0 ▶sub num_hits {
Subroutine num_hits: not called CC=1 SCAR=6.9
Pod documented
378 0 my $self = shift;
379  
380 0 return $self->num_hits_old + $self->num_hits_new;
381 }
382  
383 =head2 num_hits_new
384  
385 See documentation in L<Bio::Search::Iteration::IterationI::num_hits_new()|Bio::Search::Iteration::IterationI>.
386  
387 =cut
388  
389 0 ▶sub num_hits_new {
Subroutine num_hits_new: not called CC=1 SCAR=6.9
Pod documented
390 0 my $self = shift;
391  
392 0 return scalar $self->newhits();
393 }
394  
395 =head2 num_hits_old
396  
397 See documentation in L<Bio::Search::Iteration::IterationI::num_hits_old()|Bio::Search::Iteration::IterationI>.
398  
399 =cut
400  
401 0 ▶sub num_hits_old {
Subroutine num_hits_old: not called CC=1 SCAR=6.9
Pod documented
402 0 my ($self,$found_again) = @_;
403  
404 0 return scalar $self->oldhits();
405 }
406  
407 =head2 add_hit
408  
409 See documentation in L<Bio::Search::Iteration::IterationI::add_hit()|Bio::Search::Iteration::IterationI>.
410  
411 =cut
412  
413 0 ▶sub add_hit {
Subroutine add_hit: not called CC=9 SCAR=45.0
Pod documented
414 0 my ($self,@args) = @_;
415 0 my( $hit, $old, $below, $newly_below ) =
416 $self->_rearrange([qw(HIT
417 OLD
418 BELOW_THRESHOLD
419 NEWLY_BELOW
420 )], @args);
421 0 my $count = 0;
422  
423 0 ▶ unless( ref($hit) eq 'HASH' || $hit->isa('Bio::Search::Hit::HitI') ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $hit eq "HASH" or $hit->isa("Bio::Search::Hit::HitI")) 0 0 0
Condition0%0/3
ref $hit eq "HASH" or $hit->isa("Bio::Search::Hit::HitI")
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $hit eq "HASH" or $hit->isa("Bio::Search::Hit::HitI")
ref $hit eq "HASH" $hit->isa("Bio::Search::Hit::HitI")
Truth table0%0/3
A or B
A= ref $hit eq "HASH"B= $hit->isa("Bio::Search::Hit::HitI")
ABresult
1X1
011
000
424 0 $self->throw(-class=>'Bio::Root::BadParameter',
425 -text=>"Passed in " .ref($hit).
426 " as a Hit which is not a Bio::Search::Hit::HitI.");
427 }
428  
429 0 ▶ if($old) {
Branch: 2 branches
BranchTrueFalseTotal
if ($old) { } 0 0 0
elsif (defined $old) { } 0 0 0
430 0 ▶ if ($newly_below) {
Branch: 2 branches
BranchTrueFalseTotal
if ($newly_below) { } 0 0 0
elsif ($below) { } 0 0 0
431 0 push @{$self->{'_oldhits_newly_below_threshold'}}, $hit;
432 0 $count = scalar @{$self->{'_oldhits_newly_below_threshold'}};
433 } elsif ($below) {
434 0 push @{$self->{'_oldhits_below_threshold'}}, $hit;
435 0 $count = scalar @{$self->{'_oldhits_below_threshold'}};
436 } else {
437 0 push @{$self->{'_oldhits_not_below_threshold'}}, $hit;
438 0 $count = scalar @{$self->{'_oldhits_not_below_threshold'}};
439 }
440 } elsif (defined $old) {
441 # -old is defined but false, so this is a new PSI-BLAST hit
442 0 ▶ if ($below) {
Branch: 2 branches
BranchTrueFalseTotal
if ($below) { } 0 0 0
elsif (defined $below) { } 0 0 0
443 0 push @{$self->{'_newhits_below_threshold'}}, $hit;
444 0 $count = scalar @{$self->{'_newhits_below_threshold'}};
445 } elsif (defined $below) {
446 0 push @{$self->{'_newhits_not_below_threshold'}}, $hit;
447 0 $count = scalar @{$self->{'_newhits_not_below_threshold'}};
448 } else {
449 # -below not defined, PSI-BLAST threshold may not be known
450 0 push @{$self->{'_newhits_unclassified'}}, $hit;
451 0 $count = scalar @{$self->{'_newhits_unclassified'}};
452 }
453 } else {
454 # -old not defined, so it's non-PSI-BLAST
455 0 push @{$self->{'_newhits_unclassified'}}, $hit;
456 0 $count = scalar @{$self->{'_newhits_unclassified'}};
457 }
458 0 return $count;
459 }
460  
461 =head2 hits
462  
463 See Documentation in InterfaceI.
464  
465 =cut
466  
467 8 ▶sub hits {
Subroutine hits: called CC=1 SCAR=0.0
Pod documented
468 8 my $self = shift;
469 # print STDERR "Called GenericIteration::hits()\n";
470 8 my @new = $self->newhits;
471 8 my @old = $self->oldhits;
472 8 return ( @new, @old );
473 }
474  
475 =head2 newhits
476  
477 Returns a list containing all newhits in this order:
478  
479 newhits_below_threshold
480 newhits_not_below_threshold
481 newhits_unclassified
482  
483 See more documentation in InterfaceI.
484  
485 =cut
486  
487 45 ▶sub newhits {
Subroutine newhits: called CC=1 SCAR=0.0
Pod documented
488 45 my $self = shift;
489 45 my @hits = $self->newhits_below_threshold;
490 45 push @hits, $self->newhits_not_below_threshold;
491 45 push @hits, $self->newhits_unclassified;
492 45 return @hits;
493 }
494  
495 =head2 newhits_below_threshold
496  
497 See documentation in L<Bio::Search::Iteration::IterationI::newhits_below_threshold()|Bio::Search::Iteration::IterationI>.
498  
499 =cut
500  
501 45 ▶sub newhits_below_threshold {
Subroutine newhits_below_threshold: called CC=5 SCAR=16.4
Pod documented
502 45 my $self = shift;
503 45 ▶ if (ref $self->{'_newhits_below_threshold'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self->{"_newhits_below_threshold"}) 45 0 45
504 0 ▶ my $factory = $self->hit_factory || return @{$self->{'_newhits_below_threshold'}};
Condition50%1/2
$self->hit_factory || (return @{$self->{'_newhits_below_threshold'};})
l!l
450
MC/DC0%0/1
$self->hit_factory || (return @{$self->{'_newhits_below_threshold'};})
$self->hit_factory
Truth table50%1/2
A
A= $self->hit_factory
Aresult
11
00
505 45 for (0..$#{$self->{'_newhits_below_threshold'}}) {
506 542 ▶ ref(${$self->{'_newhits_below_threshold'}}[$_]) eq 'HASH' || next;
Branch: 1 branch
BranchTrueFalseTotal
ref do { $$self{"_newhits_below_threshold"} }->[$_] eq "HASH" or next 540 2 542
507 540 ${$self->{'_newhits_below_threshold'}}[$_] = $factory->create_object(%{${$self->{'_newhits_below_threshold'}}[$_]});
508 }
509 45 return @{$self->{'_newhits_below_threshold'}};
510 }
511 0 return;
512 }
513  
514 =head2 newhits_not_below_threshold
515  
516 See documentation in L<Bio::Search::Iteration::IterationI::newhits_not_below_threshold()|Bio::Search::Iteration::IterationI>.
517  
518 =cut
519  
520 45 ▶sub newhits_not_below_threshold {
Subroutine newhits_not_below_threshold: called CC=5 SCAR=16.4
Pod documented
521 45 my $self = shift;
522 45 ▶ if (ref $self->{'_newhits_not_below_threshold'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self->{"_newhits_not_below_threshold"}) 45 0 45
523 0 ▶ my $factory = $self->hit_factory || return @{$self->{'_newhits_not_below_threshold'}};
Condition50%1/2
$self->hit_factory || (return @{$self->{'_newhits_not_below_threshold'};})
l!l
450
MC/DC0%0/1
$self->hit_factory || (return @{$self->{'_newhits_not_below_threshold'};})
$self->hit_factory
Truth table50%1/2
A
A= $self->hit_factory
Aresult
11
00
524 45 for (0..$#{$self->{'_newhits_not_below_threshold'}}) {
525 505 ▶ ref(${$self->{'_newhits_not_below_threshold'}}[$_]) eq 'HASH' || next;
Branch: 1 branch
BranchTrueFalseTotal
ref do { $$self{"_newhits_not_below_threshold"} }->[$_] eq "HASH" or next 345 160 505
526 345 ${$self->{'_newhits_not_below_threshold'}}[$_] = $factory->create_object(%{${$self->{'_newhits_not_below_threshold'}}[$_]});
527 }
528 45 return @{$self->{'_newhits_not_below_threshold'}};
529 }
530 0 return;
531 }
532  
533 =head2 newhits_unclassified
534  
535 Title : newhits_unclassified
536 Usage : foreach( $iteration->hits_unclassified ) {...}
537 Function: Gets all newhits that have not been partitioned into
538 sets relative to the inclusion threshold.
539 Returns : Array of Bio::Search::Hit::HitI objects.
540 Args : none
541  
542 =cut
543  
544 45 ▶sub newhits_unclassified {
Subroutine newhits_unclassified: called CC=5 SCAR=22.7
Pod documented
545 45 my $self = shift;
546 45 ▶ if (ref $self->{'_newhits_unclassified'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self->{"_newhits_unclassified"}) 45 0 45
547 0 ▶ my $factory = $self->hit_factory || return @{$self->{'_newhits_unclassified'}};
Condition50%1/2
$self->hit_factory || (return @{$self->{'_newhits_unclassified'};})
l!l
450
MC/DC0%0/1
$self->hit_factory || (return @{$self->{'_newhits_unclassified'};})
$self->hit_factory
Truth table50%1/2
A
A= $self->hit_factory
Aresult
11
00
548 45 for (0..$#{$self->{'_newhits_unclassified'}}) {
549 0 ▶ ref(${$self->{'_newhits_unclassified'}}[$_]) eq 'HASH' || next;
Branch: 1 branch
BranchTrueFalseTotal
ref do { $$self{"_newhits_unclassified"} }->[$_] eq "HASH" or next 0 0 0
550 0 ${$self->{'_newhits_unclassified'}}[$_] = $factory->create_object(%{${$self->{'_newhits_unclassified'}}[$_]});
551 }
552 45 return @{$self->{'_newhits_unclassified'}};
553 }
554 0 return;
555 }
556  
557 =head2 oldhits
558  
559 Returns a list containing all oldhits in this order:
560  
561 oldhits_below_threshold
562 oldhits_newly_below_threshold
563 oldhits_not_below_threshold
564  
565 See more documentation in InterfaceI.
566  
567 =cut
568  
569 45 ▶sub oldhits {
Subroutine oldhits: called CC=1 SCAR=0.0
Pod documented
570 45 my $self = shift;
571 45 my @hits = $self->oldhits_below_threshold;
572 45 push @hits, $self->oldhits_newly_below_threshold;
573 45 push @hits, $self->oldhits_not_below_threshold;
574 45 return @hits;
575 }
576  
577 =head2 oldhits_below_threshold
578  
579 See documentation in L<Bio::Search::Iteration::IterationI::oldhits_below_threshold()|Bio::Search::Iteration::IterationI>.
580  
581 =cut
582  
583 45 ▶sub oldhits_below_threshold {
Subroutine oldhits_below_threshold: called CC=5 SCAR=22.7
Pod documented
584 45 my $self = shift;
585 45 ▶ if (ref $self->{'_oldhits_below_threshold'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self->{"_oldhits_below_threshold"}) 45 0 45
586 0 ▶ my $factory = $self->hit_factory || return @{$self->{'_oldhits_below_threshold'}};
Condition50%1/2
$self->hit_factory || (return @{$self->{'_oldhits_below_threshold'};})
l!l
450
MC/DC0%0/1
$self->hit_factory || (return @{$self->{'_oldhits_below_threshold'};})
$self->hit_factory
Truth table50%1/2
A
A= $self->hit_factory
Aresult
11
00
587 45 for (0..$#{$self->{'_oldhits_below_threshold'}}) {
588 0 ▶ ref(${$self->{'_oldhits_below_threshold'}}[$_]) eq 'HASH' || next;
Branch: 1 branch
BranchTrueFalseTotal
ref do { $$self{"_oldhits_below_threshold"} }->[$_] eq "HASH" or next 0 0 0
589 0 ${$self->{'_oldhits_below_threshold'}}[$_] = $factory->create_object(%{${$self->{'_oldhits_below_threshold'}}[$_]});
590 }
591 45 return @{$self->{'_oldhits_below_threshold'}};
592 }
593 0 return;
594 }
595  
596 =head2 oldhits_newly_below_threshold
597  
598 See documentation in L<Bio::Search::Iteration::IterationI::oldhits_newly_below_threshold()|Bio::Search::Iteration::IterationI>.
599  
600 =cut
601  
602 45 ▶sub oldhits_newly_below_threshold {
Subroutine oldhits_newly_below_threshold: called CC=5 SCAR=22.7
Pod documented
603 45 my $self = shift;
604 45 ▶ if (ref $self->{'_oldhits_newly_below_threshold'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self->{"_oldhits_newly_below_threshold"}) 45 0 45
605 0 ▶ my $factory = $self->hit_factory || return @{$self->{'_oldhits_newly_below_threshold'}};
Condition50%1/2
$self->hit_factory || (return @{$self->{'_oldhits_newly_below_threshold'};})
l!l
450
MC/DC0%0/1
$self->hit_factory || (return @{$self->{'_oldhits_newly_below_threshold'};})
$self->hit_factory
Truth table50%1/2
A
A= $self->hit_factory
Aresult
11
00
606 45 for (0..$#{$self->{'_oldhits_newly_below_threshold'}}) {
607 0 ▶ ref(${$self->{'_oldhits_newly_below_threshold'}}[$_]) eq 'HASH' || next;
Branch: 1 branch
BranchTrueFalseTotal
ref do { $$self{"_oldhits_newly_below_threshold"} }->[$_] eq "HASH" or next 0 0 0
608 0 ${$self->{'_oldhits_newly_below_threshold'}}[$_] = $factory->create_object(%{${$self->{'_oldhits_newly_below_threshold'}}[$_]});
609 }
610 45 return @{$self->{'_oldhits_newly_below_threshold'}};
611 }
612 0 return;
613 }
614  
615 =head2 oldhits_not_below_threshold
616  
617 See documentation in L<Bio::Search::Iteration::IterationI::oldhits_not_below_threshold()|Bio::Search::Iteration::IterationI>.
618  
619 =cut
620  
621 45 ▶sub oldhits_not_below_threshold {
Subroutine oldhits_not_below_threshold: called CC=5 SCAR=22.7
Pod documented
622 45 my $self = shift;
623 45 ▶ if (ref $self->{'_oldhits_not_below_threshold'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self->{"_oldhits_not_below_threshold"}) 45 0 45
624 0 ▶ my $factory = $self->hit_factory || return @{$self->{'_oldhits_not_below_threshold'}};
Condition50%1/2
$self->hit_factory || (return @{$self->{'_oldhits_not_below_threshold'};})
l!l
450
MC/DC0%0/1
$self->hit_factory || (return @{$self->{'_oldhits_not_below_threshold'};})
$self->hit_factory
Truth table50%1/2
A
A= $self->hit_factory
Aresult
11
00
625 45 for (0..$#{$self->{'_oldhits_not_below_threshold'}}) {
626 0 ▶ ref(${$self->{'_oldhits_not_below_threshold'}}[$_]) eq 'HASH' || next;
Branch: 1 branch
BranchTrueFalseTotal
ref do { $$self{"_oldhits_not_below_threshold"} }->[$_] eq "HASH" or next 0 0 0
627 0 ${$self->{'_oldhits_not_below_threshold'}}[$_] = $factory->create_object(%{${$self->{'_oldhits_not_below_threshold'}}[$_]});
628 }
629 45 return @{$self->{'_oldhits_not_below_threshold'}};
630 }
631 0 return;
632 }
633  
634 =head2 hits_below_threshold
635  
636 See documentation in L<Bio::Search::Iteration::IterationI::hits_below_threshold()|Bio::Search::Iteration::IterationI>.
637  
638 =cut
639  
640 0 ▶sub hits_below_threshold {
Subroutine hits_below_threshold: not called CC=1 SCAR=6.9
Pod documented
641 0 my $self = shift;
642 0 my @hits = $self->newhits_below_threshold;
643 0 push @hits, $self->oldhits_newly_below_threshold;
644 0 return @hits;
645 }
646  
647 =head2 get_hit
648  
649 See documentation in L<Bio::Search::Iteration::IterationI::get_hit()|Bio::Search::Iteration::IterationI>.
650  
651 To free up the memory used by the get_hit() functionality, call free_hit_lookup().
652  
653 This functionality might be useful at the Result level, too.
654 BlastResult::get_hit() would return a list of HitI objects for hits
655 that occur in multiple iterations.
656  
657 =cut
658  
659 0 ▶sub get_hit {
Subroutine get_hit: not called CC=2 SCAR=17.9
Pod documented
660 0 my ($self,$name) = @_;
661 0 ▶ $self->_create_hit_lookup() unless defined $self->{'_hit_lookup'};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"_hit_lookup"} 0 0 0
662  
663 0 return $self->{'_hit_lookup'}->{"\U$name"};
664 }
665  
666 # Internal method.
667 0 ▶sub _create_hit_lookup {
Subroutine _create_hit_lookup: not called CC=2 SCAR=17.9
668 0 my $self = shift;
669 0 foreach ($self->hits) {
670 0 my $hname = $_->name;
671 0 $self->{'_hit_lookup'}->{"\U$hname"} = $_;
672 }
673 }
674  
675 =head2 free_hit_lookup
676  
677 Purpose : Frees up the memory used by the get_hit() functionality.
678 For the memory-conscious.
679  
680 =cut
681  
682 0 ▶sub free_hit_lookup {
Subroutine free_hit_lookup: not called CC=1 SCAR=6.9
Pod documented
683 0 my $self = shift;
684 0 undef $self->{'_hit_lookup'};
685 }
686  
687 12 1;
« Bio/Location/Split.pm ↑ Summary Bio/Align/PairwiseStatistics.pm »