Bio::EnsEMBL::ExternalData::Family Family
SummaryIncluded librariesPackage variablesSynopsisDescriptionGeneral documentationMethods
Toolbar
WebCvsRaw content
Summary
Family - DESCRIPTION of Object
Package variables
No package variables defined.
Included modules
Bio::EnsEMBL::Root
Bio::LocatableSeq
Bio::SimpleAlign
IO::File
Inherit
Bio::EnsEMBL::Root
Synopsis
  use Bio::EnsEMBL::ExternalData::Family::DBSQL::DBAdaptor;
use Bio::EnsEMBL::ExternalData::Family::FamilyAdaptor;
use Bio::EnsEMBL::ExternalData::Family::Family;
$famdb = Bio::EnsEMBL::ExternalData::Family::DBSQL::DBAdaptor->new( -user => 'myusername', -dbname => 'myfamily_db', -host => 'myhost', ); my $fam_adtor = $famdb->get_FamilyAdaptor; my $fam = $fam_adtor->fetch_by_stable_id('ENSP00000012304'); print $fam->description, join('; ',$fam->keywords,$fam->release, $fam->annotation_confidence_score, $fam->size);
Description
This object describes protein families obtained from clustering
SWISSPROT/TREMBL using Tribe MCL algorithm. The clustering
neatly follows the SWISSPROT/TREMBL DE-lines, which are taken as the
description of the whole family.
SWSISSPROT keywords aren't there yet either.
The family members are currently represented by Bio::EnsEMBL::ExternalData::Family::Family
objects
Methods
adaptorDescriptionCode
add_memberDescriptionCode
annotation_confidence_scoreDescriptionCode
dbIDDescriptionCode
descriptionDescriptionCode
each_member
No description
Code
each_member_of_db
No description
Code
each_member_of_db_taxon
No description
Code
get_SimpleAlignDescriptionCode
get_Taxon_by_dbnameDescriptionCode
get_all_membersDescriptionCode
get_members_by_dbnameDescriptionCode
get_members_by_dbname_taxonDescriptionCode
newDescriptionCode
read_clustalwDescriptionCode
releaseDescriptionCode
sizeDescriptionCode
size_by_dbnameDescriptionCode
size_by_dbname_taxonDescriptionCode
stable_idDescriptionCode
Methods description
adaptorcode    nextTop
 Title   : adaptor
Usage : $adaptor = $fam->adaptor
Function: find this objects\'s adaptor object (set by FamilyAdaptor)
Example :
Returns :
Args :
add_membercodeprevnextTop
 Title   : add_member
Usage :
Function: adds member to family.
Example : $fam->add_member($family_member);
Returns : undef
Args : a Bio::EnsEMBL::ExternalData::Family::FamilyMember object
annotation_confidence_scorecodeprevnextTop
 Title   : annotation_confidence_score
Usage :
Function: get/set the annotation_confidence_score of the Family. This a measure of how good the cluster is (what is the scale??) Example : Returns : Args :
dbIDcodeprevnextTop
 Title   : dbID
Usage :
Function: get/set the dbID of the Family
Example :
Returns :
Args :
descriptioncodeprevnextTop
 Title   : description
Usage :
Function: get/set the description of the Family.
Example :
Returns : A string (currently all upper case, and no longer than 255 chars).
Args :
get_SimpleAligncodeprevnextTop
  Arg [1]    : get_SimpleAlign
Example : none
Description: Returns a Bio::SimpleAlign feature constructed from the
multiple alignment of this Families members.
The SimpleAlign can then be printed out in many different
formats using the Bio::ALignIO module
Returntype : Bio::SimpleAlign
Exceptions : none
Caller : general
get_Taxon_by_dbnamecodeprevnextTop
 Arg [1]    : string $dbname
Either "ENSEMBLGENE", "ENSEMBLPEP" or "SPTR"
Example : $family->get_Taxon_by_dbname('ENSEMBLGENE')
Description: get all the taxons that belong to a particular database in the
corresponding family
Returntype : an array reference of Bio::EnsEMBL::ExternalData::Family::Taxon objects
(which may be empty)
Exceptions : when missing argument
Caller : general
get_all_memberscodeprevnextTop
 Title   : get_all_members
Usage : foreach $member ($fam->get_all_members) {...
Function: fetch all the members of the family
Example :
Returns : an array reference of
Bio::EnsEMBL::ExternalData::Family::FamilyMember objects (which may
be empty)
Args : none
get_members_by_dbnamecodeprevnextTop
 Title   : get_members_by_dbname
Usage : $fam->get_members_by_dbname('SPTR')
Function: fetch all the members that belong to a particular database
Returns : an array reference of Bio::EnsEMBL::ExternalData::Family::FamilyMember objects (which may be empty)
Args : a databasename
get_members_by_dbname_taxoncodeprevnextTop
 Title   : get_members_by_dbname_taxon
Usage : $obj->get_members_by_dbname_taxon('ENSEMBLGENE',9606)
Function: fetch all the members that belong to a particular database and taxon_id
Returns : an array reference of Bio::EnsEMBL::ExternalData::Family::FamilyMember objects (which may be empty)
Args : a databasename and taxon_id
newcodeprevnextTop
 Title   : new
Usage : not intended for general use.
Function:
Example :
Returns : a family (but without members; caller has to fill using
add_member)
Args :
read_clustalwcodeprevnextTop
  Arg [1]    : string $file 
The name of the file containing the clustalw output
Example : $family->read_clustalw('/tmp/clustalw.aln');
Description: Parses the output from clustalw and sets the alignment strings
of each of the memebers of this family
Returntype : none
Exceptions : thrown if file cannot be parsed
warning if alignment file contains identifiers for sequences
which are not members of this family
Caller : general
releasecodeprevnextTop
 Title   : release
Usage :
Function: get/set the release number of the family database;
Example :
Returns :
Args :
sizecodeprevnextTop
 Title   : size
Usage : $fam->size
Function: returns the number of peptide members of the family
Returns : an int
Args : none
size_by_dbnamecodeprevnextTop
 Title   : size_by_dbname
Usage : $fam->size_by_dbname('ENSEMBLGENE')
Function: returns the number of members of the family belonging to a particular databasename
Returns : an int
Args : a databasename
size_by_dbname_taxoncodeprevnextTop
 Title   : size_by_dbname_taxon
Usage : $fam->size_by_dbname_taxon('ENSEMBLGENE',9606)
Function: returns the number of members of the family belonging to a particular databasename and a taxon
Returns : an int
Args : a databasename and a taxon_id
stable_idcodeprevnextTop
 Title   : stable_id
Usage :
Function: get/set the display stable_id of the Family
Example :
Returns :
Args :
Methods code
adaptordescriptionprevnextTop
sub adaptor {
  my ($self,$value)= @_;
  
  if (defined $value) {
    $self->{'adaptor'} = $value;
  }

  return $self->{'adaptor'};
}
add_memberdescriptionprevnextTop
sub add_member {
     my ($self, $member) = @_; 
    
    $member->isa('Bio::EnsEMBL::ExternalData::Family::FamilyMember') ||
      $self->throw("You have to add a Bio::EnsEMBL::ExternalData::Family::FamilyMember object, not a $member");
   
    push @{$self->{_members}}, $member;
    push @{$self->{_members_by_dbname}{$member->database}}, $member;
    push @{$self->{_members_by_dbname_taxon}{$member->database."_".$member->taxon_id}}, $member;
}
annotation_confidence_scoredescriptionprevnextTop
sub annotation_confidence_score {
    my ($self,$value) = @_;
    if( defined $value) {
	$self->{'annotation_confidence_score'} = $value;
    }
    return $self->{'annotation_confidence_score'};
}
dbIDdescriptionprevnextTop
sub dbID {
    my ($self,$value) = @_;
    if( defined $value) {
	$self->{'dbID'} = $value;
    }
    return $self->{'dbID'};
}
descriptiondescriptionprevnextTop
sub description {
    my ($self,$value) = @_;
    if( defined $value) {
	$self->{'desc'} = $value;
    }
    return $self->{'desc'};
}
each_memberdescriptionprevnextTop
sub each_member {
  my ($self) = @_;

  $self->warn("Family->each_member is a deprecated method!
Calling Family->get_all_members instead!");
  
  return $self->get_all_members;
}
each_member_of_dbdescriptionprevnextTop
sub each_member_of_db {
  my ($self, $dbname) = @_;

  $self->warn("Family->each_member_of_db is a deprecated method!
Calling Family->get_members_by_dbname instead!");
  
  return $self->get_members_by_dbname($dbname);
}
each_member_of_db_taxondescriptionprevnextTop
sub each_member_of_db_taxon {
  my ($self, $dbname, $taxon_id) = @_;

  $self->warn("Family->each_member_of_db_taxon is a deprecated method!
Calling Family->get_members_by_dbname_taxon instead!");
  
  return $self->get_members_by_dbname_taxon($dbname,$taxon_id);
}

1;
}
get_SimpleAligndescriptionprevnextTop
sub get_SimpleAlign {
  my $self = shift;
  
  my $sa = Bio::SimpleAlign->new();

  #Hack to try to work with both bioperl 0.7 and 1.2:
#Check to see if the method is called 'addSeq' or 'add_seq'
my $bio07 = 0; if(!$sa->can('add_seq')) { $bio07 = 1; } foreach my $member (@{$self->get_all_members}) { my $seqstr = $member->alignment_string; next if(!$seqstr); my $seq = Bio::LocatableSeq->new(-SEQ => $seqstr, -START => 1, -END => length($seqstr), -ID => $member->stable_id, -STRAND => 0); if($bio07) { $sa->addSeq($seq); } else { $sa->add_seq($seq); } } return $sa;
}
get_Taxon_by_dbnamedescriptionprevnextTop
sub get_Taxon_by_dbname {
  my ($self, $dbname) = @_;
  
  $self->throw("Should give defined databasename as argument\n") unless (defined $dbname);

  my $family_id = $self->dbID;
  my $FamilyAdaptor = $self->adaptor;

  return $FamilyAdaptor->fetch_Taxon_by_dbname_dbID($dbname,$family_id);
}
get_all_membersdescriptionprevnextTop
sub get_all_members {
  my ($self) = @_;
  
  unless (defined $self->{'_members'}) {
    my $family_id = $self->dbID;
    my $FamilyMemberAdaptor = $self->adaptor->db->get_FamilyMemberAdaptor();
    my $members = $FamilyMemberAdaptor->fetch_by_family_id($family_id);
    $self->{_members} = [];
    $self->{_members_by_dbname} = {};
    $self->{_members_by_dbname_taxon} = {};
    foreach my $member (@{$members}) {
      $self->add_member($member);
    }
  }
#  return @{$self->{'_members'}};
return $self->{'_members'};
}
get_members_by_dbnamedescriptionprevnextTop
sub get_members_by_dbname {
  my ($self, $dbname) = @_;

  $self->throw("Should give defined databasename as arguments\n") unless (defined $dbname);

  unless (defined $self->{_members_by_dbname}->{$dbname}) {
    my $family_id = $self->dbID;
    my $FamilyMemberAdaptor = $self->adaptor->db->get_FamilyMemberAdaptor();
    my $members = $FamilyMemberAdaptor->fetch_by_family_dbname($family_id,$dbname);

    $self->{_members_by_dbname}->{$dbname} = [];
    push @{$self->{_members_by_dbname}->{$dbname}}, @{$members};
  }
#  return @{$self->{_members_by_dbname}->{$dbname}};
return $self->{_members_by_dbname}->{$dbname};
}
get_members_by_dbname_taxondescriptionprevnextTop
sub get_members_by_dbname_taxon {
  my ($self, $dbname, $taxon_id) = @_;

  $self->throw("Should give defined databasename and taxon_id as arguments\n") unless (defined $dbname && defined $taxon_id);

  unless (defined $self->{_members_by_dbname_taxon}->{$dbname."_".$taxon_id}) {
    my $family_id = $self->dbID;
    my $FamilyMemberAdaptor = $self->adaptor->db->get_FamilyMemberAdaptor();
    my $members = $FamilyMemberAdaptor->fetch_by_family_dbname_taxon($family_id,$dbname,$taxon_id);

    $self->{_members_by_dbname_taxon}->{$dbname."_".$taxon_id} = [];
    push @{$self->{_members_by_dbname_taxon}->{$dbname."_".$taxon_id}}, @{$members};
  }
#  return @{$self->{_members_by_dbname_taxon}->{$dbname."_".$taxon_id}};
return $self->{_members_by_dbname_taxon}->{$dbname."_".$taxon_id};
}
newdescriptionprevnextTop
sub new {
  my($class,@args) = @_;
  
  my $self = $class->SUPER::new(@args);
  
  if (scalar @args) {
     #do this explicitly.
my ($dbid, $stable_id,$descr,$release, $score, $memb,$adap) = $self->_rearrange([qw(DBID STABLE_ID DESCRIPTION RELEASE SCORE MEMBERS ADAPTOR)], @args); $dbid && $self->dbID($dbid); $stable_id || $self->throw("Must have a stable_id"); $self->stable_id($stable_id); $descr || $self->throw("family must have a description"); $self->description($descr); $release && $self->release($release); $score && $self->annotation_confidence_score($score); $self->{_members} = []; push (@{$self->{_members}},@{$memb}); $adap && $self->adaptor($adap); } return $self;
}
read_clustalwdescriptionprevnextTop
sub read_clustalw {
  my $self = shift;
  my $file = shift;

  my %align_hash;
  my $FH = IO::File->new();
  $FH->open($file) || $self->throw("Could not open alignment file [$file]");

  <$FH>; #skip header
while(<$FH>) { next if($_ =~ /^\s+/); #skip lines that start with space
my ($id, $align) = split; $align_hash{$id} ||= ''; $align_hash{$id} .= $align; } $FH->close; #place all family members in a hash on their names
my %member_hash; foreach my $member (@{$self->get_all_members}) { $member_hash{$member->stable_id} = $member; } #assign alignment strings to each of the members
foreach my $id (keys %align_hash) { my $member = $member_hash{$id}; if($member) { $member->alignment_string($align_hash{$id}); } else { $self->warn("No member for alignment portion: [$id]"); } } } ###########################################
#
# Deprecated methods. Will be deleted soon.
}
releasedescriptionprevnextTop
sub release {
    my ($self,$value) = @_;
    if( defined $value) {
	$self->{'release'} = $value;
    }
    return $self->{'release'};
}
sizedescriptionprevnextTop
sub size {
  my ($self) = @_; 
  
  # we do not want to have a total number of gene+peptide members (that is non sense)
# That is why we substracte from the total those corresponding to genes
# Need to be fixed as ENSEMBLGENE is here hard coded
# Probably by just adding a colunm type in external_db, which would be gene, peptide, or
# even transcript. Then recode size as size_by_type or something like that.
# size_by_type('peptide'),...
return scalar @{$self->get_all_members} - $self->size_by_dbname('ENSEMBLGENE');
}
size_by_dbnamedescriptionprevnextTop
sub size_by_dbname {
  my ($self, $dbname) = @_; 
  
  $self->throw("Should give a defined databasename as argument\n") unless (defined $dbname);
  
  return scalar @{$self->get_members_by_dbname($dbname)};
}
size_by_dbname_taxondescriptionprevnextTop
sub size_by_dbname_taxon {
  my ($self, $dbname, $taxon_id) = @_; 
  
  $self->throw("Should give defined databasename and taxon_id as arguments\n") unless (defined $dbname && defined $taxon_id);

  return scalar @{$self->get_members_by_dbname_taxon($dbname,$taxon_id)};
}
stable_iddescriptionprevnextTop
sub stable_id {
    my ($self,$value) = @_;
    if( defined $value) {
	$self->{'stable_id'} = $value;
    }
    return $self->{'stable_id'};
}
General documentation
CONTACTTop
 Philip Lijnzaad <Lijnzaad@ebi.ac.uk> [original perl modules]
Anton Enright <enright@ebi.ac.uk> [TRIBE algorithm]
Elia Stupka <elia@fugu-sg.org> [refactoring]
Able Ureta-Vidal <abel@ebi.ac.uk> [multispecies migration]
APPENDIXTop
The rest of the documentation details each of the object methods.
Internal methods are usually preceded with a _