Bio::EnsEMBL::Compara BaseRelation
Package variablesGeneral documentationMethods
Toolbar
WebCvsRaw content
Package variables
No package variables defined.
Included modules
Bio::EnsEMBL::Utils::Argument
Bio::EnsEMBL::Utils::Exception
Synopsis
No synopsis!
Description
No description!
Methods
Member_count_by_GenomeDBDescriptionCode
Member_count_by_sourceDescriptionCode
Member_count_by_source_GenomeDBDescriptionCode
Member_count_by_source_taxonDescriptionCode
_get_Member_AttributeDescriptionCode
adaptorDescriptionCode
add_Member_Attribute
No description
Code
dbIDDescriptionCode
descriptionDescriptionCode
get_Member_Attribute_by_GenomeDBDescriptionCode
get_Member_Attribute_by_sourceDescriptionCode
get_Member_Attribute_by_source_GenomeDBDescriptionCode
get_Member_Attribute_by_source_taxonDescriptionCode
get_all_Member_AttributeDescriptionCode
get_all_MembersDescriptionCode
known_sources
No description
Code
method_link_idDescriptionCode
method_link_species_setDescriptionCode
method_link_species_set_idDescriptionCode
method_link_typeDescriptionCode
new
No description
Code
new_fastDescriptionCode
source_id
No description
Code
source_name
No description
Code
stable_idDescriptionCode
versionDescriptionCode
Methods description
Member_count_by_GenomeDBcode    nextTop
  Arg [1]    : Bio::EnsEMBL::Compara::GenomeDB $genome_db
Example : Member_count_by_GenomeDB($genome_db);
Description: Convenience wrapper for member counts by a GenomeDB
Returntype : int
Exceptions : Thrown by subrountines this call. See get_Member_Attribute
equivalent
Caller : public
Member_count_by_sourcecodeprevnextTop
  Arg [1]    : string $source_name
e.g. "ENSEMBLPEP"
Example : $domain->Member_count_by_source('ENSEMBLPEP');
Description:
Returntype : int
Exceptions :
Caller : public
Member_count_by_source_GenomeDBcodeprevnextTop
  Arg [1]    : string $source_name
Arg [2] : Bio::EnsEMBL::Compara::GenomeDB $genome_db
Example : Member_count_by_source_GenomeDB('ENSEMBLPEP', $genome_db);
Description: Convenience wrapper for member counts by a GenomeDB
Returntype : int
Exceptions : Thrown by subrountines this call. See get_Member_Attribute
equivalent
Caller : public
Member_count_by_source_taxoncodeprevnextTop
  Arg [1]    : string $source_name
Arg [2] : int $taxon_id
Example : Member_count_by_source_taxon('ENSEMBLPEP',9606);
Description:
Returntype : int
Exceptions :
Caller : public
_get_Member_AttributecodeprevnextTop
  Arg [1]    : string $attribute_scope
Arg [2] : string $key
Example : $domain->_get_Member_Attribute('_members_by_source', 'ENSEMBLPEP')
Description: Used as the generic reference point for all
get_Memeber_Attribute_by* methods. The method searches the given
scope & if the values cannot be found will initalize that value
to an empty array reference.
Returntype : array reference of Bio::EnsEMBL::Compara::Member
Exceptions : None.
Caller : internal
adaptorcodeprevnextTop
  Arg [1]    : string $adaptor (optional)
corresponding to a perl module
Example :
Description:
Returntype :
Exceptions :
Caller :
dbIDcodeprevnextTop
  Arg [1]    : int $dbID (optional)
Example :
Description:
Returntype :
Exceptions :
Caller :
descriptioncodeprevnextTop
  Arg [1]    : string $description (optional)
Example :
Description:
Returntype : string
Exceptions :
Caller :
get_Member_Attribute_by_GenomeDBcodeprevnextTop
  Arg [1]    : Bio::EnsEMBL::Compara::GenomeDB $genome_db
Example : $domain->get_Member_Attribute_by_GenomeDB($genome_db)
Description: Returns all [Member_Attribute] entries linked to this GenomeDB.
This will only return EnsEMBL based entries since UniProtKB
entries are not linked to a GenomeDB.
Returntype : array reference of Bio::EnsEMBL::Compara::Member
Exceptions : If input is undefined & genome db is not of expected type
Caller : public
get_Member_Attribute_by_sourcecodeprevnextTop
  Arg [1]    : string $source_name
e.g. "ENSEMBLPEP"
Example :
Description:
Returntype : array reference of Bio::EnsEMBL::Compara::Member and attribute
Exceptions :
Caller : public
get_Member_Attribute_by_source_GenomeDBcodeprevnextTop
  Arg [1]    : string $source_name
Arg [2] : Bio::EnsEMBL::Compara::GenomeDB $genome_db
Example : $domain->get_Member_by_source_taxon('ENSEMBLPEP', $genome_db)
Description: Returns all [Member_Attribute] entries linked to this GenomeDB
and the given source_name. This will only return EnsEMBL based
entries since UniProtKB entries are not linked to a GenomeDB.
Returntype : array reference of Bio::EnsEMBL::Compara::Member
Exceptions : If input is undefined & genome db is not of expected type
Caller : public
get_Member_Attribute_by_source_taxoncodeprevnextTop
  Arg [1]    : string $source_name
Arg [2] : int $taxon_id
Example : $domain->get_Member_by_source_taxon('ENSEMBLPEP',9606)
Description:
Returntype : array reference of Bio::EnsEMBL::Compara::Member
Exceptions :
Caller : public
get_all_Member_AttributecodeprevnextTop
  Arg [1]    : None
Example :
Description:
Returntype : array reference of [Bio::EnsEMBL::Compara::Member, Bio::EnsEMBL::Compara::Attribute]
Exceptions :
Caller :
get_all_MemberscodeprevnextTop
  Arg [1]    : None
Example :
Description:
Returntype : array reference of Bio::EnsEMBL::Compara::Member
Exceptions :
Caller : public
method_link_idcodeprevnextTop
  Arg [1]    : integer (optional)
Example :
Description:
Returntype : integer
Exceptions :
Caller :
method_link_species_setcodeprevnextTop
  Arg [1]    : MethodLinkSpeciesSet object (optional)
Example :
Description: getter/setter method for the MethodLinkSpeciesSet for this relation
Returntype : Bio::EnsEMBL::Compara::MethodLinkSpeciesSet
Exceptions :
Caller :
method_link_species_set_idcodeprevnextTop
  Arg [1]    : integer (optional)
Example :
Description:
Returntype : integer
Exceptions :
Caller :
method_link_typecodeprevnextTop
  Arg [1]    : string $method_link_type (optional)
Example :
Description:
Returntype : string
Exceptions :
Caller :
new_fastcodeprevnextTop
  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 :
Exceptions : none
Caller :
stable_idcodeprevnextTop
  Arg [1]    : string $stable_id (optional)
Example :
Description:
Returntype :
Exceptions :
Caller :
versioncodeprevnextTop
  Arg [1]    : string $version (optional)
Example :
Description:
Returntype :
Exceptions :
Caller :
Methods code
Member_count_by_GenomeDBdescriptionprevnextTop
sub Member_count_by_GenomeDB {
	my ($self, $genome_db) = @_;
	return scalar @{$self->get_Member_Attribute_by_GenomeDB($genome_db)};
}
Member_count_by_sourcedescriptionprevnextTop
sub Member_count_by_source {
  my ($self, $source_name) = @_; 
  
  throw("Should give a defined source_name as argument\n") unless (defined $source_name);
  
  return scalar @{$self->get_Member_Attribute_by_source($source_name)};
}
Member_count_by_source_GenomeDBdescriptionprevnextTop
sub Member_count_by_source_GenomeDB {
	my ($self, $source_name, $genome_db) = @_;
	return scalar @{$self->get_Member_Attribute_by_source_GenomeDB($source_name, $genome_db)};
}

#
# DEPRECATED METHODS
####################
}
Member_count_by_source_taxondescriptionprevnextTop
sub Member_count_by_source_taxon {
  my ($self, $source_name, $taxon_id) = @_; 
  
  throw("Should give defined source_name and taxon_id as arguments\n") unless (defined $source_name && defined $taxon_id);

  return scalar @{$self->get_Member_Attribute_by_source_taxon($source_name,$taxon_id)};
}
_get_Member_AttributedescriptionprevnextTop
sub _get_Member_Attribute {
	my ($self, $attribute_scope, $key) = @_;
	$self->get_all_Member_Attribute();
	$self->{$attribute_scope}->{$key} = [] unless defined $self->{$attribute_scope}->{$key};
  return $self->{$attribute_scope}->{$key};
}
adaptordescriptionprevnextTop
sub adaptor {
  my $self = shift;
  $self->{'_adaptor'} = shift if(@_);
  return $self->{'_adaptor'};
}
add_Member_AttributedescriptionprevnextTop
sub add_Member_Attribute {
  my ($self, $member_attribute) = @_;

  my ($member, $attribute) = @{$member_attribute};

  throw("member argument not defined\n") unless($member);
  throw("attribute argument not defined\n") unless($attribute);
  
  unless ($member->isa('Bio::EnsEMBL::Compara::Member')) {
    throw("Need to add a Bio::EnsEMBL::Compara::Member, not a $member\n");
  }
  unless ($attribute->isa('Bio::EnsEMBL::Compara::Attribute')) {
    throw("Need to add a Bio::EnsEMBL::Compara::Attribute, not a $attribute\n");
  }
  
  my $source_name = $member->source_name();
  my $taxon_id = $member->taxon_id();
  my $genome_db_id = $member->genome_db_id();

  if (defined $self->{'_this_one_first'} && $self->{'_this_one_first'} eq $member->stable_id) {
    unshift @{$self->{'_member_array'}}, $member_attribute ;
    unshift @{$self->{'_members_by_source'}{$source_name}}, $member_attribute;
    unshift @{$self->{'_members_by_source_taxon'}{"${source_name}_${taxon_id}"}}, $member_attribute;
    if(defined $genome_db_id) {
	    unshift @{$self->{_members_by_source_genome_db}{"${source_name}_${genome_db_id}"}}, $member_attribute;
	    unshift @{$self->{_members_by_genome_db}{$genome_db_id}}, $member_attribute;
    }
  } else {
    push @{$self->{'_member_array'}}, $member_attribute ;
    push @{$self->{'_members_by_source'}{$source_name}}, $member_attribute;
    push @{$self->{'_members_by_source_taxon'}{"${source_name}_${taxon_id}"}}, $member_attribute;
    if(defined $genome_db_id) {
	    push @{$self->{_members_by_source_genome_db}{"${source_name}_${genome_db_id}"}}, $member_attribute;
	    push @{$self->{_members_by_genome_db}{$genome_db_id}}, $member_attribute;
    }
  }
}
dbIDdescriptionprevnextTop
sub dbID {
  my $self = shift;
  $self->{'_dbID'} = shift if(@_);
  return $self->{'_dbID'};
}
descriptiondescriptionprevnextTop
sub description {
  my $self = shift;
  $self->{'_description'} = shift if(@_);
  return $self->{'_description'};
}
get_Member_Attribute_by_GenomeDBdescriptionprevnextTop
sub get_Member_Attribute_by_GenomeDB {
	my ($self, $genome_db) = @_;
	throw("Should give defined genome_db as an argument\n") unless defined $genome_db;
	throw("Param was not a GenomeDB. Was [${genome_db}]") unless $genome_db->isa('Bio::EnsEMBL::Compara::GenomeDB');
	my ($attribute_scope, $key) = ('_members_by_genome_db', $genome_db->dbID());
  return $self->_get_Member_Attribute($attribute_scope, $key);
}
get_Member_Attribute_by_sourcedescriptionprevnextTop
sub get_Member_Attribute_by_source {
  my ($self, $source_name) = @_;
  throw("Should give defined source_name as arguments\n") unless (defined $source_name);
  my ($attribute_scope, $key) = ('_members_by_source', $source_name);
	return $self->_get_Member_Attribute($attribute_scope, $key);
}
get_Member_Attribute_by_source_GenomeDBdescriptionprevnextTop
sub get_Member_Attribute_by_source_GenomeDB {
	my ($self, $source_name, $genome_db) = @_;
	throw("Should give defined source_name & genome_db as arguments\n") unless defined $source_name && $genome_db;
	throw("Param was not a GenomeDB. Was [${genome_db}]") unless $genome_db->isa('Bio::EnsEMBL::Compara::GenomeDB');
	my ($attribute_scope, $key) = ('_members_by_source_genome_db', "${source_name}_".$genome_db->dbID());
  return $self->_get_Member_Attribute($attribute_scope, $key);
}
get_Member_Attribute_by_source_taxondescriptionprevnextTop
sub get_Member_Attribute_by_source_taxon {
  my ($self, $source_name, $taxon_id) = @_;
  throw("Should give defined source_name and taxon_id as arguments\n") unless (defined $source_name && defined $taxon_id);
  my ($attribute_scope, $key) = ('_members_by_source_taxon', "${source_name}_${taxon_id}");
  return $self->_get_Member_Attribute($attribute_scope, $key);
}
get_all_Member_AttributedescriptionprevnextTop
sub get_all_Member_Attribute {
  my ($self) = @_;
  
  unless (defined $self->{'_member_array'}) {

    my $MemberAdaptor = $self->adaptor->db->get_MemberAdaptor();
    my $members = $MemberAdaptor->fetch_by_relation($self);

    $self->{'_member_array'} = [];
    $self->{'_members_by_source'} = {};
    $self->{'_members_by_source_taxon'} = {};
    $self->{'_members_by_source_genome_db'} = {};
    $self->{'_members_by_genome_db'} = {};
    foreach my $member_attribute (@{$members}) {
      $self->add_Member_Attribute($member_attribute);
    }
  }
  return $self->{'_member_array'}; #should return also attributes
}
get_all_MembersdescriptionprevnextTop
sub get_all_Members {
  my ($self) = @_;

  my $members = [];
  foreach my $member_attribute (@{$self->get_all_Member_Attribute}) {
    my ($member, $attribute) = @$member_attribute;
    push (@$members, $member);
  }

  return $members;
}
known_sourcesdescriptionprevnextTop
sub known_sources {
  my ($self) = @_;
  deprecate();
  throw("Get this data from the Bio::EnsEMBL::Compara::MethodLinkSpeciesSet object\n");
}

1;
}
method_link_iddescriptionprevnextTop
sub method_link_id {
  my $self = shift;

  $self->{'_method_link_id'} = shift if (@_);
  unless (defined $self->{'_method_link_id'}) {
    my $mlss = $self->method_link_species_set;
    $self->{'_method_link_id'} = $mlss->method_link_id;
  }

  return $self->{'_method_link_id'};
}
method_link_species_setdescriptionprevnextTop
sub method_link_species_set {
  my $self = shift;

  if(@_) {
    my $mlss = shift;
    unless ($mlss->isa('Bio::EnsEMBL::Compara::MethodLinkSpeciesSet')) {
      throw("Need to add a Bio::EnsEMBL::Compara::MethodLinkSpeciesSet, not a $mlss\n");
    }
    $self->{'_method_link_species_set'} = $mlss;
    $self->{'_method_link_species_set_id'} = $mlss->dbID;
  }

  #lazy load from method_link_species_set_id
if ( ! defined $self->{'_method_link_species_set'} && defined $self->method_link_species_set_id) { my $mlssa = $self->adaptor->db->get_MethodLinkSpeciesSetAdaptor; my $mlss = $mlssa->fetch_by_dbID($self->method_link_species_set_id); $self->{'_method_link_species_set'} = $mlss; } return $self->{'_method_link_species_set'};
}
method_link_species_set_iddescriptionprevnextTop
sub method_link_species_set_id {
  my $self = shift;

  $self->{'_method_link_species_set_id'} = shift if (@_);
  return $self->{'_method_link_species_set_id'};
}
method_link_typedescriptionprevnextTop
sub method_link_type {
  my $self = shift;

  $self->{'_method_link_type'} = shift if (@_);
  unless (defined $self->{'_method_link_type'}) {
    my $mlss = $self->method_link_species_set;
    throw("method_link_type needs a valid method_link_species_set") unless($mlss);
    $self->{'_method_link_type'} = $mlss->method_link_type;
  }

  return $self->{'_method_link_type'};
}
newdescriptionprevnextTop
sub new {
  my ($class, @args) = @_;

  my $self = bless {}, $class;

  if (scalar @args) {
    #do this explicitly.
my ($dbid, $stable_id, $version, $method_link_species_set_id, $method_link_type, $description, $adaptor) = rearrange([qw(DBID STABLE_ID VERSION METHOD_LINK_SPECIES_SET_ID METHOD_LINK_TYPE DESCRIPTION ADAPTOR)], @args); $dbid && $self->dbID($dbid); $stable_id && $self->stable_id($stable_id); $version && $self->version($version); $description && $self->description($description); $method_link_species_set_id && $self->method_link_species_set_id($method_link_species_set_id); $method_link_type && $self->method_link_type($method_link_type); $adaptor && $self->adaptor($adaptor); } return $self;
}
new_fastdescriptionprevnextTop
sub new_fast {
  my ($class, $hashref) = @_;

  return bless $hashref, $class;
}
source_iddescriptionprevnextTop
sub source_id {
  my $self = shift;
  deprecate("source method is deprecated. Calling $self->method_link_id instead\n");

  $self->{'_method_link_id'} = shift if (@_);
  return $self->method_link_id;
}
source_namedescriptionprevnextTop
sub source_name {
  my $self = shift;
  deprecate("source_name method is now deprecated. Calling method_link_type instead.\n");

  $self->{'_method_link_type'} = shift if (@_);
  return $self->method_link_type;
}
stable_iddescriptionprevnextTop
sub stable_id {
  my $self = shift;
  $self->{'_stable_id'} = shift if(@_);
  return $self->{'_stable_id'};
}
versiondescriptionprevnextTop
sub version {
  my $self = shift;
  $self->{'_version'} = shift if(@_);
  return $self->{'_version'};
}
General documentation
No general documentation available.