Bio/SearchIO/SearchResultEventBuilder.pm

filter: Statementstmt 70.1% 141 / 201 Branchbran 38.6% 34 / 88 Conditioncond 52.6% 70 / 133 MC/DCmcdc 22.2% 16 / 72 Subroutinesub 77.2% 17 / 22 Podpod 100% 16 / 16 totaltotal 55.2% 294 / 532 CC 91 SCAR 34.2
CC
91
Cov
58%
end_hsp
59.4
_add_hit
55.3
end_result
22.5
CRAP 30.4
« Bio/Factory/FTLocationFactory.pm ↑ Summary Bio/PullParserI.pm »
1 #
2 # BioPerl module for Bio::SearchIO::SearchResultEventBuilder
3 #
4 # Please direct questions and support issues to <bioperl-l@bioperl.org>
5 #
6 # Cared for by Jason Stajich <jason@bioperl.org>
7 #
8 # Copyright Jason Stajich
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 =head1 NAME
15  
16 Bio::SearchIO::SearchResultEventBuilder - Event Handler for SearchIO events.
17  
18 =head1 SYNOPSIS
19  
20 # Do not use this object directly, this object is part of the SearchIO
21 # event based parsing system.
22  
23 =head1 DESCRIPTION
24  
25 This object handles Search Events generated by the SearchIO classes
26 and build appropriate Bio::Search::* objects from them.
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 - Jason Stajich
59  
60 Email jason-at-bioperl.org
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  
74 # Let the code begin...
75  
76  
77 package Bio::SearchIO::SearchResultEventBuilder;
78 50 $Bio::SearchIO::SearchResultEventBuilder::VERSION = '1.7.8';
79 50 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
80  
81 50 ▶use Bio::Factory::ObjectFactory;
Subroutine BEGIN: called CC=1 SCAR=0.0
82  
83 50 ▶use base qw(Bio::Root::Root Bio::SearchIO::EventHandlerI);
Subroutine BEGIN: called CC=1 SCAR=0.0
84  
85 50 ▶use vars qw($DEFAULT_INCLUSION_THRESHOLD
Subroutine BEGIN: called CC=1 SCAR=0.0
86 $MAX_HSP_OVERLAP
87 50 );
88  
89 # e-value threshold for inclusion in the PSI-BLAST score matrix model (blastpgp)
90 # NOTE: Executing `blastpgp -` incorrectly reports that the default is 0.005.
91 # (version 2.2.2 [Jan-08-2002])
92 50 $DEFAULT_INCLUSION_THRESHOLD = 0.001;
93  
94 50 $MAX_HSP_OVERLAP = 2; # Used when tiling multiple HSPs.
95  
96 =head2 new
97  
98 Title : new
99 Usage : my $obj = Bio::SearchIO::SearchResultEventBuilder->new();
100 Function: Builds a new Bio::SearchIO::SearchResultEventBuilder object
101 Returns : Bio::SearchIO::SearchResultEventBuilder
102 Args : -hsp_factory => Bio::Factory::ObjectFactoryI
103 -hit_factory => Bio::Factory::ObjectFactoryI
104 -result_factory => Bio::Factory::ObjectFactoryI
105 -inclusion_threshold => e-value threshold for inclusion in the
106 PSI-BLAST score matrix model (blastpgp)
107 -signif => float or scientific notation number to be used
108 as a P- or Expect value cutoff
109 -score => integer or scientific notation number to be used
110 as a blast score value cutoff
111 -bits => integer or scientific notation number to be used
112 as a bit score value cutoff
113 -hit_filter => reference to a function to be used for
114 filtering hits based on arbitrary criteria.
115  
116 See L<Bio::Factory::ObjectFactoryI> for more information
117  
118 =cut
119  
120 139 ▶sub new {
Subroutine new: called CC=4 SCAR=15.5
Pod documented
121 139 my ($class,@args) = @_;
122 139 my $self = $class->SUPER::new(@args);
123 139 my ($resultF, $hitF, $hspF) =
124 $self->_rearrange([qw(RESULT_FACTORY
125 HIT_FACTORY
126 HSP_FACTORY)],@args);
127 139 $self->_init_parse_params(@args);
128  
129 139 ▶ $self->register_factory('result', $resultF ||
Condition33%1/3
$resultF || 'Bio::Factory::ObjectFactory'->new('-type', 'Bio::Search::Result::GenericResult', '-interface', 'Bio::Search::Result::ResultI')
l!l&&r!l&&!r
01390
MC/DC0%0/2
$resultF || 'Bio::Factory::ObjectFactory'->new('-type', 'Bio::Search::Result::GenericResult', '-interface', 'Bio::Search::Result::ResultI')
$resultF 'Bio::Factory::ObjectFactory'->new('-type', 'Bio::Search::Result::GenericResult', '-interface', 'Bio::Search::Result::ResultI')
Truth table33%1/3
A || B
A= $resultFB= 'Bio::Factory::ObjectFactory'->new('-type', 'Bio::Search::Result::GenericResult', '-interface', 'Bio::Search::Result::ResultI')
ABresult
1X1
011
000
130 Bio::Factory::ObjectFactory->new(
131 -type => 'Bio::Search::Result::GenericResult',
132 -interface => 'Bio::Search::Result::ResultI'));
133  
134 139 ▶ $self->register_factory('hit', $hitF ||
Condition33%1/3
$hitF || 'Bio::Factory::ObjectFactory'->new('-type', 'Bio::Search::Hit::GenericHit', '-interface', 'Bio::Search::Hit::HitI')
l!l&&r!l&&!r
01390
MC/DC0%0/2
$hitF || 'Bio::Factory::ObjectFactory'->new('-type', 'Bio::Search::Hit::GenericHit', '-interface', 'Bio::Search::Hit::HitI')
$hitF 'Bio::Factory::ObjectFactory'->new('-type', 'Bio::Search::Hit::GenericHit', '-interface', 'Bio::Search::Hit::HitI')
Truth table33%1/3
A || B
A= $hitFB= 'Bio::Factory::ObjectFactory'->new('-type', 'Bio::Search::Hit::GenericHit', '-interface', 'Bio::Search::Hit::HitI')
ABresult
1X1
011
000
135 Bio::Factory::ObjectFactory->new(
136 -type => 'Bio::Search::Hit::GenericHit',
137 -interface => 'Bio::Search::Hit::HitI'));
138  
139 139 ▶ $self->register_factory('hsp', $hspF ||
Condition33%1/3
$hspF || 'Bio::Factory::ObjectFactory'->new('-type', 'Bio::Search::HSP::GenericHSP', '-interface', 'Bio::Search::HSP::HSPI')
l!l&&r!l&&!r
01390
MC/DC0%0/2
$hspF || 'Bio::Factory::ObjectFactory'->new('-type', 'Bio::Search::HSP::GenericHSP', '-interface', 'Bio::Search::HSP::HSPI')
$hspF 'Bio::Factory::ObjectFactory'->new('-type', 'Bio::Search::HSP::GenericHSP', '-interface', 'Bio::Search::HSP::HSPI')
Truth table33%1/3
A || B
A= $hspFB= 'Bio::Factory::ObjectFactory'->new('-type', 'Bio::Search::HSP::GenericHSP', '-interface', 'Bio::Search::HSP::HSPI')
ABresult
1X1
011
000
140 Bio::Factory::ObjectFactory->new(
141 -type => 'Bio::Search::HSP::GenericHSP',
142 -interface => 'Bio::Search::HSP::HSPI'));
143  
144 139 return $self;
145 }
146  
147 # Initializes parameters used during parsing of reports.
148 184 ▶sub _init_parse_params {
Subroutine _init_parse_params: called CC=7 SCAR=21.8
149  
150 184 my ($self, @args) = @_;
151 # -FILT_FUNC has been replaced by -HIT_FILTER.
152 # Leaving -FILT_FUNC in place for backward compatibility
153 184 my($ithresh, $signif, $score, $bits, $hit_filter, $filt_func) =
154 $self->_rearrange([qw(INCLUSION_THRESHOLD SIGNIF SCORE BITS
155 HIT_FILTER FILT_FUNC
156 )], @args);
157  
158 184 ▶ $self->inclusion_threshold( defined($ithresh) ? $ithresh : $DEFAULT_INCLUSION_THRESHOLD);
Branch: 1 branch
BranchTrueFalseTotal
defined $ithresh ? : 0 184 184
159 184 ▶ my $hit_filt = $hit_filter || $filt_func;
Condition33%1/3
$hit_filter || $filt_func
l!l&&r!l&&!r
00184
MC/DC0%0/2
$hit_filter || $filt_func
$hit_filter $filt_func
Truth table33%1/3
A || B
A= $hit_filterB= $filt_func
ABresult
1X1
011
000
160 184 ▶ defined $hit_filter && $self->hit_filter($hit_filt);
Branch: 1 branch
BranchTrueFalseTotal
defined $hit_filter and $self->hit_filter($hit_filt) 0 184 184
161 184 ▶ defined $signif && $self->max_significance($signif);
Branch: 1 branch
BranchTrueFalseTotal
defined $signif and $self->max_significance($signif) 0 184 184
162 184 ▶ defined $score && $self->min_score($score);
Branch: 1 branch
BranchTrueFalseTotal
defined $score and $self->min_score($score) 0 184 184
163 184 ▶ defined $bits && $self->min_bits($bits);
Branch: 1 branch
BranchTrueFalseTotal
defined $bits and $self->min_bits($bits) 0 184 184
164 }
165  
166 =head2 will_handle
167  
168 Title : will_handle
169 Usage : if( $handler->will_handle($event_type) ) { ... }
170 Function: Tests if this event builder knows how to process a specific event
171 Returns : boolean
172 Args : event type name
173  
174 =cut
175  
176 623 ▶sub will_handle{
Subroutine will_handle: called CC=3 SCAR=11.0
Pod documented
177 623 my ($self,$type) = @_;
178 # these are the events we recognize
179 623 ▶ return ( $type eq 'hsp' || $type eq 'hit' || $type eq 'result' );
Condition83%5/6
$type eq 'hsp' || $type eq 'hit' || $type eq 'result'
l!l&&r!l&&!r
558650
$type eq "hsp" or $type eq "hit"
l!l&&r!l&&!r
41014865
MC/DC0%0/3
$type eq 'hsp' || $type eq 'hit' || $type eq 'result'
$type eq "hsp" $type eq "hit" $type eq 'result'
Truth table75%3/4
A or B || C
A= $type eq "hsp"B= $type eq "hit"C= $type eq 'result'
ABCresult
1XX1
01X1
0011
0000
180 }
181  
182 =head2 SAX methods
183  
184 =cut
185  
186 =head2 start_result
187  
188 Title : start_result
189 Usage : $handler->start_result($resulttype)
190 Function: Begins a result event cycle
191 Returns : none
192 Args : Type of Report
193  
194 =cut
195  
196 85 ▶sub start_result {
Subroutine start_result: called CC=1 SCAR=0.0
Pod documented
197 85 my ($self,$type) = @_;
198 85 $self->{'_resulttype'} = $type;
199 85 $self->{'_hits'} = [];
200 85 $self->{'_hsps'} = [];
201 85 $self->{'_hitcount'} = 0;
202 85 return;
203 }
204  
205 =head2 end_result
206  
207 Title : end_result
208 Usage : my @results = $parser->end_result
209 Function: Finishes a result handler cycle
210 Returns : A Bio::Search::Result::ResultI
211 Args : none
212  
213 =cut
214  
215 # this is overridden by IteratedSearchResultEventBuilder
216 # so keep that in mind when debugging
217  
218 86 ▶sub end_result {
Subroutine end_result: called CC=11 SCAR=31.1
Pod documented
219 86 my ($self,$type,$data) = @_;
220  
221 86 ▶ if( defined $data->{'runid'} &&
Branch: 1 branch
BranchTrueFalseTotal
if (defined $data->{"runid"} and not $data->{"runid"} =~ /^\s+$/) 0 86 86
Condition33%1/3
defined $data->{"runid"} and not $data->{"runid"} =~ /^\s+$/
!ll&&!rl&&r
8600
MC/DC0%0/2
defined $data->{"runid"} and not $data->{"runid"} =~ /^\s+$/
defined $data->{"runid"} not $data->{"runid"} =~ /^\s+$/
Truth table33%1/3
A and not(B)
A= defined $data->{"runid"}B= not $data->{"runid"} =~ /^\s+$/
ABresult
0X0
100
111
222 $data->{'runid'} !~ /^\s+$/ ) {
223  
224 0 ▶ if( $data->{'runid'} !~ /^lcl\|/) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $data->{'runid'} =~ /^lcl\|/) { } 0 0 0
225 0 $data->{"RESULT-query_name"} = $data->{'runid'};
226 } else {
227 ($data->{"RESULT-query_name"},
228 $data->{"RESULT-query_description"}) =
229 0 split(/\s+/,$data->{"RESULT-query_description"},2);
230 }
231  
232 0 ▶ if( my @a = split(/\|/,$data->{'RESULT-query_name'}) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my @a = split(/\|/, $data->{"RESULT-query_name"}, 0)) 0 0 0
233 0 my $acc = pop @a ; # this is for accession |1234|gb|AAABB1.1|AAABB1
234 # this is for |123|gb|ABC1.1|
235 0 ▶ $acc = pop @a if( ! defined $acc || $acc =~ /^\s+$/);
Branch: 1 branch
BranchTrueFalseTotal
if not defined $acc or $acc =~ /^\s+$/ 0 0 0
Condition0%0/3
not defined $acc or $acc =~ /^\s+$/
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $acc or $acc =~ /^\s+$/
not defined $acc $acc =~ /^\s+$/
Truth table0%0/3
not(A) or B
A= not defined $accB= $acc =~ /^\s+$/
ABresult
1X1
011
000
236 0 $data->{"RESULT-query_accession"}= $acc;
237 }
238 0 delete $data->{'runid'};
239 }
240 676 my %args = map { my $v = $data->{$_}; s/RESULT//; ($_ => $v); }
241 86 grep { /^RESULT/ } keys %{$data};
242  
243 $args{'-algorithm'} = uc( $args{'-algorithm_name'}
244 86 ▶ || $data->{'RESULT-algorithm_name'}
Condition83%5/6
$args{'-algorithm_name'} || $data->{'RESULT-algorithm_name'} || $type
l!l&&r!l&&!r
7781
$args{"-algorithm_name"} or $data->{"RESULT-algorithm_name"}
l!l&&r!l&&!r
7709
MC/DC66%2/3
$args{'-algorithm_name'} || $data->{'RESULT-algorithm_name'} || $type
$args{"-algorithm_name"} $data->{"RESULT-algorithm_name"} $type
Truth table75%3/4
A or B || C
A= $args{"-algorithm_name"}B= $data->{"RESULT-algorithm_name"}C= $type
ABCresult
1XX1
01X1
0011
0000
245 || $type);
246 ($self->isa('Bio::SearchIO::IteratedSearchResultEventBuilder')) ?
247 ( $args{'-iterations'} = $self->{'_iterations'} )
248 86 ▶ : ( $args{'-hits'} = $self->{'_hits'} );
Branch: 1 branch
BranchTrueFalseTotal
$self->isa('Bio::SearchIO::IteratedSearchResultEventBuilder') ? : 40 46 86
249  
250 86 my $result = $self->factory('result')->create_object(%args);
251 86 $result->hit_factory($self->factory('hit'));
252  
253 ($self->isa('Bio::SearchIO::IteratedSearchResultEventBuilder')) ?
254 ( $self->{'_iterations'} = [] )
255 86 ▶ : ( $self->{'_hits'} = [] );
Branch: 1 branch
BranchTrueFalseTotal
$self->isa('Bio::SearchIO::IteratedSearchResultEventBuilder') ? : 40 46 86
256  
257 86 return $result;
258 }
259  
260 =head2 start_hsp
261  
262 Title : start_hsp
263 Usage : $handler->start_hsp($name,$data)
264 Function: Begins processing a HSP event
265 Returns : none
266 Args : type of element
267 associated data (hashref)
268  
269 =cut
270  
271 1766 ▶sub start_hsp {
Subroutine start_hsp: called CC=1 SCAR=0.0
Pod documented
272 1766 my ($self,@args) = @_;
273 1766 return;
274 }
275  
276 =head2 end_hsp
277  
278 Title : end_hsp
279 Usage : $handler->end_hsp()
280 Function: Finish processing a HSP event
281 Returns : none
282 Args : type of event and associated hashref
283  
284  
285 =cut
286  
287 1766 ▶sub end_hsp {
Subroutine end_hsp: called CC=32 SCAR=40.8
Pod documented
288 1766 my ($self,$type,$data) = @_;
289  
290 1766 ▶ if( defined $data->{'runid'} &&
Branch: 1 branch
BranchTrueFalseTotal
if (defined $data->{"runid"} and not $data->{"runid"} =~ /^\s+$/) 0 1766 1766
Condition33%1/3
defined $data->{"runid"} and not $data->{"runid"} =~ /^\s+$/
!ll&&!rl&&r
176600
MC/DC0%0/2
defined $data->{"runid"} and not $data->{"runid"} =~ /^\s+$/
defined $data->{"runid"} not $data->{"runid"} =~ /^\s+$/
Truth table33%1/3
A and not(B)
A= defined $data->{"runid"}B= not $data->{"runid"} =~ /^\s+$/
ABresult
0X0
100
111
291 $data->{'runid'} !~ /^\s+$/ ) {
292  
293 0 ▶ if( $data->{'runid'} !~ /^lcl\|/) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $data->{'runid'} =~ /^lcl\|/) { } 0 0 0
294 0 $data->{"RESULT-query_name"}= $data->{'runid'};
295 } else {
296 ($data->{"RESULT-query_name"},
297 $data->{"RESULT-query_description"}) =
298 0 split(/\s+/,$data->{"RESULT-query_description"},2);
299 }
300  
301 0 ▶ if( my @a = split(/\|/,$data->{'RESULT-query_name'}) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my @a = split(/\|/, $data->{"RESULT-query_name"}, 0)) 0 0 0
302 0 my $acc = pop @a ; # this is for accession |1234|gb|AAABB1.1|AAABB1
303 # this is for |123|gb|ABC1.1|
304 0 ▶ $acc = pop @a if( ! defined $acc || $acc =~ /^\s+$/);
Branch: 1 branch
BranchTrueFalseTotal
if not defined $acc or $acc =~ /^\s+$/ 0 0 0
Condition0%0/3
not defined $acc or $acc =~ /^\s+$/
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $acc or $acc =~ /^\s+$/
not defined $acc $acc =~ /^\s+$/
Truth table0%0/3
not(A) or B
A= not defined $accB= $acc =~ /^\s+$/
ABresult
1X1
011
000
305 0 $data->{"RESULT-query_accession"}= $acc;
306 }
307 0 delete $data->{'runid'};
308 }
309  
310 # this code is to deal with the fact that Blast XML data
311 # always has start < end and one has to infer strandedness
312 # from the frame which is a problem for the Search::HSP object
313 # which expect to be able to infer strand from the order of
314 # of the begin/end of the query and hit coordinates
315 1766 ▶ if( defined $data->{'HSP-query_frame'} && # this is here to protect from undefs
Branch: 1 branch
BranchTrueFalseTotal
if (defined $data->{"HSP-query_frame"} and $data->{"HSP-query_frame"} < 0 && $data->{"HSP-query_start"} < $data->{"HSP-query_end"} || $data->{"HSP-query_frame"} > 0 && $data->{"HSP-query_start"} > $data->{"HSP-query_end"}) 0 1766 1766
Condition58%7/12
defined $data->{"HSP-query_frame"} and $data->{"HSP-query_frame"} < 0 && $data->{"HSP-query_start"} < $data->{"HSP-query_end"} || $data->{"HSP-query_frame"} > 0 && $data->{"HSP-query_start"} > $data->{"HSP-query_end"}
!ll&&!rl&&r
56911970
$data->{"HSP-query_frame"} < 0 and $data->{"HSP-query_start"} < $data->{"HSP-query_end"} or $data->{"HSP-query_frame"} > 0 and $data->{"HSP-query_start"} > $data->{"HSP-query_end"}
l!l&&r!l&&!r
001197
$data->{"HSP-query_frame"} < 0 and $data->{"HSP-query_start"} < $data->{"HSP-query_end"}
!ll&&!rl&&r
10751220
$data->{"HSP-query_frame"} > 0 and $data->{"HSP-query_start"} > $data->{"HSP-query_end"}
!ll&&!rl&&r
10311660
MC/DC0%0/5
defined $data->{"HSP-query_frame"} and $data->{"HSP-query_frame"} < 0 && $data->{"HSP-query_start"} < $data->{"HSP-query_end"} || $data->{"HSP-query_frame"} > 0 && $data->{"HSP-query_start"} > $data->{"HSP-query_end"}
defined $data->{"HSP-query_frame"} $data->{"HSP-query_frame"} < 0 $data->{"HSP-query_start"} < $data->{"HSP-query_end"} $data->{"HSP-query_frame"} > 0 $data->{"HSP-query_start"} > $data->{"HSP-query_end"}
Truth table50%4/8
A and B and C or D and E
A= defined $data->{"HSP-query_frame"}B= $data->{"HSP-query_frame"} < 0C= $data->{"HSP-query_start"} < $data->{"HSP-query_end"}D= $data->{"HSP-query_frame"} > 0E= $data->{"HSP-query_start"} > $data->{"HSP-query_end"}
ABCDEresult
0XXXX0
10X0X0
10X100
1100X0
110100
111XX1
10X111
110111
316 (( $data->{'HSP-query_frame'} < 0 &&
317 $data->{'HSP-query_start'} < $data->{'HSP-query_end'} ) ||
318 $data->{'HSP-query_frame'} > 0 &&
319 ( $data->{'HSP-query_start'} > $data->{'HSP-query_end'} ) )
320 )
321 {
322 # swap
323 ($data->{'HSP-query_start'},
324 $data->{'HSP-query_end'}) = ($data->{'HSP-query_end'},
325 0 $data->{'HSP-query_start'});
326 }
327 1766 ▶ if( defined $data->{'HSP-hit_frame'} && # this is here to protect from undefs
Branch: 1 branch
BranchTrueFalseTotal
if (defined $data->{"HSP-hit_frame"} and defined $data->{"HSP-hit_frame"} && $data->{"HSP-hit_frame"} < 0 && $data->{"HSP-hit_start"} < $data->{"HSP-hit_end"} || defined $data->{"HSP-hit_frame"} && $data->{"HSP-hit_frame"} > 0 && $data->{"HSP-hit_start"} > $data->{"HSP-hit_end"}) 0 1766 1766
Condition61%11/18
defined $data->{"HSP-hit_frame"} and defined $data->{"HSP-hit_frame"} && $data->{"HSP-hit_frame"} < 0 && $data->{"HSP-hit_start"} < $data->{"HSP-hit_end"} || defined $data->{"HSP-hit_frame"} && $data->{"HSP-hit_frame"} > 0 && $data->{"HSP-hit_start"} > $data->{"HSP-hit_end"}
!ll&&!rl&&r
56911970
defined $data->{"HSP-hit_frame"} and $data->{"HSP-hit_frame"} < 0 and $data->{"HSP-hit_start"} < $data->{"HSP-hit_end"} or defined $data->{"HSP-hit_frame"} and $data->{"HSP-hit_frame"} > 0 and $data->{"HSP-hit_start"} > $data->{"HSP-hit_end"}
l!l&&r!l&&!r
001197
defined $data->{"HSP-hit_frame"} and $data->{"HSP-hit_frame"} < 0 and $data->{"HSP-hit_start"} < $data->{"HSP-hit_end"}
!ll&&!rl&&r
1163340
defined $data->{"HSP-hit_frame"} and $data->{"HSP-hit_frame"} < 0
!ll&&!rl&&r
0116334
defined $data->{"HSP-hit_frame"} and $data->{"HSP-hit_frame"} > 0 and $data->{"HSP-hit_start"} > $data->{"HSP-hit_end"}
!ll&&!rl&&r
1098990
defined $data->{"HSP-hit_frame"} and $data->{"HSP-hit_frame"} > 0
!ll&&!rl&&r
0109899
MC/DC0%0/7
defined $data->{"HSP-hit_frame"} and defined $data->{"HSP-hit_frame"} && $data->{"HSP-hit_frame"} < 0 && $data->{"HSP-hit_start"} < $data->{"HSP-hit_end"} || defined $data->{"HSP-hit_frame"} && $data->{"HSP-hit_frame"} > 0 && $data->{"HSP-hit_start"} > $data->{"HSP-hit_end"}
defined $data->{"HSP-hit_frame"} defined $data->{"HSP-hit_frame"} $data->{"HSP-hit_frame"} < 0 $data->{"HSP-hit_start"} < $data->{"HSP-hit_end"} defined $data->{"HSP-hit_frame"} $data->{"HSP-hit_frame"} > 0 $data->{"HSP-hit_start"} > $data->{"HSP-hit_end"}
Truth table28%4/14
A and B and C and D or E and F and G
A= defined $data->{"HSP-hit_frame"}B= defined $data->{"HSP-hit_frame"}C= $data->{"HSP-hit_frame"} < 0D= $data->{"HSP-hit_start"} < $data->{"HSP-hit_end"}E= defined $data->{"HSP-hit_frame"}F= $data->{"HSP-hit_frame"} > 0G= $data->{"HSP-hit_start"} > $data->{"HSP-hit_end"}
ABCDEFGresult
0XXXXXX0
10XX0XX0
10XX10X0
10XX1100
110X0XX0
110X10X0
110X1100
11100XX0
111010X0
11101100
1111XXX1
10XX1111
110X1111
11101111
328 ((defined $data->{'HSP-hit_frame'} && $data->{'HSP-hit_frame'} < 0 &&
329 $data->{'HSP-hit_start'} < $data->{'HSP-hit_end'} ) ||
330 defined $data->{'HSP-hit_frame'} && $data->{'HSP-hit_frame'} > 0 &&
331 ( $data->{'HSP-hit_start'} > $data->{'HSP-hit_end'} ) )
332 )
333 {
334 # swap
335 ($data->{'HSP-hit_start'},
336 $data->{'HSP-hit_end'}) = ($data->{'HSP-hit_end'},
337 0 $data->{'HSP-hit_start'});
338 }
339 1766 ▶ $data->{'HSP-query_frame'} ||= 0;
Condition100%2/2
$data->{"HSP-query_frame"} ||= 0
l!l
2881478
MC/DC100%1/1
$data->{"HSP-query_frame"} ||= 0
$data->{"HSP-query_frame"}
Truth table100%2/2
A
A= $data->{"HSP-query_frame"}
Aresult
11
00
340 1766 ▶ $data->{'HSP-hit_frame'} ||= 0;
Condition100%2/2
$data->{"HSP-hit_frame"} ||= 0
l!l
1331633
MC/DC100%1/1
$data->{"HSP-hit_frame"} ||= 0
$data->{"HSP-hit_frame"}
Truth table100%2/2
A
A= $data->{"HSP-hit_frame"}
Aresult
11
00
341 # handle Blast 2.1.2 which did not support data member: hsp_align-len
342 1766 ▶ $data->{'HSP-query_length'} ||= $data->{'RESULT-query_length'};
Condition100%3/3
$data->{"HSP-query_length"} ||= $data->{"RESULT-query_length"}
l!l&&r!l&&!r
222695849
MC/DC100%2/2
$data->{"HSP-query_length"} ||= $data->{"RESULT-query_length"}
$data->{"HSP-query_length"} $data->{"RESULT-query_length"}
Truth table100%3/3
A ||= B
A= $data->{"HSP-query_length"}B= $data->{"RESULT-query_length"}
ABresult
1X1
011
000
343 1766 ▶ $data->{'HSP-hit_length'} ||= $data->{'HIT-length'};
Condition100%3/3
$data->{"HSP-hit_length"} ||= $data->{"HIT-length"}
l!l&&r!l&&!r
310702754
MC/DC100%2/2
$data->{"HSP-hit_length"} ||= $data->{"HIT-length"}
$data->{"HSP-hit_length"} $data->{"HIT-length"}
Truth table100%3/3
A ||= B
A= $data->{"HSP-hit_length"}B= $data->{"HIT-length"}
ABresult
1X1
011
000
344  
345 # If undefined lengths, calculate from alignment without gaps and separators
346 1766 ▶ if (not defined $data->{'HSP-query_length'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $data->{"HSP-query_length"}) 849 917 1766
347 849 ▶ if (my $hsp_qry_seq = $data->{'HSP-query_seq'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $hsp_qry_seq = $data->{'HSP-query_seq'}) { } 4 845 849
348 4 $hsp_qry_seq =~ s/[-\.]//g;
349 4 $data->{'HSP-query_length'} = length $hsp_qry_seq;
350 }
351 else {
352 845 $data->{'HSP-query_length'} = 0;
353 }
354 }
355 1766 ▶ if (not defined $data->{'HSP-hit_length'}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $data->{"HSP-hit_length"}) 754 1012 1766
356 754 ▶ if (my $hsp_hit_seq = $data->{'HSP-hit_seq'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $hsp_hit_seq = $data->{'HSP-hit_seq'}) { } 11 743 754
357 11 $hsp_hit_seq =~ s/[-\.]//g;
358 11 $data->{'HSP-hit_length'} = length $hsp_hit_seq;
359 }
360 else {
361 743 $data->{'HSP-hit_length'} = 0;
362 }
363 }
364 1766 ▶ $data->{'HSP-hsp_length'} ||= length ($data->{'HSP-homology_seq'} || '');
Condition100%5/5
$data->{"HSP-hsp_length"} ||= length($data->{"HSP-homology_seq"} || "")
l!l&&r!l&&!r
1721441
$data->{'HSP-homology_seq'} || ''
l!l
441
MC/DC100%2/2
$data->{"HSP-hsp_length"} ||= length($data->{"HSP-homology_seq"} || "")
$data->{"HSP-hsp_length"} $data->{'HSP-homology_seq'}
Truth table100%3/3
A ||= B
A= $data->{"HSP-hsp_length"}B= $data->{'HSP-homology_seq'}
ABresult
1X1
011
000
365  
366 28435 my %args = map { my $v = $data->{$_}; s/HSP//; ($_ => $v) }
367 1766 grep { /^HSP/ } keys %{$data};
368  
369 $args{'-algorithm'} = uc( $args{'-algorithm_name'} ||
370 1766 ▶ $data->{'RESULT-algorithm_name'} || $type);
Condition83%5/6
$args{'-algorithm_name'} || $data->{'RESULT-algorithm_name'} || $type
l!l&&r!l&&!r
1699661
$args{"-algorithm_name"} or $data->{"RESULT-algorithm_name"}
l!l&&r!l&&!r
0169967
MC/DC66%2/3
$args{'-algorithm_name'} || $data->{'RESULT-algorithm_name'} || $type
$args{"-algorithm_name"} $data->{"RESULT-algorithm_name"} $type
Truth table75%3/4
A or B || C
A= $args{"-algorithm_name"}B= $data->{"RESULT-algorithm_name"}C= $type
ABCresult
1XX1
01X1
0011
0000
371 # copy this over from result
372 1766 $args{'-query_name'} = $data->{'RESULT-query_name'};
373 1766 $args{'-hit_name'} = $data->{'HIT-name'};
374 1766 ▶ my ($rank) = scalar @{$self->{'_hsps'} || []} + 1;
Condition50%1/2
$self->{'_hsps'} || []
l!l
17660
MC/DC0%0/1
$self->{'_hsps'} || []
$self->{'_hsps'}
Truth table50%1/2
A
A= $self->{'_hsps'}
Aresult
11
00
375 1766 $args{'-rank'} = $rank;
376  
377 1766 $args{'-hit_desc'} = $data->{'HIT-description'};
378 1766 $args{'-query_desc'} = $data->{'RESULT-query_description'};
379  
380 1766 my $bits = $args{'-bits'};
381 1766 my $hsp = \%args;
382 1766 push @{$self->{'_hsps'}}, $hsp;
383  
384 1766 return $hsp;
385 }
386  
387 =head2 start_hit
388  
389 Title : start_hit
390 Usage : $handler->start_hit()
391 Function: Starts a Hit event cycle
392 Returns : none
393 Args : type of event and associated hashref
394  
395 =cut
396  
397 1823 ▶sub start_hit{
Subroutine start_hit: called CC=1 SCAR=0.0
Pod documented
398 1823 my ($self,$type) = @_;
399 1823 $self->{'_hsps'} = [];
400 1823 return;
401 }
402  
403 =head2 end_hit
404  
405 Title : end_hit
406 Usage : $handler->end_hit()
407 Function: Ends a Hit event cycle
408 Returns : Bio::Search::Hit::HitI object
409 Args : type of event and associated hashref
410  
411 =cut
412  
413 1823 ▶sub end_hit{
Subroutine end_hit: called CC=11 SCAR=24.8
Pod documented
414 1823 my ($self,$type,$data) = @_;
415  
416 # Skip process unless there is HSP data or Hit Significance (e.g. a bl2seq with no similarity
417 # gives a hit with the subject, but shows a "no hits found" message instead
418 # of the alignment data and don't have a significance value).
419 # This way, we avoid false positives
420 1823 my @hsp_data = grep { /^HSP/ } keys %{$data};
421 1823 ▶ return unless (scalar @hsp_data > 0 or exists $data->{'HIT-significance'});
Branch: 1 branch
BranchTrueFalseTotal
unless scalar @hsp_data > 0 or exists $data->{"HIT-significance"} 0 1823 1823
Condition66%2/3
scalar @hsp_data > 0 or exists $data->{"HIT-significance"}
l!l&&r!l&&!r
14084150
MC/DC0%0/2
scalar @hsp_data > 0 or exists $data->{"HIT-significance"}
scalar @hsp_data > 0 exists $data->{"HIT-significance"}
Truth table66%2/3
A or B
A= scalar @hsp_data > 0B= exists $data->{"HIT-significance"}
ABresult
1X1
011
000
422  
423 1823 my %args = map { my $v = $data->{$_}; s/HIT//; ($_ => $v); } grep { /^HIT/ } keys %{$data};
424  
425 # I hate special cases, but this is here because NCBI BLAST XML
426 # doesn't play nice and is undergoing mutation -jason
427 1823 ▶ if(exists $args{'-name'} && $args{'-name'} =~ /BL_ORD_ID/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args{"-name"} and $args{"-name"} =~ /BL_ORD_ID/) 0 1823 1823
Condition33%1/3
exists $args{"-name"} and $args{"-name"} =~ /BL_ORD_ID/
!ll&&!rl&&r
018230
MC/DC0%0/2
exists $args{"-name"} and $args{"-name"} =~ /BL_ORD_ID/
exists $args{"-name"} $args{"-name"} =~ /BL_ORD_ID/
Truth table33%1/3
A and B
A= exists $args{"-name"}B= $args{"-name"} =~ /BL_ORD_ID/
ABresult
0X0
100
111
428 0 ($args{'-name'}, $args{'-description'}) = split(/\s+/,$args{'-description'},2);
429 }
430 $args{'-algorithm'} = uc( $args{'-algorithm_name'} ||
431 1823 ▶ $data->{'RESULT-algorithm_name'} || $type);
Condition83%5/6
$args{'-algorithm_name'} || $data->{'RESULT-algorithm_name'} || $type
l!l&&r!l&&!r
1805171
$args{"-algorithm_name"} or $data->{"RESULT-algorithm_name"}
l!l&&r!l&&!r
0180518
MC/DC66%2/3
$args{'-algorithm_name'} || $data->{'RESULT-algorithm_name'} || $type
$args{"-algorithm_name"} $data->{"RESULT-algorithm_name"} $type
Truth table75%3/4
A or B || C
A= $args{"-algorithm_name"}B= $data->{"RESULT-algorithm_name"}C= $type
ABCresult
1XX1
01X1
0011
0000
432 1823 $args{'-hsps'} = $self->{'_hsps'};
433 1823 $args{'-query_len'} = $data->{'RESULT-query_length'};
434 1823 $args{'-rank'} = $self->{'_hitcount'} + 1;
435 1823 ▶ unless( defined $args{'-significance'} ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $args{"-significance"}) 379 1444 1823
436 379 ▶ if( defined $args{'-hsps'} &&
Branch: 1 branch
BranchTrueFalseTotal
if (defined $args{"-hsps"} and $args{"-hsps"}[0]) 379 0 379
Condition33%1/3
defined $args{"-hsps"} and $args{"-hsps"}[0]
!ll&&!rl&&r
00379
MC/DC0%0/2
defined $args{"-hsps"} and $args{"-hsps"}[0]
defined $args{"-hsps"} $args{"-hsps"}[0]
Truth table33%1/3
A and B
A= defined $args{"-hsps"}B= $args{"-hsps"}[0]
ABresult
0X0
100
111
437 $args{'-hsps'}->[0] ) {
438 # use pvalue if present (WU-BLAST), otherwise evalue (NCBI BLAST)
439 379 ▶ $args{'-significance'} = $args{'-hsps'}->[0]->{'-pvalue'} || $args{'-hsps'}->[0]->{'-evalue'};
Condition100%3/3
$args{'-hsps'}[0]{'-pvalue'} || $args{'-hsps'}[0]{'-evalue'}
l!l&&r!l&&!r
7725151
MC/DC100%2/2
$args{'-hsps'}[0]{'-pvalue'} || $args{'-hsps'}[0]{'-evalue'}
$args{'-hsps'}[0]{'-pvalue'} $args{'-hsps'}[0]{'-evalue'}
Truth table100%3/3
A || B
A= $args{'-hsps'}[0]{'-pvalue'}B= $args{'-hsps'}[0]{'-evalue'}
ABresult
1X1
011
000
440 }
441 }
442 1823 my $hit = \%args;
443 1823 $hit->{'-hsp_factory'} = $self->factory('hsp');
444 1823 $self->_add_hit($hit);
445 1823 $self->{'_hsps'} = [];
446 1823 return $hit;
447 }
448  
449 # Title : _add_hit (private function for internal use only)
450 # Purpose : Applies hit filtering and store it if it passes filtering.
451 # Argument: Bio::Search::Hit::HitI object
452  
453 900 ▶sub _add_hit {
Subroutine _add_hit: called CC=13 SCAR=40.1
454 900 my ($self, $hit) = @_;
455 900 my $hit_signif = $hit->{-significance};
456  
457 # Test significance using custom function (if supplied)
458 900 my $add_hit = 1;
459  
460 900 my $hit_filter = $self->{'_hit_filter'};
461 900 ▶ if($hit_filter) {
Branch: 1 branch
BranchTrueFalseTotal
if ($hit_filter) { } 0 900 900
462 # since &hit_filter is out of our control and would expect a HitI object,
463 # we're forced to make one for it
464 0 $hit = $self->factory('hit')->create_object(%{$hit});
465 0 ▶ $add_hit = 0 unless &$hit_filter($hit);
Branch: 1 branch
BranchTrueFalseTotal
unless &$hit_filter($hit) 0 0 0
466 }
467 else {
468 900 ▶ if($self->{'_confirm_significance'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"_confirm_significance"}) 0 900 900
469 0 ▶ $add_hit = 0 unless $hit_signif <= $self->{'_max_significance'};
Branch: 1 branch
BranchTrueFalseTotal
unless $hit_signif <= $self->{"_max_significance"} 0 0 0
470 }
471 900 ▶ if($self->{'_confirm_score'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"_confirm_score"}) 0 900 900
472 0 ▶ my $hit_score = $hit->{-score} || $hit->{-hsps}->[0]->{-score};
Condition0%0/3
$hit->{'-score'} || $hit->{'-hsps'}[0]{'-score'}
l!l&&r!l&&!r
000
MC/DC0%0/2
$hit->{'-score'} || $hit->{'-hsps'}[0]{'-score'}
$hit->{'-score'} $hit->{'-hsps'}[0]{'-score'}
Truth table0%0/3
A || B
A= $hit->{'-score'}B= $hit->{'-hsps'}[0]{'-score'}
ABresult
1X1
011
000
473 0 ▶ $add_hit = 0 unless $hit_score >= $self->{'_min_score'};
Branch: 1 branch
BranchTrueFalseTotal
unless $hit_score >= $self->{"_min_score"} 0 0 0
474 }
475 900 ▶ if($self->{'_confirm_bits'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"_confirm_bits"}) 0 900 900
476 0 ▶ my $hit_bits = $hit->{-bits} || $hit->{-hsps}->[0]->{-bits} || 0;
Condition0%0/5
$hit->{'-bits'} || $hit->{'-hsps'}[0]{'-bits'} || 0
l!l
00
$hit->{"-bits"} or $hit->{"-hsps"}[0]{"-bits"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$hit->{'-bits'} || $hit->{'-hsps'}[0]{'-bits'} || 0
$hit->{"-bits"} $hit->{"-hsps"}[0]{"-bits"}
Truth table0%0/3
A or B
A= $hit->{"-bits"}B= $hit->{"-hsps"}[0]{"-bits"}
ABresult
1X1
011
000
477 0 ▶ $add_hit = 0 unless $hit_bits >= $self->{'_min_bits'};
Branch: 1 branch
BranchTrueFalseTotal
unless $hit_bits >= $self->{"_min_bits"} 0 0 0
478 }
479 }
480  
481 900 ▶ $add_hit && push @{$self->{'_hits'}}, $hit;;
Branch: 1 branch
BranchTrueFalseTotal
$add_hit and push @{$$self{"_hits"};}, $hit 900 0 900
482 900 $self->{'_hitcount'} = scalar @{$self->{'_hits'}};
483 }
484  
485 =head2 Factory methods
486  
487 =cut
488  
489 =head2 register_factory
490  
491 Title : register_factory
492 Usage : $handler->register_factory('TYPE',$factory);
493 Function: Register a specific factory for a object type class
494 Returns : none
495 Args : string representing the class and
496 Bio::Factory::ObjectFactoryI
497  
498 See L<Bio::Factory::ObjectFactoryI> for more information
499  
500 =cut
501  
502 670 ▶sub register_factory{
Subroutine register_factory: called CC=4 SCAR=17.9
Pod documented
503 670 my ($self, $type,$f) = @_;
504 670 ▶ if( ! defined $f || ! ref($f) ||
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $f and ref $f and $f->isa("Bio::Factory::ObjectFactoryI")) 0 670 670
Condition33%2/6
defined $f and ref $f and $f->isa("Bio::Factory::ObjectFactoryI")
!ll&&!rl&&r
00670
defined $f and ref $f
!ll&&!rl&&r
00670
MC/DC0%0/3
defined $f and ref $f and $f->isa("Bio::Factory::ObjectFactoryI")
defined $f ref $f $f->isa("Bio::Factory::ObjectFactoryI")
Truth table25%1/4
A and B and C
A= defined $fB= ref $fC= $f->isa("Bio::Factory::ObjectFactoryI")
ABCresult
0XX0
10X0
1100
1111
505 ! $f->isa('Bio::Factory::ObjectFactoryI') ) {
506 0 $self->throw("Cannot set factory to value $f".ref($f)."\n");
507 }
508 670 $self->{'_factories'}->{lc($type)} = $f;
509 }
510  
511 =head2 factory
512  
513 Title : factory
514 Usage : my $f = $handler->factory('TYPE');
515 Function: Retrieves the associated factory for requested 'TYPE'
516 Returns : a Bio::Factory::ObjectFactoryI
517 Throws : Bio::Root::BadParameter if none registered for the supplied type
518 Args : name of factory class to retrieve
519  
520 See L<Bio::Factory::ObjectFactoryI> for more information
521  
522 =cut
523  
524 2075 ▶sub factory{
Subroutine factory: called CC=2 SCAR=8.1
Pod documented
525 2075 my ($self,$type) = @_;
526 2075 ▶ return $self->{'_factories'}->{lc($type)} ||
Condition33%1/3
$self->{'_factories'}{lc $type} || $self->throw('-class', 'Bio::Root::BadParameter', '-text', "No factory registered for $type")
l!l&&r!l&&!r
207500
MC/DC0%0/2
$self->{'_factories'}{lc $type} || $self->throw('-class', 'Bio::Root::BadParameter', '-text', "No factory registered for $type")
$self->{'_factories'}{lc $type} $self->throw('-class', 'Bio::Root::BadParameter', '-text', "No factory registered for $type")
Truth table33%1/3
A || B
A= $self->{'_factories'}{lc $type}B= $self->throw('-class', 'Bio::Root::BadParameter', '-text', "No factory registered for $type")
ABresult
1X1
011
000
527 $self->throw(-class=>'Bio::Root::BadParameter',
528 -text=>"No factory registered for $type");
529 }
530  
531 =head2 inclusion_threshold
532  
533 See L<Bio::SearchIO::blast::inclusion_threshold>.
534  
535 =cut
536  
537 226 ▶sub inclusion_threshold {
Subroutine inclusion_threshold: called CC=2 SCAR=6.9
Pod documented
538 226 my $self = shift;
539 226 ▶ return $self->{'_inclusion_threshold'} = shift if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 184 42 226
540 42 return $self->{'_inclusion_threshold'};
541 }
542  
543 =head2 max_significance
544  
545 Usage : $obj->max_significance();
546 Purpose : Set/Get the P or Expect value used as significance screening cutoff.
547 This is the value of the -signif parameter supplied to new().
548 Hits with P or E-value at HIT level above this are skipped.
549 Returns : Scientific notation number with this format: 1.0e-05.
550 Argument : Number (sci notation, float, integer) (when setting)
551 Throws : Bio::Root::BadParameter exception if the supplied argument is
552 : not a valid number.
553 Comments : Screening of significant hits uses the data provided on the
554 : description line. For NCBI BLAST1 and WU-BLAST, this data
555 : is P-value. for NCBI BLAST2 it is an Expect value.
556  
557 =cut
558  
559 0 ▶sub max_significance {
Subroutine max_significance: not called CC=4 SCAR=30.0
Pod documented
560 0 my $self = shift;
561 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
562 0 my $sig = shift;
563 0 ▶ if( $sig =~ /[^\d.e-]/ or $sig <= 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($sig =~ /[^\d.e-]/ or $sig <= 0) 0 0 0
Condition0%0/3
$sig =~ /[^\d.e-]/ or $sig <= 0
l!l&&r!l&&!r
000
MC/DC0%0/2
$sig =~ /[^\d.e-]/ or $sig <= 0
$sig =~ /[^\d.e-]/ $sig <= 0
Truth table0%0/3
A or B
A= $sig =~ /[^\d.e-]/B= $sig <= 0
ABresult
1X1
011
000
564 0 $self->throw(-class => 'Bio::Root::BadParameter',
565 -text => "Invalid significance value: $sig\n"
566 . "Must be a number greater than zero.",
567 -value => $sig);
568 }
569 0 $self->{'_confirm_significance'} = 1;
570 0 $self->{'_max_significance'} = $sig;
571 }
572 0 sprintf "%.1e", $self->{'_max_significance'};
573 }
574  
575  
576 =head2 signif
577  
578 Synonym for L<max_significance()|max_significance>
579  
580 =cut
581  
582 0 ▶sub signif { shift->max_significance }
Subroutine signif: not called CC=1 SCAR=6.9
Pod documented
583  
584 =head2 min_score
585  
586 Usage : $obj->min_score();
587 Purpose : Gets the Blast score used as screening cutoff.
588 This is the value of the -score parameter supplied to new().
589 Hits with scores at HIT level below this are skipped.
590 Returns : Integer (or undef if not set)
591 Argument : Integer (when setting)
592 Throws : Bio::Root::BadParameter exception if the supplied argument is
593 : not a valid number.
594 Comments : Screening of significant hits uses the data provided on the
595 : description line.
596  
597 =cut
598  
599 0 ▶sub min_score {
Subroutine min_score: not called CC=4 SCAR=30.0
Pod documented
600 0 my $self = shift;
601 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
602 0 my $score = shift;
603 0 ▶ if( $score =~ /[^\de+]/ or $score <= 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($score =~ /[^\de+]/ or $score <= 0) 0 0 0
Condition0%0/3
$score =~ /[^\de+]/ or $score <= 0
l!l&&r!l&&!r
000
MC/DC0%0/2
$score =~ /[^\de+]/ or $score <= 0
$score =~ /[^\de+]/ $score <= 0
Truth table0%0/3
A or B
A= $score =~ /[^\de+]/B= $score <= 0
ABresult
1X1
011
000
604 0 $self->throw(-class => 'Bio::Root::BadParameter',
605 -text => "Invalid score value: $score\n"
606 . "Must be an integer greater than zero.",
607 -value => $score);
608 }
609 0 $self->{'_confirm_score'} = 1;
610 0 $self->{'_min_score'} = $score;
611 }
612 0 return $self->{'_min_score'};
613 }
614  
615 =head2 min_bits
616  
617 Usage : $obj->min_bits();
618 Purpose : Gets the Blast bit score used as screening cutoff.
619 This is the value of the -bits parameter supplied to new().
620 Hits with bits score at HIT level below this are skipped.
621 Returns : Integer (or undef if not set)
622 Argument : Integer (when setting)
623 Throws : Bio::Root::BadParameter exception if the supplied argument is
624 : not a valid number.
625 Comments : Screening of significant hits uses the data provided on the
626 : description line.
627  
628 =cut
629  
630 0 ▶sub min_bits {
Subroutine min_bits: not called CC=4 SCAR=30.0
Pod documented
631 0 my $self = shift;
632 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
633 0 my $bits = shift;
634 0 ▶ if( $bits =~ /[^\de+]/ or $bits <= 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($bits =~ /[^\de+]/ or $bits <= 0) 0 0 0
Condition0%0/3
$bits =~ /[^\de+]/ or $bits <= 0
l!l&&r!l&&!r
000
MC/DC0%0/2
$bits =~ /[^\de+]/ or $bits <= 0
$bits =~ /[^\de+]/ $bits <= 0
Truth table0%0/3
A or B
A= $bits =~ /[^\de+]/B= $bits <= 0
ABresult
1X1
011
000
635 0 $self->throw(-class => 'Bio::Root::BadParameter',
636 -text => "Invalid bits value: $bits\n"
637 . "Must be an integer greater than zero.",
638 -value => $bits);
639 }
640 0 $self->{'_confirm_bits'} = 1;
641 0 $self->{'_min_bits'} = $bits;
642 }
643 0 return $self->{'_min_bits'};
644 }
645  
646 =head2 hit_filter
647  
648 Usage : $obj->hit_filter();
649 Purpose : Set/Get a function reference used for filtering out hits.
650 This is the value of the -hit_filter parameter supplied to new().
651 Hits that fail to pass the filter at HIT level are skipped.
652 Returns : Function ref (or undef if not set)
653 Argument : Function ref (when setting)
654 Throws : Bio::Root::BadParameter exception if the supplied argument is
655 : not a function reference.
656  
657 =cut
658  
659 0 ▶sub hit_filter {
Subroutine hit_filter: not called CC=3 SCAR=24.8
Pod documented
660 0 my $self = shift;
661 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
662 0 my $func = shift;
663 0 ▶ if(not ref $func eq 'CODE') {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $func eq "CODE") 0 0 0
664 0 $self->throw(-class => 'Bio::Root::BadParameter',
665 -text => "Not a function reference: $func\n"
666 . "The -hit_filter parameter must be function reference.",
667 -value => $func);
668 }
669 0 $self->{'_hit_filter'} = $func;
670 }
671 0 return $self->{'_hit_filter'};
672 }
673  
674 50 1;
« Bio/Factory/FTLocationFactory.pm ↑ Summary Bio/PullParserI.pm »