| 1 | # | ||||||||||
| 2 | # BioPerl module for Bio::Tools::HMMER::Domain | ||||||||||
| 3 | # | ||||||||||
| 4 | # Please direct questions and support issues to <bioperl-l@bioperl.org> | ||||||||||
| 5 | # | ||||||||||
| 6 | # Cared for by Ewan Birney <birney@sanger.ac.uk> | ||||||||||
| 7 | # | ||||||||||
| 8 | # Copyright Ewan Birney | ||||||||||
| 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::Tools::HMMER::Domain - One particular domain hit from HMMER | ||||||||||
| 17 | |||||||||||
| 18 | =head1 SYNOPSIS | ||||||||||
| 19 | |||||||||||
| 20 | Read the Bio::Tools::HMMER::Results docs | ||||||||||
| 21 | |||||||||||
| 22 | =head1 DESCRIPTION | ||||||||||
| 23 | |||||||||||
| 24 | A particular domain score. We reuse the Homol SeqFeature system | ||||||||||
| 25 | here, so this inherits off Homol SeqFeature. As this code | ||||||||||
| 26 | originally came from a separate project, there are some backward | ||||||||||
| 27 | compatibility stuff provided to keep this working with old code. | ||||||||||
| 28 | |||||||||||
| 29 | Don't forget this inherits off Bio::SeqFeature, so all your usual | ||||||||||
| 30 | nice start/end/score stuff is ready for use. | ||||||||||
| 31 | |||||||||||
| 32 | =head1 CONTACT | ||||||||||
| 33 | |||||||||||
| 34 | Ewan Birney, birney@ebi.ac.uk | ||||||||||
| 35 | |||||||||||
| 36 | =head1 CONTRIBUTORS | ||||||||||
| 37 | |||||||||||
| 38 | Jason Stajich, jason@bioperl.org | ||||||||||
| 39 | |||||||||||
| 40 | =head1 APPENDIX | ||||||||||
| 41 | |||||||||||
| 42 | The rest of the documentation details each of the object | ||||||||||
| 43 | methods. Internal methods are usually preceded with a _ | ||||||||||
| 44 | |||||||||||
| 45 | =cut | ||||||||||
| 46 | |||||||||||
| 47 | #' | ||||||||||
| 48 | package Bio::Tools::HMMER::Domain; | ||||||||||
| 49 | 4 | $Bio::Tools::HMMER::Domain::VERSION = '1.7.3'; | |||||||||
| 50 | 4 | ▶ | use Bio::SeqFeature::Generic; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 51 | 4 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 52 | |||||||||||
| 53 | |||||||||||
| 54 | 4 | ▶ | use base qw(Bio::SeqFeature::FeaturePair); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 55 | |||||||||||
| 56 | 2434 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 57 | 2434 | my($class,@args) = @_; | |||||||||
| 58 | 2434 | my $self = $class->SUPER::new(@args); | |||||||||
| 59 | |||||||||||
| 60 | 2434 | $self->{'alignlines'} = []; | |||||||||
| 61 | |||||||||||
| 62 | 2434 | my $hmmf1 = Bio::SeqFeature::Generic->new(@args); | |||||||||
| 63 | 2434 | my $hmmf2 = Bio::SeqFeature::Generic->new(@args); | |||||||||
| 64 | |||||||||||
| 65 | 2434 | $self->feature1($hmmf1); | |||||||||
| 66 | 2434 | $self->feature2($hmmf2); | |||||||||
| 67 | |||||||||||
| 68 | 2434 | return $self; | |||||||||
| 69 | } | ||||||||||
| 70 | |||||||||||
| 71 | =head2 add_alignment_line | ||||||||||
| 72 | |||||||||||
| 73 | Title : add_alignment_line | ||||||||||
| 74 | Usage : $domain->add_alignment_line($line_from_hmmer_output); | ||||||||||
| 75 | Function: add an alignment line to this Domain object | ||||||||||
| 76 | Returns : Nothing | ||||||||||
| 77 | Args : scalar | ||||||||||
| 78 | |||||||||||
| 79 | Adds an alignment line, mainly for storing the HMMER alignments | ||||||||||
| 80 | as flat text which can be reguritated. You're right. This is *not | ||||||||||
| 81 | nice* and not the right way to do it. C'est la vie. | ||||||||||
| 82 | |||||||||||
| 83 | =cut | ||||||||||
| 84 | |||||||||||
| 85 | 40 | ▶ | sub add_alignment_line { | ||||||||
|
Subroutine
add_alignment_line: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 86 | 40 | my $self = shift; | |||||||||
| 87 | 40 | my $line = shift; | |||||||||
| 88 | 40 | push(@{$self->{'alignlines'}},$line); | |||||||||
| 89 | } | ||||||||||
| 90 | |||||||||||
| 91 | =head2 each_alignment_line | ||||||||||
| 92 | |||||||||||
| 93 | Title : each_alignment_line | ||||||||||
| 94 | Usage : foreach $line ( $domain->each_alignment_line ) | ||||||||||
| 95 | Function: reguritates the alignment lines as they were fed in. | ||||||||||
| 96 | only useful realistically for printing. | ||||||||||
| 97 | Example : | ||||||||||
| 98 | Returns : | ||||||||||
| 99 | Args : None | ||||||||||
| 100 | |||||||||||
| 101 | |||||||||||
| 102 | =cut | ||||||||||
| 103 | |||||||||||
| 104 | 0 | ▶ | sub each_alignment_line { | ||||||||
|
Subroutine
each_alignment_line: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 105 | 0 | my $self = shift; | |||||||||
| 106 | 0 | return @{$self->{'alignlines'}}; | |||||||||
| 107 | } | ||||||||||
| 108 | |||||||||||
| 109 | =head2 get_nse | ||||||||||
| 110 | |||||||||||
| 111 | Title : get_nse | ||||||||||
| 112 | Usage : $domain->get_nse() | ||||||||||
| 113 | Function: Provides a seqname/start-end format, useful | ||||||||||
| 114 | for unique keys. nse stands for name-start-end | ||||||||||
| 115 | It is used a lot in Pfam | ||||||||||
| 116 | Example : | ||||||||||
| 117 | Returns : A string | ||||||||||
| 118 | Args : Optional separator 1 and separator 2 (default / and -) | ||||||||||
| 119 | |||||||||||
| 120 | |||||||||||
| 121 | =cut | ||||||||||
| 122 | |||||||||||
| 123 | |||||||||||
| 124 | |||||||||||
| 125 | 3038 | ▶ | sub get_nse { | ||||||||
|
Subroutine
get_nse: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||
| 126 | 3038 | my $self = shift; | |||||||||
| 127 | 3038 | my $sep1 = shift; | |||||||||
| 128 | 3038 | my $sep2 = shift; | |||||||||
| 129 | |||||||||||
| 130 | 3038 | ▶ | if( !defined $sep2 ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 131 | 3038 | $sep2 = "-"; | |||||||||
| 132 | } | ||||||||||
| 133 | 3038 | ▶ | if( !defined $sep1 ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 134 | 3038 | $sep1 = "/"; | |||||||||
| 135 | } | ||||||||||
| 136 | |||||||||||
| 137 | 3038 | return sprintf("%s%s%d%s%d",$self->seq_id,$sep1,$self->start,$sep2,$self->end); | |||||||||
| 138 | } | ||||||||||
| 139 | |||||||||||
| 140 | |||||||||||
| 141 | # =head2 start_seq | ||||||||||
| 142 | |||||||||||
| 143 | # Title : start_seq | ||||||||||
| 144 | # Usage : Backward compatibility with old HMMER modules. | ||||||||||
| 145 | # should use $domain->start | ||||||||||
| 146 | # Function: | ||||||||||
| 147 | # Example : | ||||||||||
| 148 | # Returns : | ||||||||||
| 149 | # Args : | ||||||||||
| 150 | |||||||||||
| 151 | # =cut | ||||||||||
| 152 | |||||||||||
| 153 | 0 | ▶ | sub start_seq { | ||||||||
|
Subroutine
start_seq: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 154 | 0 | my $self = shift; | |||||||||
| 155 | 0 | my $start = shift; | |||||||||
| 156 | |||||||||||
| 157 | 0 | $self->warn("Using old domain->start_seq. Should use domain->start"); | |||||||||
| 158 | 0 | return $self->start($start); | |||||||||
| 159 | } | ||||||||||
| 160 | |||||||||||
| 161 | # =head2 end_seq | ||||||||||
| 162 | |||||||||||
| 163 | # Title : end_seq | ||||||||||
| 164 | # Usage : Backward compatibility with old HMMER modules. | ||||||||||
| 165 | # should use $domain->end | ||||||||||
| 166 | # Function: | ||||||||||
| 167 | # Example : | ||||||||||
| 168 | # Returns : | ||||||||||
| 169 | # Args : | ||||||||||
| 170 | |||||||||||
| 171 | # =cut | ||||||||||
| 172 | |||||||||||
| 173 | 0 | ▶ | sub end_seq { | ||||||||
|
Subroutine
end_seq: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 174 | 0 | my $self = shift; | |||||||||
| 175 | 0 | my $end = shift; | |||||||||
| 176 | |||||||||||
| 177 | 0 | $self->warn("Using old domain->end_seq. Should use domain->end"); | |||||||||
| 178 | 0 | return $self->end($end); | |||||||||
| 179 | } | ||||||||||
| 180 | |||||||||||
| 181 | # =head2 start_hmm | ||||||||||
| 182 | |||||||||||
| 183 | # Title : start_hmm | ||||||||||
| 184 | # Usage : Backward compatibility with old HMMER modules, and | ||||||||||
| 185 | # for convience. Equivalent to $self->homol_SeqFeature->start | ||||||||||
| 186 | # Function: | ||||||||||
| 187 | # Example : | ||||||||||
| 188 | # Returns : | ||||||||||
| 189 | # Args : | ||||||||||
| 190 | |||||||||||
| 191 | # =cut | ||||||||||
| 192 | |||||||||||
| 193 | 0 | ▶ | sub start_hmm { | ||||||||
|
Subroutine
start_hmm: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 194 | 0 | my $self = shift; | |||||||||
| 195 | 0 | my $start = shift; | |||||||||
| 196 | 0 | $self->warn("Using old domain->start_hmm. Should use domain->hstart"); | |||||||||
| 197 | 0 | return $self->hstart($start); | |||||||||
| 198 | } | ||||||||||
| 199 | |||||||||||
| 200 | # =head2 end_hmm | ||||||||||
| 201 | |||||||||||
| 202 | # Title : end_hmm | ||||||||||
| 203 | # Usage : Backward compatibility with old HMMER modules, and | ||||||||||
| 204 | # for convience. Equivalent to $self->homol_SeqFeature->start | ||||||||||
| 205 | # Function: | ||||||||||
| 206 | # Example : | ||||||||||
| 207 | # Returns : | ||||||||||
| 208 | # Args : | ||||||||||
| 209 | |||||||||||
| 210 | # =cut | ||||||||||
| 211 | |||||||||||
| 212 | 0 | ▶ | sub end_hmm { | ||||||||
|
Subroutine
end_hmm: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 213 | 0 | my $self = shift; | |||||||||
| 214 | 0 | my $end = shift; | |||||||||
| 215 | |||||||||||
| 216 | 0 | $self->warn("Using old domain->end_hmm. Should use domain->hend"); | |||||||||
| 217 | 0 | return $self->hend($end); | |||||||||
| 218 | } | ||||||||||
| 219 | |||||||||||
| 220 | =head2 hmmacc | ||||||||||
| 221 | |||||||||||
| 222 | Title : hmmacc | ||||||||||
| 223 | Usage : $domain->hmmacc($newacc) | ||||||||||
| 224 | Function: set get for HMM accession number. This is placed in the homol | ||||||||||
| 225 | feature of the HMM | ||||||||||
| 226 | Example : | ||||||||||
| 227 | Returns : | ||||||||||
| 228 | Args : | ||||||||||
| 229 | |||||||||||
| 230 | |||||||||||
| 231 | =cut | ||||||||||
| 232 | |||||||||||
| 233 | 1 | ▶ | sub hmmacc{ | ||||||||
|
Subroutine
hmmacc: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||
| 234 | 1 | my ($self,$acc) = @_; | |||||||||
| 235 | 1 | ▶ | if( defined $acc ) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 236 | 1 | $self->feature2->add_tag_value('accession',$acc); | |||||||||
| 237 | } | ||||||||||
| 238 | 1 | my @vals = $self->feature2->each_tag_value('accession'); | |||||||||
| 239 | 1 | return shift @vals; | |||||||||
| 240 | } | ||||||||||
| 241 | |||||||||||
| 242 | =head2 hmmname | ||||||||||
| 243 | |||||||||||
| 244 | Title : hmmname | ||||||||||
| 245 | Usage : $domain->hmmname($newname) | ||||||||||
| 246 | Function: set get for HMM accession number. This is placed in the homol | ||||||||||
| 247 | feature of the HMM | ||||||||||
| 248 | Example : | ||||||||||
| 249 | Returns : | ||||||||||
| 250 | Args : | ||||||||||
| 251 | |||||||||||
| 252 | =cut | ||||||||||
| 253 | |||||||||||
| 254 | 2437 | ▶ | sub hmmname { | ||||||||
|
Subroutine
hmmname: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 255 | 2437 | return shift->hseq_id(@_); | |||||||||
| 256 | } | ||||||||||
| 257 | |||||||||||
| 258 | =head2 bits | ||||||||||
| 259 | |||||||||||
| 260 | Title : bits | ||||||||||
| 261 | Usage : | ||||||||||
| 262 | Function: backward compatibility. Same as score | ||||||||||
| 263 | Example : | ||||||||||
| 264 | Returns : | ||||||||||
| 265 | Args : | ||||||||||
| 266 | |||||||||||
| 267 | =cut | ||||||||||
| 268 | |||||||||||
| 269 | 3145 | ▶ | sub bits{ | ||||||||
|
Subroutine
bits: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 270 | 3145 | return shift->score(@_); | |||||||||
| 271 | } | ||||||||||
| 272 | |||||||||||
| 273 | =head2 evalue | ||||||||||
| 274 | |||||||||||
| 275 | Title : evalue | ||||||||||
| 276 | Usage : | ||||||||||
| 277 | Function: $domain->evalue($value); | ||||||||||
| 278 | Example : | ||||||||||
| 279 | Returns : | ||||||||||
| 280 | Args : | ||||||||||
| 281 | |||||||||||
| 282 | =cut | ||||||||||
| 283 | |||||||||||
| 284 | 2435 | ▶ | sub evalue{ | ||||||||
|
Subroutine
evalue: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 285 | 2435 | return shift->_tag_value('evalue',@_); | |||||||||
| 286 | } | ||||||||||
| 287 | |||||||||||
| 288 | =head2 seqbits | ||||||||||
| 289 | |||||||||||
| 290 | Title : seqbits | ||||||||||
| 291 | Usage : | ||||||||||
| 292 | Function: $domain->seqbits($value); | ||||||||||
| 293 | Example : | ||||||||||
| 294 | Returns : | ||||||||||
| 295 | Args : | ||||||||||
| 296 | |||||||||||
| 297 | =cut | ||||||||||
| 298 | |||||||||||
| 299 | 2434 | ▶ | sub seqbits { | ||||||||
|
Subroutine
seqbits: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 300 | 2434 | return shift->_tag_value('seqbits',@_); | |||||||||
| 301 | } | ||||||||||
| 302 | |||||||||||
| 303 | =head2 seq_range | ||||||||||
| 304 | |||||||||||
| 305 | Title : seq_range | ||||||||||
| 306 | Usage : | ||||||||||
| 307 | Function: Throws an exception to catch scripts which need to upgrade | ||||||||||
| 308 | Example : | ||||||||||
| 309 | Returns : | ||||||||||
| 310 | Args : | ||||||||||
| 311 | |||||||||||
| 312 | =cut | ||||||||||
| 313 | |||||||||||
| 314 | 0 | ▶ | sub seq_range{ | ||||||||
|
Subroutine
seq_range: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 315 | 0 | my ($self,@args) = @_; | |||||||||
| 316 | |||||||||||
| 317 | 0 | $self->throw("You have accessed an old method. Please recode your script to the new bioperl HMMER module"); | |||||||||
| 318 | } | ||||||||||
| 319 | |||||||||||
| 320 | =head2 hmm_range | ||||||||||
| 321 | |||||||||||
| 322 | Title : hmm_range | ||||||||||
| 323 | Usage : | ||||||||||
| 324 | Function: Throws an exception to catch scripts which need to upgrade | ||||||||||
| 325 | Example : | ||||||||||
| 326 | Returns : | ||||||||||
| 327 | Args : | ||||||||||
| 328 | |||||||||||
| 329 | |||||||||||
| 330 | =cut | ||||||||||
| 331 | |||||||||||
| 332 | 0 | ▶ | sub hmm_range{ | ||||||||
|
Subroutine
hmm_range: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 333 | 0 | my ($self,@args) = @_; | |||||||||
| 334 | |||||||||||
| 335 | 0 | $self->throw("You have accessed an old method. Please recode your script to the new bioperl HMMER module"); | |||||||||
| 336 | } | ||||||||||
| 337 | |||||||||||
| 338 | 4 | 1; # says use was ok | |||||||||
| 339 | __END__ | ||||||||||