| 1 | # |
| 2 | # BioPerl module for Bio::Search::HSP::HMMERHSP |
| 3 | # |
| 4 | # Please direct questions and support issues to <[email protected]> |
| 5 | # |
| 6 | # Cared for by Jason Stajich <[email protected]> |
| 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::HSP::HMMERHSP - A HSP object for HMMER results |
| 17 | |
| 18 | =head1 SYNOPSIS |
| 19 | |
| 20 | use Bio::Search::HSP::HMMERHSP; |
| 21 | # use it just like a Bio::Search::HSP::GenericHSP object |
| 22 | |
| 23 | =head1 DESCRIPTION |
| 24 | |
| 25 | This object is a specialization of L<Bio::Search::HSP::GenericHSP>. |
| 26 | |
| 27 | =head1 FEEDBACK |
| 28 | |
| 29 | =head2 Mailing Lists |
| 30 | |
| 31 | User feedback is an integral part of the evolution of this and other |
| 32 | Bioperl modules. Send your comments and suggestions preferably to |
| 33 | the Bioperl mailing list. Your participation is much appreciated. |
| 34 | |
| 35 | [email protected] - General discussion |
| 36 | http://bioperl.org/wiki/Mailing_lists - About the mailing lists |
| 37 | |
| 38 | =head2 Support |
| 39 | |
| 40 | Please direct usage questions or support issues to the mailing list: |
| 41 | |
| 42 | I<[email protected]> |
| 43 | |
| 44 | rather than to the module maintainer directly. Many experienced and |
| 45 | reponsive experts will be able look at the problem and quickly |
| 46 | address it. Please include a thorough description of the problem |
| 47 | with code and data examples if at all possible. |
| 48 | |
| 49 | =head2 Reporting Bugs |
| 50 | |
| 51 | Report bugs to the Bioperl bug tracking system to help us keep track |
| 52 | of the bugs and their resolution. Bug reports can be submitted via the |
| 53 | web: |
| 54 | |
| 55 | https://github.com/bioperl/bioperl-live/issues |
| 56 | |
| 57 | =head1 AUTHOR - Jason Stajich |
| 58 | |
| 59 | Email jason-at-bioperl.org |
| 60 | |
| 61 | =head1 APPENDIX |
| 62 | |
| 63 | The rest of the documentation details each of the object methods. |
| 64 | Internal methods are usually preceded with a _ |
| 65 | |
| 66 | =cut |
| 67 | |
| 68 | # Let the code begin... |
| 69 | |
| 70 | package Bio::Search::HSP::HMMERHSPscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Search/HSP/HMMERHSP/; |
| 71 | $Bio::Search::HSP::HMMERHSP::VERSIONscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Search/HSP/HMMERHSP/$VERSION. = '1.7.3'; |
| 72 | use strictscip-perl cpan Bio-SearchIO-hmmer 1.7.3 strict/; |
| 73 | |
| 74 | use basescip-perl cpan Bio-SearchIO-hmmer 1.7.3 base/ qw(Bio::Search::HSP::GenericHSP); |
| 75 | |
| 76 | =head2 new |
| 77 | |
| 78 | Title : new |
| 79 | Usage : my $obj = Bio::Search::HSP::HMMERHSP->new(); |
| 80 | Function: Builds a new Bio::Search::HSP::HMMERHSP object |
| 81 | Returns : Bio::Search::HSP::HMMERHSP |
| 82 | Args : |
| 83 | |
| 84 | Plus Bio::Search::HSP::GenericHSP methods |
| 85 | |
| 86 | -algorithm => algorithm used (BLASTP, TBLASTX, FASTX, etc) |
| 87 | -evalue => evalue |
| 88 | -pvalue => pvalue |
| 89 | -bits => bit value for HSP |
| 90 | -score => score value for HSP (typically z-score but depends on |
| 91 | analysis) |
| 92 | -hsp_length => Length of the HSP (including gaps) |
| 93 | -identical => # of residues that that matched identically |
| 94 | -conserved => # of residues that matched conservatively |
| 95 | (only protein comparisons - |
| 96 | conserved == identical in nucleotide comparisons) |
| 97 | -hsp_gaps => # of gaps in the HSP |
| 98 | -query_gaps => # of gaps in the query in the alignment |
| 99 | -hit_gaps => # of gaps in the subject in the alignment |
| 100 | -query_name => HSP Query sequence name (if available) |
| 101 | -query_start => HSP Query start (in original query sequence coords) |
| 102 | -query_end => HSP Query end (in original query sequence coords) |
| 103 | -hit_name => HSP Hit sequence name (if available) |
| 104 | -hit_start => HSP Hit start (in original hit sequence coords) |
| 105 | -hit_end => HSP Hit end (in original hit sequence coords) |
| 106 | -hit_length => total length of the hit sequence |
| 107 | -query_length => total length of the query sequence |
| 108 | -query_seq => query sequence portion of the HSP |
| 109 | -hit_seq => hit sequence portion of the HSP |
| 110 | -homology_seq => homology sequence for the HSP |
| 111 | -hit_frame => hit frame (only if hit is translated protein) |
| 112 | -query_frame => query frame (only if query is translated protein) |
| 113 | |
| 114 | =cut |
| 115 | |
| 116 | =head2 Bio::Search::HSP::HSPI methods |
| 117 | |
| 118 | Implementation of Bio::Search::HSP::HSPI methods follow |
| 119 | |
| 120 | =head2 algorithm |
| 121 | |
| 122 | Title : algorithm |
| 123 | Usage : my $r_type = $hsp->algorithm |
| 124 | Function: Obtain the name of the algorithm used to obtain the HSP |
| 125 | Returns : string (e.g., BLASTP) |
| 126 | Args : [optional] scalar string to set value |
| 127 | |
| 128 | =cut |
| 129 | |
| 130 | =head2 pvalue |
| 131 | |
| 132 | Title : pvalue |
| 133 | Usage : my $pvalue = $hsp->pvalue(); |
| 134 | Function: Returns the P-value for this HSP or undef |
| 135 | Returns : float or exponential (2e-10) |
| 136 | P-value is not defined with NCBI Blast2 reports. |
| 137 | Args : [optional] numeric to set value |
| 138 | |
| 139 | =cut |
| 140 | |
| 141 | =head2 evalue |
| 142 | |
| 143 | Title : evalue |
| 144 | Usage : my $evalue = $hsp->evalue(); |
| 145 | Function: Returns the e-value for this HSP |
| 146 | Returns : float or exponential (2e-10) |
| 147 | Args : [optional] numeric to set value |
| 148 | |
| 149 | =cut |
| 150 | |
| 151 | =head2 frac_identical |
| 152 | |
| 153 | Title : frac_identical |
| 154 | Usage : my $frac_id = $hsp->frac_identical( ['query'|'hit'|'total'] ); |
| 155 | Function: Returns the fraction of identitical positions for this HSP |
| 156 | Returns : Float in range 0.0 -> 1.0 |
| 157 | Args : arg 1: 'query' = num identical / length of query seq (without gaps) |
| 158 | 'hit' = num identical / length of hit seq (without gaps) |
| 159 | 'total' = num identical / length of alignment (with gaps) |
| 160 | default = 'total' |
| 161 | arg 2: [optional] frac identical value to set for the type requested |
| 162 | |
| 163 | =cut |
| 164 | |
| 165 | =head2 frac_conserved |
| 166 | |
| 167 | Title : frac_conserved |
| 168 | Usage : my $frac_cons = $hsp->frac_conserved( ['query'|'hit'|'total'] ); |
| 169 | Function : Returns the fraction of conserved positions for this HSP. |
| 170 | This is the fraction of symbols in the alignment with a |
| 171 | positive score. |
| 172 | Returns : Float in range 0.0 -> 1.0 |
| 173 | Args : arg 1: 'query' = num conserved / length of query seq (without gaps) |
| 174 | 'hit' = num conserved / length of hit seq (without gaps) |
| 175 | 'total' = num conserved / length of alignment (with gaps) |
| 176 | default = 'total' |
| 177 | arg 2: [optional] frac conserved value to set for the type requested |
| 178 | |
| 179 | =cut |
| 180 | |
| 181 | =head2 gaps |
| 182 | |
| 183 | Title : gaps |
| 184 | Usage : my $gaps = $hsp->gaps( ['query'|'hit'|'total'] ); |
| 185 | Function : Get the number of gaps in the query, hit, or total alignment. |
| 186 | Returns : Integer, number of gaps or 0 if none |
| 187 | Args : arg 1: 'query' = num gaps in query seq |
| 188 | 'hit' = num gaps in hit seq |
| 189 | 'total' = num gaps in whole alignment |
| 190 | default = 'total' |
| 191 | arg 2: [optional] integer gap value to set for the type requested |
| 192 | |
| 193 | =cut |
| 194 | |
| 195 | =head2 query_string |
| 196 | |
| 197 | Title : query_string |
| 198 | Usage : my $qseq = $hsp->query_string; |
| 199 | Function: Retrieves the query sequence of this HSP as a string |
| 200 | Returns : string |
| 201 | Args : [optional] string to set for query sequence |
| 202 | |
| 203 | |
| 204 | =cut |
| 205 | |
| 206 | =head2 hit_string |
| 207 | |
| 208 | Title : hit_string |
| 209 | Usage : my $hseq = $hsp->hit_string; |
| 210 | Function: Retrieves the hit sequence of this HSP as a string |
| 211 | Returns : string |
| 212 | Args : [optional] string to set for hit sequence |
| 213 | |
| 214 | |
| 215 | =cut |
| 216 | |
| 217 | |
| 218 | =head2 homology_string |
| 219 | |
| 220 | Title : homology_string |
| 221 | Usage : my $homo_string = $hsp->homology_string; |
| 222 | Function: Retrieves the homology sequence for this HSP as a string. |
| 223 | : The homology sequence is the string of symbols in between the |
| 224 | : query and hit sequences in the alignment indicating the degree |
| 225 | : of conservation (e.g., identical, similar, not similar). |
| 226 | Returns : string |
| 227 | Args : [optional] string to set for homology sequence |
| 228 | |
| 229 | =cut |
| 230 | |
| 231 | =head2 length |
| 232 | |
| 233 | Title : length |
| 234 | Usage : my $len = $hsp->length( ['query'|'hit'|'total'] ); |
| 235 | Function : Returns the length of the query or hit in the alignment |
| 236 | (without gaps) |
| 237 | or the aggregate length of the HSP (including gaps; |
| 238 | this may be greater than either hit or query ) |
| 239 | Returns : integer |
| 240 | Args : arg 1: 'query' = length of query seq (without gaps) |
| 241 | 'hit' = length of hit seq (without gaps) |
| 242 | 'total' = length of alignment (with gaps) |
| 243 | default = 'total' |
| 244 | arg 2: [optional] integer length value to set for specific type |
| 245 | |
| 246 | =cut |
| 247 | |
| 248 | =head2 percent_identity |
| 249 | |
| 250 | Title : percent_identity |
| 251 | Usage : my $percentid = $hsp->percent_identity() |
| 252 | Function: Returns the calculated percent identity for an HSP |
| 253 | Returns : floating point between 0 and 100 |
| 254 | Args : none |
| 255 | |
| 256 | |
| 257 | =cut |
| 258 | |
| 259 | |
| 260 | =head2 frame |
| 261 | |
| 262 | Title : frame |
| 263 | Usage : my ($qframe, $hframe) = $hsp->frame('list',$queryframe,$subjectframe) |
| 264 | Function: Set the Frame for both query and subject and insure that |
| 265 | they agree. |
| 266 | This overrides the frame() method implementation in |
| 267 | FeaturePair. |
| 268 | Returns : array of query and subject frame if return type wants an array |
| 269 | or query frame if defined or subject frame if not defined |
| 270 | Args : 'hit' or 'subject' or 'sbjct' to retrieve the frame of the subject (default) |
| 271 | 'query' to retrieve the query frame |
| 272 | 'list' or 'array' to retrieve both query and hit frames together |
| 273 | Note : Frames are stored in the GFF way (0-2) not 1-3 |
| 274 | as they are in BLAST (negative frames are deduced by checking |
| 275 | the strand of the query or hit) |
| 276 | |
| 277 | =cut |
| 278 | |
| 279 | =head2 get_aln |
| 280 | |
| 281 | Title : get_aln |
| 282 | Usage : my $aln = $hsp->gel_aln |
| 283 | Function: Returns a Bio::SimpleAlign representing the HSP alignment |
| 284 | Returns : Bio::SimpleAlign |
| 285 | Args : none |
| 286 | |
| 287 | =cut |
| 288 | |
| 289 | sub get_alnscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Search/HSP/HMMERHSP/get_aln(). { |
| 290 | my ($self) = shiftscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Search/HSP/HMMERHSP/shift().; |
| 291 | $self->warnscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Search/HSP/HMMERHSP/warn().("Inappropriate to build a Bio::SimpleAlign from a HMMER HSP object"); |
| 292 | return; |
| 293 | } |
| 294 | |
| 295 | =head2 num_conserved |
| 296 | |
| 297 | Title : num_conserved |
| 298 | Usage : $obj->num_conserved($newval) |
| 299 | Function: returns the number of conserved residues in the alignment |
| 300 | Returns : inetger |
| 301 | Args : integer (optional) |
| 302 | |
| 303 | |
| 304 | =cut |
| 305 | |
| 306 | =head2 num_identical |
| 307 | |
| 308 | Title : num_identical |
| 309 | Usage : $obj->num_identical($newval) |
| 310 | Function: returns the number of identical residues in the alignment |
| 311 | Returns : integer |
| 312 | Args : integer (optional) |
| 313 | |
| 314 | |
| 315 | =cut |
| 316 | |
| 317 | =head2 seq_inds |
| 318 | |
| 319 | Title : seq_inds |
| 320 | Purpose : Get a list of residue positions (indices) for all identical |
| 321 | : or conserved residues in the query or sbjct sequence. |
| 322 | Example : @s_ind = $hsp->seq_inds('query', 'identical'); |
| 323 | : @h_ind = $hsp->seq_inds('hit', 'conserved'); |
| 324 | : @h_ind = $hsp->seq_inds('hit', 'conserved', 1); |
| 325 | Returns : List of integers |
| 326 | : May include ranges if collapse is true. |
| 327 | Argument : seq_type = 'query' or 'hit' or 'sbjct' (default = query) |
| 328 | : ('sbjct' is synonymous with 'hit') |
| 329 | : class = 'identical' or 'conserved' or 'nomatch' or 'gap' |
| 330 | : (default = identical) |
| 331 | : (can be shortened to 'id' or 'cons') |
| 332 | : |
| 333 | : collapse = boolean, if true, consecutive positions are merged |
| 334 | : using a range notation, e.g., "1 2 3 4 5 7 9 10 11" |
| 335 | : collapses to "1-5 7 9-11". This is useful for |
| 336 | : consolidating long lists. Default = no collapse. |
| 337 | Throws : n/a. |
| 338 | Comments : |
| 339 | |
| 340 | See Also : L<Bio::Search::BlastUtils::collapse_nums()|Bio::Search::BlastUtils>, |
| 341 | L<Bio::Search::Hit::HitI::seq_inds()|Bio::Search::Hit::HitI> |
| 342 | |
| 343 | =cut |
| 344 | |
| 345 | =head2 Inherited from Bio::SeqFeature::SimilarityPair |
| 346 | |
| 347 | These methods come from Bio::SeqFeature::SimilarityPair |
| 348 | |
| 349 | =head2 query |
| 350 | |
| 351 | Title : query |
| 352 | Usage : my $query = $hsp->query |
| 353 | Function: Returns a SeqFeature representing the query in the HSP |
| 354 | Returns : Bio::SeqFeature::Similarity |
| 355 | Args : [optional] new value to set |
| 356 | |
| 357 | |
| 358 | =head2 hit |
| 359 | |
| 360 | Title : hit |
| 361 | Usage : my $hit = $hsp->hit |
| 362 | Function: Returns a SeqFeature representing the hit in the HSP |
| 363 | Returns : Bio::SeqFeature::Similarity |
| 364 | Args : [optional] new value to set |
| 365 | |
| 366 | |
| 367 | =head2 significance |
| 368 | |
| 369 | Title : significance |
| 370 | Usage : $evalue = $obj->significance(); |
| 371 | $obj->significance($evalue); |
| 372 | Function: Get/Set the significance value |
| 373 | Returns : numeric |
| 374 | Args : [optional] new value to set |
| 375 | |
| 376 | |
| 377 | =head2 score |
| 378 | |
| 379 | Title : score |
| 380 | Usage : my $score = $hsp->score(); |
| 381 | Function: Returns the score for this HSP or undef |
| 382 | Returns : numeric |
| 383 | Args : [optional] numeric to set value |
| 384 | |
| 385 | =cut |
| 386 | |
| 387 | =head2 bits |
| 388 | |
| 389 | Title : bits |
| 390 | Usage : my $bits = $hsp->bits(); |
| 391 | Function: Returns the bit value for this HSP or undef |
| 392 | Returns : numeric |
| 393 | Args : none |
| 394 | |
| 395 | =cut |
| 396 | |
| 397 | sub bitsscip-perl cpan Bio-SearchIO-hmmer 1.7.3 Bio/Search/HSP/HMMERHSP/bits(). { return 0; } |
| 398 | |
| 399 | 1; |