Archive Ensembl HomeArchive Ensembl Home
AnchorAlign.pm
Go to the documentation of this file.
00001 =head1 NAME - Bio::EnsEMBL::Compara::Production::EPOanchors::AnchorAlign
00002 
00003 =head1 SYNOPSIS
00004 
00005 =head1 DESCRIPTION
00006 
00007 =head1 CONTACT
00008 
00009 Ensembl-dev mailing list <dev@ensembl.org>
00010 
00011 =head1 APPENDIX
00012 
00013 The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
00014 
00015 =cut
00016 
00017 package Bio::EnsEMBL::Compara::Production::EPOanchors::AnchorAlign;
00018 
00019 use strict;
00020 use Bio::EnsEMBL::Utils::Argument qw(rearrange);
00021 use Bio::EnsEMBL::Compara::DnaFrag;
00022 use Bio::EnsEMBL::Utils::Exception;
00023 
00024 sub new {
00025     my($class, @args) = @_;
00026 
00027     my $self = {};
00028     bless $self,$class;
00029 
00030     ## First lines are for backward compatibility, middle one is for both versions and
00031     ## last ones are for the new schema
00032     my ($adaptor, $dbID, $method_link_species_set, $method_link_species_set_id, $anchor_id,
00033         $dnafrag, $dnafrag_id, $dnafrag_start, $dnafrag_end, $dnafrag_strand,
00034         $score, $num_of_organisms, $num_of_sequences, $evalue, $anchor_status) =
00035       rearrange([qw(
00036           ADAPTOR DBID METHOD_LINK_SPECIES_SET METHOD_LINK_SPECIES_SET_ID ANCHOR_ID
00037           DNAFRAG DNAFRAG_ID DNAFRAG_START DNAFRAG_END DNAFRAG_STRAND
00038           SCORE NUM_OF_ORGANISMS NUM_OF_SEQUENCES EVALUE ANCHOR_STATUS)], @args);
00039 
00040     $self->adaptor($adaptor) if (defined($adaptor));
00041     $self->dbID($dbID) if (defined($dbID));
00042     $self->method_link_species_set($method_link_species_set) if (defined($method_link_species_set));
00043     $self->method_link_species_set_id($method_link_species_set_id) if (defined($method_link_species_set_id));
00044     $self->anchor_id($anchor_id) if (defined($anchor_id));
00045     $self->dnafrag($dnafrag) if (defined($dnafrag));
00046     $self->dnafrag_id($dnafrag_id) if (defined($dnafrag_id));
00047     $self->dnafrag_start($dnafrag_start) if (defined($dnafrag_start));
00048     $self->dnafrag_end($dnafrag_end) if (defined($dnafrag_end));
00049     $self->dnafrag_strand($dnafrag_strand) if (defined($dnafrag_strand));
00050     $self->score($score) if (defined($score));
00051     $self->num_of_organisms($num_of_organisms) if (defined($num_of_organisms));
00052     $self->num_of_sequences($num_of_sequences) if (defined($num_of_sequences));
00053     $self->evalue($evalue) if (defined($evalue));
00054     $self->anchor_status($anchor_status) if (defined($anchor_status));
00055     return $self;
00056 }
00057 
00058 sub adaptor {
00059   my $self = shift;
00060   if (@_) {
00061     $self->{_adaptor} = shift;
00062   }
00063   return $self->{_adaptor};
00064 }
00065 
00066 sub dbID {
00067   my $self = shift;
00068   if (@_) {
00069     $self->{_dbID} = shift;
00070   }
00071   return $self->{_dbID};
00072 }
00073 
00074 sub method_link_species_set {
00075   my $self = shift;
00076   if (@_) {
00077     $self->{_method_link_species_set} = shift;
00078   }
00079   return $self->{_method_link_species_set};
00080 }
00081 
00082 sub method_link_species_set_id {
00083   my $self = shift;
00084   if (@_) {
00085     $self->{_method_link_species_set_id} = shift;
00086   }
00087   if (!defined($self->{_method_link_species_set_id}) and defined($self->{_method_link_species_set})) {
00088     $self->{_method_link_species_set_id} = $self->{_method_link_species_set}->dbID;
00089   }
00090   return $self->{_method_link_species_set_id};
00091 }
00092 
00093 sub anchor_id {
00094   my $self = shift;
00095   if (@_) {
00096     $self->{_anchor_id} = shift;
00097   }
00098   return $self->{_anchor_id};
00099 }
00100 
00101 sub evalue {
00102   my $self = shift;
00103   if (@_) {
00104     $self->{_evalue} = shift;
00105   }
00106   return $self->{_evalue};
00107 }
00108 
00109 sub dnafrag {
00110   my $self = shift;
00111   if (@_) {
00112     $self->{_dnafrag} = shift;
00113   } elsif (!$self->{_dnafrag} and $self->{_dnafrag_id} and $self->{_adaptor}) {
00114     $self->{_dnafrag} = $self->{_adaptor}->db->get_DnaFragAdaptor->fetch_by_dbID($self->{_dnafrag_id});
00115   }
00116   return $self->{_dnafrag};
00117 }
00118 
00119 sub dnafrag_id {
00120   my $self = shift;
00121   if (@_) {
00122     $self->{_dnafrag_id} = shift;
00123   }
00124   if (!defined($self->{_dnafrag_id}) and defined($self->{_dnafrag})) {
00125     $self->{_dnafrag_id} = $self->{_dnafrag}->dbID;
00126   }
00127   return $self->{_dnafrag_id};
00128 }
00129 
00130 sub dnafrag_start {
00131   my $self = shift;
00132   if (@_) {
00133     $self->{_dnafrag_start} = shift;
00134   }
00135   return $self->{_dnafrag_start};
00136 }
00137 
00138 sub dnafrag_end {
00139   my $self = shift;
00140   if (@_) {
00141     $self->{_dnafrag_end} = shift;
00142   }
00143   return $self->{_dnafrag_end};
00144 }
00145 
00146 sub dnafrag_strand {
00147   my $self = shift;
00148   if (@_) {
00149     $self->{_dnafrag_strand} = shift;
00150   }
00151   return $self->{_dnafrag_strand};
00152 }
00153 
00154 sub score {
00155   my $self = shift;
00156   if (@_) {
00157     $self->{_score} = shift;
00158   }
00159   return $self->{_score};
00160 }
00161 
00162 sub num_of_organisms {
00163   my $self = shift;
00164   if (@_) {
00165     $self->{_num_of_organisms} = shift;
00166   }
00167   return $self->{_num_of_organisms};
00168 }
00169 
00170 sub num_of_sequences {
00171   my $self = shift;
00172   if (@_) {
00173     $self->{_num_of_sequences} = shift;
00174   }
00175   return $self->{_num_of_sequences};
00176 }
00177 
00178 sub anchor_status {
00179   my $self = shift;
00180   if (@_) {
00181     $self->{_anchor_status} = shift;
00182   }
00183   return $self->{_anchor_status};
00184 }
00185 
00186 sub seq {
00187   my $self = shift;
00188   return $self->{'_seq'} if ($self->{'_seq'});
00189 
00190   my $seq = $self->dnafrag->slice()->subseq($self->{'_dnafrag_start'},
00191       $self->{'_dnafrag_end'}, $self->{'_dnafrag_strand'});
00192   $self->{'_seq'} = $seq;
00193 
00194   return $self->{'_seq'};
00195 }
00196 
00197 1;