diff variant_effect_predictor/Bio/EnsEMBL/Compara/SyntenyRegion.pm @ 0:21066c0abaf5 draft

Uploaded
author willmclaren
date Fri, 03 Aug 2012 10:04:48 -0400
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/variant_effect_predictor/Bio/EnsEMBL/Compara/SyntenyRegion.pm	Fri Aug 03 10:04:48 2012 -0400
@@ -0,0 +1,261 @@
+=head1 LICENSE
+
+  Copyright (c) 1999-2012 The European Bioinformatics Institute and
+  Genome Research Limited.  All rights reserved.
+
+  This software is distributed under a modified Apache license.
+  For license details, please see
+
+    http://www.ensembl.org/info/about/code_licence.html
+
+=head1 CONTACT
+
+  Please email comments or questions to the public Ensembl
+  developers list at <dev@ensembl.org>.
+
+  Questions may also be sent to the Ensembl help desk at
+  <helpdesk@ensembl.org>.
+
+=head1 NAME
+
+Bio::EnsEMBL::Compara::SyntenyRegion - Synteny region
+
+=head1 SYNOPSIS
+
+  print $this_synteny_region->dbID;
+
+  print $this_synteny_region->method_link_species_set_id;
+
+  my $these_dnafrag_regions = $this_synteny_region->get_all_DnaFragRegions();
+  foreach my $this_dnafrag_region (@$these_dnafrag_regions) {
+    print $this_dnafrag_region->genome_db->name, ": ", $this_dnafrag_region->slice->name, "\n";
+  }
+
+=head1 DESCRIPTION
+
+A Bio::EnsEMBL::Compara::SyntenyRegion object is a container of Bio::EnsEMBL::Compara::DnaFragRegion
+objects. Each Bio::EnsEMBL::Compara::DnaFragRegion represent a genomic region which is in synteny
+with the other regions represented in the Bio::EnsEMBL::Compara::SyntenyRegion object.
+
+Also, the Bio::EnsEMBL::Compara::SyntenyRegion object implicitly contains a
+Bio::EnsEMBL::Compara::MethodLinkSpeciesSet object which defines the type of synteny.
+
+=head1 OBJECT ATTRIBUTES
+
+=over
+
+=item dbID
+
+corresponds to synteny_region.synteny_region_id
+
+=item adaptor
+
+Bio::EnsEMBL::Compara::DBSQL::SyntenyRegionAdaptor object to access DB
+
+=item method_link_species_set_id
+
+corresponds to synteny_region.method_link_species_set_id
+
+=back
+
+=head1 APPENDIX
+
+The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _
+
+=cut
+
+
+# Let the code begin...
+
+
+package Bio::EnsEMBL::Compara::SyntenyRegion;
+
+use strict;
+use Bio::EnsEMBL::Utils::Argument;
+use Bio::EnsEMBL::Utils::Exception;
+
+#use Bio::EnsEMBL::Compara::NestedSet;
+#our @ISA = qw(Bio::EnsEMBL::Compara::NestedSet);
+
+=head2 new_fast
+
+  Arg [-DBID] : integer $dbID
+  Arg [-METHOD_LINK_SPECIES_SET_ID]
+              : integer $method_link_species_set_id
+  Arg [-ADAPTOR]
+              : Bio::EnsEMBL::Compara::DBSQL::SyntenyRegionAdaptor $adaptor
+  Example     : none
+  Description : This is the default constructor
+  Returntype  : Bio::EnsEMBL::Compara::SyntenyRegion object
+  Exceptions  : none
+  Caller      :
+  Status      : Stable
+
+=cut
+
+sub new {
+  my ($class, @args) = @_;
+
+#  my $self = $class->SUPER::new(@args);
+
+  my $self = bless {}, $class;
+
+  if (scalar @args) {
+    #do this explicitly.
+    my ($dbid, $method_link_species_set_id, $adaptor, $regions) =
+        rearrange([qw(DBID METHOD_LINK_SPECIES_SET_ID ADAPTOR REGIONS)], @args);
+
+    $dbid && $self->dbID($dbid);
+    $regions && $self->regions($regions);
+    $method_link_species_set_id && $self->method_link_species_set_id($method_link_species_set_id);
+    $adaptor && $self->adaptor($adaptor);
+  }
+
+  return $self;
+}
+
+
+=head2 new_fast
+
+  Arg [1]     : hash reference $hashref
+  Example     : none
+  Description : This is an ultra fast constructor which requires knowledge of
+                the objects internals to be used.
+  Returntype  : Bio::EnsEMBL::Compara::SyntenyRegion object
+  Exceptions  : none
+  Caller      :
+  Status      : Stable
+
+=cut
+
+sub new_fast {
+  my ($class, $hashref) = @_;
+
+  return bless $hashref, $class;
+}
+
+
+=head2 stable_id
+
+DEPRECATED: SyntenyRegions don't have any stable id.
+
+=cut
+
+sub stable_id {
+  my $obj = shift;
+
+  deprecate("SyntenyRegions don't have any stable id.");
+
+  if( @_ ) {
+    my $value = shift;
+    $obj->{'stable_id'} = $value;
+  }
+
+  return $obj->{'stable_id'};
+}
+
+
+=head2 method_link_species_set_id
+
+  Arg [1]     : (optional) integer $method_link_species_set_id
+  Example     : none
+  Description : Getter/setter for the method_link_species_set_id value.
+  Returntype  : integer
+  Exceptions  : none
+  Caller      : general
+  Status      : Stable
+
+=cut
+
+sub method_link_species_set_id {
+  my $obj = shift;
+  if( @_ ) {
+    my $value = shift;
+    $obj->{'method_link_species_set_id'} = $value;
+  }
+  return $obj->{'method_link_species_set_id'};
+}
+
+
+=head2 dbID
+
+  Arg [1]     : (optional) integer $dbID
+  Example     : none
+  Description : Getter/setter for the dbID value. This corresponds to
+                synteny_region.synteny_region_id
+  Returntype  : integer
+  Exceptions  : none
+  Caller      : general
+  Status      : Stable
+
+=cut
+
+sub dbID {
+  my $obj = shift;
+
+  if (@_) {
+    my $value = shift;
+    $obj->{'dbID'} = $value;
+  }
+
+  return $obj->{'dbID'};
+}
+
+
+=head2 adaptor
+
+  Arg [1]     : (optional) Bio::EnsEMBL::Compara::DBSQL::SyntenyRegionAdaptor $adaptor
+  Example     : none
+  Description : Getter/setter for the adaptor
+  Returntype  : Bio::EnsEMBL::Compara::DBSQL::SyntenyRegionAdaptor object
+  Exceptions  : none
+  Caller      : general
+  Status      : Stable
+
+=cut
+
+sub adaptor {
+  my $obj = shift;
+
+  if (@_) {
+    my $value = shift;
+    $obj->{'adaptor'} = $value;
+  }
+
+  return $obj->{'adaptor'};
+}
+
+
+=head2 get_all_DnaFragRegions
+
+ Arg  1     : -none-
+ Example    : my $all_dnafrag_regions = $obj->get_all_DnaFragRegions();
+ Description: returns all the DnaFragRegion objects for this syntenic
+              region. This method is an alias for children(), see
+              Bio::EnsEMBL::Compara::NestedSet for more details.
+ Returntype : a ref. to an array of Bio::EnsEMBL::Compara::DnaFragRegion
+              objects
+ Exception  :
+ Caller     : general
+ Status     : Stable
+
+=cut
+
+sub get_all_DnaFragRegions {
+  my $obj = shift;
+
+  return $obj->regions();
+#  return $obj->children();
+}
+
+sub regions {
+  my ($obj, $value) = @_;
+
+  if (defined $value) {
+    $obj->{'regions'} = $value;
+  }
+
+  return $obj->{'regions'};
+}
+
+1;