| 1 | # | ||||||||||||||||||||||||||||
| 2 | # BioPerl module for Bio::Search::Hit::HmmpfamHit | ||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||
| 4 | # Please direct questions and support issues to <bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||
| 5 | # | ||||||||||||||||||||||||||||
| 6 | # Cared for by Sendu Bala <bix@sendu.me.uk> | ||||||||||||||||||||||||||||
| 7 | # | ||||||||||||||||||||||||||||
| 8 | # Copyright Sendu Bala | ||||||||||||||||||||||||||||
| 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::Search::Hit::HmmpfamHit - A parser and hit object for hmmpfam hits | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | # generally we use Bio::SearchIO to build these objects | ||||||||||||||||||||||||||||
| 21 | use Bio::SearchIO; | ||||||||||||||||||||||||||||
| 22 | my $in = Bio::SearchIO->new(-format => 'hmmer_pull', | ||||||||||||||||||||||||||||
| 23 | -file => 'result.hmmer'); | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | while (my $result = $in->next_result) { | ||||||||||||||||||||||||||||
| 26 | while (my $hit = $result->next_hit) { | ||||||||||||||||||||||||||||
| 27 | print $hit->name, "\n"; | ||||||||||||||||||||||||||||
| 28 | print $hit->score, "\n"; | ||||||||||||||||||||||||||||
| 29 | print $hit->significance, "\n"; | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | while (my $hsp = $hit->next_hsp) { | ||||||||||||||||||||||||||||
| 32 | # process HSPI objects | ||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | This object implements a parser for hmmpfam hit output, a program in the HMMER | ||||||||||||||||||||||||||||
| 40 | package. | ||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | =head1 FEEDBACK | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | =head2 Mailing Lists | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | User feedback is an integral part of the evolution of this and other | ||||||||||||||||||||||||||||
| 47 | Bioperl modules. Send your comments and suggestions preferably to | ||||||||||||||||||||||||||||
| 48 | the Bioperl mailing list. Your participation is much appreciated. | ||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | bioperl-l@bioperl.org - General discussion | ||||||||||||||||||||||||||||
| 51 | http://bioperl.org/wiki/Mailing_lists - About the mailing lists | ||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | =head2 Support | ||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | Please direct usage questions or support issues to the mailing list: | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | I<bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||
| 59 | rather than to the module maintainer directly. Many experienced and | ||||||||||||||||||||||||||||
| 60 | reponsive experts will be able look at the problem and quickly | ||||||||||||||||||||||||||||
| 61 | address it. Please include a thorough description of the problem | ||||||||||||||||||||||||||||
| 62 | with code and data examples if at all possible. | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | =head2 Reporting Bugs | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | Report bugs to the Bioperl bug tracking system to help us keep track | ||||||||||||||||||||||||||||
| 67 | of the bugs and their resolution. Bug reports can be submitted via the | ||||||||||||||||||||||||||||
| 68 | web: | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | https://github.com/bioperl/bioperl-live/issues | ||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||
| 72 | =head1 AUTHOR - Sendu Bala | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | Email bix@sendu.me.uk | ||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||
| 76 | =head1 APPENDIX | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | The rest of the documentation details each of the object methods. | ||||||||||||||||||||||||||||
| 79 | Internal methods are usually preceded with a _ | ||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||
| 81 | =cut | ||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||
| 83 | # Let the code begin... | ||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||
| 85 | package Bio::Search::Hit::HmmpfamHit; | ||||||||||||||||||||||||||||
| 86 | 4 | $Bio::Search::Hit::HmmpfamHit::VERSION = '1.7.3'; | |||||||||||||||||||||||||||
| 87 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||
| 89 | 4 | ▶ | use Bio::Search::HSP::HmmpfamHSP; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | 4 | ▶ | use base qw(Bio::Root::Root Bio::Search::Hit::PullHitI); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | =head2 new | ||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||
| 95 | Title : new | ||||||||||||||||||||||||||||
| 96 | Usage : my $obj = Bio::Search::Hit::HmmpfamHit->new(); | ||||||||||||||||||||||||||||
| 97 | Function: Builds a new Bio::Search::Hit::HmmpfamHit object. | ||||||||||||||||||||||||||||
| 98 | Returns : Bio::Search::Hit::HmmpfamHit | ||||||||||||||||||||||||||||
| 99 | Args : -chunk => [Bio::Root::IO, $start, $end] (required if no -parent) | ||||||||||||||||||||||||||||
| 100 | -parent => Bio::PullParserI object (required if no -chunk) | ||||||||||||||||||||||||||||
| 101 | -hit_data => array ref with [name description score significance | ||||||||||||||||||||||||||||
| 102 | num_hsps rank] | ||||||||||||||||||||||||||||
| 103 | |||||||||||||||||||||||||||||
| 104 | where the array ref provided to -chunk contains an IO object | ||||||||||||||||||||||||||||
| 105 | for a filehandle to something representing the raw data of the | ||||||||||||||||||||||||||||
| 106 | hit, and $start and $end define the tell() position within the | ||||||||||||||||||||||||||||
| 107 | filehandle that the hit data starts and ends (optional; defaults | ||||||||||||||||||||||||||||
| 108 | to start and end of the entire thing described by the filehandle) | ||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | =cut | ||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | 16 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=5 SCAR=16.3
Pod
documented
| |||||||||||||||||||||||||||||
| 113 | 16 | my ($class, @args) = @_; | |||||||||||||||||||||||||||
| 114 | 16 | my $self = $class->SUPER::new(@args); | |||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||
| 116 | 16 | $self->_setup(@args); | |||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||
| 118 | 16 | my $fields = $self->_fields; | |||||||||||||||||||||||||||
| 119 | 16 | foreach my $field (qw( next_domain domains hsp_data )) { | |||||||||||||||||||||||||||
| 120 | 48 | $fields->{$field} = undef; | |||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||
| 123 | 16 | my $hit_data = $self->_raw_hit_data; | |||||||||||||||||||||||||||
| 124 | 16 | ▶ | if ($hit_data && ref($hit_data) eq 'ARRAY') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$hit_data and ref $hit_data eq "ARRAY"
MC/DC0%0/2
$hit_data and ref $hit_data eq "ARRAY"
$hit_data
ref $hit_data eq "ARRAY"
Truth table33%1/3
A and B
A= $hit_dataB= ref $hit_data eq "ARRAY"
| |||||||||||||||||||||||||||||
| 125 | 16 | foreach my $field (qw(name description score significance num_hsps rank)) { | |||||||||||||||||||||||||||
| 126 | 96 | $fields->{$field} = shift(@{$hit_data}); | |||||||||||||||||||||||||||
| 127 | } | ||||||||||||||||||||||||||||
| 128 | } | ||||||||||||||||||||||||||||
| 129 | 16 | $fields->{hit_start} = 1; | |||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||
| 131 | 16 | delete $self->_fields->{accession}; | |||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||
| 133 | 16 | $self->_dependencies( { ( length => 'hsp_data' ) } ); | |||||||||||||||||||||||||||
| 134 | |||||||||||||||||||||||||||||
| 135 | 16 | return $self; | |||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||
| 138 | # | ||||||||||||||||||||||||||||
| 139 | # PullParserI discovery methods so we can answer all HitI questions | ||||||||||||||||||||||||||||
| 140 | # | ||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||
| 142 | 10 | ▶ | sub _discover_description { | ||||||||||||||||||||||||||
|
Subroutine
_discover_description: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 143 | # this should be set when this object is created, but if it was undef as is | ||||||||||||||||||||||||||||
| 144 | # possible, this _discover method will be called: just return and keep the | ||||||||||||||||||||||||||||
| 145 | # return value undef | ||||||||||||||||||||||||||||
| 146 | 10 | return; | |||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||
| 149 | 16 | ▶ | sub _discover_hsp_data { | ||||||||||||||||||||||||||
|
Subroutine
_discover_hsp_data: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||
| 150 | 16 | my $self = shift; | |||||||||||||||||||||||||||
| 151 | 16 | my $hsp_table = $self->get_field('hsp_table'); | |||||||||||||||||||||||||||
| 152 | 16 | ▶ | my $hsp_data = $hsp_table->{$self->get_field('name')} || undef; | ||||||||||||||||||||||||||
|
Condition100%2/2
$$hsp_table{$self->get_field('name')} || undef
MC/DC100%1/1
$$hsp_table{$self->get_field('name')} || undef
$$hsp_table{$self->get_field('name')}
Truth table100%2/2
A
A= $$hsp_table{$self->get_field('name')}
| |||||||||||||||||||||||||||||
| 153 | 16 | ▶ | if ($hsp_data) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 154 | 4 | ▶ | if (defined $hsp_data->{hit_length}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 155 | 3 | $self->_fields->{length} = $hsp_data->{hit_length}; | |||||||||||||||||||||||||||
| 156 | } | ||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||
| 158 | # rank query_start query_end hit_start hit_end score evalue | ||||||||||||||||||||||||||||
| 159 | 4 | $self->_fields->{hsp_data} = $hsp_data->{hsp_data}; | |||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||
| 163 | 2 | ▶ | sub _discover_query_start { | ||||||||||||||||||||||||||
|
Subroutine
_discover_query_start: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||
| 164 | 2 | my $self = shift; | |||||||||||||||||||||||||||
| 165 | 2 | ▶ | my $hsp_data = $self->get_field('hsp_data') || return; | ||||||||||||||||||||||||||
|
Condition50%1/2
$self->get_field('hsp_data') || (return)
MC/DC0%0/1
$self->get_field('hsp_data') || (return)
$self->get_field('hsp_data')
Truth table50%1/2
A
A= $self->get_field('hsp_data')
| |||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||
| 167 | 2 | my ($this_hsp) = sort { $a->[1] <=> $b->[1] } @{$hsp_data}; | |||||||||||||||||||||||||||
| 168 | 2 | $self->_fields->{query_start} = $this_hsp->[1]; | |||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||
| 171 | 2 | ▶ | sub _discover_query_end { | ||||||||||||||||||||||||||
|
Subroutine
_discover_query_end: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||
| 172 | 2 | my $self = shift; | |||||||||||||||||||||||||||
| 173 | 2 | ▶ | my $hsp_data = $self->get_field('hsp_data') || return; | ||||||||||||||||||||||||||
|
Condition50%1/2
$self->get_field('hsp_data') || (return)
MC/DC0%0/1
$self->get_field('hsp_data') || (return)
$self->get_field('hsp_data')
Truth table50%1/2
A
A= $self->get_field('hsp_data')
| |||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||
| 175 | 2 | my ($this_hsp) = sort { $b->[2] <=> $a->[2] } @{$hsp_data}; | |||||||||||||||||||||||||||
| 176 | 2 | $self->_fields->{query_end} = $this_hsp->[2]; | |||||||||||||||||||||||||||
| 177 | } | ||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||
| 179 | 0 | ▶ | sub _discover_hit_start { | ||||||||||||||||||||||||||
|
Subroutine
_discover_hit_start: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||
| 180 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 181 | 0 | ▶ | my $hsp_data = $self->get_field('hsp_data') || return; | ||||||||||||||||||||||||||
|
Condition0%0/2
$self->get_field('hsp_data') || (return)
MC/DC0%0/1
$self->get_field('hsp_data') || (return)
$self->get_field('hsp_data')
Truth table0%0/2
A
A= $self->get_field('hsp_data')
| |||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||
| 183 | 0 | my ($this_hsp) = sort { $a->[3] <=> $b->[3] } @{$hsp_data}; | |||||||||||||||||||||||||||
| 184 | 0 | $self->_fields->{hit_start} = $this_hsp->[3]; | |||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||
| 187 | 2 | ▶ | sub _discover_hit_end { | ||||||||||||||||||||||||||
|
Subroutine
_discover_hit_end: called CC=2 SCAR=7.0
| |||||||||||||||||||||||||||||
| 188 | 2 | my $self = shift; | |||||||||||||||||||||||||||
| 189 | 2 | ▶ | my $hsp_data = $self->get_field('hsp_data') || return; | ||||||||||||||||||||||||||
|
Condition50%1/2
$self->get_field('hsp_data') || (return)
MC/DC0%0/1
$self->get_field('hsp_data') || (return)
$self->get_field('hsp_data')
Truth table50%1/2
A
A= $self->get_field('hsp_data')
| |||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||
| 191 | 2 | my ($this_hsp) = sort { $b->[4] <=> $a->[4] } @{$hsp_data}; | |||||||||||||||||||||||||||
| 192 | 2 | $self->_fields->{hit_end} = $this_hsp->[4]; | |||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||
| 195 | 49 | ▶ | sub _discover_next_hsp { | ||||||||||||||||||||||||||
|
Subroutine
_discover_next_hsp: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||
| 196 | 49 | my $self = shift; | |||||||||||||||||||||||||||
| 197 | 49 | ▶ | my $hsp_data = $self->get_field('hsp_data') || return; | ||||||||||||||||||||||||||
|
Condition100%2/2
$self->get_field('hsp_data') || (return)
MC/DC100%1/1
$self->get_field('hsp_data') || (return)
$self->get_field('hsp_data')
Truth table100%2/2
A
A= $self->get_field('hsp_data')
| |||||||||||||||||||||||||||||
| 198 | 44 | ▶ | unless (defined $self->{_next_hsp_index}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 199 | 2 | $self->{_next_hsp_index} = 0; | |||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||
| 201 | 44 | ▶ | return if $self->{_next_hsp_index} == -1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||
| 203 | $self->_fields->{next_hsp} = Bio::Search::HSP::HmmpfamHSP->new(-parent => $self, | ||||||||||||||||||||||||||||
| 204 | 30 | -hsp_data => $hsp_data->[$self->{_next_hsp_index}++]); | |||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||
| 206 | 30 | ▶ | if ($self->{_next_hsp_index} > $#{$hsp_data}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 207 | 15 | $self->{_next_hsp_index} = -1; | |||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||
| 209 | } | ||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||
| 211 | =head2 next_hsp | ||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||
| 213 | Title : next_hsp | ||||||||||||||||||||||||||||
| 214 | Usage : while( $hsp = $obj->next_hsp()) { ... } | ||||||||||||||||||||||||||||
| 215 | Function : Returns the next available High Scoring Pair | ||||||||||||||||||||||||||||
| 216 | Example : | ||||||||||||||||||||||||||||
| 217 | Returns : L<Bio::Search::HSP::HSPI> object or null if finished | ||||||||||||||||||||||||||||
| 218 | Args : none | ||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||
| 220 | =cut | ||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||
| 222 | 49 | ▶ | sub next_hsp { | ||||||||||||||||||||||||||
|
Subroutine
next_hsp: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 223 | 49 | my $self = shift; | |||||||||||||||||||||||||||
| 224 | 49 | my $hsp = $self->get_field('next_hsp'); | |||||||||||||||||||||||||||
| 225 | 49 | undef $self->_fields->{next_hsp}; | |||||||||||||||||||||||||||
| 226 | 49 | return $hsp; | |||||||||||||||||||||||||||
| 227 | } | ||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||
| 229 | =head2 next_domain | ||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||
| 231 | Title : next_domain | ||||||||||||||||||||||||||||
| 232 | Usage : my $domain = $hit->next_domain(); | ||||||||||||||||||||||||||||
| 233 | Function: An alias for L<next_hsp()>, this will return the next HSP | ||||||||||||||||||||||||||||
| 234 | Returns : L<Bio::Search::HSP::HSPI> object | ||||||||||||||||||||||||||||
| 235 | Args : none | ||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||
| 237 | =cut | ||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||
| 239 | 4 | *next_domain = \&next_hsp; | |||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||
| 241 | =head2 hsps | ||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||
| 243 | Usage : $hit_object->hsps(); | ||||||||||||||||||||||||||||
| 244 | Purpose : Get a list containing all HSP objects. | ||||||||||||||||||||||||||||
| 245 | Example : @hsps = $hit_object->hsps(); | ||||||||||||||||||||||||||||
| 246 | Returns : list of L<Bio::Search::HSP::BlastHSP> objects. | ||||||||||||||||||||||||||||
| 247 | Argument : none | ||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||
| 249 | =cut | ||||||||||||||||||||||||||||
| 250 | |||||||||||||||||||||||||||||
| 251 | 16 | ▶ | sub hsps { | ||||||||||||||||||||||||||
|
Subroutine
hsps: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||
| 252 | 16 | my $self = shift; | |||||||||||||||||||||||||||
| 253 | 16 | ▶ | my $old = $self->{_next_hsp_index} || 0; | ||||||||||||||||||||||||||
|
Condition100%2/2
$self->{'_next_hsp_index'} || 0
MC/DC100%1/1
$self->{'_next_hsp_index'} || 0
$self->{'_next_hsp_index'}
Truth table100%2/2
A
A= $self->{'_next_hsp_index'}
| |||||||||||||||||||||||||||||
| 254 | 16 | $self->rewind; | |||||||||||||||||||||||||||
| 255 | 16 | my @hsps; | |||||||||||||||||||||||||||
| 256 | 16 | ▶ | while (defined(my $hsp = $self->next_hsp)) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 257 | 24 | push(@hsps, $hsp); | |||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||
| 259 | 16 | ▶ | $self->{_next_hsp_index} = @hsps > 0 ? $old : -1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 260 | 16 | return @hsps; | |||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||
| 263 | =head2 domains | ||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||
| 265 | Title : domains | ||||||||||||||||||||||||||||
| 266 | Usage : my @domains = $hit->domains(); | ||||||||||||||||||||||||||||
| 267 | Function: An alias for L<hsps()>, this will return the full list of hsps | ||||||||||||||||||||||||||||
| 268 | Returns : array of L<Bio::Search::HSP::HSPI> objects | ||||||||||||||||||||||||||||
| 269 | Args : none | ||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||
| 271 | =cut | ||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||
| 273 | 4 | *domains = \&hsps; | |||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||
| 275 | =head2 hsp | ||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||
| 277 | Usage : $hit_object->hsp( [string] ); | ||||||||||||||||||||||||||||
| 278 | Purpose : Get a single HSPI object for the present HitI object. | ||||||||||||||||||||||||||||
| 279 | Example : $hspObj = $hit_object->hsp; # same as 'best' | ||||||||||||||||||||||||||||
| 280 | : $hspObj = $hit_object->hsp('best'); | ||||||||||||||||||||||||||||
| 281 | : $hspObj = $hit_object->hsp('worst'); | ||||||||||||||||||||||||||||
| 282 | Returns : Object reference for a L<Bio::Search::HSP::HSPI> object. | ||||||||||||||||||||||||||||
| 283 | Argument : String (or no argument). | ||||||||||||||||||||||||||||
| 284 | : No argument (default) = highest scoring HSP (same as 'best'). | ||||||||||||||||||||||||||||
| 285 | : 'best' = highest scoring HSP. | ||||||||||||||||||||||||||||
| 286 | : 'worst' = lowest scoring HSP. | ||||||||||||||||||||||||||||
| 287 | Throws : Exception if an unrecognized argument is used. | ||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||
| 289 | See Also : L<hsps()|hsps>, L<num_hsps>() | ||||||||||||||||||||||||||||
| 290 | |||||||||||||||||||||||||||||
| 291 | =cut | ||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||
| 293 | 4 | ▶ | sub hsp { | ||||||||||||||||||||||||||
|
Subroutine
hsp: called CC=5 SCAR=16.4
Pod
documented
| |||||||||||||||||||||||||||||
| 294 | 4 | my ($self, $type) = @_; | |||||||||||||||||||||||||||
| 295 | 4 | ▶ | $type ||= 'best'; | ||||||||||||||||||||||||||
|
Condition50%1/2
$type ||= "best"
MC/DC0%0/1
$type ||= "best"
$type
Truth table50%1/2
A
A= $type
| |||||||||||||||||||||||||||||
| 296 | 4 | ▶ | my $hsp_data = $self->get_field('hsp_data') || return; | ||||||||||||||||||||||||||
|
Condition50%1/2
$self->get_field('hsp_data') || (return)
MC/DC0%0/1
$self->get_field('hsp_data') || (return)
$self->get_field('hsp_data')
Truth table50%1/2
A
A= $self->get_field('hsp_data')
| |||||||||||||||||||||||||||||
| 297 | |||||||||||||||||||||||||||||
| 298 | 4 | my $sort; | |||||||||||||||||||||||||||
| 299 | 4 | ▶ | if ($type eq 'best') { | ||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||
| 300 | 2 | ▶ | $sort = sub { $a->[6] <=> $b->[6] }; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 301 | } | ||||||||||||||||||||||||||||
| 302 | elsif ($type eq 'worst') { | ||||||||||||||||||||||||||||
| 303 | 2 | ▶ | $sort = sub { $b->[6] <=> $a->[6] }; | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 304 | } | ||||||||||||||||||||||||||||
| 305 | else { | ||||||||||||||||||||||||||||
| 306 | 0 | $self->throw("Unknown arg '$type' given to hsp()"); | |||||||||||||||||||||||||||
| 307 | } | ||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||
| 309 | 4 | my ($this_hsp) = sort $sort @{$hsp_data}; | |||||||||||||||||||||||||||
| 310 | 4 | return Bio::Search::HSP::HmmpfamHSP->new(-parent => $self, -hsp_data => $this_hsp); | |||||||||||||||||||||||||||
| 311 | } | ||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||
| 313 | =head2 rewind | ||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||
| 315 | Title : rewind | ||||||||||||||||||||||||||||
| 316 | Usage : $result->rewind; | ||||||||||||||||||||||||||||
| 317 | Function: Allow one to reset the Hit iterator to the beginning, so that | ||||||||||||||||||||||||||||
| 318 | next_hit() will subsequently return the first hit and so on. | ||||||||||||||||||||||||||||
| 319 | Returns : n/a | ||||||||||||||||||||||||||||
| 320 | Args : none | ||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||
| 322 | =cut | ||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||
| 324 | 16 | ▶ | sub rewind { | ||||||||||||||||||||||||||
|
Subroutine
rewind: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||
| 325 | 16 | my $self = shift; | |||||||||||||||||||||||||||
| 326 | 16 | ▶ | my $hsp_data = $self->get_field('hsp_data') || return; | ||||||||||||||||||||||||||
|
Condition100%2/2
$self->get_field('hsp_data') || (return)
MC/DC100%1/1
$self->get_field('hsp_data') || (return)
$self->get_field('hsp_data')
Truth table100%2/2
A
A= $self->get_field('hsp_data')
| |||||||||||||||||||||||||||||
| 327 | 12 | ▶ | $self->{_next_hsp_index} = @{$hsp_data} > 0 ? 0 : -1; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 328 | } | ||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||
| 330 | # have p() a synonym of significance() | ||||||||||||||||||||||||||||
| 331 | 3 | ▶ | sub p { | ||||||||||||||||||||||||||
|
Subroutine
p: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 332 | 3 | return shift->significance; | |||||||||||||||||||||||||||
| 333 | } | ||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||
| 335 | =head2 strand | ||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||
| 337 | Usage : $sbjct->strand( [seq_type] ); | ||||||||||||||||||||||||||||
| 338 | Purpose : Gets the strand(s) for the query, sbjct, or both sequences. | ||||||||||||||||||||||||||||
| 339 | : For hmmpfam, the answers are always 1 (forward strand). | ||||||||||||||||||||||||||||
| 340 | Example : $qstrand = $sbjct->strand('query'); | ||||||||||||||||||||||||||||
| 341 | : $sstrand = $sbjct->strand('hit'); | ||||||||||||||||||||||||||||
| 342 | : ($qstrand, $sstrand) = $sbjct->strand(); | ||||||||||||||||||||||||||||
| 343 | Returns : scalar context: integer '1' | ||||||||||||||||||||||||||||
| 344 | : array context without args: list of two strings (1, 1) | ||||||||||||||||||||||||||||
| 345 | : Array context can be "induced" by providing an argument of 'list' | ||||||||||||||||||||||||||||
| 346 | : or 'array'. | ||||||||||||||||||||||||||||
| 347 | Argument : In scalar context: seq_type = 'query' or 'hit' or 'sbjct' (default | ||||||||||||||||||||||||||||
| 348 | : = 'query') ('sbjct' is synonymous with 'hit') | ||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||
| 350 | =cut | ||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||
| 352 | 9 | ▶ | sub strand { | ||||||||||||||||||||||||||
|
Subroutine
strand: called CC=5 SCAR=16.4
Pod
documented
| |||||||||||||||||||||||||||||
| 353 | 9 | my ($self, $type) = @_; | |||||||||||||||||||||||||||
| 354 | 9 | ▶ | $type ||= (wantarray ? 'list' : 'query'); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$type ||= wantarray ? "list" : "query"
MC/DC0%0/2
$type ||= wantarray ? "list" : "query"
$type
wantarray ? "list" : "query"
Truth table66%2/3
A ||= B
A= $typeB= wantarray ? "list" : "query"
| |||||||||||||||||||||||||||||
| 355 | 9 | $type = lc($type); | |||||||||||||||||||||||||||
| 356 | 9 | ▶ | if ($type eq 'list' || $type eq 'array') { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$type eq "list" or $type eq "array"
MC/DC50%1/2
$type eq "list" or $type eq "array"
$type eq "list"
$type eq "array"
Truth table66%2/3
A or B
A= $type eq "list"B= $type eq "array"
| |||||||||||||||||||||||||||||
| 357 | 3 | return (1, 1); | |||||||||||||||||||||||||||
| 358 | } | ||||||||||||||||||||||||||||
| 359 | 6 | return 1; | |||||||||||||||||||||||||||
| 360 | } | ||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||
| 362 | =head2 frac_aligned_query | ||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||
| 364 | Usage : $hit_object->frac_aligned_query(); | ||||||||||||||||||||||||||||
| 365 | Purpose : Get the fraction of the query sequence which has been aligned | ||||||||||||||||||||||||||||
| 366 | : across all HSPs (not including intervals between non-overlapping | ||||||||||||||||||||||||||||
| 367 | : HSPs). | ||||||||||||||||||||||||||||
| 368 | Example : $frac_alnq = $hit_object->frac_aligned_query(); | ||||||||||||||||||||||||||||
| 369 | Returns : undef (the length of query sequences is unknown in Hmmpfam reports) | ||||||||||||||||||||||||||||
| 370 | Argument : none | ||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||
| 372 | =cut | ||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||
| 374 | # noop | ||||||||||||||||||||||||||||
| 375 | 1 | ▶ | sub frac_aligned_query { } | ||||||||||||||||||||||||||
|
Subroutine
frac_aligned_query: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 376 | |||||||||||||||||||||||||||||
| 377 | 4 | 1; | |||||||||||||||||||||||||||