| 1 | # | ||||||||||||||||||||||||||||
| 2 | # BioPerl module for Bio::Search::HSP::ModelHSP | ||||||||||||||||||||||||||||
| 3 | # | ||||||||||||||||||||||||||||
| 4 | # Please direct questions and support issues to <bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||
| 5 | # | ||||||||||||||||||||||||||||
| 6 | # Cared for by Chris Fields <cjfields at bioperl dot org> | ||||||||||||||||||||||||||||
| 7 | # | ||||||||||||||||||||||||||||
| 8 | # Copyright Chris Fields | ||||||||||||||||||||||||||||
| 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::HSP::ModelHSP - A HSP object for model-based searches | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | use Bio::Search::HSP::ModelHSP; | ||||||||||||||||||||||||||||
| 21 | # us it just like a Bio::Search::HSP::ModelHSP object | ||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||
| 23 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | This object is a specialization of L<Bio::Search::HSP::ModelHSP> and is used | ||||||||||||||||||||||||||||
| 26 | for searches which involve a query model, such as a Hidden Markov Model (HMM), | ||||||||||||||||||||||||||||
| 27 | covariance model (CM), descriptor, or anything else besides a sequence. Note | ||||||||||||||||||||||||||||
| 28 | that results from any HSPI class methods which rely on the query being a | ||||||||||||||||||||||||||||
| 29 | sequence are unreliable and have thus been overridden with warnings indicating | ||||||||||||||||||||||||||||
| 30 | they have not been implemented at this time. | ||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | =head1 FEEDBACK | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | =head2 Mailing Lists | ||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | User feedback is an integral part of the evolution of this and other | ||||||||||||||||||||||||||||
| 37 | Bioperl modules. Send your comments and suggestions preferably to | ||||||||||||||||||||||||||||
| 38 | the Bioperl mailing list. Your participation is much appreciated. | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | bioperl-l@bioperl.org - General discussion | ||||||||||||||||||||||||||||
| 41 | http://bioperl.org/wiki/Mailing_lists - About the mailing lists | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | =head2 Support | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | Please direct usage questions or support issues to the mailing list: | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | I<bioperl-l@bioperl.org> | ||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||
| 49 | rather than to the module maintainer directly. Many experienced and | ||||||||||||||||||||||||||||
| 50 | reponsive experts will be able look at the problem and quickly | ||||||||||||||||||||||||||||
| 51 | address it. Please include a thorough description of the problem | ||||||||||||||||||||||||||||
| 52 | with code and data examples if at all possible. | ||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||
| 54 | =head2 Reporting Bugs | ||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | Report bugs to the Bioperl bug tracking system to help us keep track | ||||||||||||||||||||||||||||
| 57 | of the bugs and their resolution. Bug reports can be submitted via the | ||||||||||||||||||||||||||||
| 58 | web: | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | https://github.com/bioperl/bioperl-live/issues | ||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | =head1 AUTHOR - Chris Fields | ||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | Email cjfields at bioperl dot org | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | =head1 APPENDIX | ||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | The rest of the documentation details each of the object methods. | ||||||||||||||||||||||||||||
| 69 | Internal methods are usually preceded with a _ | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | =cut | ||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | # Let the code begin... | ||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||
| 75 | package Bio::Search::HSP::ModelHSP; | ||||||||||||||||||||||||||||
| 76 | 4 | $Bio::Search::HSP::ModelHSP::VERSION = '1.7.8'; | |||||||||||||||||||||||||||
| 77 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 78 | 4 | ▶ | use Bio::Seq::Meta; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||
| 80 | 4 | ▶ | use base qw(Bio::Search::HSP::GenericHSP); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||
| 82 | =head2 new | ||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||
| 84 | Title : new | ||||||||||||||||||||||||||||
| 85 | Usage : my $obj = Bio::Search::HSP::ModelHSP->new(); | ||||||||||||||||||||||||||||
| 86 | Function: Builds a new Bio::Search::HSP::ModelHSP object | ||||||||||||||||||||||||||||
| 87 | Returns : Bio::Search::HSP::ModelHSP | ||||||||||||||||||||||||||||
| 88 | Args : | ||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | Plus Bio::Seach::HSP::ModelHSP methods | ||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | -algorithm => algorithm used (Infernal, RNAMotif, ERPIN, etc) | ||||||||||||||||||||||||||||
| 93 | -evalue => evalue | ||||||||||||||||||||||||||||
| 94 | -pvalue => pvalue | ||||||||||||||||||||||||||||
| 95 | -bits => bit value for HSP | ||||||||||||||||||||||||||||
| 96 | -score => score value for HSP (typically z-score but depends on | ||||||||||||||||||||||||||||
| 97 | analysis) | ||||||||||||||||||||||||||||
| 98 | -hsp_length=> Length of the HSP (including gaps) | ||||||||||||||||||||||||||||
| 99 | -identical => # of residues that that matched identically | ||||||||||||||||||||||||||||
| 100 | -conserved => # of residues that matched conservatively | ||||||||||||||||||||||||||||
| 101 | (only protein comparisons; | ||||||||||||||||||||||||||||
| 102 | conserved == identical in nucleotide comparisons) | ||||||||||||||||||||||||||||
| 103 | -hsp_gaps => # of gaps in the HSP | ||||||||||||||||||||||||||||
| 104 | -query_gaps => # of gaps in the query in the alignment | ||||||||||||||||||||||||||||
| 105 | -hit_gaps => # of gaps in the subject in the alignment | ||||||||||||||||||||||||||||
| 106 | -query_name => HSP Query sequence name (if available) | ||||||||||||||||||||||||||||
| 107 | -query_start => HSP Query start (in original query sequence coords) | ||||||||||||||||||||||||||||
| 108 | -query_end => HSP Query end (in original query sequence coords) | ||||||||||||||||||||||||||||
| 109 | -hit_name => HSP Hit sequence name (if available) | ||||||||||||||||||||||||||||
| 110 | -hit_start => HSP Hit start (in original hit sequence coords) | ||||||||||||||||||||||||||||
| 111 | -hit_end => HSP Hit end (in original hit sequence coords) | ||||||||||||||||||||||||||||
| 112 | -hit_length => total length of the hit sequence | ||||||||||||||||||||||||||||
| 113 | -query_length=> total length of the query sequence | ||||||||||||||||||||||||||||
| 114 | -query_seq => query sequence portion of the HSP | ||||||||||||||||||||||||||||
| 115 | -hit_seq => hit sequence portion of the HSP | ||||||||||||||||||||||||||||
| 116 | -homology_seq=> homology sequence for the HSP | ||||||||||||||||||||||||||||
| 117 | -hit_frame => hit frame (only if hit is translated protein) | ||||||||||||||||||||||||||||
| 118 | -query_frame => query frame (only if query is translated protein) | ||||||||||||||||||||||||||||
| 119 | -meta => optional meta data (sec structure, markup, etc) | ||||||||||||||||||||||||||||
| 120 | -custom_score=> custom score data | ||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||
| 122 | =cut | ||||||||||||||||||||||||||||
| 123 | |||||||||||||||||||||||||||||
| 124 | =head2 meta | ||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||
| 126 | Title : meta | ||||||||||||||||||||||||||||
| 127 | Usage : my $meta = $hsp->meta(); | ||||||||||||||||||||||||||||
| 128 | Function: Returns meta data for this HSP or undef | ||||||||||||||||||||||||||||
| 129 | Returns : string of meta data or undef | ||||||||||||||||||||||||||||
| 130 | Args : [optional] string to set value | ||||||||||||||||||||||||||||
| 131 | Note : At some point very soon this will likely be a Bio::AnnotationI. | ||||||||||||||||||||||||||||
| 132 | Don't get used to a simple string! | ||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||
| 134 | =cut | ||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||
| 136 | 12 | ▶ | sub meta { | ||||||||||||||||||||||||||
|
Subroutine
meta: called CC=2 SCAR=7.4
Pod
documented
| |||||||||||||||||||||||||||||
| 137 | 12 | my ($self,$value) = @_; | |||||||||||||||||||||||||||
| 138 | 12 | my $previous = $self->{'META'}; | |||||||||||||||||||||||||||
| 139 | 12 | ▶ | if( defined $value ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 140 | 0 | $self->{'META'} = $value; | |||||||||||||||||||||||||||
| 141 | } | ||||||||||||||||||||||||||||
| 142 | 12 | return $previous; | |||||||||||||||||||||||||||
| 143 | } | ||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||
| 145 | =head2 noncanonical_string | ||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||
| 147 | Title : noncanonical_string | ||||||||||||||||||||||||||||
| 148 | Usage : my $nc_seq = $hsp->noncanonical_string(); | ||||||||||||||||||||||||||||
| 149 | Function: Returns noncanonical string (NC) data for this HSP or undef | ||||||||||||||||||||||||||||
| 150 | Returns : string of noncanonical data or undef | ||||||||||||||||||||||||||||
| 151 | Args : [optional] string to set value | ||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||
| 153 | =cut | ||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||
| 155 | 1 | ▶ | sub noncanonical_string { | ||||||||||||||||||||||||||
|
Subroutine
noncanonical_string: called CC=2 SCAR=7.4
Pod
documented
| |||||||||||||||||||||||||||||
| 156 | 1 | my ($self,$value) = @_; | |||||||||||||||||||||||||||
| 157 | 1 | my $previous = $self->{'NC_SEQ'}; | |||||||||||||||||||||||||||
| 158 | 1 | ▶ | if( defined $value ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 159 | 0 | $self->{'NC_SEQ'} = $value; | |||||||||||||||||||||||||||
| 160 | } | ||||||||||||||||||||||||||||
| 161 | 1 | return $previous; | |||||||||||||||||||||||||||
| 162 | } | ||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||
| 164 | =head2 custom_score | ||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||
| 166 | Title : custom_score | ||||||||||||||||||||||||||||
| 167 | Usage : my $data = $hsp->custom_score(); | ||||||||||||||||||||||||||||
| 168 | Function: Returns custom_score data for this HSP, or undef | ||||||||||||||||||||||||||||
| 169 | Returns : custom_score data or undef | ||||||||||||||||||||||||||||
| 170 | Args : [optional] custom_score | ||||||||||||||||||||||||||||
| 171 | Note : This is a Get/Set used to deal with odd score-like data generated | ||||||||||||||||||||||||||||
| 172 | from RNAMotif (and other programs) where the score section | ||||||||||||||||||||||||||||
| 173 | can be customized to include non-standard data, including sequence | ||||||||||||||||||||||||||||
| 174 | data, user-based scores, and other values. | ||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||
| 176 | =cut | ||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||
| 178 | 3 | ▶ | sub custom_score { | ||||||||||||||||||||||||||
|
Subroutine
custom_score: called CC=2 SCAR=7.4
Pod
documented
| |||||||||||||||||||||||||||||
| 179 | 3 | my ($self,$value) = @_; | |||||||||||||||||||||||||||
| 180 | 3 | my $previous = $self->{'CUSTOMSCORE'}; | |||||||||||||||||||||||||||
| 181 | 3 | ▶ | if( defined $value ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 182 | 0 | $self->{'CUSTOMSCORE'} = $value; | |||||||||||||||||||||||||||
| 183 | } | ||||||||||||||||||||||||||||
| 184 | 3 | return $previous; | |||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||
| 187 | =head2 Bio::Search::HSP::HSPI methods | ||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||
| 189 | Implementation of Bio::Search::HSP::HSPI methods follow | ||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||
| 191 | =head2 algorithm | ||||||||||||||||||||||||||||
| 192 | |||||||||||||||||||||||||||||
| 193 | Title : algorithm | ||||||||||||||||||||||||||||
| 194 | Usage : my $r_type = $hsp->algorithm | ||||||||||||||||||||||||||||
| 195 | Function: Obtain the name of the algorithm used to obtain the HSP | ||||||||||||||||||||||||||||
| 196 | Returns : string (e.g., BLASTP) | ||||||||||||||||||||||||||||
| 197 | Args : [optional] scalar string to set value | ||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||
| 199 | =cut | ||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||
| 201 | =head2 strand | ||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||
| 203 | Title : strand | ||||||||||||||||||||||||||||
| 204 | Usage : $hsp->strand('hit') | ||||||||||||||||||||||||||||
| 205 | Function: Retrieves the strand for the HSP component requested | ||||||||||||||||||||||||||||
| 206 | Returns : +1 or -1 (0 if unknown) | ||||||||||||||||||||||||||||
| 207 | Args : 'hit' or 'subject' or 'sbjct' to retrieve the strand of the subject. | ||||||||||||||||||||||||||||
| 208 | There is no strand available for 'query', as the query is a model | ||||||||||||||||||||||||||||
| 209 | and not a true sequence. | ||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||
| 211 | =cut | ||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||
| 213 | # overrides HSPI::seq() | ||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||
| 215 | =head2 seq | ||||||||||||||||||||||||||||
| 216 | |||||||||||||||||||||||||||||
| 217 | Usage : $hsp->seq( [seq_type] ); | ||||||||||||||||||||||||||||
| 218 | Purpose : Get the query or sbjct sequence as a Bio::Seq.pm object. | ||||||||||||||||||||||||||||
| 219 | Example : $seqObj = $hsp->seq('sbjct'); | ||||||||||||||||||||||||||||
| 220 | Returns : Object reference for a Bio::Seq.pm object. | ||||||||||||||||||||||||||||
| 221 | Argument : seq_type = 'query' or 'hit' or 'sbjct' (default = 'sbjct'). | ||||||||||||||||||||||||||||
| 222 | : ('sbjct' is synonymous with 'hit') | ||||||||||||||||||||||||||||
| 223 | : default is 'sbjct' | ||||||||||||||||||||||||||||
| 224 | : Note: if there is no sequence available (eg for a model-based | ||||||||||||||||||||||||||||
| 225 | : search), this returns a LocatableSeq object w/o a sequence | ||||||||||||||||||||||||||||
| 226 | Throws : Propagates any exception that occurs during construction | ||||||||||||||||||||||||||||
| 227 | : of the Bio::Seq.pm object. | ||||||||||||||||||||||||||||
| 228 | Comments : The sequence is returned in an array of strings corresponding | ||||||||||||||||||||||||||||
| 229 | : to the strings in the original format of the Blast alignment. | ||||||||||||||||||||||||||||
| 230 | : (i.e., same spacing). | ||||||||||||||||||||||||||||
| 231 | |||||||||||||||||||||||||||||
| 232 | See Also : L<seq_str()|seq_str>, L<Bio::Seq> | ||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||
| 234 | =cut | ||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||
| 236 | #------- | ||||||||||||||||||||||||||||
| 237 | 3 | ▶ | sub seq { | ||||||||||||||||||||||||||
|
Subroutine
seq: called CC=6 SCAR=19.3
Pod
documented
| |||||||||||||||||||||||||||||
| 238 | #------- | ||||||||||||||||||||||||||||
| 239 | 3 | my($self,$seqType) = @_; | |||||||||||||||||||||||||||
| 240 | 3 | ▶ | $seqType ||= 'sbjct'; | ||||||||||||||||||||||||||
|
Condition50%1/2
$seqType ||= "sbjct"
MC/DC0%0/1
$seqType ||= "sbjct"
$seqType
Truth table50%1/2
A
A= $seqType
| |||||||||||||||||||||||||||||
| 241 | 3 | ▶ | $seqType = 'sbjct' if $seqType eq 'hit'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 242 | 3 | my $str = $self->seq_str($seqType); | |||||||||||||||||||||||||||
| 243 | 3 | ▶ | if( $seqType =~ /^(m|ho)/i ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 244 | 0 | $self->throw("cannot call seq on the homology match string, it isn't really a sequence, use get_aln to convert the HSP to a Bio::AlignIO and generate a consensus from that."); | |||||||||||||||||||||||||||
| 245 | } | ||||||||||||||||||||||||||||
| 246 | 3 | require Bio::LocatableSeq; | |||||||||||||||||||||||||||
| 247 | 3 | ▶ | my $id = $seqType =~ /^q/i ? $self->query->seq_id : $self->hit->seq_id; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 248 | 0 | $str =~ s{\*\[\s*(\d+)\s*\]\*}{'N' x $1}ge; | |||||||||||||||||||||||||||
| 249 | 3 | $str =~ s{\s+}{}g; | |||||||||||||||||||||||||||
| 250 | 3 | my $seq = Bio::LocatableSeq->new (-ID => $id, | |||||||||||||||||||||||||||
| 251 | -START => $self->start($seqType), | ||||||||||||||||||||||||||||
| 252 | -END => $self->end($seqType), | ||||||||||||||||||||||||||||
| 253 | -STRAND=> $self->strand($seqType), | ||||||||||||||||||||||||||||
| 254 | -DESC => "$seqType sequence ", | ||||||||||||||||||||||||||||
| 255 | ); | ||||||||||||||||||||||||||||
| 256 | 3 | ▶ | $seq->seq($str) if $str; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 257 | 3 | $seq; | |||||||||||||||||||||||||||
| 258 | } | ||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||
| 260 | =head2 pvalue | ||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||
| 262 | Title : pvalue | ||||||||||||||||||||||||||||
| 263 | Usage : my $pvalue = $hsp->pvalue(); | ||||||||||||||||||||||||||||
| 264 | Function: Returns the P-value for this HSP or undef | ||||||||||||||||||||||||||||
| 265 | Returns : float or exponential (2e-10) | ||||||||||||||||||||||||||||
| 266 | P-value is not defined with NCBI Blast2 reports. | ||||||||||||||||||||||||||||
| 267 | Args : [optional] numeric to set value | ||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||
| 269 | =cut | ||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||
| 271 | =head2 evalue | ||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||
| 273 | Title : evalue | ||||||||||||||||||||||||||||
| 274 | Usage : my $evalue = $hsp->evalue(); | ||||||||||||||||||||||||||||
| 275 | Function: Returns the e-value for this HSP | ||||||||||||||||||||||||||||
| 276 | Returns : float or exponential (2e-10) | ||||||||||||||||||||||||||||
| 277 | Args : [optional] numeric to set value | ||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||
| 279 | =cut | ||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||
| 281 | =head2 gaps | ||||||||||||||||||||||||||||
| 282 | |||||||||||||||||||||||||||||
| 283 | Title : gaps | ||||||||||||||||||||||||||||
| 284 | Usage : my $gaps = $hsp->gaps( ['query'|'hit'|'total'] ); | ||||||||||||||||||||||||||||
| 285 | Function : Get the number of gaps in the query, hit, or total alignment. | ||||||||||||||||||||||||||||
| 286 | Returns : Integer, number of gaps or 0 if none | ||||||||||||||||||||||||||||
| 287 | Args : arg 1: 'query' = num gaps in query seq | ||||||||||||||||||||||||||||
| 288 | 'hit' = num gaps in hit seq | ||||||||||||||||||||||||||||
| 289 | 'total' = num gaps in whole alignment | ||||||||||||||||||||||||||||
| 290 | default = 'total' | ||||||||||||||||||||||||||||
| 291 | arg 2: [optional] integer gap value to set for the type requested | ||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||
| 293 | =cut | ||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||
| 295 | =head2 query_string | ||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||
| 297 | Title : query_string | ||||||||||||||||||||||||||||
| 298 | Usage : my $qseq = $hsp->query_string; | ||||||||||||||||||||||||||||
| 299 | Function: Retrieves the query sequence of this HSP as a string | ||||||||||||||||||||||||||||
| 300 | Returns : string | ||||||||||||||||||||||||||||
| 301 | Args : [optional] string to set for query sequence | ||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||
| 303 | =cut | ||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||
| 305 | =head2 hit_string | ||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||
| 307 | Title : hit_string | ||||||||||||||||||||||||||||
| 308 | Usage : my $hseq = $hsp->hit_string; | ||||||||||||||||||||||||||||
| 309 | Function: Retrieves the hit sequence of this HSP as a string | ||||||||||||||||||||||||||||
| 310 | Returns : string | ||||||||||||||||||||||||||||
| 311 | Args : [optional] string to set for hit sequence | ||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||
| 313 | =cut | ||||||||||||||||||||||||||||
| 314 | |||||||||||||||||||||||||||||
| 315 | =head2 homology_string | ||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||
| 317 | Title : homology_string | ||||||||||||||||||||||||||||
| 318 | Usage : my $homo_string = $hsp->homology_string; | ||||||||||||||||||||||||||||
| 319 | Function: Retrieves the homology sequence for this HSP as a string. | ||||||||||||||||||||||||||||
| 320 | : The homology sequence is the string of symbols in between the | ||||||||||||||||||||||||||||
| 321 | : query and hit sequences in the alignment indicating the degree | ||||||||||||||||||||||||||||
| 322 | : of conservation (e.g., identical, similar, not similar). | ||||||||||||||||||||||||||||
| 323 | Returns : string | ||||||||||||||||||||||||||||
| 324 | Args : [optional] string to set for homology sequence | ||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||
| 326 | =cut | ||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||
| 328 | =head2 length | ||||||||||||||||||||||||||||
| 329 | |||||||||||||||||||||||||||||
| 330 | Title : length | ||||||||||||||||||||||||||||
| 331 | Usage : my $len = $hsp->length( ['query'|'hit'|'total'] ); | ||||||||||||||||||||||||||||
| 332 | Function : Returns the length of the query or hit in the alignment | ||||||||||||||||||||||||||||
| 333 | (without gaps) | ||||||||||||||||||||||||||||
| 334 | or the aggregate length of the HSP (including gaps; | ||||||||||||||||||||||||||||
| 335 | this may be greater than either hit or query ) | ||||||||||||||||||||||||||||
| 336 | Returns : integer | ||||||||||||||||||||||||||||
| 337 | Args : arg 1: 'query' = length of query seq (without gaps) | ||||||||||||||||||||||||||||
| 338 | 'hit' = length of hit seq (without gaps) | ||||||||||||||||||||||||||||
| 339 | 'total' = length of alignment (with gaps) | ||||||||||||||||||||||||||||
| 340 | default = 'total' | ||||||||||||||||||||||||||||
| 341 | arg 2: [optional] integer length value to set for specific type | ||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||
| 343 | =cut | ||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||
| 345 | =head2 frame | ||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||
| 347 | Title : frame | ||||||||||||||||||||||||||||
| 348 | Usage : my ($qframe, $hframe) = $hsp->frame('list',$queryframe,$subjectframe) | ||||||||||||||||||||||||||||
| 349 | Function: Set the Frame for both query and subject and insure that | ||||||||||||||||||||||||||||
| 350 | they agree. | ||||||||||||||||||||||||||||
| 351 | This overrides the frame() method implementation in | ||||||||||||||||||||||||||||
| 352 | FeaturePair. | ||||||||||||||||||||||||||||
| 353 | Returns : array of query and subject frame if return type wants an array | ||||||||||||||||||||||||||||
| 354 | or query frame if defined or subject frame if not defined | ||||||||||||||||||||||||||||
| 355 | Args : 'hit' or 'subject' or 'sbjct' to retrieve the frame of the subject (default) | ||||||||||||||||||||||||||||
| 356 | 'query' to retrieve the query frame | ||||||||||||||||||||||||||||
| 357 | 'list' or 'array' to retrieve both query and hit frames together | ||||||||||||||||||||||||||||
| 358 | Note : Frames are stored in the GFF way (0-2) not 1-3 | ||||||||||||||||||||||||||||
| 359 | as they are in BLAST (negative frames are deduced by checking | ||||||||||||||||||||||||||||
| 360 | the strand of the query or hit) | ||||||||||||||||||||||||||||
| 361 | |||||||||||||||||||||||||||||
| 362 | =cut | ||||||||||||||||||||||||||||
| 363 | |||||||||||||||||||||||||||||
| 364 | =head2 get_aln | ||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||
| 366 | Title : get_aln | ||||||||||||||||||||||||||||
| 367 | Usage : my $aln = $hsp->gel_aln | ||||||||||||||||||||||||||||
| 368 | Function: Returns a Bio::SimpleAlign representing the HSP alignment | ||||||||||||||||||||||||||||
| 369 | Returns : Bio::SimpleAlign | ||||||||||||||||||||||||||||
| 370 | Args : none | ||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||
| 372 | =cut | ||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||
| 374 | 3 | ▶ | sub get_aln { | ||||||||||||||||||||||||||
|
Subroutine
get_aln: called CC=9 SCAR=23.7
Pod
documented
| |||||||||||||||||||||||||||||
| 375 | 3 | my ($self) = @_; | |||||||||||||||||||||||||||
| 376 | 3 | require Bio::LocatableSeq; | |||||||||||||||||||||||||||
| 377 | 3 | require Bio::SimpleAlign; | |||||||||||||||||||||||||||
| 378 | 3 | my $aln = Bio::SimpleAlign->new; | |||||||||||||||||||||||||||
| 379 | 3 | my %hsp = (hit => $self->hit_string, | |||||||||||||||||||||||||||
| 380 | midline => $self->homology_string, | ||||||||||||||||||||||||||||
| 381 | query => $self->query_string, | ||||||||||||||||||||||||||||
| 382 | meta => $self->meta); | ||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||
| 384 | # this takes care of infernal issues | ||||||||||||||||||||||||||||
| 385 | 3 | ▶ | if ($hsp{meta} && $hsp{meta} =~ m{~+}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$hsp{"meta"} and $hsp{"meta"} =~ /~+/
MC/DC0%0/2
$hsp{"meta"} and $hsp{"meta"} =~ /~+/
$hsp{"meta"}
$hsp{"meta"} =~ /~+/
Truth table66%2/3
A and B
A= $hsp{"meta"}B= $hsp{"meta"} =~ /~+/
| |||||||||||||||||||||||||||||
| 386 | 0 | $self->_postprocess_hsp(\%hsp); | |||||||||||||||||||||||||||
| 387 | } | ||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||
| 389 | 3 | ▶ | if (!$hsp{query}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 390 | 2 | $self->warn("Missing query string, can't build alignment"); | |||||||||||||||||||||||||||
| 391 | 0 | return; | |||||||||||||||||||||||||||
| 392 | } | ||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||
| 394 | 1 | my $seqonly = $hsp{query}; | |||||||||||||||||||||||||||
| 395 | 1 | $seqonly =~ s/[\-\s]//g; | |||||||||||||||||||||||||||
| 396 | 1 | my ($q_nm,$s_nm) = ($self->query->seq_id(), | |||||||||||||||||||||||||||
| 397 | $self->hit->seq_id()); | ||||||||||||||||||||||||||||
| 398 | 1 | ▶ | unless( defined $q_nm && CORE::length ($q_nm) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $q_nm and length $q_nm
MC/DC0%0/2
defined $q_nm and length $q_nm
defined $q_nm
length $q_nm
Truth table33%1/3
A and B
A= defined $q_nmB= length $q_nm
| |||||||||||||||||||||||||||||
| 399 | 0 | $q_nm = 'query'; | |||||||||||||||||||||||||||
| 400 | } | ||||||||||||||||||||||||||||
| 401 | 1 | ▶ | unless( defined $s_nm && CORE::length ($s_nm) ) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
defined $s_nm and length $s_nm
MC/DC0%0/2
defined $s_nm and length $s_nm
defined $s_nm
length $s_nm
Truth table33%1/3
A and B
A= defined $s_nmB= length $s_nm
| |||||||||||||||||||||||||||||
| 402 | 0 | $s_nm = 'hit'; | |||||||||||||||||||||||||||
| 403 | } | ||||||||||||||||||||||||||||
| 404 | my $query = Bio::LocatableSeq->new('-seq' => $hsp{query}, | ||||||||||||||||||||||||||||
| 405 | 1 | '-id' => $q_nm, | |||||||||||||||||||||||||||
| 406 | '-start' => $self->query->start, | ||||||||||||||||||||||||||||
| 407 | '-end' => $self->query->end, | ||||||||||||||||||||||||||||
| 408 | ); | ||||||||||||||||||||||||||||
| 409 | 1 | $seqonly = $hsp{hit}; | |||||||||||||||||||||||||||
| 410 | 1 | $seqonly =~ s/[\-\s]//g; | |||||||||||||||||||||||||||
| 411 | my $hit = Bio::LocatableSeq->new('-seq' => $hsp{hit}, | ||||||||||||||||||||||||||||
| 412 | 1 | '-id' => $s_nm, | |||||||||||||||||||||||||||
| 413 | '-start' => $self->hit->start, | ||||||||||||||||||||||||||||
| 414 | '-end' => $self->hit->end, | ||||||||||||||||||||||||||||
| 415 | ); | ||||||||||||||||||||||||||||
| 416 | 1 | $aln->add_seq($query); | |||||||||||||||||||||||||||
| 417 | 1 | $aln->add_seq($hit); | |||||||||||||||||||||||||||
| 418 | 1 | ▶ | if ($hsp{meta}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 419 | 1 | my $meta_obj = Bio::Seq::Meta->new(); | |||||||||||||||||||||||||||
| 420 | 1 | $meta_obj->named_meta('ss_cons', $hsp{meta}); | |||||||||||||||||||||||||||
| 421 | 1 | $aln->consensus_meta($meta_obj); | |||||||||||||||||||||||||||
| 422 | } | ||||||||||||||||||||||||||||
| 423 | 1 | return $aln; | |||||||||||||||||||||||||||
| 424 | } | ||||||||||||||||||||||||||||
| 425 | |||||||||||||||||||||||||||||
| 426 | =head2 Inherited from Bio::SeqFeature::SimilarityPair | ||||||||||||||||||||||||||||
| 427 | |||||||||||||||||||||||||||||
| 428 | These methods come from Bio::SeqFeature::SimilarityPair | ||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||
| 430 | =head2 query | ||||||||||||||||||||||||||||
| 431 | |||||||||||||||||||||||||||||
| 432 | Title : query | ||||||||||||||||||||||||||||
| 433 | Usage : my $query = $hsp->query | ||||||||||||||||||||||||||||
| 434 | Function: Returns a SeqFeature representing the query in the HSP | ||||||||||||||||||||||||||||
| 435 | Returns : Bio::SeqFeature::Similarity | ||||||||||||||||||||||||||||
| 436 | Args : [optional] new value to set | ||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||
| 439 | =head2 hit | ||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||
| 441 | Title : hit | ||||||||||||||||||||||||||||
| 442 | Usage : my $hit = $hsp->hit | ||||||||||||||||||||||||||||
| 443 | Function: Returns a SeqFeature representing the hit in the HSP | ||||||||||||||||||||||||||||
| 444 | Returns : Bio::SeqFeature::Similarity | ||||||||||||||||||||||||||||
| 445 | Args : [optional] new value to set | ||||||||||||||||||||||||||||
| 446 | |||||||||||||||||||||||||||||
| 447 | |||||||||||||||||||||||||||||
| 448 | =head2 significance | ||||||||||||||||||||||||||||
| 449 | |||||||||||||||||||||||||||||
| 450 | Title : significance | ||||||||||||||||||||||||||||
| 451 | Usage : $evalue = $obj->significance(); | ||||||||||||||||||||||||||||
| 452 | $obj->significance($evalue); | ||||||||||||||||||||||||||||
| 453 | Function: Get/Set the significance value | ||||||||||||||||||||||||||||
| 454 | Returns : numeric | ||||||||||||||||||||||||||||
| 455 | Args : [optional] new value to set | ||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||
| 458 | =head2 score | ||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||
| 460 | Title : score | ||||||||||||||||||||||||||||
| 461 | Usage : my $score = $hsp->score(); | ||||||||||||||||||||||||||||
| 462 | Function: Returns the score for this HSP or undef | ||||||||||||||||||||||||||||
| 463 | Returns : numeric | ||||||||||||||||||||||||||||
| 464 | Args : [optional] numeric to set value | ||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||
| 466 | =cut | ||||||||||||||||||||||||||||
| 467 | |||||||||||||||||||||||||||||
| 468 | =head2 bits | ||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||
| 470 | Title : bits | ||||||||||||||||||||||||||||
| 471 | Usage : my $bits = $hsp->bits(); | ||||||||||||||||||||||||||||
| 472 | Function: Returns the bit value for this HSP or undef | ||||||||||||||||||||||||||||
| 473 | Returns : numeric | ||||||||||||||||||||||||||||
| 474 | Args : none | ||||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||
| 476 | =cut | ||||||||||||||||||||||||||||
| 477 | |||||||||||||||||||||||||||||
| 478 | =head1 ModelHSP methods overridden in ModelHSP | ||||||||||||||||||||||||||||
| 479 | |||||||||||||||||||||||||||||
| 480 | The following methods have been overridden due to their current reliance on | ||||||||||||||||||||||||||||
| 481 | sequence-based queries. They may be implemented in future versions of this class. | ||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||
| 483 | =head2 seq_inds | ||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||
| 485 | =cut | ||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||
| 487 | 0 | ▶ | sub seq_inds { | ||||||||||||||||||||||||||
|
Subroutine
seq_inds: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 488 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 489 | 0 | $self->warn('$hsp->seq_inds not implemented for Model-based searches'); | |||||||||||||||||||||||||||
| 490 | 0 | return; | |||||||||||||||||||||||||||
| 491 | } | ||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||
| 493 | =head2 frac_identical | ||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||
| 495 | =cut | ||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||
| 497 | 0 | ▶ | sub frac_identical { | ||||||||||||||||||||||||||
|
Subroutine
frac_identical: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 498 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 499 | 0 | $self->warn('$hsp->frac_identical not implemented for Model-based searches'); | |||||||||||||||||||||||||||
| 500 | 0 | return; | |||||||||||||||||||||||||||
| 501 | } | ||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||
| 503 | =head2 frac_conserved | ||||||||||||||||||||||||||||
| 504 | |||||||||||||||||||||||||||||
| 505 | =cut | ||||||||||||||||||||||||||||
| 506 | |||||||||||||||||||||||||||||
| 507 | 0 | ▶ | sub frac_conserved { | ||||||||||||||||||||||||||
|
Subroutine
frac_conserved: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 508 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 509 | 0 | $self->warn('$hsp->frac_conserved not implemented for Model-based searches'); | |||||||||||||||||||||||||||
| 510 | 0 | return; | |||||||||||||||||||||||||||
| 511 | } | ||||||||||||||||||||||||||||
| 512 | |||||||||||||||||||||||||||||
| 513 | =head2 matches | ||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||
| 515 | =cut | ||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||
| 517 | 0 | ▶ | sub matches { | ||||||||||||||||||||||||||
|
Subroutine
matches: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 518 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 519 | 0 | $self->warn('$hsp->matches not implemented for Model-based searches'); | |||||||||||||||||||||||||||
| 520 | 0 | return; | |||||||||||||||||||||||||||
| 521 | } | ||||||||||||||||||||||||||||
| 522 | |||||||||||||||||||||||||||||
| 523 | =head2 num_conserved | ||||||||||||||||||||||||||||
| 524 | |||||||||||||||||||||||||||||
| 525 | =cut | ||||||||||||||||||||||||||||
| 526 | |||||||||||||||||||||||||||||
| 527 | 0 | ▶ | sub num_conserved { | ||||||||||||||||||||||||||
|
Subroutine
num_conserved: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 528 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 529 | 0 | $self->warn('$hsp->num_conserved not implemented for Model-based searches'); | |||||||||||||||||||||||||||
| 530 | 0 | return; | |||||||||||||||||||||||||||
| 531 | } | ||||||||||||||||||||||||||||
| 532 | |||||||||||||||||||||||||||||
| 533 | =head2 num_identical | ||||||||||||||||||||||||||||
| 534 | |||||||||||||||||||||||||||||
| 535 | =cut | ||||||||||||||||||||||||||||
| 536 | |||||||||||||||||||||||||||||
| 537 | 0 | ▶ | sub num_identical { | ||||||||||||||||||||||||||
|
Subroutine
num_identical: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 538 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 539 | 0 | $self->warn('$hsp->num_identical not implemented for Model-based searches'); | |||||||||||||||||||||||||||
| 540 | 0 | return; | |||||||||||||||||||||||||||
| 541 | } | ||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||
| 543 | =head2 cigar_string | ||||||||||||||||||||||||||||
| 544 | |||||||||||||||||||||||||||||
| 545 | =cut | ||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||
| 547 | |||||||||||||||||||||||||||||
| 548 | 0 | ▶ | sub cigar_string { | ||||||||||||||||||||||||||
|
Subroutine
cigar_string: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 549 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 550 | 0 | $self->warn('$hsp->cigar_string not implemented for Model-based searches'); | |||||||||||||||||||||||||||
| 551 | 0 | return; | |||||||||||||||||||||||||||
| 552 | } | ||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||
| 554 | =head2 generate_cigar_string | ||||||||||||||||||||||||||||
| 555 | |||||||||||||||||||||||||||||
| 556 | =cut | ||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||
| 558 | 0 | ▶ | sub generate_cigar_string { | ||||||||||||||||||||||||||
|
Subroutine
generate_cigar_string: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 559 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 560 | 0 | $self->warn('$hsp->generate_cigar_string not implemented for Model-based searches'); | |||||||||||||||||||||||||||
| 561 | 0 | return; | |||||||||||||||||||||||||||
| 562 | } | ||||||||||||||||||||||||||||
| 563 | |||||||||||||||||||||||||||||
| 564 | =head2 percent_identity | ||||||||||||||||||||||||||||
| 565 | |||||||||||||||||||||||||||||
| 566 | =cut | ||||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||||
| 568 | 0 | ▶ | sub percent_identity { | ||||||||||||||||||||||||||
|
Subroutine
percent_identity: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 569 | 0 | my $self = shift; | |||||||||||||||||||||||||||
| 570 | 0 | $self->warn('$hsp->percent_identity not implemented for Model-based searches'); | |||||||||||||||||||||||||||
| 571 | 0 | return; | |||||||||||||||||||||||||||
| 572 | } | ||||||||||||||||||||||||||||
| 573 | |||||||||||||||||||||||||||||
| 574 | ############## PRIVATE ############## | ||||||||||||||||||||||||||||
| 575 | |||||||||||||||||||||||||||||
| 576 | # the following method postprocesses HSP data in cases where the sequences | ||||||||||||||||||||||||||||
| 577 | # aren't complete (which can trigger a validation error) | ||||||||||||||||||||||||||||
| 578 | |||||||||||||||||||||||||||||
| 579 | { | ||||||||||||||||||||||||||||
| 580 | 4 | my $SEQ_REGEX = qr/\*\[\s*(\d+)\s*\]\*/; | |||||||||||||||||||||||||||
| 581 | 4 | my $META_REGEX = qr/(~+)/; | |||||||||||||||||||||||||||
| 582 | |||||||||||||||||||||||||||||
| 583 | 0 | ▶ | sub _postprocess_hsp { | ||||||||||||||||||||||||||
|
Subroutine
_postprocess_hsp: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||
| 584 | 0 | my ($self, $hsp) = @_; | |||||||||||||||||||||||||||
| 585 | 0 | ▶ | $self->throw('Must pass a hash ref for HSP processing') unless ref($hsp) eq 'HASH'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 586 | 0 | my @ins; | |||||||||||||||||||||||||||
| 587 | 0 | for my $type (qw(query hit meta)) { | |||||||||||||||||||||||||||
| 588 | 0 | $hsp->{$type} =~ s{\s+$}{}; | |||||||||||||||||||||||||||
| 589 | 0 | my $str = $hsp->{$type}; | |||||||||||||||||||||||||||
| 590 | 0 | ▶ | my $regex = $type eq 'meta' ? $META_REGEX : $SEQ_REGEX; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 591 | 0 | my $ind = 0; | |||||||||||||||||||||||||||
| 592 | 0 | ▶ | while ($str =~ m{$regex}g) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 593 | 0 | $ins[$ind]->{$type} = {pos => pos($str) - length($1), str => $1}; | |||||||||||||||||||||||||||
| 594 | 0 | $ind++; | |||||||||||||||||||||||||||
| 595 | } | ||||||||||||||||||||||||||||
| 596 | } | ||||||||||||||||||||||||||||
| 597 | 0 | for my $chunk (reverse @ins) { | |||||||||||||||||||||||||||
| 598 | 0 | ▶ | my ($max, $min) = ($chunk->{hit}->{str} >= $chunk->{query}->{str}) ? | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 599 | ('hit', 'query') : ('query', 'hit'); | ||||||||||||||||||||||||||||
| 600 | 0 | my %rep; | |||||||||||||||||||||||||||
| 601 | 0 | $rep{$max} = 'N' x $chunk->{$max}->{str}; | |||||||||||||||||||||||||||
| 602 | $rep{$min} = 'N' x $chunk->{$min}->{str}. | ||||||||||||||||||||||||||||
| 603 | 0 | ('-'x($chunk->{$max}->{str}-$chunk->{$min}->{str})); | |||||||||||||||||||||||||||
| 604 | 0 | $rep{'meta'} = '~' x $chunk->{$max}->{str}; | |||||||||||||||||||||||||||
| 605 | 0 | $rep{'midline'} = ' ' x $chunk->{$max}->{str}; | |||||||||||||||||||||||||||
| 606 | 0 | for my $t (qw(hit query meta midline)) { | |||||||||||||||||||||||||||
| 607 | 0 | substr($hsp->{$t}, $chunk->{meta}->{pos}, length($chunk->{meta}->{str}) , $rep{$t}); | |||||||||||||||||||||||||||
| 608 | } | ||||||||||||||||||||||||||||
| 609 | } | ||||||||||||||||||||||||||||
| 610 | } | ||||||||||||||||||||||||||||
| 611 | |||||||||||||||||||||||||||||
| 612 | } | ||||||||||||||||||||||||||||
| 613 | |||||||||||||||||||||||||||||
| 614 | 4 | 1; | |||||||||||||||||||||||||||