Archive Ensembl HomeArchive Ensembl Home
SitewiseOmega.pm
Go to the documentation of this file.
00001 
00002 #
00003 # Ensembl module for Bio::EnsEMBL::Compara::SitewiseOmega
00004 #
00005 # Cared for by Albert Vilella <avilella@ebi.ac.uk>
00006 #
00007 # Copyright Albert Vilella
00008 #
00009 # You may distribute this module under the same terms as perl itself
00010 
00011 # POD documentation - main docs before the code
00012 
00013 =head1 NAME
00014 
00015 Bio::EnsEMBL::Compara::SitewiseOmega - DESCRIPTION of Object
00016 
00017 =head1 SYNOPSIS
00018 
00019 Give standard usage here
00020 
00021 =head1 DESCRIPTION
00022 
00023 Describe the object here
00024 
00025 =head1 AUTHOR - Albert Vilella
00026 
00027 This modules is part of the Ensembl project http://www.ensembl.org
00028 
00029 Email avilella@ebi.ac.uk
00030 
00031 Describe contact details here
00032 
00033 =head1 APPENDIX
00034 
00035 The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
00036 
00037 =cut
00038 
00039 
00040 # Let the code begin...
00041 
00042 
00043 package Bio::EnsEMBL::Compara::SitewiseOmega;
00044 
00045 use strict;
00046 
00047 use Bio::EnsEMBL::Utils::Argument qw(rearrange);
00048 use Bio::EnsEMBL::Utils::Exception qw(warning deprecate throw);
00049 
00050 =head2 new_fast
00051 
00052   Arg [1]    : hash reference $hashref
00053   Example    : none
00054   Description: This is an ultra fast constructor which requires knowledge of
00055                the objects internals to be used.
00056   Returntype :
00057   Exceptions : none
00058   Caller     :
00059 
00060 =cut
00061 
00062 sub new_fast {
00063   my ($class, $hashref) = @_;
00064 
00065   return bless $hashref, $class;
00066 }
00067 
00068 =head2 member_position
00069 
00070   Arg [1]    : Bio::EnsEMBL::Member $member
00071   Arg [2]    : Bio::SimpleAlign $aln
00072   Example    : $sitewise_omega->member_position($member,$aln);
00073   Description: Obtain the member position for a given sitewise_omega value
00074   Returntype : integer
00075   Exceptions : return undef if member not in the alignment or aln_position not in member
00076   Caller     : general
00077   Status     : At risk
00078 
00079 =cut
00080 
00081 sub member_position {
00082   my ($self, $member, $aln) = @_;
00083 
00084   throw("$member is not a Bio::EnsEMBL::Compara::Member object")
00085     unless ($member->isa("Bio::EnsEMBL::Compara::Member"));
00086 
00087   throw("$aln is not a Bio::SimpleAlign object")
00088     unless ($aln->isa("Bio::SimpleAlign"));
00089 
00090   my @seqs = $aln->each_seq_with_id($member->stable_id);
00091   my $seq = $seqs[0];
00092 
00093   my $seq_location;
00094   eval { $seq_location = $seq->location_from_column($self->aln_position);};
00095   return undef if ($@);
00096   my $location_type;
00097   eval { $location_type = $seq_location->location_type;};
00098   return undef if ($@);
00099   if ($seq_location->location_type eq 'EXACT') {
00100     my $member_position = $seq_location->start;
00101     return $member_position;
00102   }
00103 
00104   return undef;
00105 }
00106 
00107 =head2 adaptor
00108 
00109   Arg [1]    : Bio::EnsEMBL::DBSQL::SitewiseOmegaAdaptor $adaptor
00110   Example    : $sitewise_omega->adaptor($adaptor);
00111   Description: Getter/Setter for the adaptor this object used for database
00112                interaction
00113   Returntype : Bio::EnsEMBL::DBSQL::SitewiseOmegaAdaptor object
00114   Exceptions : thrown if the argument is not a
00115                Bio::EnsEMBL::DBSQL::SitewiseOmegaAdaptor object
00116   Caller     : general
00117   Status     : At risk
00118 
00119 =cut
00120 
00121 sub adaptor {
00122   my ( $self, $adaptor ) = @_;
00123 
00124   if (defined($adaptor)) {
00125     throw("$adaptor is not a Bio::EnsEMBL::Compara::DBSQL::SitewiseOmegaAdaptor object")
00126         unless ($adaptor->isa("Bio::EnsEMBL::Compara::DBSQL::SitewiseOmegaAdaptor"));
00127     $self->{'adaptor'} = $adaptor;
00128   }
00129 
00130   return $self->{'adaptor'};
00131 }
00132 
00133 =head2 aln_position
00134 
00135   Arg [1]    : (opt) integer
00136   Example    : $sitewise_dnds->aln_position(1);
00137   Description: Getter/Setter for the alignment position
00138   Returntype : integer. Return 1 if value not defined
00139   Exceptions : none
00140   Caller     : general
00141   Status     : At risk
00142 
00143 =cut
00144 
00145 sub aln_position {
00146     my ($self, $aln_position) = @_;
00147 
00148     if(defined $aln_position) {
00149     $self->{'aln_position'} = $aln_position;
00150     }
00151 
00152   $self->{'aln_position'}= undef unless(defined($self->{'aln_position'}));
00153   return $self->{'aln_position'};
00154 }
00155 
00156 
00157 =head2 omega
00158 
00159   Arg [1]    : (opt) integer
00160   Example    : $sitewise_dnds->omega(1);
00161   Description: Getter/Setter for the omega value
00162   Returntype : integer. Return 1 if value not defined
00163   Exceptions : none
00164   Caller     : general
00165   Status     : At risk
00166 
00167 =cut
00168 
00169 sub omega {
00170     my ($self, $omega) = @_;
00171 
00172     if(defined $omega) {
00173     $self->{'omega'} = $omega;
00174     }
00175 
00176   $self->{'omega'}= undef unless(defined($self->{'omega'}));
00177   return $self->{'omega'};
00178 }
00179 
00180 
00181 =head2 omega_lower
00182 
00183   Arg [1]    : (opt) float
00184   Example    : $sitewise_dnds->omega_lower(1);
00185   Description: Getter/Setter for the omega_lower value
00186   Returntype : float. Return 1 if value not defined
00187   Exceptions : none
00188   Caller     : general
00189   Status     : At risk
00190 
00191 =cut
00192 
00193 sub omega_lower {
00194     my ($self, $omega_lower) = @_;
00195 
00196     if(defined $omega_lower) {
00197     $self->{'omega_lower'} = $omega_lower;
00198     }
00199 
00200   $self->{'omega_lower'}= undef unless(defined($self->{'omega_lower'}));
00201   return $self->{'omega_lower'};
00202 }
00203 
00204 
00205 =head2 omega_upper
00206 
00207   Arg [1]    : (opt) float
00208   Example    : $sitewise_dnds->omega_upper(1);
00209   Description: Getter/Setter for the omega_upper value
00210   Returntype : float. Return 1 if value not defined
00211   Exceptions : none
00212   Caller     : general
00213   Status     : At risk
00214 
00215 =cut
00216 
00217 sub omega_upper {
00218     my ($self, $omega_upper) = @_;
00219 
00220     if(defined $omega_upper) {
00221     $self->{'omega_upper'} = $omega_upper;
00222     }
00223 
00224   $self->{'omega_upper'}= undef unless(defined($self->{'omega_upper'}));
00225   return $self->{'omega_upper'};
00226 }
00227 
00228 
00229 =head2 optimal
00230 
00231   Arg [1]    : (opt) float
00232   Example    : $sitewise_dnds->optimal(1);
00233   Description: Getter/Setter for the optimal value
00234   Returntype : float. Return 1 if value not defined
00235   Exceptions : none
00236   Caller     : general
00237   Status     : At risk
00238 
00239 =cut
00240 
00241 sub optimal {
00242     my ($self, $optimal) = @_;
00243 
00244     if(defined $optimal) {
00245     $self->{'optimal'} = $optimal;
00246     }
00247 
00248   $self->{'optimal'}= undef unless(defined($self->{'optimal'}));
00249   return $self->{'optimal'};
00250 }
00251 
00252 
00253 =head2 threshold_on_branch_ds
00254 
00255   Arg [1]    : (opt) float
00256   Example    : $sitewise_dnds->threshold_on_branch_ds(1);
00257   Description: Getter/Setter for the threshold_on_branch_ds value
00258   Returntype : float. Return 1 if value not defined
00259   Exceptions : none
00260   Caller     : general
00261   Status     : At risk
00262 
00263 =cut
00264 
00265 sub threshold_on_branch_ds {
00266     my ($self, $threshold_on_branch_ds) = @_;
00267 
00268     if(defined $threshold_on_branch_ds) {
00269     $self->{'threshold_on_branch_ds'} = $threshold_on_branch_ds;
00270     }
00271 
00272   $self->{'threshold_on_branch_ds'}= undef unless(defined($self->{'threshold_on_branch_ds'}));
00273   return $self->{'threshold_on_branch_ds'};
00274 }
00275 
00276 =head2 type
00277 
00278   Arg [1]    : (opt) integer
00279   Example    : $sitewise_dnds->type(1);
00280   Description: Getter/Setter for the type value
00281   Returntype : integer. Return 1 if value not defined
00282   Exceptions : none
00283   Caller     : general
00284   Status     : At risk
00285 
00286 =cut
00287 
00288 sub type {
00289     my ($self, $type) = @_;
00290 
00291     if(defined $type) {
00292     $self->{'type'} = $type;
00293     }
00294 
00295   $self->{'type'}= undef unless(defined($self->{'type'}));
00296   return $self->{'type'};
00297 }
00298 
00299 
00300 =head2 node_id
00301 
00302   Arg [1]    : (opt) integer
00303   Example    : $sitewise_dnds->node_id(1);
00304   Description: Getter/Setter for the node_id value
00305   Returnnode_id : integer. Return 1 if value not defined
00306   Exceptions : none
00307   Caller     : general
00308   Status     : At risk
00309 
00310 =cut
00311 
00312 sub node_id {
00313     my ($self, $node_id) = @_;
00314 
00315     if(defined $node_id) {
00316     $self->{'node_id'} = $node_id;
00317     }
00318 
00319   $self->{'node_id'}= undef unless(defined($self->{'node_id'}));
00320   return $self->{'node_id'};
00321 }
00322 
00323 =head2 tree_node_id
00324 
00325   Arg [1]    : (opt) integer
00326   Example    : $sitewise_dnds->tree_node_id(1);
00327   Description: Getter/Setter for the tree_node_id value
00328   Returntree_node_id : integer. Return 1 if value not defined
00329   Exceptions : none
00330   Caller     : general
00331   Status     : At risk
00332 
00333 =cut
00334 
00335 sub tree_node_id {
00336     my ($self, $tree_node_id) = @_;
00337 
00338     if(defined $tree_node_id) {
00339     $self->{'tree_node_id'} = $tree_node_id;
00340     }
00341 
00342   $self->{'tree_node_id'}= undef unless(defined($self->{'tree_node_id'}));
00343   return $self->{'tree_node_id'};
00344 }
00345 
00346 
00347 sub dbID {
00348     my ($self, $dbID) = @_;
00349 
00350     if(defined $dbID) {
00351     $self->{'_dbID'} = $dbID;
00352     }
00353 
00354   $self->{'_dbID'}= undef unless(defined($self->{'_dbID'}));
00355   return $self->{'_dbID'};
00356 }
00357 
00358 
00359 
00360 
00361 1;