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