| 1 | # | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # BioPerl module for Bio::Search::Hit::GenericHit | ||||||||||||||||||||||||||||||||||||||||||
| 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::Search::Hit::GenericHit - A generic implementation of the Bio::Search::Hit::HitI interface | ||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | use Bio::Search::Hit::GenericHit; | ||||||||||||||||||||||||||||||||||||||||||
| 21 | my $hit = Bio::Search::Hit::GenericHit->new(-algorithm => 'blastp'); | ||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | # typically one gets HitI objects from a SearchIO stream via a ResultI | ||||||||||||||||||||||||||||||||||||||||||
| 24 | use Bio::SearchIO; | ||||||||||||||||||||||||||||||||||||||||||
| 25 | my $parser = Bio::SearchIO->new(-format => 'blast', -file => 'result.bls'); | ||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | my $result = $parser->next_result; | ||||||||||||||||||||||||||||||||||||||||||
| 28 | my $hit = $result->next_hit; | ||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | # TODO: Describe how to configure a SearchIO stream so that it generates | ||||||||||||||||||||||||||||||||||||||||||
| 31 | # GenericHit objects. | ||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | This object handles the hit data from a Database Sequence Search such | ||||||||||||||||||||||||||||||||||||||||||
| 36 | as FASTA or BLAST. | ||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | Unless you're writing a parser, you won't ever need to create a | ||||||||||||||||||||||||||||||||||||||||||
| 39 | GenericHit or any other HitI-implementing object. If you use | ||||||||||||||||||||||||||||||||||||||||||
| 40 | the SearchIO system, HitI objects are created automatically from | ||||||||||||||||||||||||||||||||||||||||||
| 41 | a SearchIO stream which returns Bio::Search::Hit::HitI objects. | ||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | For documentation on what you can do with GenericHit (and other HitI | ||||||||||||||||||||||||||||||||||||||||||
| 44 | objects), please see the API documentation in | ||||||||||||||||||||||||||||||||||||||||||
| 45 | L<Bio::Search::Hit::HitI|Bio::Search::Hit::HitI>. | ||||||||||||||||||||||||||||||||||||||||||
| 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 and Steve Chervitz | ||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||
| 79 | Email jason-at-bioperl-dot-org | ||||||||||||||||||||||||||||||||||||||||||
| 80 | Email sac-at-bioperl-dot-org | ||||||||||||||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||||||||||||
| 82 | =head1 CONTRIBUTORS | ||||||||||||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||||||||||||
| 84 | Sendu Bala, bix@sendu.me.uk | ||||||||||||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||||||||||||
| 86 | =head1 APPENDIX | ||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | The rest of the documentation details each of the object methods. | ||||||||||||||||||||||||||||||||||||||||||
| 89 | Internal methods are usually preceded with a _ | ||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||
| 91 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||
| 94 | # Let the code begin... | ||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||
| 97 | package Bio::Search::Hit::GenericHit; | ||||||||||||||||||||||||||||||||||||||||||
| 98 | 30 | $Bio::Search::Hit::GenericHit::VERSION = '1.7.8'; | |||||||||||||||||||||||||||||||||||||||||
| 99 | 30 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | 30 | ▶ | use Bio::Search::SearchUtils; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | 30 | ▶ | use base qw(Bio::Root::Root Bio::Search::Hit::HitI); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||
| 105 | =head2 new | ||||||||||||||||||||||||||||||||||||||||||
| 106 | |||||||||||||||||||||||||||||||||||||||||||
| 107 | Title : new | ||||||||||||||||||||||||||||||||||||||||||
| 108 | Usage : my $obj = Bio::Search::Hit::GenericHit->new(); | ||||||||||||||||||||||||||||||||||||||||||
| 109 | Function: Builds a new Bio::Search::Hit::GenericHit object | ||||||||||||||||||||||||||||||||||||||||||
| 110 | Returns : Bio::Search::Hit::GenericHit | ||||||||||||||||||||||||||||||||||||||||||
| 111 | Args : -name => Name of Hit (required) | ||||||||||||||||||||||||||||||||||||||||||
| 112 | -description => Description (optional) | ||||||||||||||||||||||||||||||||||||||||||
| 113 | -accession => Accession number (optional) | ||||||||||||||||||||||||||||||||||||||||||
| 114 | -ncbi_gi => NCBI GI UID (optional) | ||||||||||||||||||||||||||||||||||||||||||
| 115 | -length => Length of the Hit (optional) | ||||||||||||||||||||||||||||||||||||||||||
| 116 | -score => Raw Score for the Hit (optional) | ||||||||||||||||||||||||||||||||||||||||||
| 117 | -bits => Bit Score for the Hit (optional) | ||||||||||||||||||||||||||||||||||||||||||
| 118 | -significance => Significance value for the Hit (optional) | ||||||||||||||||||||||||||||||||||||||||||
| 119 | -algorithm => Algorithm used (BLASTP, FASTX, etc...) | ||||||||||||||||||||||||||||||||||||||||||
| 120 | -hsps => Array ref of HSPs for this Hit. | ||||||||||||||||||||||||||||||||||||||||||
| 121 | -found_again => boolean, true if hit appears in a | ||||||||||||||||||||||||||||||||||||||||||
| 122 | "previously found" section of a PSI-Blast report. | ||||||||||||||||||||||||||||||||||||||||||
| 123 | -hsp_factory => Bio::Factory::ObjectFactoryI able to create HSPI | ||||||||||||||||||||||||||||||||||||||||||
| 124 | objects. | ||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||
| 126 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | 1079 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=21 SCAR=30.6
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 129 | 1079 | my($class,@args) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||
| 131 | 1079 | my $self = $class->SUPER::new(@args); | |||||||||||||||||||||||||||||||||||||||||
| 132 | 1079 | my ($hsps, $name,$query_len,$desc, $acc, $locus, $length, | |||||||||||||||||||||||||||||||||||||||||
| 133 | $score,$algo,$signif,$bits, $p, | ||||||||||||||||||||||||||||||||||||||||||
| 134 | $rank, $hsp_factory, $gi, $iter, $found) = $self->_rearrange([qw(HSPS | ||||||||||||||||||||||||||||||||||||||||||
| 135 | NAME | ||||||||||||||||||||||||||||||||||||||||||
| 136 | QUERY_LEN | ||||||||||||||||||||||||||||||||||||||||||
| 137 | DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 138 | ACCESSION | ||||||||||||||||||||||||||||||||||||||||||
| 139 | LOCUS | ||||||||||||||||||||||||||||||||||||||||||
| 140 | LENGTH SCORE ALGORITHM | ||||||||||||||||||||||||||||||||||||||||||
| 141 | SIGNIFICANCE BITS P | ||||||||||||||||||||||||||||||||||||||||||
| 142 | RANK | ||||||||||||||||||||||||||||||||||||||||||
| 143 | HSP_FACTORY | ||||||||||||||||||||||||||||||||||||||||||
| 144 | NCBI_GI | ||||||||||||||||||||||||||||||||||||||||||
| 145 | ITERATION | ||||||||||||||||||||||||||||||||||||||||||
| 146 | FOUND_AGAIN)], @args); | ||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||
| 148 | 1079 | ▶ | defined $query_len && $self->query_length($query_len); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||||||||||||
| 150 | 1079 | ▶ | if( ! defined $name ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | $self->throw("Must have defined a valid name for Hit"); | |||||||||||||||||||||||||||||||||||||||||
| 152 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 153 | 1079 | $self->name($name); | |||||||||||||||||||||||||||||||||||||||||
| 154 | } | ||||||||||||||||||||||||||||||||||||||||||
| 155 | |||||||||||||||||||||||||||||||||||||||||||
| 156 | 1079 | ▶ | defined $acc && $self->accession($acc); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 157 | 1079 | ▶ | defined $locus && $self->locus($locus); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 158 | 1079 | ▶ | defined $desc && $self->description($desc); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 159 | 1079 | ▶ | defined $length && $self->length($length); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 160 | 1079 | ▶ | defined $algo && $self->algorithm($algo); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 161 | 1079 | ▶ | defined $signif && $self->significance($signif); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 162 | 1079 | ▶ | defined $score && $self->raw_score($score); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 163 | 1079 | ▶ | defined $bits && $self->bits($bits); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 164 | 1079 | ▶ | defined $rank && $self->rank($rank); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 165 | 1079 | ▶ | defined $hsp_factory && $self->hsp_factory($hsp_factory); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 166 | 1079 | ▶ | defined $gi && $self->ncbi_gi($gi); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 167 | 1079 | ▶ | defined $iter && $self->iteration($iter); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 168 | 1079 | ▶ | defined $found && $self->found_again($found); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 169 | # p() has a weird interface, so this is a hack workaround | ||||||||||||||||||||||||||||||||||||||||||
| 170 | 1079 | ▶ | if (defined $p) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 171 | 1 | $self->{_p} = $p; | |||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||
| 174 | 1079 | $self->{'_iterator'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 175 | 1079 | ▶ | if( defined $hsps ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 176 | 1018 | ▶ | if( ref($hsps) !~ /array/i ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | $self->warn("Did not specify a valid array ref for the param HSPS ($hsps)"); | |||||||||||||||||||||||||||||||||||||||||
| 178 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 179 | 1018 | my $hspcount=0; | |||||||||||||||||||||||||||||||||||||||||
| 180 | 1018 | ▶ | while( @{$hsps} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 181 | 868 | $hspcount++; | |||||||||||||||||||||||||||||||||||||||||
| 182 | 868 | $self->add_hsp(shift @{$hsps} ); | |||||||||||||||||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||||||||||||||||
| 184 | 1018 | ▶ | $self->{'_hsps'} = undef if $hspcount == 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||
| 187 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 188 | 61 | $self->{'_hsps'} = undef; | |||||||||||||||||||||||||||||||||||||||||
| 189 | } | ||||||||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||||||||
| 191 | 1079 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||
| 194 | =head2 add_hsp | ||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||
| 196 | Title : add_hsp | ||||||||||||||||||||||||||||||||||||||||||
| 197 | Usage : $hit->add_hsp($hsp) | ||||||||||||||||||||||||||||||||||||||||||
| 198 | Function: Add a HSP to the collection of HSPs for a Hit | ||||||||||||||||||||||||||||||||||||||||||
| 199 | Returns : number of HSPs in the Hit | ||||||||||||||||||||||||||||||||||||||||||
| 200 | Args : Bio::Search::HSP::HSPI object, OR hash ref containing data suitable | ||||||||||||||||||||||||||||||||||||||||||
| 201 | for creating a HSPI object (&hsp_factory must be set to get it back) | ||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||
| 203 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | 1470 | ▶ | sub add_hsp { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_hsp: called CC=5 SCAR=17.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 206 | 1470 | my ($self,$hsp) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 207 | 1470 | ▶ | if (!defined $hsp || (ref($hsp) ne 'HASH' && !$hsp->isa('Bio::Search::HSP::HSPI'))) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%3/6
not defined $hsp or ref $hsp ne "HASH" and not $hsp->isa("Bio::Search::HSP::HSPI")
ref $hsp ne "HASH" and not $hsp->isa("Bio::Search::HSP::HSPI")
MC/DC0%0/3
not defined $hsp or ref $hsp ne "HASH" and not $hsp->isa("Bio::Search::HSP::HSPI")
not defined $hsp
ref $hsp ne "HASH"
not $hsp->isa("Bio::Search::HSP::HSPI")
Truth table50%2/4
not(A) or B and not(C)
A= not defined $hspB= ref $hsp ne "HASH"C= not $hsp->isa("Bio::Search::HSP::HSPI")
| |||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | $self->throw("Must provide a valid Bio::Search::HSP::HSPI object or hash ref to object: $self method: add_hsp value: $hsp"); | |||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 210 | } | ||||||||||||||||||||||||||||||||||||||||||
| 211 | |||||||||||||||||||||||||||||||||||||||||||
| 212 | 1470 | push @{$self->{'_hsps'}}, $hsp; | |||||||||||||||||||||||||||||||||||||||||
| 213 | 1470 | ▶ | if (ref($hsp) eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 214 | 867 | $self->{_hashes}->{$#{$self->{'_hsps'}}} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 215 | } | ||||||||||||||||||||||||||||||||||||||||||
| 216 | 1470 | return scalar @{$self->{'_hsps'}}; | |||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||
| 218 | |||||||||||||||||||||||||||||||||||||||||||
| 219 | =head2 hsp_factory | ||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||
| 221 | Title : hsp_factory | ||||||||||||||||||||||||||||||||||||||||||
| 222 | Usage : $hit->hsp_factory($hsp_factory) | ||||||||||||||||||||||||||||||||||||||||||
| 223 | Function: Get/set the factory used to build HSPI objects if necessary. | ||||||||||||||||||||||||||||||||||||||||||
| 224 | Returns : Bio::Factory::ObjectFactoryI | ||||||||||||||||||||||||||||||||||||||||||
| 225 | Args : Bio::Factory::ObjectFactoryI | ||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||
| 227 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||
| 229 | 1487 | ▶ | sub hsp_factory { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
hsp_factory: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 230 | 1487 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 231 | 1487 | ▶ | if (@_) { $self->{_hsp_factory} = shift } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 232 | 1487 | ▶ | return $self->{_hsp_factory} || return; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{'_hsp_factory'} || (return)
MC/DC0%0/1
$self->{'_hsp_factory'} || (return)
$self->{'_hsp_factory'}
Truth table50%1/2
A
A= $self->{'_hsp_factory'}
| |||||||||||||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||
| 235 | =head2 Bio::Search::Hit::HitI methods | ||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||
| 237 | Implementation of Bio::Search::Hit::HitI methods | ||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||
| 239 | =head2 name | ||||||||||||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||||||||||||
| 241 | Title : name | ||||||||||||||||||||||||||||||||||||||||||
| 242 | Usage : $hit_name = $hit->name(); | ||||||||||||||||||||||||||||||||||||||||||
| 243 | Function: returns the name of the Hit sequence | ||||||||||||||||||||||||||||||||||||||||||
| 244 | Returns : a scalar string | ||||||||||||||||||||||||||||||||||||||||||
| 245 | Args : [optional] scalar string to set the name | ||||||||||||||||||||||||||||||||||||||||||
| 246 | |||||||||||||||||||||||||||||||||||||||||||
| 247 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||||||||
| 249 | 1389 | ▶ | sub name { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
name: called CC=4 SCAR=14.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 250 | 1389 | my ($self,$value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 251 | 1389 | my $previous = $self->{'_name'}; | |||||||||||||||||||||||||||||||||||||||||
| 252 | 1389 | ▶ | if( defined $value || ! defined $previous ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $value or not defined $previous
MC/DC50%1/2
defined $value or not defined $previous
defined $value
not defined $previous
Truth table66%2/3
A or not(B)
A= defined $valueB= not defined $previous
| |||||||||||||||||||||||||||||||||||||||||||
| 253 | 1140 | ▶ | $value = $previous = '' unless defined $value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 254 | 1140 | $self->{'_name'} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 255 | } | ||||||||||||||||||||||||||||||||||||||||||
| 256 | 1389 | return $previous; | |||||||||||||||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||
| 259 | =head2 accession | ||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||
| 261 | Title : accession | ||||||||||||||||||||||||||||||||||||||||||
| 262 | Usage : $acc = $hit->accession(); | ||||||||||||||||||||||||||||||||||||||||||
| 263 | Function: Retrieve the accession (if available) for the hit | ||||||||||||||||||||||||||||||||||||||||||
| 264 | Returns : a scalar string (empty string if not set) | ||||||||||||||||||||||||||||||||||||||||||
| 265 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||
| 267 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||
| 269 | 1002 | ▶ | sub accession { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
accession: called CC=4 SCAR=14.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 270 | 1002 | my ($self,$value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 271 | 1002 | my $previous = $self->{'_accession'}; | |||||||||||||||||||||||||||||||||||||||||
| 272 | 1002 | ▶ | if( defined $value || ! defined $previous ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $value or not defined $previous
MC/DC50%1/2
defined $value or not defined $previous
defined $value
not defined $previous
Truth table66%2/3
A or not(B)
A= defined $valueB= not defined $previous
| |||||||||||||||||||||||||||||||||||||||||||
| 273 | 983 | ▶ | $value = $previous = '' unless defined $value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 274 | 983 | $self->{'_accession'} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||||||||||||||||
| 276 | 1002 | return $previous; | |||||||||||||||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||
| 279 | =head2 description | ||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||
| 281 | Title : description | ||||||||||||||||||||||||||||||||||||||||||
| 282 | Usage : $desc = $hit->description(); | ||||||||||||||||||||||||||||||||||||||||||
| 283 | Function: Retrieve the description for the hit | ||||||||||||||||||||||||||||||||||||||||||
| 284 | Returns : a scalar string | ||||||||||||||||||||||||||||||||||||||||||
| 285 | Args : [optional] scalar string to set the description | ||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||
| 287 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||
| 289 | 1125 | ▶ | sub description { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
description: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 290 | 1125 | my ($self,$value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 291 | 1125 | my $previous = $self->{'_description'}; | |||||||||||||||||||||||||||||||||||||||||
| 292 | 1125 | ▶ | if( defined $value || ! defined $previous ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $value or not defined $previous
MC/DC100%2/2
defined $value or not defined $previous
defined $value
not defined $previous
Truth table100%3/3
A or not(B)
A= defined $valueB= not defined $previous
| |||||||||||||||||||||||||||||||||||||||||||
| 293 | 996 | ▶ | $value = $previous = '' unless defined $value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 294 | 996 | $self->{'_description'} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||||||||||||||||
| 296 | 1125 | return $previous; | |||||||||||||||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||
| 299 | =head2 length | ||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||
| 301 | Title : length | ||||||||||||||||||||||||||||||||||||||||||
| 302 | Usage : my $len = $hit->length | ||||||||||||||||||||||||||||||||||||||||||
| 303 | Function: Returns the length of the hit | ||||||||||||||||||||||||||||||||||||||||||
| 304 | Returns : integer | ||||||||||||||||||||||||||||||||||||||||||
| 305 | Args : [optional] integer to set the length | ||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||
| 307 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 308 | |||||||||||||||||||||||||||||||||||||||||||
| 309 | 563 | ▶ | sub length { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
length: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 310 | 563 | my ($self,$value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 311 | 563 | my $previous = $self->{'_length'}; | |||||||||||||||||||||||||||||||||||||||||
| 312 | 563 | ▶ | if( defined $value || ! defined $previous ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $value or not defined $previous
MC/DC100%2/2
defined $value or not defined $previous
defined $value
not defined $previous
Truth table100%3/3
A or not(B)
A= defined $valueB= not defined $previous
| |||||||||||||||||||||||||||||||||||||||||||
| 313 | 459 | ▶ | $value = $previous = 0 unless defined $value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 314 | 459 | $self->{'_length'} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 315 | } | ||||||||||||||||||||||||||||||||||||||||||
| 316 | 563 | return $previous; | |||||||||||||||||||||||||||||||||||||||||
| 317 | } | ||||||||||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||||||||
| 319 | |||||||||||||||||||||||||||||||||||||||||||
| 320 | =head2 algorithm | ||||||||||||||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||||||||||||
| 322 | Title : algorithm | ||||||||||||||||||||||||||||||||||||||||||
| 323 | Usage : $alg = $hit->algorithm(); | ||||||||||||||||||||||||||||||||||||||||||
| 324 | Function: Gets the algorithm specification that was used to obtain the hit | ||||||||||||||||||||||||||||||||||||||||||
| 325 | For BLAST, the algorithm denotes what type of sequence was aligned | ||||||||||||||||||||||||||||||||||||||||||
| 326 | against what (BLASTN: dna-dna, BLASTP prt-prt, BLASTX translated | ||||||||||||||||||||||||||||||||||||||||||
| 327 | dna-prt, TBLASTN prt-translated dna, TBLASTX translated | ||||||||||||||||||||||||||||||||||||||||||
| 328 | dna-translated dna). | ||||||||||||||||||||||||||||||||||||||||||
| 329 | Returns : a scalar string | ||||||||||||||||||||||||||||||||||||||||||
| 330 | Args : [optional] scalar string to set the algorithm | ||||||||||||||||||||||||||||||||||||||||||
| 331 | |||||||||||||||||||||||||||||||||||||||||||
| 332 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||||||||
| 334 | 2082 | ▶ | sub algorithm { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
algorithm: called CC=4 SCAR=14.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 335 | 2082 | my ($self,$value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 336 | 2082 | my $previous = $self->{'_algorithm'}; | |||||||||||||||||||||||||||||||||||||||||
| 337 | 2082 | ▶ | if( defined $value || ! defined $previous ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $value or not defined $previous
MC/DC50%1/2
defined $value or not defined $previous
defined $value
not defined $previous
Truth table66%2/3
A or not(B)
A= defined $valueB= not defined $previous
| |||||||||||||||||||||||||||||||||||||||||||
| 338 | 1017 | ▶ | $value = $previous = '' unless defined $value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 339 | 1017 | $self->{'_algorithm'} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 340 | } | ||||||||||||||||||||||||||||||||||||||||||
| 341 | 2082 | return $previous; | |||||||||||||||||||||||||||||||||||||||||
| 342 | } | ||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||
| 344 | =head2 raw_score | ||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||
| 346 | Title : raw_score | ||||||||||||||||||||||||||||||||||||||||||
| 347 | Usage : $score = $hit->raw_score(); | ||||||||||||||||||||||||||||||||||||||||||
| 348 | Function: Gets the "raw score" generated by the algorithm. What | ||||||||||||||||||||||||||||||||||||||||||
| 349 | this score is exactly will vary from algorithm to algorithm, | ||||||||||||||||||||||||||||||||||||||||||
| 350 | returning undef if unavailable. | ||||||||||||||||||||||||||||||||||||||||||
| 351 | Returns : a scalar value | ||||||||||||||||||||||||||||||||||||||||||
| 352 | Args : [optional] scalar value to set the raw score | ||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||
| 354 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||
| 356 | 151 | ▶ | sub raw_score { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
raw_score: called CC=6 SCAR=18.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 357 | 151 | my ($self,$value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 358 | 151 | my $previous = $self->{'_score'}; | |||||||||||||||||||||||||||||||||||||||||
| 359 | 151 | ▶ | if( defined $value ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 360 | 108 | $self->{'_score'} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 361 | } elsif ( ! defined $previous ) { | ||||||||||||||||||||||||||||||||||||||||||
| 362 | # Set the bits of the Hit to that of the top HSP. | ||||||||||||||||||||||||||||||||||||||||||
| 363 | 22 | ▶ | unless( defined $self->{'_hsps'}->[0] ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 364 | 0 | $self->warn("No HSPs for this minimal Hit (".$self->name.")\n". | |||||||||||||||||||||||||||||||||||||||||
| 365 | "If using NCBI BLAST, check bits() instead"); | ||||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 367 | } | ||||||||||||||||||||||||||||||||||||||||||
| 368 | # use 'score' if available | ||||||||||||||||||||||||||||||||||||||||||
| 369 | 22 | ▶ | if ( defined( ($self->hsps)[0]->score ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 370 | 21 | $previous = $self->{'_score'} = ($self->hsps)[0]->score; | |||||||||||||||||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||||||||||||||||
| 372 | # otherwise use 'bits' | ||||||||||||||||||||||||||||||||||||||||||
| 373 | elsif ( defined( ($self->hsps)[0]->bits ) ) { | ||||||||||||||||||||||||||||||||||||||||||
| 374 | 1 | $previous = $self->{'_score'} = ($self->hsps)[0]->bits; | |||||||||||||||||||||||||||||||||||||||||
| 375 | } | ||||||||||||||||||||||||||||||||||||||||||
| 376 | } | ||||||||||||||||||||||||||||||||||||||||||
| 377 | 151 | return $previous; | |||||||||||||||||||||||||||||||||||||||||
| 378 | } | ||||||||||||||||||||||||||||||||||||||||||
| 379 | |||||||||||||||||||||||||||||||||||||||||||
| 380 | =head2 score | ||||||||||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||||||||
| 382 | Equivalent to L<raw_score()|raw_score> | ||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||
| 384 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 385 | |||||||||||||||||||||||||||||||||||||||||||
| 386 | 7 | ▶ | sub score { shift->raw_score(@_); } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
score: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 387 | |||||||||||||||||||||||||||||||||||||||||||
| 388 | =head2 significance | ||||||||||||||||||||||||||||||||||||||||||
| 389 | |||||||||||||||||||||||||||||||||||||||||||
| 390 | Title : significance | ||||||||||||||||||||||||||||||||||||||||||
| 391 | Usage : $significance = $hit->significance(); | ||||||||||||||||||||||||||||||||||||||||||
| 392 | Function: Used to obtain the E or P value of a hit, i.e. the probability that | ||||||||||||||||||||||||||||||||||||||||||
| 393 | this particular hit was obtained purely by random chance. If | ||||||||||||||||||||||||||||||||||||||||||
| 394 | information is not available (nor calculatable from other | ||||||||||||||||||||||||||||||||||||||||||
| 395 | information sources), return undef. | ||||||||||||||||||||||||||||||||||||||||||
| 396 | Returns : a scalar value or undef if unavailable | ||||||||||||||||||||||||||||||||||||||||||
| 397 | Args : [optional] scalar value to set the significance | ||||||||||||||||||||||||||||||||||||||||||
| 398 | |||||||||||||||||||||||||||||||||||||||||||
| 399 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 400 | |||||||||||||||||||||||||||||||||||||||||||
| 401 | 1112 | ▶ | sub significance { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
significance: called CC=4 SCAR=14.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 402 | 1112 | my ($self,$value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 403 | 1112 | my $previous = $self->{'_significance'}; | |||||||||||||||||||||||||||||||||||||||||
| 404 | 1112 | ▶ | if( defined $value ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 405 | 994 | $self->{'_significance'} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 406 | } elsif ( ! defined $previous ) { | ||||||||||||||||||||||||||||||||||||||||||
| 407 | 1 | ▶ | unless( defined $self->{'_hsps'}->[0] ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 408 | 0 | $self->warn("No HSPs for this Hit (".$self->name.")"); | |||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 410 | } | ||||||||||||||||||||||||||||||||||||||||||
| 411 | # Set the significance of the Hit to that of the top HSP. | ||||||||||||||||||||||||||||||||||||||||||
| 412 | 1 | $previous = $self->{'_significance'} = ($self->hsps)[0]->significance; | |||||||||||||||||||||||||||||||||||||||||
| 413 | } | ||||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||
| 415 | 1112 | return $previous; | |||||||||||||||||||||||||||||||||||||||||
| 416 | } | ||||||||||||||||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||||||||||||||||
| 418 | =head2 bits | ||||||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||||||
| 420 | Usage : $hit_object->bits(); | ||||||||||||||||||||||||||||||||||||||||||
| 421 | Purpose : Gets the bit score of the best HSP for the current hit. | ||||||||||||||||||||||||||||||||||||||||||
| 422 | Example : $bits = $hit_object->bits(); | ||||||||||||||||||||||||||||||||||||||||||
| 423 | Returns : Integer or undef if bit score is not set | ||||||||||||||||||||||||||||||||||||||||||
| 424 | Argument : n/a | ||||||||||||||||||||||||||||||||||||||||||
| 425 | Comments : For BLAST1, the non-bit score is listed in the summary line. | ||||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||
| 427 | See Also : L<score()|score> | ||||||||||||||||||||||||||||||||||||||||||
| 428 | |||||||||||||||||||||||||||||||||||||||||||
| 429 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||
| 431 | 727 | ▶ | sub bits { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bits: called CC=4 SCAR=14.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 432 | 727 | my ($self,$value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 433 | 727 | my $previous = $self->{'_bits'}; | |||||||||||||||||||||||||||||||||||||||||
| 434 | 727 | ▶ | if( defined $value ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 435 | 611 | $self->{'_bits'} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 436 | } elsif ( ! defined $previous ) { | ||||||||||||||||||||||||||||||||||||||||||
| 437 | # Set the bits of the Hit to that of the top HSP. | ||||||||||||||||||||||||||||||||||||||||||
| 438 | 65 | ▶ | unless( defined $self->{'_hsps'}->[0] ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 439 | 0 | $self->warn("No HSPs for this minimal Hit (".$self->name.")\n". | |||||||||||||||||||||||||||||||||||||||||
| 440 | "If using WU-BLAST, check raw_score() instead"); | ||||||||||||||||||||||||||||||||||||||||||
| 441 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 442 | } | ||||||||||||||||||||||||||||||||||||||||||
| 443 | 65 | $previous = $self->{'_bits'} = ($self->hsps)[0]->bits; | |||||||||||||||||||||||||||||||||||||||||
| 444 | } | ||||||||||||||||||||||||||||||||||||||||||
| 445 | 727 | return $previous; | |||||||||||||||||||||||||||||||||||||||||
| 446 | } | ||||||||||||||||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||||||||||||||||
| 448 | =head2 next_hsp | ||||||||||||||||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||||||||||||||||
| 450 | Title : next_hsp | ||||||||||||||||||||||||||||||||||||||||||
| 451 | Usage : while( $hsp = $obj->next_hsp()) { ... } | ||||||||||||||||||||||||||||||||||||||||||
| 452 | Function : Returns the next available High Scoring Pair | ||||||||||||||||||||||||||||||||||||||||||
| 453 | Example : | ||||||||||||||||||||||||||||||||||||||||||
| 454 | Returns : Bio::Search::HSP::HSPI object or null if finished | ||||||||||||||||||||||||||||||||||||||||||
| 455 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||
| 457 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 458 | |||||||||||||||||||||||||||||||||||||||||||
| 459 | 249 | ▶ | sub next_hsp { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
next_hsp: called CC=7 SCAR=19.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 460 | 249 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 461 | 249 | ▶ | $self->{'_iterator'} = 0 unless defined $self->{'_iterator'}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 462 | return unless | ||||||||||||||||||||||||||||||||||||||||||
| 463 | defined($self->{'_hsps'}) | ||||||||||||||||||||||||||||||||||||||||||
| 464 | 249 | ▶ | && $self->{'_iterator'} <= scalar @{$self->{'_hsps'}}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $self->{"_hsps"} and $self->{"_iterator"} <= scalar @{$self->{"_hsps"};}
MC/DC50%1/2
defined $self->{"_hsps"} and $self->{"_iterator"} <= scalar @{$self->{"_hsps"};}
defined $self->{"_hsps"}
$self->{"_iterator"} <= scalar @{$self->{"_hsps"};}
Truth table66%2/3
A and B
A= defined $self->{"_hsps"}B= $self->{"_iterator"} <= scalar @{$self->{"_hsps"};}
| |||||||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||||||
| 466 | 159 | my $iterator = $self->{'_iterator'}++; | |||||||||||||||||||||||||||||||||||||||||
| 467 | 159 | ▶ | my $hsp = $self->{'_hsps'}->[$iterator] || return; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{'_hsps'}[$iterator] || (return)
MC/DC100%1/1
$self->{'_hsps'}[$iterator] || (return)
$self->{'_hsps'}[$iterator]
Truth table100%2/2
A
A= $self->{'_hsps'}[$iterator]
| |||||||||||||||||||||||||||||||||||||||||||
| 468 | 112 | ▶ | if (ref($hsp) eq 'HASH') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 469 | 98 | ▶ | my $factory = $self->hsp_factory || $self->throw("Tried to get a HSP, but it was a hash ref and we have no hsp factory"); | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->hsp_factory || $self->throw('Tried to get a HSP, but it was a hash ref and we have no hsp factory')
MC/DC0%0/2
$self->hsp_factory || $self->throw('Tried to get a HSP, but it was a hash ref and we have no hsp factory')
$self->hsp_factory
$self->throw('Tried to get a HSP, but it was a hash ref and we have no hsp factory')
Truth table33%1/3
A || B
A= $self->hsp_factoryB= $self->throw('Tried to get a HSP, but it was a hash ref and we have no hsp factory')
| |||||||||||||||||||||||||||||||||||||||||||
| 470 | 98 | $hsp = $factory->create_object(%{$hsp}); | |||||||||||||||||||||||||||||||||||||||||
| 471 | 98 | $self->{'_hsps'}->[$iterator] = $hsp; | |||||||||||||||||||||||||||||||||||||||||
| 472 | 98 | delete $self->{_hashes}->{$iterator}; | |||||||||||||||||||||||||||||||||||||||||
| 473 | } | ||||||||||||||||||||||||||||||||||||||||||
| 474 | 112 | return $hsp; | |||||||||||||||||||||||||||||||||||||||||
| 475 | } | ||||||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||||||||||||||||
| 478 | =head2 hsps | ||||||||||||||||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||||||||||||||||
| 480 | Usage : $hit_object->hsps(); | ||||||||||||||||||||||||||||||||||||||||||
| 481 | Purpose : Get a list containing all HSP objects. | ||||||||||||||||||||||||||||||||||||||||||
| 482 | : Get the numbers of HSPs for the current hit. | ||||||||||||||||||||||||||||||||||||||||||
| 483 | Example : @hsps = $hit_object->hsps(); | ||||||||||||||||||||||||||||||||||||||||||
| 484 | : $num = $hit_object->hsps(); # alternatively, use num_hsps() | ||||||||||||||||||||||||||||||||||||||||||
| 485 | Returns : Array context : list of Bio::Search::HSP::BlastHSP.pm objects. | ||||||||||||||||||||||||||||||||||||||||||
| 486 | : Scalar context: integer (number of HSPs). | ||||||||||||||||||||||||||||||||||||||||||
| 487 | : (Equivalent to num_hsps()). | ||||||||||||||||||||||||||||||||||||||||||
| 488 | Argument : n/a. Relies on wantarray | ||||||||||||||||||||||||||||||||||||||||||
| 489 | Throws : Exception if the HSPs have not been collected. | ||||||||||||||||||||||||||||||||||||||||||
| 490 | |||||||||||||||||||||||||||||||||||||||||||
| 491 | See Also : L<hsp()|hsp>, L<num_hsps()|num_hsps> | ||||||||||||||||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||||||||||||||||
| 493 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||||||||||||||||
| 495 | 3223 | ▶ | sub hsps { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
hsps: called CC=7 SCAR=19.7
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 496 | 3223 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 497 | 3223 | ▶ | foreach my $i (keys %{$self->{_hashes} || {}}) { | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$self->{'_hashes'} || {}
MC/DC100%1/1
$self->{'_hashes'} || {}
$self->{'_hashes'}
Truth table100%2/2
A
A= $self->{'_hashes'}
| |||||||||||||||||||||||||||||||||||||||||||
| 498 | 372 | ▶ | my $factory = $self->hsp_factory || $self->throw("Tried to get a HSP, but it was a hash ref and we have no hsp factory"); | ||||||||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$self->hsp_factory || $self->throw('Tried to get a HSP, but it was a hash ref and we have no hsp factory')
MC/DC0%0/2
$self->hsp_factory || $self->throw('Tried to get a HSP, but it was a hash ref and we have no hsp factory')
$self->hsp_factory
$self->throw('Tried to get a HSP, but it was a hash ref and we have no hsp factory')
Truth table33%1/3
A || B
A= $self->hsp_factoryB= $self->throw('Tried to get a HSP, but it was a hash ref and we have no hsp factory')
| |||||||||||||||||||||||||||||||||||||||||||
| 499 | 372 | $self->{'_hsps'}->[$i] = $factory->create_object(%{$self->{'_hsps'}->[$i]}); | |||||||||||||||||||||||||||||||||||||||||
| 500 | 372 | delete $self->{_hashes}->{$i}; | |||||||||||||||||||||||||||||||||||||||||
| 501 | } | ||||||||||||||||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||||||||||||||||
| 503 | 3223 | ▶ | return wantarray() ? @{$self->{'_hsps'} || []} : scalar(@{$self->{'_hsps'} || []}); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition75%3/4
$self->{'_hsps'} || []
$self->{'_hsps'} || []
MC/DC100%1/1
$self->{'_hsps'} || []
$self->{'_hsps'}
MC/DC0%0/1
$self->{'_hsps'} || []
$self->{'_hsps'}
Truth table100%2/2
A
A= $self->{'_hsps'}
Truth table50%1/2
A
A= $self->{'_hsps'}
| |||||||||||||||||||||||||||||||||||||||||||
| 504 | } | ||||||||||||||||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||||||||||||||||
| 506 | =head2 num_hsps | ||||||||||||||||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||||||||||||||||
| 508 | Usage : $hit_object->num_hsps(); | ||||||||||||||||||||||||||||||||||||||||||
| 509 | Purpose : Get the number of HSPs for the present hit. | ||||||||||||||||||||||||||||||||||||||||||
| 510 | Example : $nhsps = $hit_object->num_hsps(); | ||||||||||||||||||||||||||||||||||||||||||
| 511 | Returns : Integer or '-' if HSPs have not been callected | ||||||||||||||||||||||||||||||||||||||||||
| 512 | Argument : n/a | ||||||||||||||||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||||||||||||||||
| 514 | See Also : L<hsps()|hsps> | ||||||||||||||||||||||||||||||||||||||||||
| 515 | |||||||||||||||||||||||||||||||||||||||||||
| 516 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||||||||||||||||
| 518 | 51 | ▶ | sub num_hsps { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
num_hsps: called CC=2 SCAR=7.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 519 | 51 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 520 | |||||||||||||||||||||||||||||||||||||||||||
| 521 | 51 | ▶ | unless ($self->{'_hsps'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 522 | 0 | return '-'; | |||||||||||||||||||||||||||||||||||||||||
| 523 | } | ||||||||||||||||||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||||||||||||||||
| 525 | 51 | return scalar(@{$self->{'_hsps'}}); | |||||||||||||||||||||||||||||||||||||||||
| 526 | } | ||||||||||||||||||||||||||||||||||||||||||
| 527 | |||||||||||||||||||||||||||||||||||||||||||
| 528 | =head2 rewind | ||||||||||||||||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||||||||||||||||
| 530 | Title : rewind | ||||||||||||||||||||||||||||||||||||||||||
| 531 | Usage : $hit->rewind; | ||||||||||||||||||||||||||||||||||||||||||
| 532 | Function: Allow one to reset the HSP iterator to the beginning | ||||||||||||||||||||||||||||||||||||||||||
| 533 | Since this is an in-memory implementation | ||||||||||||||||||||||||||||||||||||||||||
| 534 | Returns : none | ||||||||||||||||||||||||||||||||||||||||||
| 535 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 536 | |||||||||||||||||||||||||||||||||||||||||||
| 537 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 538 | |||||||||||||||||||||||||||||||||||||||||||
| 539 | 102 | ▶ | sub rewind{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rewind: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 540 | 102 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 541 | 102 | $self->{'_iterator'} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 542 | } | ||||||||||||||||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||||||||||||||||
| 544 | =head2 ambiguous_aln | ||||||||||||||||||||||||||||||||||||||||||
| 545 | |||||||||||||||||||||||||||||||||||||||||||
| 546 | Usage : $ambig_code = $hit_object->ambiguous_aln(); | ||||||||||||||||||||||||||||||||||||||||||
| 547 | Purpose : Sets/Gets ambiguity code data member. | ||||||||||||||||||||||||||||||||||||||||||
| 548 | Example : (see usage) | ||||||||||||||||||||||||||||||||||||||||||
| 549 | Returns : String = 'q', 's', 'qs', '-' | ||||||||||||||||||||||||||||||||||||||||||
| 550 | : 'q' = query sequence contains overlapping sub-sequences | ||||||||||||||||||||||||||||||||||||||||||
| 551 | : while sbjct does not. | ||||||||||||||||||||||||||||||||||||||||||
| 552 | : 's' = sbjct sequence contains overlapping sub-sequences | ||||||||||||||||||||||||||||||||||||||||||
| 553 | : while query does not. | ||||||||||||||||||||||||||||||||||||||||||
| 554 | : 'qs' = query and sbjct sequence contains overlapping sub-sequences | ||||||||||||||||||||||||||||||||||||||||||
| 555 | : relative to each other. | ||||||||||||||||||||||||||||||||||||||||||
| 556 | : '-' = query and sbjct sequence do not contains multiple domains | ||||||||||||||||||||||||||||||||||||||||||
| 557 | : relative to each other OR both contain the same distribution | ||||||||||||||||||||||||||||||||||||||||||
| 558 | : of similar domains. | ||||||||||||||||||||||||||||||||||||||||||
| 559 | Argument : n/a | ||||||||||||||||||||||||||||||||||||||||||
| 560 | Throws : n/a | ||||||||||||||||||||||||||||||||||||||||||
| 561 | Comment : Note: "sbjct" is synonymous with "hit" | ||||||||||||||||||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||||||||||||||||
| 563 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 564 | |||||||||||||||||||||||||||||||||||||||||||
| 565 | 0 | ▶ | sub ambiguous_aln { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ambiguous_aln: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 566 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 567 | 0 | ▶ | if(@_) { $self->{'_ambiguous_aln'} = shift; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 568 | 0 | ▶ | $self->{'_ambiguous_aln'} || '-'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 569 | } | ||||||||||||||||||||||||||||||||||||||||||
| 570 | |||||||||||||||||||||||||||||||||||||||||||
| 571 | =head2 overlap | ||||||||||||||||||||||||||||||||||||||||||
| 572 | |||||||||||||||||||||||||||||||||||||||||||
| 573 | See documentation in L<Bio::Search::Hit::HitI::overlap()|Bio::Search::Hit::HitI> | ||||||||||||||||||||||||||||||||||||||||||
| 574 | |||||||||||||||||||||||||||||||||||||||||||
| 575 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||||||||||||||||
| 577 | 1 | ▶ | sub overlap { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
overlap: called CC=3 SCAR=12.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 578 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 579 | 0 | ▶ | if(@_) { $self->{'_overlap'} = shift; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 580 | 1 | ▶ | defined $self->{'_overlap'} ? $self->{'_overlap'} : 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 581 | } | ||||||||||||||||||||||||||||||||||||||||||
| 582 | |||||||||||||||||||||||||||||||||||||||||||
| 583 | |||||||||||||||||||||||||||||||||||||||||||
| 584 | =head2 n | ||||||||||||||||||||||||||||||||||||||||||
| 585 | |||||||||||||||||||||||||||||||||||||||||||
| 586 | Usage : $hit_object->n(); | ||||||||||||||||||||||||||||||||||||||||||
| 587 | Purpose : Gets the N number for the current hit. | ||||||||||||||||||||||||||||||||||||||||||
| 588 | : This is the number of HSPs in the set which was ascribed | ||||||||||||||||||||||||||||||||||||||||||
| 589 | : the lowest P-value (listed on the description line). | ||||||||||||||||||||||||||||||||||||||||||
| 590 | : This number is not the same as the total number of HSPs. | ||||||||||||||||||||||||||||||||||||||||||
| 591 | : To get the total number of HSPs, use num_hsps(). | ||||||||||||||||||||||||||||||||||||||||||
| 592 | Example : $n = $hit_object->n(); | ||||||||||||||||||||||||||||||||||||||||||
| 593 | Returns : Integer | ||||||||||||||||||||||||||||||||||||||||||
| 594 | Argument : n/a | ||||||||||||||||||||||||||||||||||||||||||
| 595 | Throws : Exception if HSPs have not been set (BLAST2 reports). | ||||||||||||||||||||||||||||||||||||||||||
| 596 | Comments : Note that the N parameter is not reported in gapped BLAST2. | ||||||||||||||||||||||||||||||||||||||||||
| 597 | : Calling n() on such reports will result in a call to num_hsps(). | ||||||||||||||||||||||||||||||||||||||||||
| 598 | : The num_hsps() method will count the actual number of | ||||||||||||||||||||||||||||||||||||||||||
| 599 | : HSPs in the alignment listing, which may exceed N in | ||||||||||||||||||||||||||||||||||||||||||
| 600 | : some cases. | ||||||||||||||||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||||||||||||||||
| 602 | See Also : L<num_hsps()|num_hsps> | ||||||||||||||||||||||||||||||||||||||||||
| 603 | |||||||||||||||||||||||||||||||||||||||||||
| 604 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||||||||||||||||
| 606 | 0 | ▶ | sub n { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
n: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 607 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 608 | |||||||||||||||||||||||||||||||||||||||||||
| 609 | # The check for $self->{'_n'} is a remnant from the 'query' mode days | ||||||||||||||||||||||||||||||||||||||||||
| 610 | # in which the sbjct object would collect data from the description | ||||||||||||||||||||||||||||||||||||||||||
| 611 | # line only. | ||||||||||||||||||||||||||||||||||||||||||
| 612 | |||||||||||||||||||||||||||||||||||||||||||
| 613 | 0 | my ($n); | |||||||||||||||||||||||||||||||||||||||||
| 614 | 0 | ▶ | if(not defined($self->{'_n'})) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 615 | 0 | ▶ | if( $self->hsp ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 616 | 0 | $n = $self->hsp->n; | |||||||||||||||||||||||||||||||||||||||||
| 617 | } | ||||||||||||||||||||||||||||||||||||||||||
| 618 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 619 | 0 | $n = $self->{'_n'}; | |||||||||||||||||||||||||||||||||||||||||
| 620 | } | ||||||||||||||||||||||||||||||||||||||||||
| 621 | 0 | ▶ | $n ||= $self->num_hsps; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$n ||= $self->num_hsps
MC/DC0%0/2
$n ||= $self->num_hsps
$n
$self->num_hsps
Truth table0%0/3
A ||= B
A= $nB= $self->num_hsps
| |||||||||||||||||||||||||||||||||||||||||||
| 622 | |||||||||||||||||||||||||||||||||||||||||||
| 623 | 0 | return $n; | |||||||||||||||||||||||||||||||||||||||||
| 624 | } | ||||||||||||||||||||||||||||||||||||||||||
| 625 | |||||||||||||||||||||||||||||||||||||||||||
| 626 | =head2 p | ||||||||||||||||||||||||||||||||||||||||||
| 627 | |||||||||||||||||||||||||||||||||||||||||||
| 628 | Usage : $hit_object->p( [format] ); | ||||||||||||||||||||||||||||||||||||||||||
| 629 | Purpose : Get the P-value for the best HSP of the given BLAST hit. | ||||||||||||||||||||||||||||||||||||||||||
| 630 | : (Note that P-values are not provided with NCBI Blast2 reports). | ||||||||||||||||||||||||||||||||||||||||||
| 631 | Example : $p = $sbjct->p; | ||||||||||||||||||||||||||||||||||||||||||
| 632 | : $p = $sbjct->p('exp'); # get exponent only. | ||||||||||||||||||||||||||||||||||||||||||
| 633 | : ($num, $exp) = $sbjct->p('parts'); # split sci notation into parts | ||||||||||||||||||||||||||||||||||||||||||
| 634 | Returns : Float or scientific notation number (the raw P-value, DEFAULT). | ||||||||||||||||||||||||||||||||||||||||||
| 635 | : Integer if format == 'exp' (the magnitude of the base 10 exponent). | ||||||||||||||||||||||||||||||||||||||||||
| 636 | : 2-element list (float, int) if format == 'parts' and P-value | ||||||||||||||||||||||||||||||||||||||||||
| 637 | : is in scientific notation (See Comments). | ||||||||||||||||||||||||||||||||||||||||||
| 638 | Argument : format: string of 'raw' | 'exp' | 'parts' | ||||||||||||||||||||||||||||||||||||||||||
| 639 | : 'raw' returns value given in report. Default. (1.2e-34) | ||||||||||||||||||||||||||||||||||||||||||
| 640 | : 'exp' returns exponent value only (34) | ||||||||||||||||||||||||||||||||||||||||||
| 641 | : 'parts' returns the decimal and exponent as a | ||||||||||||||||||||||||||||||||||||||||||
| 642 | : 2-element list (1.2, -34) (See Comments). | ||||||||||||||||||||||||||||||||||||||||||
| 643 | Throws : Warns if no P-value is defined. Uses expect instead. | ||||||||||||||||||||||||||||||||||||||||||
| 644 | Comments : Using the 'parts' argument is not recommended since it will not | ||||||||||||||||||||||||||||||||||||||||||
| 645 | : work as expected if the P-value is not in scientific notation. | ||||||||||||||||||||||||||||||||||||||||||
| 646 | : That is, floats are not converted into sci notation before | ||||||||||||||||||||||||||||||||||||||||||
| 647 | : splitting into parts. | ||||||||||||||||||||||||||||||||||||||||||
| 648 | |||||||||||||||||||||||||||||||||||||||||||
| 649 | See Also : L<expect()|expect>, L<significance()|significance>, L<Bio::Search::SearchUtils::get_exponent()|Bio::Search::SearchUtils> | ||||||||||||||||||||||||||||||||||||||||||
| 650 | |||||||||||||||||||||||||||||||||||||||||||
| 651 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 652 | |||||||||||||||||||||||||||||||||||||||||||
| 653 | 0 | ▶ | sub p { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
p: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 654 | # Some duplication of logic for p(), expect() and signif() for the sake of performance. | ||||||||||||||||||||||||||||||||||||||||||
| 655 | 0 | my ($self, $fmt) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 656 | |||||||||||||||||||||||||||||||||||||||||||
| 657 | 0 | my $val = $self->{'_p'}; | |||||||||||||||||||||||||||||||||||||||||
| 658 | |||||||||||||||||||||||||||||||||||||||||||
| 659 | # $val can be zero. | ||||||||||||||||||||||||||||||||||||||||||
| 660 | 0 | ▶ | if(!defined $val) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 661 | # P-value not defined, must be a NCBI Blast2 report. | ||||||||||||||||||||||||||||||||||||||||||
| 662 | # Use expect instead. | ||||||||||||||||||||||||||||||||||||||||||
| 663 | 0 | $self->warn( "P-value not defined. Using significance() instead."); | |||||||||||||||||||||||||||||||||||||||||
| 664 | 0 | $val = $self->significance(); | |||||||||||||||||||||||||||||||||||||||||
| 665 | } | ||||||||||||||||||||||||||||||||||||||||||
| 666 | |||||||||||||||||||||||||||||||||||||||||||
| 667 | 0 | ▶ | return $val if not $fmt or $fmt =~ /^raw/i; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $fmt or $fmt =~ /^raw/i
MC/DC0%0/2
not $fmt or $fmt =~ /^raw/i
not $fmt
$fmt =~ /^raw/i
Truth table0%0/3
not(A) or B
A= not $fmtB= $fmt =~ /^raw/i
| |||||||||||||||||||||||||||||||||||||||||||
| 668 | ## Special formats: exponent-only or as list. | ||||||||||||||||||||||||||||||||||||||||||
| 669 | 0 | ▶ | return &Bio::Search::SearchUtils::get_exponent($val) if $fmt =~ /^exp/i; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 670 | 0 | ▶ | return (split (/eE/, $val)) if $fmt =~ /^parts/i; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 671 | |||||||||||||||||||||||||||||||||||||||||||
| 672 | ## Default: return the raw P-value. | ||||||||||||||||||||||||||||||||||||||||||
| 673 | 0 | return $val; | |||||||||||||||||||||||||||||||||||||||||
| 674 | } | ||||||||||||||||||||||||||||||||||||||||||
| 675 | |||||||||||||||||||||||||||||||||||||||||||
| 676 | =head2 hsp | ||||||||||||||||||||||||||||||||||||||||||
| 677 | |||||||||||||||||||||||||||||||||||||||||||
| 678 | Usage : $hit_object->hsp( [string] ); | ||||||||||||||||||||||||||||||||||||||||||
| 679 | Purpose : Get a single HSPI object for the present HitI object. | ||||||||||||||||||||||||||||||||||||||||||
| 680 | Example : $hspObj = $hit_object->hsp; # same as 'best' | ||||||||||||||||||||||||||||||||||||||||||
| 681 | : $hspObj = $hit_object->hsp('best'); | ||||||||||||||||||||||||||||||||||||||||||
| 682 | : $hspObj = $hit_object->hsp('worst'); | ||||||||||||||||||||||||||||||||||||||||||
| 683 | Returns : Object reference for a Bio::Search::HSP::BlastHSP.pm object. | ||||||||||||||||||||||||||||||||||||||||||
| 684 | Argument : String (or no argument). | ||||||||||||||||||||||||||||||||||||||||||
| 685 | : No argument (default) = highest scoring HSP (same as 'best'). | ||||||||||||||||||||||||||||||||||||||||||
| 686 | : 'best' or 'first' = highest scoring HSP. | ||||||||||||||||||||||||||||||||||||||||||
| 687 | : 'worst' or 'last' = lowest scoring HSP. | ||||||||||||||||||||||||||||||||||||||||||
| 688 | Throws : Exception if the HSPs have not been collected. | ||||||||||||||||||||||||||||||||||||||||||
| 689 | : Exception if an unrecognized argument is used. | ||||||||||||||||||||||||||||||||||||||||||
| 690 | |||||||||||||||||||||||||||||||||||||||||||
| 691 | See Also : L<hsps()|hsps>, L<num_hsps>() | ||||||||||||||||||||||||||||||||||||||||||
| 692 | |||||||||||||||||||||||||||||||||||||||||||
| 693 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 694 | |||||||||||||||||||||||||||||||||||||||||||
| 695 | 24 | ▶ | sub hsp { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
hsp: called CC=5 SCAR=20.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 696 | 24 | my( $self, $option ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 697 | 24 | ▶ | $option ||= 'best'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$option ||= "best"
MC/DC0%0/1
$option ||= "best"
$option
Truth table50%1/2
A
A= $option
| |||||||||||||||||||||||||||||||||||||||||||
| 698 | |||||||||||||||||||||||||||||||||||||||||||
| 699 | 24 | ▶ | if (not ref $self->{'_hsps'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 700 | 0 | $self->throw("Can't get HSPs: data not collected."); | |||||||||||||||||||||||||||||||||||||||||
| 701 | } | ||||||||||||||||||||||||||||||||||||||||||
| 702 | |||||||||||||||||||||||||||||||||||||||||||
| 703 | 24 | my @hsps = $self->hsps; | |||||||||||||||||||||||||||||||||||||||||
| 704 | |||||||||||||||||||||||||||||||||||||||||||
| 705 | 24 | ▶ | return $hsps[0] if $option =~ /best|first|1/i; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 706 | 0 | ▶ | return $hsps[$#hsps] if $option =~ /worst|last/i; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 707 | |||||||||||||||||||||||||||||||||||||||||||
| 708 | 0 | $self->throw("Can't get HSP for: $option\n" . | |||||||||||||||||||||||||||||||||||||||||
| 709 | "Valid arguments: 'best', 'worst'"); | ||||||||||||||||||||||||||||||||||||||||||
| 710 | } | ||||||||||||||||||||||||||||||||||||||||||
| 711 | |||||||||||||||||||||||||||||||||||||||||||
| 712 | =head2 logical_length | ||||||||||||||||||||||||||||||||||||||||||
| 713 | |||||||||||||||||||||||||||||||||||||||||||
| 714 | Usage : $hit_object->logical_length( [seq_type] ); | ||||||||||||||||||||||||||||||||||||||||||
| 715 | : (mostly intended for internal use). | ||||||||||||||||||||||||||||||||||||||||||
| 716 | Purpose : Get the logical length of the hit sequence. | ||||||||||||||||||||||||||||||||||||||||||
| 717 | : This is necessary since the number of identical/conserved residues | ||||||||||||||||||||||||||||||||||||||||||
| 718 | : can be in terms of peptide sequence space, yet the query and/or hit | ||||||||||||||||||||||||||||||||||||||||||
| 719 | : sequence are in nucleotide space. | ||||||||||||||||||||||||||||||||||||||||||
| 720 | Example : $len = $hit_object->logical_length(); | ||||||||||||||||||||||||||||||||||||||||||
| 721 | Returns : Integer | ||||||||||||||||||||||||||||||||||||||||||
| 722 | Argument : seq_type = 'query' or 'hit' or 'sbjct' (default = 'query') | ||||||||||||||||||||||||||||||||||||||||||
| 723 | ('sbjct' is synonymous with 'hit') | ||||||||||||||||||||||||||||||||||||||||||
| 724 | Throws : n/a | ||||||||||||||||||||||||||||||||||||||||||
| 725 | Comments : | ||||||||||||||||||||||||||||||||||||||||||
| 726 | : In the case of BLAST flavors: | ||||||||||||||||||||||||||||||||||||||||||
| 727 | : For TBLASTN reports, the length of the aligned portion of the | ||||||||||||||||||||||||||||||||||||||||||
| 728 | : nucleotide hit sequence is divided by 3; for BLASTX reports, | ||||||||||||||||||||||||||||||||||||||||||
| 729 | : the length of the aligned portion of the nucleotide query | ||||||||||||||||||||||||||||||||||||||||||
| 730 | : sequence is divided by 3. For TBLASTX reports, the length of | ||||||||||||||||||||||||||||||||||||||||||
| 731 | : both hit and query sequence are converted. | ||||||||||||||||||||||||||||||||||||||||||
| 732 | : | ||||||||||||||||||||||||||||||||||||||||||
| 733 | : This is important for functions like frac_aligned_query() | ||||||||||||||||||||||||||||||||||||||||||
| 734 | : which need to operate in amino acid coordinate space when dealing | ||||||||||||||||||||||||||||||||||||||||||
| 735 | : with [T]BLAST[NX] type reports. | ||||||||||||||||||||||||||||||||||||||||||
| 736 | |||||||||||||||||||||||||||||||||||||||||||
| 737 | See Also : L<length()|length>, L<frac_aligned_query()|frac_aligned_query>, L<frac_aligned_hit()|frac_aligned_hit> | ||||||||||||||||||||||||||||||||||||||||||
| 738 | |||||||||||||||||||||||||||||||||||||||||||
| 739 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 740 | |||||||||||||||||||||||||||||||||||||||||||
| 741 | 0 | ▶ | sub logical_length { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
logical_length: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 742 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 743 | 0 | ▶ | my $seqType = shift || 'query'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
shift() || 'query'
MC/DC0%0/1
shift() || 'query'
shift()
Truth table0%0/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 744 | 0 | ▶ | $seqType = 'sbjct' if $seqType eq 'hit'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 745 | |||||||||||||||||||||||||||||||||||||||||||
| 746 | 0 | my ($length, $logical); | |||||||||||||||||||||||||||||||||||||||||
| 747 | 0 | my $algo = $self->algorithm; | |||||||||||||||||||||||||||||||||||||||||
| 748 | |||||||||||||||||||||||||||||||||||||||||||
| 749 | # For the sbjct, return logical sbjct length | ||||||||||||||||||||||||||||||||||||||||||
| 750 | 0 | ▶ | if( $seqType eq 'sbjct' ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 751 | 0 | $length = $self->length; | |||||||||||||||||||||||||||||||||||||||||
| 752 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 753 | # Otherwise, return logical query length | ||||||||||||||||||||||||||||||||||||||||||
| 754 | 0 | $length = $self->query_length(); | |||||||||||||||||||||||||||||||||||||||||
| 755 | } | ||||||||||||||||||||||||||||||||||||||||||
| 756 | |||||||||||||||||||||||||||||||||||||||||||
| 757 | 0 | $logical = Bio::Search::SearchUtils::logical_length($algo, $seqType, $length); | |||||||||||||||||||||||||||||||||||||||||
| 758 | |||||||||||||||||||||||||||||||||||||||||||
| 759 | 0 | return int($logical); | |||||||||||||||||||||||||||||||||||||||||
| 760 | } | ||||||||||||||||||||||||||||||||||||||||||
| 761 | |||||||||||||||||||||||||||||||||||||||||||
| 762 | =head2 length_aln | ||||||||||||||||||||||||||||||||||||||||||
| 763 | |||||||||||||||||||||||||||||||||||||||||||
| 764 | Usage : $hit_object->length_aln( [seq_type] ); | ||||||||||||||||||||||||||||||||||||||||||
| 765 | Purpose : Get the total length of the aligned region for query or sbjct seq. | ||||||||||||||||||||||||||||||||||||||||||
| 766 | : This number will include all HSPs | ||||||||||||||||||||||||||||||||||||||||||
| 767 | Example : $len = $hit_object->length_aln(); # default = query | ||||||||||||||||||||||||||||||||||||||||||
| 768 | : $lenAln = $hit_object->length_aln('query'); | ||||||||||||||||||||||||||||||||||||||||||
| 769 | Returns : Integer | ||||||||||||||||||||||||||||||||||||||||||
| 770 | Argument : seq_Type = 'query' or 'hit' or 'sbjct' (Default = 'query') | ||||||||||||||||||||||||||||||||||||||||||
| 771 | ('sbjct' is synonymous with 'hit') | ||||||||||||||||||||||||||||||||||||||||||
| 772 | Throws : Exception if the argument is not recognized. | ||||||||||||||||||||||||||||||||||||||||||
| 773 | Comments : This method will report the logical length of the alignment, | ||||||||||||||||||||||||||||||||||||||||||
| 774 | : meaning that for TBLAST[NX] reports, the length is reported | ||||||||||||||||||||||||||||||||||||||||||
| 775 | : using amino acid coordinate space (i.e., nucleotides / 3). | ||||||||||||||||||||||||||||||||||||||||||
| 776 | : | ||||||||||||||||||||||||||||||||||||||||||
| 777 | : This method requires that all HSPs be tiled. If they have not | ||||||||||||||||||||||||||||||||||||||||||
| 778 | : already been tiled, they will be tiled first automatically.. | ||||||||||||||||||||||||||||||||||||||||||
| 779 | : If you don't want the tiled data, iterate through each HSP | ||||||||||||||||||||||||||||||||||||||||||
| 780 | : calling length() on each (use hsps() to get all HSPs). | ||||||||||||||||||||||||||||||||||||||||||
| 781 | |||||||||||||||||||||||||||||||||||||||||||
| 782 | See Also : L<length()|length>, L<frac_aligned_query()|frac_aligned_query>, L<frac_aligned_hit()|frac_aligned_hit>, L<gaps()|gaps>, L<Bio::Search::SearchUtils::tile_hsps()|Bio::Search::SearchUtils>, L<Bio::Search::HSP::BlastHSP::length()|Bio::Search::HSP::BlastHSP> | ||||||||||||||||||||||||||||||||||||||||||
| 783 | |||||||||||||||||||||||||||||||||||||||||||
| 784 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 785 | |||||||||||||||||||||||||||||||||||||||||||
| 786 | 170 | ▶ | sub length_aln { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
length_aln: called CC=7 SCAR=20.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 787 | 170 | my( $self, $seqType, $num ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 788 | |||||||||||||||||||||||||||||||||||||||||||
| 789 | 170 | ▶ | $seqType ||= 'query'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$seqType ||= "query"
MC/DC0%0/1
$seqType ||= "query"
$seqType
Truth table50%1/2
A
A= $seqType
| |||||||||||||||||||||||||||||||||||||||||||
| 790 | 170 | ▶ | $seqType = 'sbjct' if $seqType eq 'hit'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 791 | |||||||||||||||||||||||||||||||||||||||||||
| 792 | # Setter: | ||||||||||||||||||||||||||||||||||||||||||
| 793 | 170 | ▶ | if( defined $num) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 794 | 108 | return $self->{'_length_aln_'.$seqType} = $num; | |||||||||||||||||||||||||||||||||||||||||
| 795 | } | ||||||||||||||||||||||||||||||||||||||||||
| 796 | |||||||||||||||||||||||||||||||||||||||||||
| 797 | 62 | ▶ | unless ($self->{'_hsps'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 798 | #return wantarray ? ('-','-') : '-'; | ||||||||||||||||||||||||||||||||||||||||||
| 799 | 0 | Bio::Search::SearchUtils::_warn_about_no_hsps($self); | |||||||||||||||||||||||||||||||||||||||||
| 800 | 0 | return '-'; | |||||||||||||||||||||||||||||||||||||||||
| 801 | } | ||||||||||||||||||||||||||||||||||||||||||
| 802 | |||||||||||||||||||||||||||||||||||||||||||
| 803 | 62 | ▶ | Bio::Search::SearchUtils::tile_hsps($self) unless $self->tiled_hsps; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 804 | |||||||||||||||||||||||||||||||||||||||||||
| 805 | 62 | my $data = $self->{'_length_aln_'.$seqType}; | |||||||||||||||||||||||||||||||||||||||||
| 806 | |||||||||||||||||||||||||||||||||||||||||||
| 807 | ## If we don't have data, figure out what went wrong. | ||||||||||||||||||||||||||||||||||||||||||
| 808 | 62 | ▶ | if(!$data) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 809 | 0 | $self->throw("Can't get length aln for sequence type \"$seqType\". " . | |||||||||||||||||||||||||||||||||||||||||
| 810 | "Valid types are 'query', 'hit', 'sbjct' ('sbjct' = 'hit')"); | ||||||||||||||||||||||||||||||||||||||||||
| 811 | } | ||||||||||||||||||||||||||||||||||||||||||
| 812 | 62 | return $data; | |||||||||||||||||||||||||||||||||||||||||
| 813 | } | ||||||||||||||||||||||||||||||||||||||||||
| 814 | |||||||||||||||||||||||||||||||||||||||||||
| 815 | =head2 gaps | ||||||||||||||||||||||||||||||||||||||||||
| 816 | |||||||||||||||||||||||||||||||||||||||||||
| 817 | Usage : $hit_object->gaps( [seq_type] ); | ||||||||||||||||||||||||||||||||||||||||||
| 818 | Purpose : Get the number of gaps in the aligned query, hit, or both sequences. | ||||||||||||||||||||||||||||||||||||||||||
| 819 | : Data is summed across all HSPs. | ||||||||||||||||||||||||||||||||||||||||||
| 820 | Example : $qgaps = $hit_object->gaps('query'); | ||||||||||||||||||||||||||||||||||||||||||
| 821 | : $hgaps = $hit_object->gaps('hit'); | ||||||||||||||||||||||||||||||||||||||||||
| 822 | : $tgaps = $hit_object->gaps(); # default = total (query + hit) | ||||||||||||||||||||||||||||||||||||||||||
| 823 | Returns : scalar context: integer | ||||||||||||||||||||||||||||||||||||||||||
| 824 | : array context without args: two-element list of integers | ||||||||||||||||||||||||||||||||||||||||||
| 825 | : (queryGaps, hitGaps) | ||||||||||||||||||||||||||||||||||||||||||
| 826 | : Array context can be forced by providing an argument of 'list' or 'array'. | ||||||||||||||||||||||||||||||||||||||||||
| 827 | : | ||||||||||||||||||||||||||||||||||||||||||
| 828 | : CAUTION: Calling this method within printf or sprintf is arrray context. | ||||||||||||||||||||||||||||||||||||||||||
| 829 | : So this function may not give you what you expect. For example: | ||||||||||||||||||||||||||||||||||||||||||
| 830 | : printf "Total gaps: %d", $hit->gaps(); | ||||||||||||||||||||||||||||||||||||||||||
| 831 | : Actually returns a two-element array, so what gets printed | ||||||||||||||||||||||||||||||||||||||||||
| 832 | : is the number of gaps in the query, not the total | ||||||||||||||||||||||||||||||||||||||||||
| 833 | : | ||||||||||||||||||||||||||||||||||||||||||
| 834 | Argument : seq_type: 'query' | 'hit' or 'sbjct' | 'total' | 'list' (default = 'total') | ||||||||||||||||||||||||||||||||||||||||||
| 835 | ('sbjct' is synonymous with 'hit') | ||||||||||||||||||||||||||||||||||||||||||
| 836 | Throws : n/a | ||||||||||||||||||||||||||||||||||||||||||
| 837 | Comments : If you need data for each HSP, use hsps() and then interate | ||||||||||||||||||||||||||||||||||||||||||
| 838 | : through each HSP object. | ||||||||||||||||||||||||||||||||||||||||||
| 839 | : This method requires that all HSPs be tiled. If they have not | ||||||||||||||||||||||||||||||||||||||||||
| 840 | : already been tiled, they will be tiled first automatically.. | ||||||||||||||||||||||||||||||||||||||||||
| 841 | : Not relying on wantarray since that will fail in situations | ||||||||||||||||||||||||||||||||||||||||||
| 842 | : such as printf "%d", $hit->gaps() in which you might expect to | ||||||||||||||||||||||||||||||||||||||||||
| 843 | : be printing the total gaps, but evaluates to array context. | ||||||||||||||||||||||||||||||||||||||||||
| 844 | |||||||||||||||||||||||||||||||||||||||||||
| 845 | See Also : L<length_aln()|length_aln> | ||||||||||||||||||||||||||||||||||||||||||
| 846 | |||||||||||||||||||||||||||||||||||||||||||
| 847 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 848 | |||||||||||||||||||||||||||||||||||||||||||
| 849 | 44 | ▶ | sub gaps { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gaps: called CC=14 SCAR=39.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 850 | 44 | my( $self, $seqType, $num ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 851 | |||||||||||||||||||||||||||||||||||||||||||
| 852 | 44 | ▶ | $seqType ||= (wantarray ? 'list' : 'total'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$seqType ||= wantarray ? "list" : "total"
MC/DC0%0/2
$seqType ||= wantarray ? "list" : "total"
$seqType
wantarray ? "list" : "total"
Truth table33%1/3
A ||= B
A= $seqTypeB= wantarray ? "list" : "total"
| |||||||||||||||||||||||||||||||||||||||||||
| 853 | 44 | ▶ | $seqType = 'sbjct' if $seqType eq 'hit'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 854 | |||||||||||||||||||||||||||||||||||||||||||
| 855 | 44 | ▶ | unless ($self->{'_hsps'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 856 | 0 | Bio::Search::SearchUtils::_warn_about_no_hsps($self); | |||||||||||||||||||||||||||||||||||||||||
| 857 | 0 | ▶ | return wantarray ? ('-','-') : '-'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 858 | #return '-'; | ||||||||||||||||||||||||||||||||||||||||||
| 859 | } | ||||||||||||||||||||||||||||||||||||||||||
| 860 | |||||||||||||||||||||||||||||||||||||||||||
| 861 | 44 | ▶ | Bio::Search::SearchUtils::tile_hsps($self) unless $self->tiled_hsps; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 862 | |||||||||||||||||||||||||||||||||||||||||||
| 863 | 44 | $seqType = lc($seqType); | |||||||||||||||||||||||||||||||||||||||||
| 864 | |||||||||||||||||||||||||||||||||||||||||||
| 865 | 44 | ▶ | if( defined $num ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 866 | 44 | ▶ | $self->throw("Can't set gaps for seqType '$seqType'. Must be 'query' or 'hit'\n") unless ($seqType eq 'sbjct' or $seqType eq 'query'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$seqType eq "sbjct" or $seqType eq "query"
MC/DC0%0/2
$seqType eq "sbjct" or $seqType eq "query"
$seqType eq "sbjct"
$seqType eq "query"
Truth table66%2/3
A or B
A= $seqType eq "sbjct"B= $seqType eq "query"
| |||||||||||||||||||||||||||||||||||||||||||
| 867 | |||||||||||||||||||||||||||||||||||||||||||
| 868 | 44 | return $self->{'_gaps_'.$seqType} = $num; | |||||||||||||||||||||||||||||||||||||||||
| 869 | } | ||||||||||||||||||||||||||||||||||||||||||
| 870 | elsif($seqType =~ /list|array/i) { | ||||||||||||||||||||||||||||||||||||||||||
| 871 | 0 | return ($self->{'_gaps_query'}, $self->{'_gaps_sbjct'}); | |||||||||||||||||||||||||||||||||||||||||
| 872 | } | ||||||||||||||||||||||||||||||||||||||||||
| 873 | elsif($seqType eq 'total') { | ||||||||||||||||||||||||||||||||||||||||||
| 874 | 0 | ▶ | return ($self->{'_gaps_query'} + $self->{'_gaps_sbjct'}) || 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$self->{'_gaps_query'} + $self->{'_gaps_sbjct'} || 0
MC/DC0%0/1
$self->{'_gaps_query'} + $self->{'_gaps_sbjct'} || 0
$self->{'_gaps_query'} + $self->{'_gaps_sbjct'}
Truth table0%0/2
A
A= $self->{'_gaps_query'} + $self->{'_gaps_sbjct'}
| |||||||||||||||||||||||||||||||||||||||||||
| 875 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 876 | 0 | ▶ | return $self->{'_gaps_'.$seqType} || 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$$self{'_gaps_' . $seqType} || 0
MC/DC0%0/1
$$self{'_gaps_' . $seqType} || 0
$$self{'_gaps_' . $seqType}
Truth table0%0/2
A
A= $$self{'_gaps_' . $seqType}
| |||||||||||||||||||||||||||||||||||||||||||
| 877 | } | ||||||||||||||||||||||||||||||||||||||||||
| 878 | } | ||||||||||||||||||||||||||||||||||||||||||
| 879 | |||||||||||||||||||||||||||||||||||||||||||
| 880 | |||||||||||||||||||||||||||||||||||||||||||
| 881 | =head2 matches | ||||||||||||||||||||||||||||||||||||||||||
| 882 | |||||||||||||||||||||||||||||||||||||||||||
| 883 | See documentation in L<Bio::Search::Hit::HitI::matches()|Bio::Search::Hit::HitI> | ||||||||||||||||||||||||||||||||||||||||||
| 884 | |||||||||||||||||||||||||||||||||||||||||||
| 885 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 886 | |||||||||||||||||||||||||||||||||||||||||||
| 887 | 43 | ▶ | sub matches { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
matches: called CC=7 SCAR=20.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 888 | 43 | my( $self, $arg1, $arg2) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 889 | 43 | my(@data,$data); | |||||||||||||||||||||||||||||||||||||||||
| 890 | |||||||||||||||||||||||||||||||||||||||||||
| 891 | 43 | ▶ | unless ($self->{'_hsps'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 892 | 0 | Bio::Search::SearchUtils::_warn_about_no_hsps($self); | |||||||||||||||||||||||||||||||||||||||||
| 893 | 0 | ▶ | return wantarray ? ('-','-') : '-'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 894 | } | ||||||||||||||||||||||||||||||||||||||||||
| 895 | |||||||||||||||||||||||||||||||||||||||||||
| 896 | 43 | ▶ | Bio::Search::SearchUtils::tile_hsps($self) unless $self->tiled_hsps; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 897 | |||||||||||||||||||||||||||||||||||||||||||
| 898 | 43 | ▶ | unless( $arg1 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 899 | 2 | @data = ($self->{'_totalIdentical'}, $self->{'_totalConserved'}); | |||||||||||||||||||||||||||||||||||||||||
| 900 | |||||||||||||||||||||||||||||||||||||||||||
| 901 | 2 | return @data; | |||||||||||||||||||||||||||||||||||||||||
| 902 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 903 | |||||||||||||||||||||||||||||||||||||||||||
| 904 | 41 | ▶ | if( defined $arg2 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 905 | 21 | $self->{'_totalIdentical'} = $arg1; | |||||||||||||||||||||||||||||||||||||||||
| 906 | 21 | $self->{'_totalConserved'} = $arg2; | |||||||||||||||||||||||||||||||||||||||||
| 907 | 21 | return ( $arg1, $arg2 ); | |||||||||||||||||||||||||||||||||||||||||
| 908 | } | ||||||||||||||||||||||||||||||||||||||||||
| 909 | elsif($arg1 =~ /^id/i) { | ||||||||||||||||||||||||||||||||||||||||||
| 910 | 20 | $data = $self->{'_totalIdentical'}; | |||||||||||||||||||||||||||||||||||||||||
| 911 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 912 | 0 | $data = $self->{'_totalConserved'}; | |||||||||||||||||||||||||||||||||||||||||
| 913 | } | ||||||||||||||||||||||||||||||||||||||||||
| 914 | #print STDERR "\nmatches(): id=$self->{'_totalIdentical'}, cons=$self->{'_totalConserved'}\n\n"; | ||||||||||||||||||||||||||||||||||||||||||
| 915 | 20 | return $data; | |||||||||||||||||||||||||||||||||||||||||
| 916 | } | ||||||||||||||||||||||||||||||||||||||||||
| 917 | |||||||||||||||||||||||||||||||||||||||||||
| 918 | ## If we make it to here, it is likely the case that | ||||||||||||||||||||||||||||||||||||||||||
| 919 | ## the parser constructed a minimal hit object from the summary line only. | ||||||||||||||||||||||||||||||||||||||||||
| 920 | ## It either delibrately skipped parsing the alignment section, | ||||||||||||||||||||||||||||||||||||||||||
| 921 | ## or was not able to because it was absent (due to blast executable parameter | ||||||||||||||||||||||||||||||||||||||||||
| 922 | ## setting such as -b 0 (B=0 for WU-BLAST) ) | ||||||||||||||||||||||||||||||||||||||||||
| 923 | #$self->throw("Can't get identical or conserved data: no data."); | ||||||||||||||||||||||||||||||||||||||||||
| 924 | } | ||||||||||||||||||||||||||||||||||||||||||
| 925 | |||||||||||||||||||||||||||||||||||||||||||
| 926 | |||||||||||||||||||||||||||||||||||||||||||
| 927 | =head2 start | ||||||||||||||||||||||||||||||||||||||||||
| 928 | |||||||||||||||||||||||||||||||||||||||||||
| 929 | Usage : $sbjct->start( [seq_type] ); | ||||||||||||||||||||||||||||||||||||||||||
| 930 | Purpose : Gets the start coordinate for the query, sbjct, or both sequences | ||||||||||||||||||||||||||||||||||||||||||
| 931 | : in the BlastHit object. If there is more than one HSP, the lowest start | ||||||||||||||||||||||||||||||||||||||||||
| 932 | : value of all HSPs is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 933 | Example : $qbeg = $sbjct->start('query'); | ||||||||||||||||||||||||||||||||||||||||||
| 934 | : $sbeg = $sbjct->start('hit'); | ||||||||||||||||||||||||||||||||||||||||||
| 935 | : ($qbeg, $sbeg) = $sbjct->start(); | ||||||||||||||||||||||||||||||||||||||||||
| 936 | Returns : scalar context: integer | ||||||||||||||||||||||||||||||||||||||||||
| 937 | : array context without args: list of two integers (queryStart, sbjctStart) | ||||||||||||||||||||||||||||||||||||||||||
| 938 | : Array context can be "induced" by providing an argument of 'list' or 'array'. | ||||||||||||||||||||||||||||||||||||||||||
| 939 | Argument : In scalar context: seq_type = 'query' or 'hit' or 'sbjct' (default = 'query') | ||||||||||||||||||||||||||||||||||||||||||
| 940 | ('sbjct' is synonymous with 'hit') | ||||||||||||||||||||||||||||||||||||||||||
| 941 | Throws : n/a | ||||||||||||||||||||||||||||||||||||||||||
| 942 | |||||||||||||||||||||||||||||||||||||||||||
| 943 | See Also : L<end()|end>, L<range()|range>, L<strand()|strand>, | ||||||||||||||||||||||||||||||||||||||||||
| 944 | L<Bio::Search::HSP::BlastHSP::start|Bio::Search::HSP::BlastHSP> | ||||||||||||||||||||||||||||||||||||||||||
| 945 | |||||||||||||||||||||||||||||||||||||||||||
| 946 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 947 | |||||||||||||||||||||||||||||||||||||||||||
| 948 | 2 | ▶ | sub start { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
start: called CC=15 SCAR=48.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 949 | 2 | my ($self, $seqType, $num) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 950 | |||||||||||||||||||||||||||||||||||||||||||
| 951 | 2 | ▶ | unless ($self->{'_hsps'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 952 | 0 | Bio::Search::SearchUtils::_warn_about_no_hsps($self); | |||||||||||||||||||||||||||||||||||||||||
| 953 | 0 | ▶ | return wantarray ? ('-','-') : '-'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 954 | } | ||||||||||||||||||||||||||||||||||||||||||
| 955 | |||||||||||||||||||||||||||||||||||||||||||
| 956 | 2 | ▶ | $seqType ||= (wantarray ? 'list' : 'query'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$seqType ||= wantarray ? "list" : "query"
MC/DC0%0/2
$seqType ||= wantarray ? "list" : "query"
$seqType
wantarray ? "list" : "query"
Truth table33%1/3
A ||= B
A= $seqTypeB= wantarray ? "list" : "query"
| |||||||||||||||||||||||||||||||||||||||||||
| 957 | 2 | ▶ | $seqType = 'sbjct' if $seqType eq 'hit'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 958 | |||||||||||||||||||||||||||||||||||||||||||
| 959 | 2 | ▶ | if( defined $num ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 960 | 2 | $seqType = "_\L$seqType\E"; | |||||||||||||||||||||||||||||||||||||||||
| 961 | 2 | return $self->{$seqType.'Start'} = $num; | |||||||||||||||||||||||||||||||||||||||||
| 962 | } | ||||||||||||||||||||||||||||||||||||||||||
| 963 | |||||||||||||||||||||||||||||||||||||||||||
| 964 | # If there is only one HSP, defer this call to the solitary HSP. | ||||||||||||||||||||||||||||||||||||||||||
| 965 | 0 | ▶ | if($self->num_hsps == 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 966 | 0 | return $self->hsp->start($seqType); | |||||||||||||||||||||||||||||||||||||||||
| 967 | } | ||||||||||||||||||||||||||||||||||||||||||
| 968 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 969 | # Tiling normally generates $self->{'_queryStart'} and | ||||||||||||||||||||||||||||||||||||||||||
| 970 | # $self->{'_sbjctStart'}, but is very slow. If we haven't tiled, | ||||||||||||||||||||||||||||||||||||||||||
| 971 | # find the answer quickly without tiling. | ||||||||||||||||||||||||||||||||||||||||||
| 972 | 0 | ▶ | unless (defined $self->{'_queryStart'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 973 | 0 | my $earliest_query_start; | |||||||||||||||||||||||||||||||||||||||||
| 974 | my $earliest_sbjct_start; | ||||||||||||||||||||||||||||||||||||||||||
| 975 | 0 | foreach my $hsp ($self->hsps) { | |||||||||||||||||||||||||||||||||||||||||
| 976 | 0 | my $this_query_start = $hsp->start('query'); | |||||||||||||||||||||||||||||||||||||||||
| 977 | 0 | ▶ | if (! defined $earliest_query_start || $this_query_start < $earliest_query_start) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $earliest_query_start or $this_query_start < $earliest_query_start
MC/DC0%0/2
not defined $earliest_query_start or $this_query_start < $earliest_query_start
not defined $earliest_query_start
$this_query_start < $earliest_query_start
Truth table0%0/3
not(A) or B
A= not defined $earliest_query_startB= $this_query_start < $earliest_query_start
| |||||||||||||||||||||||||||||||||||||||||||
| 978 | 0 | $earliest_query_start = $this_query_start; | |||||||||||||||||||||||||||||||||||||||||
| 979 | } | ||||||||||||||||||||||||||||||||||||||||||
| 980 | |||||||||||||||||||||||||||||||||||||||||||
| 981 | 0 | my $this_sbjct_start = $hsp->start('sbjct'); | |||||||||||||||||||||||||||||||||||||||||
| 982 | 0 | ▶ | if (! defined $earliest_sbjct_start || $this_sbjct_start < $earliest_sbjct_start) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $earliest_sbjct_start or $this_sbjct_start < $earliest_sbjct_start
MC/DC0%0/2
not defined $earliest_sbjct_start or $this_sbjct_start < $earliest_sbjct_start
not defined $earliest_sbjct_start
$this_sbjct_start < $earliest_sbjct_start
Truth table0%0/3
not(A) or B
A= not defined $earliest_sbjct_startB= $this_sbjct_start < $earliest_sbjct_start
| |||||||||||||||||||||||||||||||||||||||||||
| 983 | 0 | $earliest_sbjct_start = $this_sbjct_start; | |||||||||||||||||||||||||||||||||||||||||
| 984 | } | ||||||||||||||||||||||||||||||||||||||||||
| 985 | } | ||||||||||||||||||||||||||||||||||||||||||
| 986 | 0 | $self->{'_queryStart'} = $earliest_query_start; | |||||||||||||||||||||||||||||||||||||||||
| 987 | 0 | $self->{'_sbjctStart'} = $earliest_sbjct_start; | |||||||||||||||||||||||||||||||||||||||||
| 988 | } | ||||||||||||||||||||||||||||||||||||||||||
| 989 | |||||||||||||||||||||||||||||||||||||||||||
| 990 | |||||||||||||||||||||||||||||||||||||||||||
| 991 | 0 | ▶ | if ($seqType =~ /list|array/i) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 992 | 0 | return ($self->{'_queryStart'}, $self->{'_sbjctStart'}); | |||||||||||||||||||||||||||||||||||||||||
| 993 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 994 | ## Sensitive to member name changes. | ||||||||||||||||||||||||||||||||||||||||||
| 995 | 0 | $seqType = "_\L$seqType\E"; | |||||||||||||||||||||||||||||||||||||||||
| 996 | 0 | return $self->{$seqType.'Start'}; | |||||||||||||||||||||||||||||||||||||||||
| 997 | } | ||||||||||||||||||||||||||||||||||||||||||
| 998 | } | ||||||||||||||||||||||||||||||||||||||||||
| 999 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1000 | |||||||||||||||||||||||||||||||||||||||||||
| 1001 | |||||||||||||||||||||||||||||||||||||||||||
| 1002 | =head2 end | ||||||||||||||||||||||||||||||||||||||||||
| 1003 | |||||||||||||||||||||||||||||||||||||||||||
| 1004 | Usage : $sbjct->end( [seq_type] ); | ||||||||||||||||||||||||||||||||||||||||||
| 1005 | Purpose : Gets the end coordinate for the query, sbjct, or both sequences | ||||||||||||||||||||||||||||||||||||||||||
| 1006 | : in the BlastHit object. If there is more than one HSP, | ||||||||||||||||||||||||||||||||||||||||||
| 1007 | the largest end | ||||||||||||||||||||||||||||||||||||||||||
| 1008 | : value of all HSPs is returned. | ||||||||||||||||||||||||||||||||||||||||||
| 1009 | Example : $qend = $sbjct->end('query'); | ||||||||||||||||||||||||||||||||||||||||||
| 1010 | : $send = $sbjct->end('hit'); | ||||||||||||||||||||||||||||||||||||||||||
| 1011 | : ($qend, $send) = $sbjct->end(); | ||||||||||||||||||||||||||||||||||||||||||
| 1012 | Returns : scalar context: integer | ||||||||||||||||||||||||||||||||||||||||||
| 1013 | : array context without args: list of two integers | ||||||||||||||||||||||||||||||||||||||||||
| 1014 | : (queryEnd, sbjctEnd) | ||||||||||||||||||||||||||||||||||||||||||
| 1015 | : Array context can be "induced" by providing an argument | ||||||||||||||||||||||||||||||||||||||||||
| 1016 | : of 'list' or 'array'. | ||||||||||||||||||||||||||||||||||||||||||
| 1017 | Argument : In scalar context: seq_type = 'query' or 'sbjct' | ||||||||||||||||||||||||||||||||||||||||||
| 1018 | : (case insensitive). If not supplied, 'query' is used. | ||||||||||||||||||||||||||||||||||||||||||
| 1019 | Throws : n/a | ||||||||||||||||||||||||||||||||||||||||||
| 1020 | |||||||||||||||||||||||||||||||||||||||||||
| 1021 | See Also : L<start()|start>, L<range()|range>, L<strand()|strand> | ||||||||||||||||||||||||||||||||||||||||||
| 1022 | |||||||||||||||||||||||||||||||||||||||||||
| 1023 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1024 | |||||||||||||||||||||||||||||||||||||||||||
| 1025 | 2 | ▶ | sub end { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
end: called CC=15 SCAR=47.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1026 | 2 | my ($self, $seqType, $num) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1027 | |||||||||||||||||||||||||||||||||||||||||||
| 1028 | 2 | ▶ | unless ($self->{'_hsps'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1029 | 0 | ▶ | return wantarray ? ('-','-') : '-'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1030 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1031 | |||||||||||||||||||||||||||||||||||||||||||
| 1032 | 2 | ▶ | $seqType ||= (wantarray ? 'list' : 'query'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$seqType ||= wantarray ? "list" : "query"
MC/DC0%0/2
$seqType ||= wantarray ? "list" : "query"
$seqType
wantarray ? "list" : "query"
Truth table33%1/3
A ||= B
A= $seqTypeB= wantarray ? "list" : "query"
| |||||||||||||||||||||||||||||||||||||||||||
| 1033 | 2 | ▶ | $seqType = 'sbjct' if $seqType eq 'hit'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1034 | |||||||||||||||||||||||||||||||||||||||||||
| 1035 | 2 | ▶ | if( defined $num ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1036 | 2 | $seqType = "_\L$seqType\E"; | |||||||||||||||||||||||||||||||||||||||||
| 1037 | 2 | return $self->{$seqType.'Stop'} = $num; | |||||||||||||||||||||||||||||||||||||||||
| 1038 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1039 | |||||||||||||||||||||||||||||||||||||||||||
| 1040 | # If there is only one HSP, defer this call to the solitary HSP. | ||||||||||||||||||||||||||||||||||||||||||
| 1041 | 0 | ▶ | if($self->num_hsps == 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1042 | 0 | return $self->hsp->end($seqType); | |||||||||||||||||||||||||||||||||||||||||
| 1043 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1044 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1045 | # Tiling normally generates $self->{'_queryStop'} and | ||||||||||||||||||||||||||||||||||||||||||
| 1046 | # $self->{'_sbjctStop'}, but is very slow. If we haven't tiled, | ||||||||||||||||||||||||||||||||||||||||||
| 1047 | # find the answer quickly without tiling. | ||||||||||||||||||||||||||||||||||||||||||
| 1048 | 0 | ▶ | unless (defined $self->{'_queryStop'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1049 | 0 | my $latest_query_end; | |||||||||||||||||||||||||||||||||||||||||
| 1050 | my $latest_sbjct_end; | ||||||||||||||||||||||||||||||||||||||||||
| 1051 | 0 | foreach my $hsp ($self->hsps) { | |||||||||||||||||||||||||||||||||||||||||
| 1052 | 0 | my $this_query_end = $hsp->end('query'); | |||||||||||||||||||||||||||||||||||||||||
| 1053 | 0 | ▶ | if (! defined $latest_query_end || $this_query_end > $latest_query_end) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $latest_query_end or $this_query_end > $latest_query_end
MC/DC0%0/2
not defined $latest_query_end or $this_query_end > $latest_query_end
not defined $latest_query_end
$this_query_end > $latest_query_end
Truth table0%0/3
not(A) or B
A= not defined $latest_query_endB= $this_query_end > $latest_query_end
| |||||||||||||||||||||||||||||||||||||||||||
| 1054 | 0 | $latest_query_end = $this_query_end; | |||||||||||||||||||||||||||||||||||||||||
| 1055 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1056 | |||||||||||||||||||||||||||||||||||||||||||
| 1057 | 0 | my $this_sbjct_end = $hsp->end('sbjct'); | |||||||||||||||||||||||||||||||||||||||||
| 1058 | 0 | ▶ | if (! defined $latest_sbjct_end || $this_sbjct_end > $latest_sbjct_end) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $latest_sbjct_end or $this_sbjct_end > $latest_sbjct_end
MC/DC0%0/2
not defined $latest_sbjct_end or $this_sbjct_end > $latest_sbjct_end
not defined $latest_sbjct_end
$this_sbjct_end > $latest_sbjct_end
Truth table0%0/3
not(A) or B
A= not defined $latest_sbjct_endB= $this_sbjct_end > $latest_sbjct_end
| |||||||||||||||||||||||||||||||||||||||||||
| 1059 | 0 | $latest_sbjct_end = $this_sbjct_end; | |||||||||||||||||||||||||||||||||||||||||
| 1060 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1061 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1062 | 0 | $self->{'_queryStop'} = $latest_query_end; | |||||||||||||||||||||||||||||||||||||||||
| 1063 | 0 | $self->{'_sbjctStop'} = $latest_sbjct_end; | |||||||||||||||||||||||||||||||||||||||||
| 1064 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1065 | |||||||||||||||||||||||||||||||||||||||||||
| 1066 | |||||||||||||||||||||||||||||||||||||||||||
| 1067 | 0 | ▶ | if($seqType =~ /list|array/i) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1068 | 0 | return ($self->{'_queryStop'}, $self->{'_sbjctStop'}); | |||||||||||||||||||||||||||||||||||||||||
| 1069 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1070 | ## Sensitive to member name changes. | ||||||||||||||||||||||||||||||||||||||||||
| 1071 | 0 | $seqType = "_\L$seqType\E"; | |||||||||||||||||||||||||||||||||||||||||
| 1072 | 0 | return $self->{$seqType.'Stop'}; | |||||||||||||||||||||||||||||||||||||||||
| 1073 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1074 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1075 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1076 | |||||||||||||||||||||||||||||||||||||||||||
| 1077 | =head2 range | ||||||||||||||||||||||||||||||||||||||||||
| 1078 | |||||||||||||||||||||||||||||||||||||||||||
| 1079 | Usage : $sbjct->range( [seq_type] ); | ||||||||||||||||||||||||||||||||||||||||||
| 1080 | Purpose : Gets the (start, end) coordinates for the query or sbjct sequence | ||||||||||||||||||||||||||||||||||||||||||
| 1081 | : in the HSP alignment. | ||||||||||||||||||||||||||||||||||||||||||
| 1082 | Example : ($qbeg, $qend) = $sbjct->range('query'); | ||||||||||||||||||||||||||||||||||||||||||
| 1083 | : ($sbeg, $send) = $sbjct->range('hit'); | ||||||||||||||||||||||||||||||||||||||||||
| 1084 | Returns : Two-element array of integers | ||||||||||||||||||||||||||||||||||||||||||
| 1085 | Argument : seq_type = string, 'query' or 'hit' or 'sbjct' (default = 'query') | ||||||||||||||||||||||||||||||||||||||||||
| 1086 | ('sbjct' is synonymous with 'hit') | ||||||||||||||||||||||||||||||||||||||||||
| 1087 | Throws : n/a | ||||||||||||||||||||||||||||||||||||||||||
| 1088 | |||||||||||||||||||||||||||||||||||||||||||
| 1089 | See Also : L<start()|start>, L<end()|end> | ||||||||||||||||||||||||||||||||||||||||||
| 1090 | |||||||||||||||||||||||||||||||||||||||||||
| 1091 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1092 | |||||||||||||||||||||||||||||||||||||||||||
| 1093 | 0 | ▶ | sub range { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
range: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1094 | 0 | my ($self, $seqType) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1095 | 0 | ▶ | $seqType ||= 'query'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$seqType ||= "query"
MC/DC0%0/1
$seqType ||= "query"
$seqType
Truth table0%0/2
A
A= $seqType
| |||||||||||||||||||||||||||||||||||||||||||
| 1096 | 0 | ▶ | $seqType = 'sbjct' if $seqType eq 'hit'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1097 | 0 | return ($self->start($seqType), $self->end($seqType)); | |||||||||||||||||||||||||||||||||||||||||
| 1098 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1099 | |||||||||||||||||||||||||||||||||||||||||||
| 1100 | |||||||||||||||||||||||||||||||||||||||||||
| 1101 | =head2 frac_identical | ||||||||||||||||||||||||||||||||||||||||||
| 1102 | |||||||||||||||||||||||||||||||||||||||||||
| 1103 | Usage : $hit_object->frac_identical( [seq_type] ); | ||||||||||||||||||||||||||||||||||||||||||
| 1104 | Purpose : Get the overall fraction of identical positions across all HSPs. | ||||||||||||||||||||||||||||||||||||||||||
| 1105 | : The number refers to only the aligned regions and does not | ||||||||||||||||||||||||||||||||||||||||||
| 1106 | : account for unaligned regions in between the HSPs, if any. | ||||||||||||||||||||||||||||||||||||||||||
| 1107 | Example : $frac_iden = $hit_object->frac_identical('query'); | ||||||||||||||||||||||||||||||||||||||||||
| 1108 | Returns : Float (2-decimal precision, e.g., 0.75). | ||||||||||||||||||||||||||||||||||||||||||
| 1109 | Argument : seq_type: 'query' | 'hit' or 'sbjct' | 'total' | ||||||||||||||||||||||||||||||||||||||||||
| 1110 | : default = 'query' (but see comments below). | ||||||||||||||||||||||||||||||||||||||||||
| 1111 | : ('sbjct' is synonymous with 'hit') | ||||||||||||||||||||||||||||||||||||||||||
| 1112 | Throws : n/a | ||||||||||||||||||||||||||||||||||||||||||
| 1113 | Comments : | ||||||||||||||||||||||||||||||||||||||||||
| 1114 | : To compute the fraction identical, the logical length of the | ||||||||||||||||||||||||||||||||||||||||||
| 1115 | : aligned portion of the sequence is used, meaning that | ||||||||||||||||||||||||||||||||||||||||||
| 1116 | : in the case of BLAST flavors, for TBLASTN reports, the length of | ||||||||||||||||||||||||||||||||||||||||||
| 1117 | : the aligned portion of the | ||||||||||||||||||||||||||||||||||||||||||
| 1118 | : nucleotide hit sequence is divided by 3; for BLASTX reports, | ||||||||||||||||||||||||||||||||||||||||||
| 1119 | : the length of the aligned portion of the nucleotide query | ||||||||||||||||||||||||||||||||||||||||||
| 1120 | : sequence is divided by 3. For TBLASTX reports, the length of | ||||||||||||||||||||||||||||||||||||||||||
| 1121 | : both hit and query sequence are converted. | ||||||||||||||||||||||||||||||||||||||||||
| 1122 | : This is necessary since the number of identical residues is | ||||||||||||||||||||||||||||||||||||||||||
| 1123 | : in terms of peptide sequence space. | ||||||||||||||||||||||||||||||||||||||||||
| 1124 | : | ||||||||||||||||||||||||||||||||||||||||||
| 1125 | : Different versions of Blast report different values for the total | ||||||||||||||||||||||||||||||||||||||||||
| 1126 | : length of the alignment. This is the number reported in the | ||||||||||||||||||||||||||||||||||||||||||
| 1127 | : denominators in the stats section: | ||||||||||||||||||||||||||||||||||||||||||
| 1128 | : "Identical = 34/120 Positives = 67/120". | ||||||||||||||||||||||||||||||||||||||||||
| 1129 | : NCBI BLAST uses the total length of the alignment (with gaps) | ||||||||||||||||||||||||||||||||||||||||||
| 1130 | : WU-BLAST uses the length of the query sequence (without gaps). | ||||||||||||||||||||||||||||||||||||||||||
| 1131 | : | ||||||||||||||||||||||||||||||||||||||||||
| 1132 | : Therefore, when called with an argument of 'total', | ||||||||||||||||||||||||||||||||||||||||||
| 1133 | : this method will report different values depending on the | ||||||||||||||||||||||||||||||||||||||||||
| 1134 | : version of BLAST used. Total does NOT take into account HSP | ||||||||||||||||||||||||||||||||||||||||||
| 1135 | : tiling, so it should not be used. | ||||||||||||||||||||||||||||||||||||||||||
| 1136 | : | ||||||||||||||||||||||||||||||||||||||||||
| 1137 | : To get the fraction identical among only the aligned residues, | ||||||||||||||||||||||||||||||||||||||||||
| 1138 | : ignoring the gaps, call this method without an argument or | ||||||||||||||||||||||||||||||||||||||||||
| 1139 | : with an argument of 'query' or 'hit'. | ||||||||||||||||||||||||||||||||||||||||||
| 1140 | : | ||||||||||||||||||||||||||||||||||||||||||
| 1141 | : If you need data for each HSP, use hsps() and then iterate | ||||||||||||||||||||||||||||||||||||||||||
| 1142 | : through the HSP objects. | ||||||||||||||||||||||||||||||||||||||||||
| 1143 | : This method requires that all HSPs be tiled. If they have not | ||||||||||||||||||||||||||||||||||||||||||
| 1144 | : already been tiled, they will be tiled first automatically. | ||||||||||||||||||||||||||||||||||||||||||
| 1145 | |||||||||||||||||||||||||||||||||||||||||||
| 1146 | See Also : L<frac_conserved()|frac_conserved>, L<frac_aligned_query()|frac_aligned_query>, L<matches()|matches>, L<Bio::Search::SearchUtils::tile_hsps()|Bio::Search::SearchUtils> | ||||||||||||||||||||||||||||||||||||||||||
| 1147 | |||||||||||||||||||||||||||||||||||||||||||
| 1148 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1149 | |||||||||||||||||||||||||||||||||||||||||||
| 1150 | 20 | ▶ | sub frac_identical { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
frac_identical: called CC=7 SCAR=21.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1151 | 20 | my ($self, $seqType) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1152 | 20 | ▶ | $seqType ||= 'query'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$seqType ||= "query"
MC/DC0%0/1
$seqType ||= "query"
$seqType
Truth table50%1/2
A
A= $seqType
| |||||||||||||||||||||||||||||||||||||||||||
| 1153 | 20 | ▶ | $seqType = 'sbjct' if $seqType eq 'hit'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1154 | |||||||||||||||||||||||||||||||||||||||||||
| 1155 | ## Sensitive to member name format. | ||||||||||||||||||||||||||||||||||||||||||
| 1156 | 20 | $seqType = lc($seqType); | |||||||||||||||||||||||||||||||||||||||||
| 1157 | |||||||||||||||||||||||||||||||||||||||||||
| 1158 | 20 | ▶ | unless ($self->{'_hsps'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1159 | 0 | Bio::Search::SearchUtils::_warn_about_no_hsps($self); | |||||||||||||||||||||||||||||||||||||||||
| 1160 | #return wantarray ? ('-','-') : '-'; | ||||||||||||||||||||||||||||||||||||||||||
| 1161 | 0 | return '-'; | |||||||||||||||||||||||||||||||||||||||||
| 1162 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1163 | |||||||||||||||||||||||||||||||||||||||||||
| 1164 | 20 | ▶ | Bio::Search::SearchUtils::tile_hsps($self) unless $self->tiled_hsps; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1165 | |||||||||||||||||||||||||||||||||||||||||||
| 1166 | 20 | my $ident = $self->matches('id'); | |||||||||||||||||||||||||||||||||||||||||
| 1167 | 20 | my $total = $self->length_aln($seqType); | |||||||||||||||||||||||||||||||||||||||||
| 1168 | 20 | my $ratio = $ident / $total; | |||||||||||||||||||||||||||||||||||||||||
| 1169 | 20 | my $ratio_rounded = sprintf( "%.3f", $ratio); | |||||||||||||||||||||||||||||||||||||||||
| 1170 | |||||||||||||||||||||||||||||||||||||||||||
| 1171 | # Round down iff normal rounding yields 1 (just like blast) | ||||||||||||||||||||||||||||||||||||||||||
| 1172 | 20 | ▶ | $ratio_rounded = 0.999 if (($ratio_rounded == 1) && ($ratio < 1)); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$ratio_rounded == 1 and $ratio < 1
MC/DC0%0/2
$ratio_rounded == 1 and $ratio < 1
$ratio_rounded == 1
$ratio < 1
Truth table33%1/3
A and B
A= $ratio_rounded == 1B= $ratio < 1
| |||||||||||||||||||||||||||||||||||||||||||
| 1173 | 20 | return $ratio_rounded; | |||||||||||||||||||||||||||||||||||||||||
| 1174 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1175 | |||||||||||||||||||||||||||||||||||||||||||
| 1176 | |||||||||||||||||||||||||||||||||||||||||||
| 1177 | =head2 frac_conserved | ||||||||||||||||||||||||||||||||||||||||||
| 1178 | |||||||||||||||||||||||||||||||||||||||||||
| 1179 | Usage : $hit_object->frac_conserved( [seq_type] ); | ||||||||||||||||||||||||||||||||||||||||||
| 1180 | Purpose : Get the overall fraction of conserved positions across all HSPs. | ||||||||||||||||||||||||||||||||||||||||||
| 1181 | : The number refers to only the aligned regions and does not | ||||||||||||||||||||||||||||||||||||||||||
| 1182 | : account for unaligned regions in between the HSPs, if any. | ||||||||||||||||||||||||||||||||||||||||||
| 1183 | Example : $frac_cons = $hit_object->frac_conserved('hit'); | ||||||||||||||||||||||||||||||||||||||||||
| 1184 | Returns : Float (2-decimal precision, e.g., 0.75). | ||||||||||||||||||||||||||||||||||||||||||
| 1185 | Argument : seq_type: 'query' | 'hit' or 'sbjct' | 'total' | ||||||||||||||||||||||||||||||||||||||||||
| 1186 | : default = 'query' (but see comments below). | ||||||||||||||||||||||||||||||||||||||||||
| 1187 | : ('sbjct' is synonymous with 'hit') | ||||||||||||||||||||||||||||||||||||||||||
| 1188 | Throws : n/a | ||||||||||||||||||||||||||||||||||||||||||
| 1189 | Comments : | ||||||||||||||||||||||||||||||||||||||||||
| 1190 | : To compute the fraction conserved, the logical length of the | ||||||||||||||||||||||||||||||||||||||||||
| 1191 | : aligned portion of the sequence is used, meaning that | ||||||||||||||||||||||||||||||||||||||||||
| 1192 | : in the case of BLAST flavors, for TBLASTN reports, the length of | ||||||||||||||||||||||||||||||||||||||||||
| 1193 | : the aligned portion of the | ||||||||||||||||||||||||||||||||||||||||||
| 1194 | : nucleotide hit sequence is divided by 3; for BLASTX reports, | ||||||||||||||||||||||||||||||||||||||||||
| 1195 | : the length of the aligned portion of the nucleotide query | ||||||||||||||||||||||||||||||||||||||||||
| 1196 | : sequence is divided by 3. For TBLASTX reports, the length of | ||||||||||||||||||||||||||||||||||||||||||
| 1197 | : both hit and query sequence are converted. | ||||||||||||||||||||||||||||||||||||||||||
| 1198 | : This is necessary since the number of conserved residues is | ||||||||||||||||||||||||||||||||||||||||||
| 1199 | : in terms of peptide sequence space. | ||||||||||||||||||||||||||||||||||||||||||
| 1200 | : | ||||||||||||||||||||||||||||||||||||||||||
| 1201 | : Different versions of Blast report different values for the total | ||||||||||||||||||||||||||||||||||||||||||
| 1202 | : length of the alignment. This is the number reported in the | ||||||||||||||||||||||||||||||||||||||||||
| 1203 | : denominators in the stats section: | ||||||||||||||||||||||||||||||||||||||||||
| 1204 | : "Positives = 34/120 Positives = 67/120". | ||||||||||||||||||||||||||||||||||||||||||
| 1205 | : NCBI BLAST uses the total length of the alignment (with gaps) | ||||||||||||||||||||||||||||||||||||||||||
| 1206 | : WU-BLAST uses the length of the query sequence (without gaps). | ||||||||||||||||||||||||||||||||||||||||||
| 1207 | : | ||||||||||||||||||||||||||||||||||||||||||
| 1208 | : Therefore, when called with an argument of 'total', | ||||||||||||||||||||||||||||||||||||||||||
| 1209 | : this method will report different values depending on the | ||||||||||||||||||||||||||||||||||||||||||
| 1210 | : version of BLAST used. Total does NOT take into account HSP | ||||||||||||||||||||||||||||||||||||||||||
| 1211 | : tiling, so it should not be used. | ||||||||||||||||||||||||||||||||||||||||||
| 1212 | : | ||||||||||||||||||||||||||||||||||||||||||
| 1213 | : To get the fraction conserved among only the aligned residues, | ||||||||||||||||||||||||||||||||||||||||||
| 1214 | : ignoring the gaps, call this method without an argument or | ||||||||||||||||||||||||||||||||||||||||||
| 1215 | : with an argument of 'query' or 'hit'. | ||||||||||||||||||||||||||||||||||||||||||
| 1216 | : | ||||||||||||||||||||||||||||||||||||||||||
| 1217 | : If you need data for each HSP, use hsps() and then interate | ||||||||||||||||||||||||||||||||||||||||||
| 1218 | : through the HSP objects. | ||||||||||||||||||||||||||||||||||||||||||
| 1219 | : This method requires that all HSPs be tiled. If they have not | ||||||||||||||||||||||||||||||||||||||||||
| 1220 | : already been tiled, they will be tiled first automatically. | ||||||||||||||||||||||||||||||||||||||||||
| 1221 | |||||||||||||||||||||||||||||||||||||||||||
| 1222 | See Also : L<frac_identical()|frac_identical>, L<matches()|matches>, L<Bio::Search::SearchUtils::tile_hsps()|Bio::Search::SearchUtils> | ||||||||||||||||||||||||||||||||||||||||||
| 1223 | |||||||||||||||||||||||||||||||||||||||||||
| 1224 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1225 | |||||||||||||||||||||||||||||||||||||||||||
| 1226 | 0 | ▶ | sub frac_conserved { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
frac_conserved: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1227 | 0 | my ($self, $seqType) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1228 | 0 | ▶ | $seqType ||= 'query'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$seqType ||= "query"
MC/DC0%0/1
$seqType ||= "query"
$seqType
Truth table0%0/2
A
A= $seqType
| |||||||||||||||||||||||||||||||||||||||||||
| 1229 | 0 | ▶ | $seqType = 'sbjct' if $seqType eq 'hit'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1230 | |||||||||||||||||||||||||||||||||||||||||||
| 1231 | ## Sensitive to member name format. | ||||||||||||||||||||||||||||||||||||||||||
| 1232 | 0 | $seqType = lc($seqType); | |||||||||||||||||||||||||||||||||||||||||
| 1233 | |||||||||||||||||||||||||||||||||||||||||||
| 1234 | 0 | ▶ | unless ($self->{'_hsps'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1235 | 0 | Bio::Search::SearchUtils::_warn_about_no_hsps($self); | |||||||||||||||||||||||||||||||||||||||||
| 1236 | #return wantarray ? ('-','-') : '-'; | ||||||||||||||||||||||||||||||||||||||||||
| 1237 | 0 | return '-'; | |||||||||||||||||||||||||||||||||||||||||
| 1238 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1239 | |||||||||||||||||||||||||||||||||||||||||||
| 1240 | 0 | ▶ | Bio::Search::SearchUtils::tile_hsps($self) unless $self->tiled_hsps; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1241 | |||||||||||||||||||||||||||||||||||||||||||
| 1242 | 0 | my $consv = $self->matches('cons'); | |||||||||||||||||||||||||||||||||||||||||
| 1243 | 0 | my $total = $self->length_aln($seqType); | |||||||||||||||||||||||||||||||||||||||||
| 1244 | 0 | my $ratio = $consv / $total; | |||||||||||||||||||||||||||||||||||||||||
| 1245 | 0 | my $ratio_rounded = sprintf( "%.3f", $ratio); | |||||||||||||||||||||||||||||||||||||||||
| 1246 | |||||||||||||||||||||||||||||||||||||||||||
| 1247 | # Round down iff normal rounding yields 1 (just like blast) | ||||||||||||||||||||||||||||||||||||||||||
| 1248 | 0 | ▶ | $ratio_rounded = 0.999 if (($ratio_rounded == 1) && ($ratio < 1)); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$ratio_rounded == 1 and $ratio < 1
MC/DC0%0/2
$ratio_rounded == 1 and $ratio < 1
$ratio_rounded == 1
$ratio < 1
Truth table0%0/3
A and B
A= $ratio_rounded == 1B= $ratio < 1
| |||||||||||||||||||||||||||||||||||||||||||
| 1249 | 0 | return $ratio_rounded; | |||||||||||||||||||||||||||||||||||||||||
| 1250 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1251 | |||||||||||||||||||||||||||||||||||||||||||
| 1252 | |||||||||||||||||||||||||||||||||||||||||||
| 1253 | |||||||||||||||||||||||||||||||||||||||||||
| 1254 | |||||||||||||||||||||||||||||||||||||||||||
| 1255 | =head2 frac_aligned_query | ||||||||||||||||||||||||||||||||||||||||||
| 1256 | |||||||||||||||||||||||||||||||||||||||||||
| 1257 | Usage : $hit_object->frac_aligned_query(); | ||||||||||||||||||||||||||||||||||||||||||
| 1258 | Purpose : Get the fraction of the query sequence which has been aligned | ||||||||||||||||||||||||||||||||||||||||||
| 1259 | : across all HSPs (not including intervals between non-overlapping | ||||||||||||||||||||||||||||||||||||||||||
| 1260 | : HSPs). | ||||||||||||||||||||||||||||||||||||||||||
| 1261 | Example : $frac_alnq = $hit_object->frac_aligned_query(); | ||||||||||||||||||||||||||||||||||||||||||
| 1262 | Returns : Float (2-decimal precision, e.g., 0.75), | ||||||||||||||||||||||||||||||||||||||||||
| 1263 | : or undef if query length is unknown to avoid division by 0. | ||||||||||||||||||||||||||||||||||||||||||
| 1264 | Argument : n/a | ||||||||||||||||||||||||||||||||||||||||||
| 1265 | Throws : n/a | ||||||||||||||||||||||||||||||||||||||||||
| 1266 | Comments : If you need data for each HSP, use hsps() and then interate | ||||||||||||||||||||||||||||||||||||||||||
| 1267 | : through the HSP objects. | ||||||||||||||||||||||||||||||||||||||||||
| 1268 | : This method requires that all HSPs be tiled. If they have not | ||||||||||||||||||||||||||||||||||||||||||
| 1269 | : already been tiled, they will be tiled first automatically. | ||||||||||||||||||||||||||||||||||||||||||
| 1270 | |||||||||||||||||||||||||||||||||||||||||||
| 1271 | See Also : L<frac_aligned_hit()|frac_aligned_hit>, L<logical_length()|logical_length>, L<length_aln()|length_aln>, L<Bio::Search::SearchUtils::tile_hsps()|Bio::Search::SearchUtils> | ||||||||||||||||||||||||||||||||||||||||||
| 1272 | |||||||||||||||||||||||||||||||||||||||||||
| 1273 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1274 | |||||||||||||||||||||||||||||||||||||||||||
| 1275 | 0 | ▶ | sub frac_aligned_query { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
frac_aligned_query: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1276 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1277 | |||||||||||||||||||||||||||||||||||||||||||
| 1278 | 0 | ▶ | unless ($self->{'_hsps'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1279 | 0 | Bio::Search::SearchUtils::_warn_about_no_hsps($self); | |||||||||||||||||||||||||||||||||||||||||
| 1280 | #return wantarray ? ('-','-') : '-'; | ||||||||||||||||||||||||||||||||||||||||||
| 1281 | 0 | return '-'; | |||||||||||||||||||||||||||||||||||||||||
| 1282 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1283 | |||||||||||||||||||||||||||||||||||||||||||
| 1284 | 0 | ▶ | Bio::Search::SearchUtils::tile_hsps($self) unless $self->tiled_hsps; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1285 | |||||||||||||||||||||||||||||||||||||||||||
| 1286 | 0 | my $qry_len = $self->logical_length('query'); | |||||||||||||||||||||||||||||||||||||||||
| 1287 | 0 | ▶ | return undef if $qry_len == 0; # Avoid division by 0 crash | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1288 | 0 | sprintf( "%.2f", $self->length_aln('query') / $qry_len); | |||||||||||||||||||||||||||||||||||||||||
| 1289 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1290 | |||||||||||||||||||||||||||||||||||||||||||
| 1291 | |||||||||||||||||||||||||||||||||||||||||||
| 1292 | |||||||||||||||||||||||||||||||||||||||||||
| 1293 | =head2 frac_aligned_hit | ||||||||||||||||||||||||||||||||||||||||||
| 1294 | |||||||||||||||||||||||||||||||||||||||||||
| 1295 | Usage : $hit_object->frac_aligned_hit(); | ||||||||||||||||||||||||||||||||||||||||||
| 1296 | Purpose : Get the fraction of the hit (sbjct) sequence which has been aligned | ||||||||||||||||||||||||||||||||||||||||||
| 1297 | : across all HSPs (not including intervals between non-overlapping | ||||||||||||||||||||||||||||||||||||||||||
| 1298 | : HSPs). | ||||||||||||||||||||||||||||||||||||||||||
| 1299 | Example : $frac_alnq = $hit_object->frac_aligned_hit(); | ||||||||||||||||||||||||||||||||||||||||||
| 1300 | Returns : Float (2-decimal precision, e.g., 0.75), | ||||||||||||||||||||||||||||||||||||||||||
| 1301 | : or undef if hit length is unknown to avoid division by 0. | ||||||||||||||||||||||||||||||||||||||||||
| 1302 | Argument : n/a | ||||||||||||||||||||||||||||||||||||||||||
| 1303 | Throws : n/a | ||||||||||||||||||||||||||||||||||||||||||
| 1304 | Comments : If you need data for each HSP, use hsps() and then interate | ||||||||||||||||||||||||||||||||||||||||||
| 1305 | : through the HSP objects. | ||||||||||||||||||||||||||||||||||||||||||
| 1306 | : This method requires that all HSPs be tiled. If they have not | ||||||||||||||||||||||||||||||||||||||||||
| 1307 | : already been tiled, they will be tiled first automatically. | ||||||||||||||||||||||||||||||||||||||||||
| 1308 | |||||||||||||||||||||||||||||||||||||||||||
| 1309 | See Also : L<frac_aligned_query()|frac_aligned_query>, L<matches()|matches>, , L<logical_length()|logical_length>, L<length_aln()|length_aln>, L<Bio::Search::SearchUtils::tile_hsps()|Bio::Search::SearchUtils> | ||||||||||||||||||||||||||||||||||||||||||
| 1310 | |||||||||||||||||||||||||||||||||||||||||||
| 1311 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1312 | |||||||||||||||||||||||||||||||||||||||||||
| 1313 | 0 | ▶ | sub frac_aligned_hit { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
frac_aligned_hit: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1314 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1315 | |||||||||||||||||||||||||||||||||||||||||||
| 1316 | 0 | ▶ | unless ($self->{'_hsps'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1317 | 0 | Bio::Search::SearchUtils::_warn_about_no_hsps($self); | |||||||||||||||||||||||||||||||||||||||||
| 1318 | #return wantarray ? ('-','-') : '-'; | ||||||||||||||||||||||||||||||||||||||||||
| 1319 | 0 | return '-'; | |||||||||||||||||||||||||||||||||||||||||
| 1320 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1321 | |||||||||||||||||||||||||||||||||||||||||||
| 1322 | 0 | ▶ | Bio::Search::SearchUtils::tile_hsps($self) unless $self->tiled_hsps; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1323 | |||||||||||||||||||||||||||||||||||||||||||
| 1324 | 0 | my $sbjct_len = $self->logical_length('sbjct'); | |||||||||||||||||||||||||||||||||||||||||
| 1325 | 0 | ▶ | return undef if $sbjct_len == 0; # Avoid division by 0 crash | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1326 | 0 | sprintf( "%.2f", $self->length_aln('sbjct') / $sbjct_len); | |||||||||||||||||||||||||||||||||||||||||
| 1327 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1328 | |||||||||||||||||||||||||||||||||||||||||||
| 1329 | |||||||||||||||||||||||||||||||||||||||||||
| 1330 | ## These methods are being maintained for backward compatibility. | ||||||||||||||||||||||||||||||||||||||||||
| 1331 | |||||||||||||||||||||||||||||||||||||||||||
| 1332 | =head2 frac_aligned_sbjct | ||||||||||||||||||||||||||||||||||||||||||
| 1333 | |||||||||||||||||||||||||||||||||||||||||||
| 1334 | Same as L<frac_aligned_hit()|frac_aligned_hit> | ||||||||||||||||||||||||||||||||||||||||||
| 1335 | |||||||||||||||||||||||||||||||||||||||||||
| 1336 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1337 | |||||||||||||||||||||||||||||||||||||||||||
| 1338 | 30 | *frac_aligned_sbjct = \&frac_aligned_hit; | |||||||||||||||||||||||||||||||||||||||||
| 1339 | |||||||||||||||||||||||||||||||||||||||||||
| 1340 | =head2 num_unaligned_sbjct | ||||||||||||||||||||||||||||||||||||||||||
| 1341 | |||||||||||||||||||||||||||||||||||||||||||
| 1342 | Same as L<num_unaligned_hit()|num_unaligned_hit> | ||||||||||||||||||||||||||||||||||||||||||
| 1343 | |||||||||||||||||||||||||||||||||||||||||||
| 1344 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1345 | |||||||||||||||||||||||||||||||||||||||||||
| 1346 | 30 | *num_unaligned_sbjct = \&num_unaligned_hit; | |||||||||||||||||||||||||||||||||||||||||
| 1347 | |||||||||||||||||||||||||||||||||||||||||||
| 1348 | |||||||||||||||||||||||||||||||||||||||||||
| 1349 | =head2 num_unaligned_hit | ||||||||||||||||||||||||||||||||||||||||||
| 1350 | |||||||||||||||||||||||||||||||||||||||||||
| 1351 | Usage : $hit_object->num_unaligned_hit(); | ||||||||||||||||||||||||||||||||||||||||||
| 1352 | Purpose : Get the number of the unaligned residues in the hit sequence. | ||||||||||||||||||||||||||||||||||||||||||
| 1353 | : Sums across all all HSPs. | ||||||||||||||||||||||||||||||||||||||||||
| 1354 | Example : $num_unaln = $hit_object->num_unaligned_hit(); | ||||||||||||||||||||||||||||||||||||||||||
| 1355 | Returns : Integer | ||||||||||||||||||||||||||||||||||||||||||
| 1356 | Argument : n/a | ||||||||||||||||||||||||||||||||||||||||||
| 1357 | Throws : n/a | ||||||||||||||||||||||||||||||||||||||||||
| 1358 | Comments : See notes regarding logical lengths in the comments for frac_aligned_hit(). | ||||||||||||||||||||||||||||||||||||||||||
| 1359 | : They apply here as well. | ||||||||||||||||||||||||||||||||||||||||||
| 1360 | : If you need data for each HSP, use hsps() and then interate | ||||||||||||||||||||||||||||||||||||||||||
| 1361 | : through the HSP objects. | ||||||||||||||||||||||||||||||||||||||||||
| 1362 | : This method requires that all HSPs be tiled. If they have not | ||||||||||||||||||||||||||||||||||||||||||
| 1363 | : already been tiled, they will be tiled first automatically.. | ||||||||||||||||||||||||||||||||||||||||||
| 1364 | |||||||||||||||||||||||||||||||||||||||||||
| 1365 | See Also : L<num_unaligned_query()|num_unaligned_query>, L<Bio::Search::SearchUtils::tile_hsps()|Bio::Search::SearchUtils>, L<frac_aligned_hit()|frac_aligned_hit> | ||||||||||||||||||||||||||||||||||||||||||
| 1366 | |||||||||||||||||||||||||||||||||||||||||||
| 1367 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1368 | |||||||||||||||||||||||||||||||||||||||||||
| 1369 | 0 | ▶ | sub num_unaligned_hit { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
num_unaligned_hit: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1370 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1371 | |||||||||||||||||||||||||||||||||||||||||||
| 1372 | 0 | ▶ | unless ($self->{'_hsps'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1373 | 0 | Bio::Search::SearchUtils::_warn_about_no_hsps($self); | |||||||||||||||||||||||||||||||||||||||||
| 1374 | #return wantarray ? ('-','-') : '-'; | ||||||||||||||||||||||||||||||||||||||||||
| 1375 | 0 | return '-'; | |||||||||||||||||||||||||||||||||||||||||
| 1376 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1377 | |||||||||||||||||||||||||||||||||||||||||||
| 1378 | 0 | ▶ | Bio::Search::SearchUtils::tile_hsps($self) unless $self->tiled_hsps; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1379 | |||||||||||||||||||||||||||||||||||||||||||
| 1380 | 0 | my $num = $self->logical_length('sbjct') - $self->length_aln('sbjct'); | |||||||||||||||||||||||||||||||||||||||||
| 1381 | 0 | ▶ | ($num < 0 ? 0 : $num ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1382 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1383 | |||||||||||||||||||||||||||||||||||||||||||
| 1384 | |||||||||||||||||||||||||||||||||||||||||||
| 1385 | =head2 num_unaligned_query | ||||||||||||||||||||||||||||||||||||||||||
| 1386 | |||||||||||||||||||||||||||||||||||||||||||
| 1387 | Usage : $hit_object->num_unaligned_query(); | ||||||||||||||||||||||||||||||||||||||||||
| 1388 | Purpose : Get the number of the unaligned residues in the query sequence. | ||||||||||||||||||||||||||||||||||||||||||
| 1389 | : Sums across all all HSPs. | ||||||||||||||||||||||||||||||||||||||||||
| 1390 | Example : $num_unaln = $hit_object->num_unaligned_query(); | ||||||||||||||||||||||||||||||||||||||||||
| 1391 | Returns : Integer | ||||||||||||||||||||||||||||||||||||||||||
| 1392 | Argument : n/a | ||||||||||||||||||||||||||||||||||||||||||
| 1393 | Throws : n/a | ||||||||||||||||||||||||||||||||||||||||||
| 1394 | Comments : See notes regarding logical lengths in the comments for frac_aligned_query(). | ||||||||||||||||||||||||||||||||||||||||||
| 1395 | : They apply here as well. | ||||||||||||||||||||||||||||||||||||||||||
| 1396 | : If you need data for each HSP, use hsps() and then interate | ||||||||||||||||||||||||||||||||||||||||||
| 1397 | : through the HSP objects. | ||||||||||||||||||||||||||||||||||||||||||
| 1398 | : This method requires that all HSPs be tiled. If they have not | ||||||||||||||||||||||||||||||||||||||||||
| 1399 | : already been tiled, they will be tiled first automatically.. | ||||||||||||||||||||||||||||||||||||||||||
| 1400 | |||||||||||||||||||||||||||||||||||||||||||
| 1401 | See Also : L<num_unaligned_hit()|num_unaligned_hit>, L<frac_aligned_query()|frac_aligned_query>, L<Bio::Search::SearchUtils::tile_hsps()|Bio::Search::SearchUtils> | ||||||||||||||||||||||||||||||||||||||||||
| 1402 | |||||||||||||||||||||||||||||||||||||||||||
| 1403 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1404 | |||||||||||||||||||||||||||||||||||||||||||
| 1405 | 0 | ▶ | sub num_unaligned_query { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
num_unaligned_query: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1406 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1407 | |||||||||||||||||||||||||||||||||||||||||||
| 1408 | 0 | ▶ | unless ($self->{'_hsps'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1409 | 0 | Bio::Search::SearchUtils::_warn_about_no_hsps($self); | |||||||||||||||||||||||||||||||||||||||||
| 1410 | #return wantarray ? ('-','-') : '-'; | ||||||||||||||||||||||||||||||||||||||||||
| 1411 | 0 | return '-'; | |||||||||||||||||||||||||||||||||||||||||
| 1412 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1413 | |||||||||||||||||||||||||||||||||||||||||||
| 1414 | 0 | ▶ | Bio::Search::SearchUtils::tile_hsps($self) unless $self->tiled_hsps; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1415 | |||||||||||||||||||||||||||||||||||||||||||
| 1416 | 0 | my $num = $self->logical_length('query') - $self->length_aln('query'); | |||||||||||||||||||||||||||||||||||||||||
| 1417 | 0 | ▶ | ($num < 0 ? 0 : $num ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1418 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1419 | |||||||||||||||||||||||||||||||||||||||||||
| 1420 | |||||||||||||||||||||||||||||||||||||||||||
| 1421 | |||||||||||||||||||||||||||||||||||||||||||
| 1422 | =head2 seq_inds | ||||||||||||||||||||||||||||||||||||||||||
| 1423 | |||||||||||||||||||||||||||||||||||||||||||
| 1424 | Usage : $hit->seq_inds( seq_type, class, collapse ); | ||||||||||||||||||||||||||||||||||||||||||
| 1425 | Purpose : Get a list of residue positions (indices) across all HSPs | ||||||||||||||||||||||||||||||||||||||||||
| 1426 | : for identical or conserved residues in the query or sbjct sequence. | ||||||||||||||||||||||||||||||||||||||||||
| 1427 | Example : @s_ind = $hit->seq_inds('query', 'identical'); | ||||||||||||||||||||||||||||||||||||||||||
| 1428 | : @h_ind = $hit->seq_inds('hit', 'conserved'); | ||||||||||||||||||||||||||||||||||||||||||
| 1429 | : @h_ind = $hit->seq_inds('hit', 'conserved', 1); | ||||||||||||||||||||||||||||||||||||||||||
| 1430 | Returns : Array of integers | ||||||||||||||||||||||||||||||||||||||||||
| 1431 | : May include ranges if collapse is non-zero. | ||||||||||||||||||||||||||||||||||||||||||
| 1432 | Argument : [0] seq_type = 'query' or 'hit' or 'sbjct' (default = 'query') | ||||||||||||||||||||||||||||||||||||||||||
| 1433 | : ('sbjct' is synonymous with 'hit') | ||||||||||||||||||||||||||||||||||||||||||
| 1434 | : [1] class = 'identical' or 'conserved' (default = 'identical') | ||||||||||||||||||||||||||||||||||||||||||
| 1435 | : (can be shortened to 'id' or 'cons') | ||||||||||||||||||||||||||||||||||||||||||
| 1436 | : (actually, anything not 'id' will evaluate to 'conserved'). | ||||||||||||||||||||||||||||||||||||||||||
| 1437 | : [2] collapse = boolean, if non-zero, consecutive positions are merged | ||||||||||||||||||||||||||||||||||||||||||
| 1438 | : using a range notation, e.g., "1 2 3 4 5 7 9 10 11" | ||||||||||||||||||||||||||||||||||||||||||
| 1439 | : collapses to "1-5 7 9-11". This is useful for | ||||||||||||||||||||||||||||||||||||||||||
| 1440 | : consolidating long lists. Default = no collapse. | ||||||||||||||||||||||||||||||||||||||||||
| 1441 | Throws : n/a. | ||||||||||||||||||||||||||||||||||||||||||
| 1442 | |||||||||||||||||||||||||||||||||||||||||||
| 1443 | See Also : L<Bio::Search::HSP::BlastHSP::seq_inds()|Bio::Search::HSP::BlastHSP> | ||||||||||||||||||||||||||||||||||||||||||
| 1444 | |||||||||||||||||||||||||||||||||||||||||||
| 1445 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1446 | |||||||||||||||||||||||||||||||||||||||||||
| 1447 | 0 | ▶ | sub seq_inds { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
seq_inds: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1448 | 0 | my ($self, $seqType, $class, $collapse) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1449 | |||||||||||||||||||||||||||||||||||||||||||
| 1450 | 0 | ▶ | $seqType ||= 'query'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$seqType ||= "query"
MC/DC0%0/1
$seqType ||= "query"
$seqType
Truth table0%0/2
A
A= $seqType
| |||||||||||||||||||||||||||||||||||||||||||
| 1451 | 0 | ▶ | $class ||= 'identical'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$class ||= "identical"
MC/DC0%0/1
$class ||= "identical"
$class
Truth table0%0/2
A
A= $class
| |||||||||||||||||||||||||||||||||||||||||||
| 1452 | 0 | ▶ | $collapse ||= 0; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$collapse ||= 0
MC/DC0%0/1
$collapse ||= 0
$collapse
Truth table0%0/2
A
A= $collapse
| |||||||||||||||||||||||||||||||||||||||||||
| 1453 | |||||||||||||||||||||||||||||||||||||||||||
| 1454 | 0 | ▶ | $seqType = 'sbjct' if $seqType eq 'hit'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1455 | |||||||||||||||||||||||||||||||||||||||||||
| 1456 | 0 | my (@inds, $hsp); | |||||||||||||||||||||||||||||||||||||||||
| 1457 | 0 | foreach $hsp ($self->hsps) { | |||||||||||||||||||||||||||||||||||||||||
| 1458 | # This will merge data for all HSPs together. | ||||||||||||||||||||||||||||||||||||||||||
| 1459 | 0 | push @inds, $hsp->seq_inds($seqType, $class); | |||||||||||||||||||||||||||||||||||||||||
| 1460 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1461 | |||||||||||||||||||||||||||||||||||||||||||
| 1462 | # Need to remove duplicates and sort the merged positions. | ||||||||||||||||||||||||||||||||||||||||||
| 1463 | 0 | ▶ | if(@inds) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1464 | 0 | my %tmp = map { $_, 1 } @inds; | |||||||||||||||||||||||||||||||||||||||||
| 1465 | 0 | @inds = sort {$a <=> $b} keys %tmp; | |||||||||||||||||||||||||||||||||||||||||
| 1466 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1467 | |||||||||||||||||||||||||||||||||||||||||||
| 1468 | 0 | ▶ | $collapse ? &Bio::Search::SearchUtils::collapse_nums(@inds) : @inds; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1469 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1470 | |||||||||||||||||||||||||||||||||||||||||||
| 1471 | |||||||||||||||||||||||||||||||||||||||||||
| 1472 | =head2 strand | ||||||||||||||||||||||||||||||||||||||||||
| 1473 | |||||||||||||||||||||||||||||||||||||||||||
| 1474 | See documentation in L<Bio::Search::Hit::HitI::strand()|Bio::Search::Hit::HitI> | ||||||||||||||||||||||||||||||||||||||||||
| 1475 | |||||||||||||||||||||||||||||||||||||||||||
| 1476 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1477 | |||||||||||||||||||||||||||||||||||||||||||
| 1478 | 2 | ▶ | sub strand { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
strand: called CC=15 SCAR=44.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1479 | 2 | my ($self, $seqType, $strnd) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1480 | |||||||||||||||||||||||||||||||||||||||||||
| 1481 | 2 | ▶ | unless ($self->{'_hsps'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1482 | 0 | Bio::Search::SearchUtils::_warn_about_no_hsps($self); | |||||||||||||||||||||||||||||||||||||||||
| 1483 | 0 | ▶ | return wantarray ? ('-','-') : '-'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1484 | #return '-'; | ||||||||||||||||||||||||||||||||||||||||||
| 1485 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1486 | |||||||||||||||||||||||||||||||||||||||||||
| 1487 | 2 | ▶ | Bio::Search::SearchUtils::tile_hsps($self) unless $self->tiled_hsps; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1488 | |||||||||||||||||||||||||||||||||||||||||||
| 1489 | 2 | ▶ | $seqType ||= (wantarray ? 'list' : 'query'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$seqType ||= wantarray ? "list" : "query"
MC/DC0%0/2
$seqType ||= wantarray ? "list" : "query"
$seqType
wantarray ? "list" : "query"
Truth table33%1/3
A ||= B
A= $seqTypeB= wantarray ? "list" : "query"
| |||||||||||||||||||||||||||||||||||||||||||
| 1490 | 2 | ▶ | $seqType = 'sbjct' if $seqType eq 'hit'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1491 | |||||||||||||||||||||||||||||||||||||||||||
| 1492 | 2 | $seqType = lc($seqType); | |||||||||||||||||||||||||||||||||||||||||
| 1493 | |||||||||||||||||||||||||||||||||||||||||||
| 1494 | 2 | ▶ | if( defined $strnd ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1495 | 2 | ▶ | $self->throw("Can't set strand for seqType '$seqType'. Must be 'query' or 'hit'\n") unless ($seqType eq 'sbjct' or $seqType eq 'query'); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$seqType eq "sbjct" or $seqType eq "query"
MC/DC0%0/2
$seqType eq "sbjct" or $seqType eq "query"
$seqType eq "sbjct"
$seqType eq "query"
Truth table66%2/3
A or B
A= $seqType eq "sbjct"B= $seqType eq "query"
| |||||||||||||||||||||||||||||||||||||||||||
| 1496 | |||||||||||||||||||||||||||||||||||||||||||
| 1497 | 2 | return $self->{'_strand_'.$seqType} = $strnd; | |||||||||||||||||||||||||||||||||||||||||
| 1498 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1499 | |||||||||||||||||||||||||||||||||||||||||||
| 1500 | 0 | my ($qstr, $hstr); | |||||||||||||||||||||||||||||||||||||||||
| 1501 | # If there is only one HSP, defer this call to the solitary HSP. | ||||||||||||||||||||||||||||||||||||||||||
| 1502 | 0 | ▶ | if($self->num_hsps == 1) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 1503 | 0 | return $self->hsp->strand($seqType); | |||||||||||||||||||||||||||||||||||||||||
| 1504 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1505 | elsif( defined $self->{'_strand_query'}) { | ||||||||||||||||||||||||||||||||||||||||||
| 1506 | # Get the data computed during hsp tiling. | ||||||||||||||||||||||||||||||||||||||||||
| 1507 | 0 | $qstr = $self->{'_strand_query'}; | |||||||||||||||||||||||||||||||||||||||||
| 1508 | 0 | $hstr = $self->{'_strand_sbjct'} | |||||||||||||||||||||||||||||||||||||||||
| 1509 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1510 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1511 | # otherwise, iterate through all HSPs collecting strand info. | ||||||||||||||||||||||||||||||||||||||||||
| 1512 | # This will return the string "-1/1" if there are HSPs on different strands. | ||||||||||||||||||||||||||||||||||||||||||
| 1513 | # NOTE: This was the pre-10/21/02 procedure which will no longer be used, | ||||||||||||||||||||||||||||||||||||||||||
| 1514 | # (unless the above elsif{} is commented out). | ||||||||||||||||||||||||||||||||||||||||||
| 1515 | 0 | my (%qstr, %hstr); | |||||||||||||||||||||||||||||||||||||||||
| 1516 | 0 | foreach my $hsp( $self->hsps ) { | |||||||||||||||||||||||||||||||||||||||||
| 1517 | 0 | my ( $q, $h ) = $hsp->strand(); | |||||||||||||||||||||||||||||||||||||||||
| 1518 | 0 | $qstr{ $q }++; | |||||||||||||||||||||||||||||||||||||||||
| 1519 | 0 | $hstr{ $h }++; | |||||||||||||||||||||||||||||||||||||||||
| 1520 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1521 | 0 | $qstr = join( '/', sort keys %qstr); | |||||||||||||||||||||||||||||||||||||||||
| 1522 | 0 | $hstr = join( '/', sort keys %hstr); | |||||||||||||||||||||||||||||||||||||||||
| 1523 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1524 | |||||||||||||||||||||||||||||||||||||||||||
| 1525 | 0 | ▶ | if($seqType =~ /list|array/i) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 1526 | 0 | return ($qstr, $hstr); | |||||||||||||||||||||||||||||||||||||||||
| 1527 | } elsif( $seqType eq 'query' ) { | ||||||||||||||||||||||||||||||||||||||||||
| 1528 | 0 | return $qstr; | |||||||||||||||||||||||||||||||||||||||||
| 1529 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1530 | 0 | return $hstr; | |||||||||||||||||||||||||||||||||||||||||
| 1531 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1532 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1533 | |||||||||||||||||||||||||||||||||||||||||||
| 1534 | =head2 frame | ||||||||||||||||||||||||||||||||||||||||||
| 1535 | |||||||||||||||||||||||||||||||||||||||||||
| 1536 | See documentation in L<Bio::Search::Hit::HitI::frame()|Bio::Search::Hit::HitI> | ||||||||||||||||||||||||||||||||||||||||||
| 1537 | |||||||||||||||||||||||||||||||||||||||||||
| 1538 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1539 | |||||||||||||||||||||||||||||||||||||||||||
| 1540 | 1 | ▶ | sub frame { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
frame: called CC=5 SCAR=23.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1541 | 1 | my( $self, $frm ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1542 | |||||||||||||||||||||||||||||||||||||||||||
| 1543 | 1 | ▶ | unless ($self->{'_hsps'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1544 | 0 | Bio::Search::SearchUtils::_warn_about_no_hsps($self); | |||||||||||||||||||||||||||||||||||||||||
| 1545 | #return wantarray ? ('-','-') : '-'; | ||||||||||||||||||||||||||||||||||||||||||
| 1546 | 0 | return '-'; | |||||||||||||||||||||||||||||||||||||||||
| 1547 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1548 | |||||||||||||||||||||||||||||||||||||||||||
| 1549 | 1 | ▶ | Bio::Search::SearchUtils::tile_hsps($self) unless $self->tiled_hsps; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1550 | |||||||||||||||||||||||||||||||||||||||||||
| 1551 | 1 | ▶ | if( defined $frm ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1552 | 1 | return $self->{'_frame'} = $frm; | |||||||||||||||||||||||||||||||||||||||||
| 1553 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1554 | |||||||||||||||||||||||||||||||||||||||||||
| 1555 | # The check for $self->{'_frame'} is a remnant from the 'query' mode days | ||||||||||||||||||||||||||||||||||||||||||
| 1556 | # in which the sbjct object would collect data from the description line only. | ||||||||||||||||||||||||||||||||||||||||||
| 1557 | |||||||||||||||||||||||||||||||||||||||||||
| 1558 | 0 | my ($frame); | |||||||||||||||||||||||||||||||||||||||||
| 1559 | 0 | ▶ | if(not defined($self->{'_frame'})) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1560 | 0 | $frame = $self->hsp->frame('hit'); | |||||||||||||||||||||||||||||||||||||||||
| 1561 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1562 | 0 | $frame = $self->{'_frame'}; | |||||||||||||||||||||||||||||||||||||||||
| 1563 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1564 | 0 | return $frame; | |||||||||||||||||||||||||||||||||||||||||
| 1565 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1566 | |||||||||||||||||||||||||||||||||||||||||||
| 1567 | =head2 rank | ||||||||||||||||||||||||||||||||||||||||||
| 1568 | |||||||||||||||||||||||||||||||||||||||||||
| 1569 | Title : rank | ||||||||||||||||||||||||||||||||||||||||||
| 1570 | Usage : $obj->rank($newval) | ||||||||||||||||||||||||||||||||||||||||||
| 1571 | Function: Get/Set the rank of this Hit in the Query search list | ||||||||||||||||||||||||||||||||||||||||||
| 1572 | i.e. this is the Nth hit for a specific query | ||||||||||||||||||||||||||||||||||||||||||
| 1573 | Returns : value of rank | ||||||||||||||||||||||||||||||||||||||||||
| 1574 | Args : newvalue (optional) | ||||||||||||||||||||||||||||||||||||||||||
| 1575 | |||||||||||||||||||||||||||||||||||||||||||
| 1576 | |||||||||||||||||||||||||||||||||||||||||||
| 1577 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1578 | |||||||||||||||||||||||||||||||||||||||||||
| 1579 | 1013 | ▶ | sub rank { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
rank: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1580 | 1013 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1581 | 1013 | ▶ | return $self->{'_rank'} = shift if @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1582 | 3 | ▶ | return $self->{'_rank'} || 1; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$self->{'_rank'} || 1
MC/DC0%0/1
$self->{'_rank'} || 1
$self->{'_rank'}
Truth table50%1/2
A
A= $self->{'_rank'}
| |||||||||||||||||||||||||||||||||||||||||||
| 1583 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1584 | |||||||||||||||||||||||||||||||||||||||||||
| 1585 | =head2 locus | ||||||||||||||||||||||||||||||||||||||||||
| 1586 | |||||||||||||||||||||||||||||||||||||||||||
| 1587 | Title : locus | ||||||||||||||||||||||||||||||||||||||||||
| 1588 | Usage : $locus = $hit->locus(); | ||||||||||||||||||||||||||||||||||||||||||
| 1589 | Function: Retrieve the locus (if available) for the hit | ||||||||||||||||||||||||||||||||||||||||||
| 1590 | Returns : a scalar string (empty string if not set) | ||||||||||||||||||||||||||||||||||||||||||
| 1591 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 1592 | |||||||||||||||||||||||||||||||||||||||||||
| 1593 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1594 | |||||||||||||||||||||||||||||||||||||||||||
| 1595 | 0 | ▶ | sub locus { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
locus: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1596 | 0 | my ($self,$value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1597 | 0 | my $previous = $self->{'_locus'}; | |||||||||||||||||||||||||||||||||||||||||
| 1598 | 0 | ▶ | if( defined $value || ! defined $previous ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $value or not defined $previous
MC/DC0%0/2
defined $value or not defined $previous
defined $value
not defined $previous
Truth table0%0/3
A or not(B)
A= defined $valueB= not defined $previous
| |||||||||||||||||||||||||||||||||||||||||||
| 1599 | 0 | ▶ | unless (defined $value) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1600 | 0 | ▶ | if ($self->{'_name'} =~/(gb|emb|dbj|ref)\|(.*)\|(.*)/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1601 | 0 | $value = $previous = $3; | |||||||||||||||||||||||||||||||||||||||||
| 1602 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1603 | 0 | $value = $previous = ''; | |||||||||||||||||||||||||||||||||||||||||
| 1604 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1605 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1606 | 0 | $self->{'_locus'} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 1607 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1608 | 0 | return $previous; | |||||||||||||||||||||||||||||||||||||||||
| 1609 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1610 | |||||||||||||||||||||||||||||||||||||||||||
| 1611 | =head2 each_accession_number | ||||||||||||||||||||||||||||||||||||||||||
| 1612 | |||||||||||||||||||||||||||||||||||||||||||
| 1613 | Title : each_accession_number | ||||||||||||||||||||||||||||||||||||||||||
| 1614 | Usage : @each_accession_number = $hit->each_accession_number(); | ||||||||||||||||||||||||||||||||||||||||||
| 1615 | Function: Get each accession number listed in the description of the hit. | ||||||||||||||||||||||||||||||||||||||||||
| 1616 | If there are no alternatives, then only the primary accession will | ||||||||||||||||||||||||||||||||||||||||||
| 1617 | be given | ||||||||||||||||||||||||||||||||||||||||||
| 1618 | Returns : list of all accession numbers in the description | ||||||||||||||||||||||||||||||||||||||||||
| 1619 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 1620 | |||||||||||||||||||||||||||||||||||||||||||
| 1621 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1622 | |||||||||||||||||||||||||||||||||||||||||||
| 1623 | 0 | ▶ | sub each_accession_number { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
each_accession_number: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1624 | 0 | my ($self,$value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1625 | 0 | my $desc = $self->{'_description'}; | |||||||||||||||||||||||||||||||||||||||||
| 1626 | #put primary accnum on the list | ||||||||||||||||||||||||||||||||||||||||||
| 1627 | 0 | my @accnums; | |||||||||||||||||||||||||||||||||||||||||
| 1628 | 0 | push (@accnums,$self->{'_accession'}); | |||||||||||||||||||||||||||||||||||||||||
| 1629 | 0 | ▶ | if( defined $desc ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1630 | 0 | ▶ | while ($desc =~ /(\b\S+\|\S*\|\S*\s?)/g) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1631 | 0 | my $id = $1; | |||||||||||||||||||||||||||||||||||||||||
| 1632 | 0 | my ($acc, $version); | |||||||||||||||||||||||||||||||||||||||||
| 1633 | 0 | ▶ | if ($id =~ /(gb|emb|dbj|sp|pdb|bbs|ref|tp[gde])\|(.*)\|(.*)/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 1634 | 0 | ($acc, $version) = split /\./, $2; | |||||||||||||||||||||||||||||||||||||||||
| 1635 | } elsif ($id =~ /(pir|prf|pat|gnl)\|(.*)\|(.*)/) { | ||||||||||||||||||||||||||||||||||||||||||
| 1636 | 0 | ($acc, $version) = split /\./, $3; | |||||||||||||||||||||||||||||||||||||||||
| 1637 | } elsif( $id =~ /(gim|gi|bbm|bbs|lcl)\|(\d*)/) { | ||||||||||||||||||||||||||||||||||||||||||
| 1638 | 0 | $acc = $id; | |||||||||||||||||||||||||||||||||||||||||
| 1639 | } elsif( $id =~ /(oth)\|(.*)\|(.*)\|(.*)/ ) { # discontinued... | ||||||||||||||||||||||||||||||||||||||||||
| 1640 | 0 | ($acc,$version) = ($2); | |||||||||||||||||||||||||||||||||||||||||
| 1641 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1642 | #punt, not matching the db's at ftp://ftp.ncbi.nih.gov/blast/db/README | ||||||||||||||||||||||||||||||||||||||||||
| 1643 | #Database Name Identifier Syntax | ||||||||||||||||||||||||||||||||||||||||||
| 1644 | #============================ ======================== | ||||||||||||||||||||||||||||||||||||||||||
| 1645 | #GenBank gb|accession|locus | ||||||||||||||||||||||||||||||||||||||||||
| 1646 | #EMBL Data Library emb|accession|locus | ||||||||||||||||||||||||||||||||||||||||||
| 1647 | #DDBJ, DNA Database of Japan dbj|accession|locus | ||||||||||||||||||||||||||||||||||||||||||
| 1648 | #NBRF PIR pir||entry | ||||||||||||||||||||||||||||||||||||||||||
| 1649 | #Protein Research Foundation prf||name | ||||||||||||||||||||||||||||||||||||||||||
| 1650 | #SWISS-PROT sp|accession|entry name | ||||||||||||||||||||||||||||||||||||||||||
| 1651 | #Brookhaven Protein Data Bank pdb|entry|chain | ||||||||||||||||||||||||||||||||||||||||||
| 1652 | #Patents pat|country|number | ||||||||||||||||||||||||||||||||||||||||||
| 1653 | #GenInfo Backbone Id bbs|number | ||||||||||||||||||||||||||||||||||||||||||
| 1654 | #General database identifier gnl|database|identifier | ||||||||||||||||||||||||||||||||||||||||||
| 1655 | #NCBI Reference Sequence ref|accession|locus | ||||||||||||||||||||||||||||||||||||||||||
| 1656 | #Local Sequence identifier lcl|identifier | ||||||||||||||||||||||||||||||||||||||||||
| 1657 | 0 | $acc=$id; | |||||||||||||||||||||||||||||||||||||||||
| 1658 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1659 | 0 | push(@accnums, $acc); | |||||||||||||||||||||||||||||||||||||||||
| 1660 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1661 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1662 | 0 | return @accnums; | |||||||||||||||||||||||||||||||||||||||||
| 1663 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1664 | |||||||||||||||||||||||||||||||||||||||||||
| 1665 | =head2 tiled_hsps | ||||||||||||||||||||||||||||||||||||||||||
| 1666 | |||||||||||||||||||||||||||||||||||||||||||
| 1667 | See documentation in L<Bio::Search::SearchUtils::tile_hsps()|Bio::Search::SearchUtils> | ||||||||||||||||||||||||||||||||||||||||||
| 1668 | |||||||||||||||||||||||||||||||||||||||||||
| 1669 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1670 | |||||||||||||||||||||||||||||||||||||||||||
| 1671 | 193 | ▶ | sub tiled_hsps { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tiled_hsps: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1672 | 193 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1673 | 193 | ▶ | return $self->{'_tiled_hsps'} = shift if @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1674 | 172 | return $self->{'_tiled_hsps'}; | |||||||||||||||||||||||||||||||||||||||||
| 1675 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1676 | |||||||||||||||||||||||||||||||||||||||||||
| 1677 | =head2 query_length | ||||||||||||||||||||||||||||||||||||||||||
| 1678 | |||||||||||||||||||||||||||||||||||||||||||
| 1679 | Title : query_length | ||||||||||||||||||||||||||||||||||||||||||
| 1680 | Usage : $obj->query_length($newval) | ||||||||||||||||||||||||||||||||||||||||||
| 1681 | Function: Get/Set the query_length | ||||||||||||||||||||||||||||||||||||||||||
| 1682 | Returns : value of query_length (a scalar) | ||||||||||||||||||||||||||||||||||||||||||
| 1683 | Args : on set, new value (a scalar or undef, optional) | ||||||||||||||||||||||||||||||||||||||||||
| 1684 | |||||||||||||||||||||||||||||||||||||||||||
| 1685 | |||||||||||||||||||||||||||||||||||||||||||
| 1686 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1687 | |||||||||||||||||||||||||||||||||||||||||||
| 1688 | 1048 | ▶ | sub query_length { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
query_length: called CC=4 SCAR=14.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1689 | 1048 | my ($self,$value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1690 | 1048 | my $previous = $self->{'_query_length'}; | |||||||||||||||||||||||||||||||||||||||||
| 1691 | 1048 | ▶ | if( defined $value || ! defined $previous ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $value or not defined $previous
MC/DC50%1/2
defined $value or not defined $previous
defined $value
not defined $previous
Truth table66%2/3
A or not(B)
A= defined $valueB= not defined $previous
| |||||||||||||||||||||||||||||||||||||||||||
| 1692 | 1046 | ▶ | $value = $previous = 0 unless defined $value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1693 | 1046 | $self->{'_query_length'} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 1694 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1695 | 1048 | return $previous; | |||||||||||||||||||||||||||||||||||||||||
| 1696 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1697 | |||||||||||||||||||||||||||||||||||||||||||
| 1698 | =head2 ncbi_gi | ||||||||||||||||||||||||||||||||||||||||||
| 1699 | |||||||||||||||||||||||||||||||||||||||||||
| 1700 | Title : ncbi_gi | ||||||||||||||||||||||||||||||||||||||||||
| 1701 | Usage : $acc = $hit->ncbi_gi(); | ||||||||||||||||||||||||||||||||||||||||||
| 1702 | Function: Retrieve the NCBI Unique ID (aka the GI #), | ||||||||||||||||||||||||||||||||||||||||||
| 1703 | if available, for the hit | ||||||||||||||||||||||||||||||||||||||||||
| 1704 | Returns : a scalar string (empty string if not set) | ||||||||||||||||||||||||||||||||||||||||||
| 1705 | Args : none | ||||||||||||||||||||||||||||||||||||||||||
| 1706 | Note : As of Sept. 2016 NCBI records will no longer have a | ||||||||||||||||||||||||||||||||||||||||||
| 1707 | GI; this attributue will remain in place for older | ||||||||||||||||||||||||||||||||||||||||||
| 1708 | records | ||||||||||||||||||||||||||||||||||||||||||
| 1709 | |||||||||||||||||||||||||||||||||||||||||||
| 1710 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1711 | |||||||||||||||||||||||||||||||||||||||||||
| 1712 | 3 | ▶ | sub ncbi_gi { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ncbi_gi: called CC=3 SCAR=12.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1713 | 3 | my ($self,$value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1714 | 3 | ▶ | if( defined $value ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1715 | 0 | $self->{'_ncbi_gi'} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 1716 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 1717 | 3 | ▶ | $self->{'_ncbi_gi'} = $self->name =~ m{^gi\|(\d+)} ? $1 : ''; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1718 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1719 | 3 | return $self->{'_ncbi_gi'}; | |||||||||||||||||||||||||||||||||||||||||
| 1720 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1721 | |||||||||||||||||||||||||||||||||||||||||||
| 1722 | |||||||||||||||||||||||||||||||||||||||||||
| 1723 | # sort method for HSPs | ||||||||||||||||||||||||||||||||||||||||||
| 1724 | |||||||||||||||||||||||||||||||||||||||||||
| 1725 | =head2 sort_hits | ||||||||||||||||||||||||||||||||||||||||||
| 1726 | |||||||||||||||||||||||||||||||||||||||||||
| 1727 | Title : sort_hsps | ||||||||||||||||||||||||||||||||||||||||||
| 1728 | Usage : $result->sort_hsps(\&sort_function) | ||||||||||||||||||||||||||||||||||||||||||
| 1729 | Function : Sorts the available HSP objects by a user-supplied function. Defaults to sort | ||||||||||||||||||||||||||||||||||||||||||
| 1730 | by descending score. | ||||||||||||||||||||||||||||||||||||||||||
| 1731 | Returns : n/a | ||||||||||||||||||||||||||||||||||||||||||
| 1732 | Args : A coderef for the sort function. See the documentation on the Perl sort() | ||||||||||||||||||||||||||||||||||||||||||
| 1733 | function for guidelines on writing sort functions. | ||||||||||||||||||||||||||||||||||||||||||
| 1734 | Note : To access the special variables $a and $b used by the Perl sort() function | ||||||||||||||||||||||||||||||||||||||||||
| 1735 | the user function must access Bio::Search::Hit::HitI namespace. | ||||||||||||||||||||||||||||||||||||||||||
| 1736 | For example, use : | ||||||||||||||||||||||||||||||||||||||||||
| 1737 | $hit->sort_hsps( sub{$Bio::Search::Result::HitI::a->length <=> | ||||||||||||||||||||||||||||||||||||||||||
| 1738 | $Bio::Search::Result::HitI::b->length}); | ||||||||||||||||||||||||||||||||||||||||||
| 1739 | NOT $hit->sort_hsps($a->length <=> $b->length); | ||||||||||||||||||||||||||||||||||||||||||
| 1740 | |||||||||||||||||||||||||||||||||||||||||||
| 1741 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1742 | |||||||||||||||||||||||||||||||||||||||||||
| 1743 | 0 | ▶ | sub sort_hsps { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
sort_hsps: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1744 | 0 | my ($self, $coderef) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1745 | 0 | my @sorted_hsps; | |||||||||||||||||||||||||||||||||||||||||
| 1746 | |||||||||||||||||||||||||||||||||||||||||||
| 1747 | 0 | ▶ | if ($coderef) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1748 | 0 | ▶ | $self->throw('sort_hsps requires a sort function passed as a subroutine reference') | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1749 | unless (ref($coderef) eq 'CODE'); | ||||||||||||||||||||||||||||||||||||||||||
| 1750 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1751 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1752 | 0 | $coderef = \&_default_sort_hsps; | |||||||||||||||||||||||||||||||||||||||||
| 1753 | # throw a warning? | ||||||||||||||||||||||||||||||||||||||||||
| 1754 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1755 | |||||||||||||||||||||||||||||||||||||||||||
| 1756 | 0 | my @hsps = $self->hsps(); | |||||||||||||||||||||||||||||||||||||||||
| 1757 | 0 | eval {@sorted_hsps = sort $coderef @hsps }; | |||||||||||||||||||||||||||||||||||||||||
| 1758 | |||||||||||||||||||||||||||||||||||||||||||
| 1759 | 0 | ▶ | if ($@) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1760 | 0 | $self->throw("Unable to sort hsps: $@"); | |||||||||||||||||||||||||||||||||||||||||
| 1761 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1762 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1763 | 0 | $self->{'_hsps'} = \@sorted_hsps; | |||||||||||||||||||||||||||||||||||||||||
| 1764 | 0 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 1765 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1766 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1767 | |||||||||||||||||||||||||||||||||||||||||||
| 1768 | =head2 iteration | ||||||||||||||||||||||||||||||||||||||||||
| 1769 | |||||||||||||||||||||||||||||||||||||||||||
| 1770 | Usage : $hit->iteration( $iteration_num ); | ||||||||||||||||||||||||||||||||||||||||||
| 1771 | Purpose : Gets the iteration number in which the Hit was found. | ||||||||||||||||||||||||||||||||||||||||||
| 1772 | Example : $iteration_num = $sbjct->iteration(); | ||||||||||||||||||||||||||||||||||||||||||
| 1773 | Returns : Integer greater than or equal to 1 | ||||||||||||||||||||||||||||||||||||||||||
| 1774 | Non-PSI-BLAST reports may report iteration as 1, but this number | ||||||||||||||||||||||||||||||||||||||||||
| 1775 | is only meaningful for PSI-BLAST reports. | ||||||||||||||||||||||||||||||||||||||||||
| 1776 | Argument : iteration_num (optional, used when setting only) | ||||||||||||||||||||||||||||||||||||||||||
| 1777 | Throws : none | ||||||||||||||||||||||||||||||||||||||||||
| 1778 | |||||||||||||||||||||||||||||||||||||||||||
| 1779 | See Also : L<found_again()|found_again> | ||||||||||||||||||||||||||||||||||||||||||
| 1780 | |||||||||||||||||||||||||||||||||||||||||||
| 1781 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1782 | |||||||||||||||||||||||||||||||||||||||||||
| 1783 | 0 | ▶ | sub iteration{ | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
iteration: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1784 | 0 | my ($self,$value) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1785 | 0 | ▶ | if( defined $value) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1786 | 0 | $self->{'_psiblast_iteration'} = $value; | |||||||||||||||||||||||||||||||||||||||||
| 1787 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1788 | 0 | return $self->{'_psiblast_iteration'}; | |||||||||||||||||||||||||||||||||||||||||
| 1789 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1790 | |||||||||||||||||||||||||||||||||||||||||||
| 1791 | =head2 found_again | ||||||||||||||||||||||||||||||||||||||||||
| 1792 | |||||||||||||||||||||||||||||||||||||||||||
| 1793 | Title : found_again | ||||||||||||||||||||||||||||||||||||||||||
| 1794 | Usage : $hit->found_again; | ||||||||||||||||||||||||||||||||||||||||||
| 1795 | $hit->found_again(1); | ||||||||||||||||||||||||||||||||||||||||||
| 1796 | Purpose : Gets a boolean indicator whether or not the hit has | ||||||||||||||||||||||||||||||||||||||||||
| 1797 | been found in a previous iteration. | ||||||||||||||||||||||||||||||||||||||||||
| 1798 | This is only applicable to PSI-BLAST reports. | ||||||||||||||||||||||||||||||||||||||||||
| 1799 | |||||||||||||||||||||||||||||||||||||||||||
| 1800 | This method indicates if the hit was reported in the | ||||||||||||||||||||||||||||||||||||||||||
| 1801 | "Sequences used in model and found again" section of the | ||||||||||||||||||||||||||||||||||||||||||
| 1802 | PSI-BLAST report or if it was reported in the | ||||||||||||||||||||||||||||||||||||||||||
| 1803 | "Sequences not found previously or not previously below threshold" | ||||||||||||||||||||||||||||||||||||||||||
| 1804 | section of the PSI-BLAST report. Only for hits in iteration > 1. | ||||||||||||||||||||||||||||||||||||||||||
| 1805 | |||||||||||||||||||||||||||||||||||||||||||
| 1806 | Example : if( $hit->found_again()) { ... }; | ||||||||||||||||||||||||||||||||||||||||||
| 1807 | Returns : Boolean, true (1) if the hit has been found in a | ||||||||||||||||||||||||||||||||||||||||||
| 1808 | previous PSI-BLAST iteration. | ||||||||||||||||||||||||||||||||||||||||||
| 1809 | Returns false (0 or undef) for hits that have not occurred in a | ||||||||||||||||||||||||||||||||||||||||||
| 1810 | previous PSI-BLAST iteration. | ||||||||||||||||||||||||||||||||||||||||||
| 1811 | Argument : Boolean (1 or 0). Only used for setting. | ||||||||||||||||||||||||||||||||||||||||||
| 1812 | Throws : none | ||||||||||||||||||||||||||||||||||||||||||
| 1813 | |||||||||||||||||||||||||||||||||||||||||||
| 1814 | See Also : L<iteration()|iteration> | ||||||||||||||||||||||||||||||||||||||||||
| 1815 | |||||||||||||||||||||||||||||||||||||||||||
| 1816 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 1817 | |||||||||||||||||||||||||||||||||||||||||||
| 1818 | 0 | ▶ | sub found_again { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
found_again: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1819 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1820 | 0 | ▶ | return $self->{'_found_again'} = shift if @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1821 | 0 | return $self->{'_found_again'}; | |||||||||||||||||||||||||||||||||||||||||
| 1822 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1823 | |||||||||||||||||||||||||||||||||||||||||||
| 1824 | 30 | 1; | |||||||||||||||||||||||||||||||||||||||||