Bio::EnsEMBL::ExternalData::Family FamilyMember
SummaryIncluded librariesPackage variablesSynopsisDescriptionGeneral documentationMethods
Toolbar
WebCvsRaw content
Summary
FamilyMember - DESCRIPTION of Object
Package variables
No package variables defined.
Included modules
Bio::Annotation::DBLink
Bio::EnsEMBL::Root
Inherit
Bio::Annotation::DBLink
Synopsis
  use Bio::EnsEMBL::ExternalData::Family::DBSQL::DBAdaptor;
$famdb = Bio::EnsEMBL::ExternalData::Family::DBSQL::DBAdaptor->new( -user => 'myusername', -dbname => 'myfamily_db', -host => 'myhost', ); my $FamilyMemberAdaptor = $famdb->get_FamilyAdaptor; my $FamilyMember = $FamilyMemberAdaptor->fetch_by_dbID(1);
Description
Methods
adaptorDescriptionCode
alignment_stringDescriptionCode
cdna_alignment_stringDescriptionCode
dbIDDescriptionCode
external_db_idDescriptionCode
family_idDescriptionCode
peptide_stringDescriptionCode
stable_idDescriptionCode
taxonDescriptionCode
taxon_idDescriptionCode
Methods description
adaptorcode    nextTop
 Arg [1]    : string $adaptor (optional)
Example : my $FamilyMember->adaptor;
Description: get/set the Adaptor which is used for reading and writing
the calling object from and to the SQL database.
Returntype : string
Exceptions : Bio::EnsEMBL::ExternalData::Family::DBSQL::FamilyMemberAdaptor
Caller : general
alignment_stringcodeprevnextTop
  Arg [1]    : (optional) string $align_str 
Example : $align_str = $family_member->alignment_string();
Description: Getter/Setter for the portion of the familywide multiple
protein alignment that corresponds with this family member.
The string returned will be the full peptide with alignment
gaps denoted as '-'s.
Returntype : string
Exceptions : none
Caller : general
cdna_alignment_stringcodeprevnextTop
  Arg [1]    : none
Example : my $cdna_alignment = $family_member->cdna_alignment_string();
Description: Converts the peptide alignment string to a cdna alignment
string. This only works for EnsEMBL peptides whose cdna can
be retrieved from the attached EnsEMBL databse.
If the cdna cannot be retrieved undef is returned and a
warning is thrown.
Returntype : string
Exceptions : none
Caller : general
dbIDcodeprevnextTop
 Arg [1]    : int $dbID (optional)
Example : my $FamilyMember->dbID;
Description: get/set the database dbID
Returntype : int
Exceptions : none
Caller : general
external_db_idcodeprevnextTop
 Arg [1]    : int $external_db_id (optional)
Example : my $FamilyMember->external_db_id;
Description: get/set the FamilyMember external_db_id
Returntype : int
Exceptions : none
Caller : general
family_idcodeprevnextTop
 Arg [1]    : int $family_id (optional)
Example : my $FamilyMember->family_id;
Description: get/set the family_id where the FamilyMember belongs to
Returntype : int
Exceptions : none
Caller : general
peptide_stringcodeprevnextTop
  Arg [1]    : none
Example : my $peptide = $family_member->peptide_string();
Description: Extracts the peptide string for this family member from the
alignment_string by removing gaps
Returntype : string
Exceptions : none
Caller : general
stable_idcodeprevnextTop
 Arg [1]    : string $stable_id (optional)
Example : my $FamilyMember->stable_id;
Description: get/set the FamilyMember stable_id
Returntype : string
Exceptions : none
Caller : general
taxoncodeprevnextTop
 Args       : none
Example : my $FamilyMember->taxon;
Description: get the Taxon object corresponding to a FamilyMember
Returntype : Bio::EnsEMBL::ExternalData::Family::Taxon
Exceptions : none
Caller : general
taxon_idcodeprevnextTop
 Arg [1]    : int $taxon_id (optional)
Example : my $FamilyMember->taxon_id;
Description: get/set the FamilyMember taxon_id
Returntype : int
Exceptions : none
Caller : general
Methods code
adaptordescriptionprevnextTop
sub adaptor {
   my ($self, $value) = @_;

   if (defined $value) {
      $self->{'_adaptor'} = $value;
   }

   return $self->{'_adaptor'};
}
alignment_stringdescriptionprevnextTop
sub alignment_string {
  my $self = shift;
  
  if(@_) {
    $self->{'alignment_string'} = shift;
  }

  return $self->{'alignment_string'};
}
cdna_alignment_stringdescriptionprevnextTop
sub cdna_alignment_string {
  my $self = shift;

  my $dbname = $self->database;

  if($dbname ne 'ENSEMBLPEP') {
    $self->warn("Don't know how to retrieve cdna for database [$dbname]");
    return undef;
  }

  my $taxon_id = $self->taxon_id;
	
  my $genome_db = 
    $self->adaptor->db->get_GenomeDBAdaptor->fetch_by_taxon_id($taxon_id);

  my $ta = $genome_db->db_adaptor->get_TranscriptAdaptor;
  my $transcript = $ta->fetch_by_translation_stable_id($self->stable_id);

  if(!$transcript) {
    $self->warn("Could not retrieve transcript via peptide id [" . 
		$self->stable_id . "] from database [" . 
		$genome_db->db_adaptor->dbname . "]");
    return undef;
  }

  my $cdna = $transcript->translateable_seq;
  my $cdna_len = length($cdna);
  my $start = 0;
  my $cdna_align_string = '';
  foreach my $pep (split(//,$self->alignment_string)) {
    last if($start >= $cdna_len);
	
    if($pep eq '-') {
      $cdna_align_string .= '--- ';
    } else {
      $cdna_align_string .= substr($cdna, $start, 3) .' ';
    }
    $start += 3;
  }

  return $cdna_align_string;
}


1;
}
dbIDdescriptionprevnextTop
sub dbID {
  my ($self,$value) = @_;

  if( defined $value) {
    $self->{'_dbID'} = $value;
  }

  return $self->{'_dbID'};
}
external_db_iddescriptionprevnextTop
sub external_db_id {
    my ($self, $value) = @_;

    if (defined $value) {
      $self->{'_external_db_id'} = $value;
    }
    return $self->{'_external_db_id'};
}
family_iddescriptionprevnextTop
sub family_id {
  my ($self,$value) = @_;

  if( defined $value) {
    $self->{'_family_id'} = $value;
  }

  return $self->{'_family_id'};
}
peptide_stringdescriptionprevnextTop
sub peptide_string {
  my $self = shift;

  my $peptide = $self->{'alignment_string'};
  $peptide =~ s/-//g;

  return $peptide;
}
stable_iddescriptionprevnextTop
sub stable_id {
   my ($self, $value) = @_;

   if (defined $value) {
      $self->primary_id($value);
   }

   return $self->primary_id;
}
taxondescriptionprevnextTop
sub taxon {
  my ($self, $taxon) = @_;

  if (defined $taxon) {
    unless($taxon->isa('Bio::EnsEMBL::ExternalData::Family::Taxon')) {
      $self->throw(
		   "taxon arg must be a [Bio::EnsEMBL::ExternalData::Family::Taxon".
		   "not a [$taxon]");
    }
    $self->{'_taxon'} = $taxon;
    $self->taxon_id($taxon->ncbi_taxid);
  } else {
    unless (defined $self->{'_taxon'}) {
      my $taxon_adpator = $self->adaptor->db->get_TaxonAdaptor;
      $self->{'_taxon'} = $taxon_adpator->fetch_by_taxon_id($self->taxon_id);
      $self->taxon_id($self->{'_taxon'}->ncbi_taxid);
    }
  }
  
  return $self->{'_taxon'};
}
taxon_iddescriptionprevnextTop
sub taxon_id {
    my ($self,$value) = @_;

    if (defined $value) {
	$self->{'_taxon_id'} = $value;
    }

    return $self->{'_taxon_id'};
}
General documentation
CONTACTTop
 Abel Ureta-Vidal <abel@ebi.ac.uk>
APPENDIXTop
The rest of the documentation details each of the object methods.
Internal methods are usually preceded with a _