| 1 | # | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # BioPerl module for Bio::SearchIO::FastHitEventBuilder | ||||||||||||||||||||||||||||||||||||||||||
| 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::FastHitEventBuilder - 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 | # to use the FastHitEventBuilder do this | ||||||||||||||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||||||||||||
| 25 | use Bio::SearchIO::FastHitEventBuilder; | ||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | my $searchio = Bio::SearchIO->new(-format => $format, -file => $file); | ||||||||||||||||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||||||||||||||||
| 29 | $searchio->attach_EventHandler(Bio::SearchIO::FastHitEventBuilder->new()); | ||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | while( my $r = $searchio->next_result ) { | ||||||||||||||||||||||||||||||||||||||||||
| 32 | while( my $h = $r->next_hit ) { | ||||||||||||||||||||||||||||||||||||||||||
| 33 | # note that Hits will NOT have HSPs | ||||||||||||||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | This object handles Search Events generated by the SearchIO classes | ||||||||||||||||||||||||||||||||||||||||||
| 40 | and build appropriate Bio::Search::* objects from them. This object | ||||||||||||||||||||||||||||||||||||||||||
| 41 | is intended for lightweight parsers which only want Hits and not deal | ||||||||||||||||||||||||||||||||||||||||||
| 42 | with the overhead of HSPs. It is a lot faster than the standard | ||||||||||||||||||||||||||||||||||||||||||
| 43 | parser event handler but of course you are getting less information | ||||||||||||||||||||||||||||||||||||||||||
| 44 | and less objects out. | ||||||||||||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | =head1 FEEDBACK | ||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | =head2 Mailing Lists | ||||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | User feedback is an integral part of the evolution of this and other | ||||||||||||||||||||||||||||||||||||||||||
| 52 | Bioperl modules. Send your comments and suggestions preferably to | ||||||||||||||||||||||||||||||||||||||||||
| 53 | the Bioperl mailing list. Your participation is much appreciated. | ||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | bioperl-l@bioperl.org - General discussion | ||||||||||||||||||||||||||||||||||||||||||
| 56 | http://bioperl.org/wiki/Mailing_lists - About the mailing lists | ||||||||||||||||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||||||||||||||||
| 58 | =head2 Support | ||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | Please direct usage questions or support issues to the mailing list: | ||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | I<bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | rather than to the module maintainer directly. Many experienced and | ||||||||||||||||||||||||||||||||||||||||||
| 65 | reponsive experts will be able look at the problem and quickly | ||||||||||||||||||||||||||||||||||||||||||
| 66 | address it. Please include a thorough description of the problem | ||||||||||||||||||||||||||||||||||||||||||
| 67 | with code and data examples if at all possible. | ||||||||||||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||||||||||||
| 69 | =head2 Reporting Bugs | ||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | Report bugs to the Bioperl bug tracking system to help us keep track | ||||||||||||||||||||||||||||||||||||||||||
| 72 | of the bugs and their resolution. Bug reports can be submitted via the | ||||||||||||||||||||||||||||||||||||||||||
| 73 | web: | ||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | https://github.com/bioperl/bioperl-live/issues | ||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||
| 77 | =head1 AUTHOR - Jason Stajich | ||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||
| 79 | Email jason-at-bioperl.org | ||||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||
| 81 | =head1 APPENDIX | ||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||
| 83 | The rest of the documentation details each of the object methods. | ||||||||||||||||||||||||||||||||||||||||||
| 84 | Internal methods are usually preceded with a _ | ||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||
| 89 | # Let the code begin... | ||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||
| 92 | package Bio::SearchIO::FastHitEventBuilder; | ||||||||||||||||||||||||||||||||||||||||||
| 93 | 1 | $Bio::SearchIO::FastHitEventBuilder::VERSION = '1.7.8'; | |||||||||||||||||||||||||||||||||||||||||
| 94 | 1 | ▶ | use vars qw(%KNOWNEVENTS); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 95 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||
| 97 | 1 | ▶ | use Bio::Search::HSP::HSPFactory; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 98 | 1 | ▶ | use Bio::Search::Hit::HitFactory; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 99 | 1 | ▶ | use Bio::Search::Result::ResultFactory; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | 1 | ▶ | use base qw(Bio::Root::Root Bio::SearchIO::EventHandlerI); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | =head2 new | ||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||
| 105 | Title : new | ||||||||||||||||||||||||||||||||||||||||||
| 106 | Usage : my $obj = Bio::SearchIO::FastHitEventBuilder->new(); | ||||||||||||||||||||||||||||||||||||||||||
| 107 | Function: Builds a new Bio::SearchIO::FastHitEventBuilder object | ||||||||||||||||||||||||||||||||||||||||||
| 108 | Returns : Bio::SearchIO::FastHitEventBuilder | ||||||||||||||||||||||||||||||||||||||||||
| 109 | Args : -hit_factory => Bio::Factory::ObjectFactoryI | ||||||||||||||||||||||||||||||||||||||||||
| 110 | -result_factory => Bio::Factory::ObjectFactoryI | ||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||
| 112 | See L<Bio::Factory::ObjectFactoryI> for more information | ||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||
| 114 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | my ($class,@args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | my $self = $class->SUPER::new(@args); | |||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | my ($hitF,$resultF) = $self->_rearrange([qw(HIT_FACTORY | |||||||||||||||||||||||||||||||||||||||||
| 120 | RESULT_FACTORY)],@args); | ||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | ▶ | $self->register_factory('hit', $hitF || | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$hitF || 'Bio::Factory::ObjectFactory'->new('-type', 'Bio::Search::Hit::GenericHit', '-interface', 'Bio::Search::Hit::HitI')
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 table0%0/3
A || B
A= $hitFB= 'Bio::Factory::ObjectFactory'->new('-type', 'Bio::Search::Hit::GenericHit', '-interface', 'Bio::Search::Hit::HitI')
| |||||||||||||||||||||||||||||||||||||||||||
| 122 | Bio::Factory::ObjectFactory->new( | ||||||||||||||||||||||||||||||||||||||||||
| 123 | -type => 'Bio::Search::Hit::GenericHit', | ||||||||||||||||||||||||||||||||||||||||||
| 124 | -interface => 'Bio::Search::Hit::HitI')); | ||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | ▶ | $self->register_factory('result', $resultF || | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$resultF || 'Bio::Factory::ObjectFactory'->new('-type', 'Bio::Search::Result::GenericResult', '-interface', 'Bio::Search::Result::ResultI')
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 table0%0/3
A || B
A= $resultFB= 'Bio::Factory::ObjectFactory'->new('-type', 'Bio::Search::Result::GenericResult', '-interface', 'Bio::Search::Result::ResultI')
| |||||||||||||||||||||||||||||||||||||||||||
| 127 | Bio::Factory::ObjectFactory->new( | ||||||||||||||||||||||||||||||||||||||||||
| 128 | -type => 'Bio::Search::Result::GenericResult', | ||||||||||||||||||||||||||||||||||||||||||
| 129 | -interface => 'Bio::Search::Result::ResultI')); | ||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||
| 131 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||
| 134 | # new comes from the superclass | ||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||
| 136 | =head2 will_handle | ||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||
| 138 | Title : will_handle | ||||||||||||||||||||||||||||||||||||||||||
| 139 | Usage : if( $handler->will_handle($event_type) ) { ... } | ||||||||||||||||||||||||||||||||||||||||||
| 140 | Function: Tests if this event builder knows how to process a specific event | ||||||||||||||||||||||||||||||||||||||||||
| 141 | Returns : boolean | ||||||||||||||||||||||||||||||||||||||||||
| 142 | Args : event type name | ||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||
| 145 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | ▶ | sub will_handle{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
will_handle: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | my ($self,$type) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 149 | # these are the events we recognize | ||||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | ▶ | return ( $type eq 'hit' || $type eq 'result' ); | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$type eq 'hit' || $type eq 'result'
MC/DC0%0/2
$type eq 'hit' || $type eq 'result'
$type eq 'hit'
$type eq 'result'
Truth table0%0/3
A || B
A= $type eq 'hit'B= $type eq 'result'
| |||||||||||||||||||||||||||||||||||||||||||
| 151 | } | ||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | =head2 SAX methods | ||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||
| 155 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||
| 157 | =head2 start_result | ||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | Title : start_result | ||||||||||||||||||||||||||||||||||||||||||
| 160 | Usage : $handler->start_result($resulttype) | ||||||||||||||||||||||||||||||||||||||||||
| 161 | Function: Begins a result event cycle | ||||||||||||||||||||||||||||||||||||||||||
| 162 | Returns : none | ||||||||||||||||||||||||||||||||||||||||||
| 163 | Args : Type of Report | ||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||
| 165 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | ▶ | sub start_result { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
start_result: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | my ($self,$type) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | $self->{'_resulttype'} = $type; | |||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | $self->{'_hits'} = []; | |||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||
| 174 | =head2 end_result | ||||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||
| 176 | Title : end_result | ||||||||||||||||||||||||||||||||||||||||||
| 177 | Usage : my @results = $parser->end_result | ||||||||||||||||||||||||||||||||||||||||||
| 178 | Function: Finishes a result handler cycle Returns : A Bio::Search::Result::ResultI | ||||||||||||||||||||||||||||||||||||||||||
| 179 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||
| 181 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | ▶ | sub end_result { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
end_result: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | my ($self,$type,$data) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | ▶ | if( defined $data->{'runid'} && | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $data->{"runid"} and not $data->{"runid"} =~ /^\s+$/
MC/DC0%0/2
defined $data->{"runid"} and not $data->{"runid"} =~ /^\s+$/
defined $data->{"runid"}
not $data->{"runid"} =~ /^\s+$/
Truth table0%0/3
A and not(B)
A= defined $data->{"runid"}B= not $data->{"runid"} =~ /^\s+$/
| |||||||||||||||||||||||||||||||||||||||||||
| 186 | $data->{'runid'} !~ /^\s+$/ ) { | ||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | ▶ | if( $data->{'runid'} !~ /^lcl\|/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | $data->{"RESULT-query_name"}= $data->{'runid'}; | |||||||||||||||||||||||||||||||||||||||||
| 190 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | ($data->{"RESULT-query_name"},$data->{"RESULT-query_description"}) = split(/\s+/,$data->{"RESULT-query_description"},2); | |||||||||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | ▶ | if( my @a = split(/\|/,$data->{'RESULT-query_name'}) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | my $acc = pop @a ; # this is for accession |1234|gb|AAABB1.1|AAABB1 | |||||||||||||||||||||||||||||||||||||||||
| 196 | # this is for |123|gb|ABC1.1| | ||||||||||||||||||||||||||||||||||||||||||
| 197 | 0 | ▶ | $acc = pop @a if( ! defined $acc || $acc =~ /^\s+$/); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $acc or $acc =~ /^\s+$/
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+$/
| |||||||||||||||||||||||||||||||||||||||||||
| 198 | 0 | $data->{"RESULT-query_accession"}= $acc; | |||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | delete $data->{'runid'}; | |||||||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||||||
| 202 | 0 | my %args = map { my $v = $data->{$_}; s/RESULT//; ($_ => $v); } | |||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | grep { /^RESULT/ } keys %{$data}; | |||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | ▶ | $args{'-algorithm'} = uc( $args{'-algorithm_name'} || $type); | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$args{'-algorithm_name'} || $type
MC/DC0%0/2
$args{'-algorithm_name'} || $type
$args{'-algorithm_name'}
$type
Truth table0%0/3
A || B
A= $args{'-algorithm_name'}B= $type
| |||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | $args{'-hits'} = $self->{'_hits'}; | |||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | my $result = $self->factory('result')->create(%args); | |||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | $self->{'_hits'} = []; | |||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | return $result; | |||||||||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||
| 212 | =head2 start_hit | ||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||
| 214 | Title : start_hit | ||||||||||||||||||||||||||||||||||||||||||
| 215 | Usage : $handler->start_hit() | ||||||||||||||||||||||||||||||||||||||||||
| 216 | Function: Starts a Hit event cycle | ||||||||||||||||||||||||||||||||||||||||||
| 217 | Returns : none | ||||||||||||||||||||||||||||||||||||||||||
| 218 | Args : type of event and associated hashref | ||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||
| 221 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 222 | |||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | ▶ | sub start_hit{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
start_hit: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | my ($self,$type) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 225 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||
| 229 | =head2 end_hit | ||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||
| 231 | Title : end_hit | ||||||||||||||||||||||||||||||||||||||||||
| 232 | Usage : $handler->end_hit() | ||||||||||||||||||||||||||||||||||||||||||
| 233 | Function: Ends a Hit event cycle | ||||||||||||||||||||||||||||||||||||||||||
| 234 | Returns : Bio::Search::Hit::HitI object | ||||||||||||||||||||||||||||||||||||||||||
| 235 | Args : type of event and associated hashref | ||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||||||||
| 238 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | ▶ | sub end_hit{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
end_hit: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | my ($self,$type,$data) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | my %args = map { my $v = $data->{$_}; s/HIT//; ($_ => $v); } grep { /^HIT/ } keys %{$data}; | |||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | ▶ | $args{'-algorithm'} = uc( $args{'-algorithm_name'} || $type); | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$args{'-algorithm_name'} || $type
MC/DC0%0/2
$args{'-algorithm_name'} || $type
$args{'-algorithm_name'}
$type
Truth table0%0/3
A || B
A= $args{'-algorithm_name'}B= $type
| |||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | $args{'-query_len'} = $data->{'RESULT-query_length'}; | |||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | my ($hitrank) = scalar @{$self->{'_hits'}} + 1; | |||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | $args{'-rank'} = $hitrank; | |||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | my $hit = $self->factory('hit')->create(%args); | |||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | push @{$self->{'_hits'}}, $hit; | |||||||||||||||||||||||||||||||||||||||||
| 249 | 0 | $self->{'_hsps'} = []; | |||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | return $hit; | |||||||||||||||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||
| 253 | =head2 Factory methods | ||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||
| 255 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||
| 257 | =head2 register_factory | ||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||
| 259 | Title : register_factory | ||||||||||||||||||||||||||||||||||||||||||
| 260 | Usage : $handler->register_factory('TYPE',$factory); | ||||||||||||||||||||||||||||||||||||||||||
| 261 | Function: Register a specific factory for a object type class | ||||||||||||||||||||||||||||||||||||||||||
| 262 | Returns : none | ||||||||||||||||||||||||||||||||||||||||||
| 263 | Args : string representing the class and | ||||||||||||||||||||||||||||||||||||||||||
| 264 | Bio::Factory::ObjectFactoryI | ||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||
| 266 | See L<Bio::Factory::ObjectFactoryI> for more information | ||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||
| 268 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | ▶ | sub register_factory{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
register_factory: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | my ($self, $type,$f) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | ▶ | if( ! defined $f || ! ref($f) || | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $f and ref $f and $f->isa("Bio::Factory::ObjectFactoryI")
defined $f and ref $f
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 table0%0/4
A and B and C
A= defined $fB= ref $fC= $f->isa("Bio::Factory::ObjectFactoryI")
| |||||||||||||||||||||||||||||||||||||||||||
| 273 | ! $f->isa('Bio::Factory::ObjectFactoryI') ) { | ||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | $self->throw("Cannot set factory to value $f".ref($f)."\n"); | |||||||||||||||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | $self->{'_factories'}->{lc($type)} = $f; | |||||||||||||||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||
| 279 | |||||||||||||||||||||||||||||||||||||||||||
| 280 | =head2 factory | ||||||||||||||||||||||||||||||||||||||||||
| 281 | |||||||||||||||||||||||||||||||||||||||||||
| 282 | Title : factory | ||||||||||||||||||||||||||||||||||||||||||
| 283 | Usage : my $f = $handler->factory('TYPE'); | ||||||||||||||||||||||||||||||||||||||||||
| 284 | Function: Retrieves the associated factory for requested 'TYPE' | ||||||||||||||||||||||||||||||||||||||||||
| 285 | Returns : a Bio::Factory::ObjectFactoryI or undef if none registered | ||||||||||||||||||||||||||||||||||||||||||
| 286 | Args : name of factory class to retrieve | ||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||
| 288 | See L<Bio::Factory::ObjectFactoryI> for more information | ||||||||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||||||||
| 290 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | ▶ | sub factory{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
factory: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | my ($self,$type) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 294 | 0 | ▶ | return $self->{'_factories'}->{lc($type)} || $self->throw("No factory registered for $type"); | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{'_factories'}{lc $type} || $self->throw("No factory registered for $type")
MC/DC0%0/2
$self->{'_factories'}{lc $type} || $self->throw("No factory registered for $type")
$self->{'_factories'}{lc $type}
$self->throw("No factory registered for $type")
Truth table0%0/3
A || B
A= $self->{'_factories'}{lc $type}B= $self->throw("No factory registered for $type")
| |||||||||||||||||||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||
| 297 | =head2 inclusion_threshold | ||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||
| 299 | See L<Bio::SearchIO::blast::inclusion_threshold>. | ||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||
| 301 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | ▶ | sub inclusion_threshold { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
inclusion_threshold: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | ▶ | return $self->{'_inclusion_threshold'} = shift if @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | return $self->{'_inclusion_threshold'}; | |||||||||||||||||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||
| 309 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||