LICENSE
Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute Copyright [2016-2024] EMBL-European Bioinformatics Institute
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
CONTACT
Please email comments or questions to the public Ensembl
developers list at <http://lists.ensembl.org/mailman/listinfo/dev>.
Questions may also be sent to the Ensembl help desk at
<http://www.ensembl.org/Help/Contact>.
NAME
Bio::EnsEMBL::Translation - A class representing the translation of a transcript
SYNOPSIS
my $translation = Bio::EnsEMBL::Translation->new(
-START_EXON => $exon1,
-END_EXON => $exon2,
-SEQ_START => 98,
-SEQ_END => 39
);
# stable ID setter
$translation->stable_id('ENSP00053458');
# get start and end position in start/end exons
my $start = $translation->start;
my $end = $translation->end;
DESCRIPTION
A Translation object defines the CDS and UTR regions of a Transcript through the use of start_Exon/end_Exon, and start/end attributes.
new
Arg [-START_EXON] : The Exon object in which the translation (CDS) starts
Arg [-END_EXON] : The Exon object in which the translation (CDS) ends
Arg [-SEQ_START] : The offset in the start_Exon indicating the start
position of the CDS.
Arg [-SEQ_END] : The offset in the end_Exon indicating the end
position of the CDS.
Arg [-STABLE_ID] : The stable identifier for this Translation
Arg [-VERSION] : The version of the stable identifier
Arg [-DBID] : The internal identifier of this Translation
Arg [-ADAPTOR] : The TranslationAdaptor for this Translation
Arg [-SEQ] : Manually sets the peptide sequence of this translation.
May be useful if this translation is not stored in
a database.
Arg [-CREATED_DATE]: the date the translation was created
Arg [-MODIFIED_DATE]: the date the translation was modified
Example : my $tl = Bio::EnsEMBL::Translation->new
(-START_EXON => $ex1,
-END_EXON => $ex2,
-SEQ_START => 98,
-SEQ_END => 39);
Description: Constructor. Creates a new Translation object
Returntype : Bio::EnsEMBL::Translation
Exceptions : none
Caller : general
Status : Stable
transcript
Arg [1] : Transcript object (optional)
Description : Sets or retrieves the transcript object associated
with this translation object.
Exceptions : Throws if there is no adaptor or no dbID defined for
the translation object.
Returntype : Bio::EnsEMBL::Transcript
start
Arg [1] : (optional) int $start - start position to set
Example : $translation->start(17);
Description: Getter/setter for the value of start, which is a position within
the exon given by start_Exon.
If you need genomic coordinates, use the genomic_start()
method.
Returntype : int
Exceptions : none
Caller : general
Status : Stable
end
Arg [1] : (optional) int $end - end position to set
Example : $translation->end(8);
Description: Getter/setter for the value of end, which is a position within
the exon given by end_Exon.
If you need genomic coordinates, use the genomic_end()
method.
Returntype : int
Exceptions : none
Caller : general
Status : Stable
start_Exon
Arg [1] : (optional) Bio::EnsEMBL::Exon - start exon to assign
Example : $translation->start_Exon($exon1);
Description: Getter/setter for the value of start_Exon, which denotes the
exon at which translation starts (and within this exon, at the
position indicated by start, see above).
Returntype : Bio::EnsEMBL::Exon
Exceptions : thrown on wrong argument type
Caller : general
Status : Stable
end_Exon
Arg [1] : (optional) Bio::EnsEMBL::Exon - start exon to assign
Example : $translation->start_Exon($exon1);
Description: Getter/setter for the value of end_Exon, which denotes the
exon at which translation ends (and within this exon, at the
position indicated by end, see above).
Returntype : Bio::EnsEMBL::Exon
Exceptions : thrown on wrong argument type
Caller : general
Status : Stable
cdna_start
Arg [1] : (optional) Bio::EnsEMBL::Transcript $transcript
The transcript which this is a translation of.
Example : $translation_cdna_start = $translation->cdna_start();
Description : Returns the start position of the translation in cDNA
coordinates.
If no transcript is given, the method will use
TranscriptAdaptor->fetch_by_translation_id() to locate
the correct transcript.
Return type : Integer
Exceptions : Throws if the given (optional) argument is not a
transcript.
Caller : General
Status : At Risk (Under Development)
cdna_end
Arg [1] : (optional) Bio::EnsEMBL::Transcript $transcript
The transcript which this is a translation of.
Example : $translation_cdna_end = $translation->cdna_end();
Description : Returns the end position of the translation in cDNA
coordinates.
If no transcript is given, the method will use
TranscriptAdaptor->fetch_by_translation_id() to locate
the correct transcript.
Return type : Integer
Exceptions : Throws if the given (optional) argument is not a
transcript.
Caller : General
Status : At Risk (Under Development)
genomic_start
Args : None
Example : $translation_genomic_start =
$translation->genomic_start();
Description : Returns the start position of the translation in
genomic coordinates on the forward strand.
Return type : Integer
Exceptions : None
Caller : General
Status : At Risk (Under Development)
genomic_end
Args : None
Example : $translation_genomic_end = $translation->genomic_end();
Description : Returns the end position of the translation in genomic
coordinates on the forward strand.
Return type : Integer
Exceptions : None
Caller : General
Status : At Risk (Under Development)
version
Arg [1] : (optional) string $version - version to set
Example : $translation->version(2);
Description: Getter/setter for attribute version
Returntype : string
Exceptions : none
Caller : general
Status : Stable
stable_id
Arg [1] : (optional) string $stable_id - stable ID to set
Example : $translation->stable_id('ENSP0059890');
Description: Getter/setter for attribute stable_id
Returntype : string
Exceptions : none
Caller : general
Status : Stable
stable_id_version
Arg [1] : (optional) String - the stable ID with version to set
Example : $translation->stable_id("ENSP0059890.3");
Description: Getter/setter for stable id with version for this translation.
Returntype : String
Exceptions : none
Caller : general
Status : Stable
created_date
Arg [1] : (optional) string $created_date - created date to set
Example : $translation->created_date('2007-01-10 20:52:00');
Description: Getter/setter for attribute created date
Returntype : string
Exceptions : none
Caller : general
Status : Stable
modified_date
Arg [1] : (optional) string $modified_date - modification date to set
Example : $translation->modified_date('2007-01-10 20:52:00');
Description: Getter/setter for attribute modified date
Returntype : string
Exceptions : none
Caller : general
Status : Stable
transform
Arg [1] : hashref $old_new_exon_map
a hash that maps old to new exons for a whole gene
Description: maps start end end exon according to mapping table.
If an exon is not mapped, just keep the old one.
Returntype : none
Exceptions : none
Caller : Transcript->transform()
Status : Stable
get_all_DBEntries
Arg [1] : (optional) String, external database name,
SQL wildcard characters (_ and %) can be used to
specify patterns.
Arg [2] : (optional) String, external_db type,
('ARRAY','ALT_TRANS','ALT_GENE','MISC','LIT','PRIMARY_DB_SYNONYM','ENSEMBL'),
SQL wildcard characters (_ and %) can be used to
specify patterns.
Example : my @dbentries = @{ $translation->get_all_DBEntries() };
@dbentries = @{ $translation->get_all_DBEntries('Uniprot%') };
@dbentries = @{ $translation->get_all_DBEntries('%', 'ENSEMBL') };
Description: Retrieves DBEntries (xrefs) for this translation.
This method will attempt to lazy-load DBEntries
from a database if an adaptor is available and no
DBEntries are present on the translation (i.e. they
have not already been added or loaded).
Returntype : Listref to Bio::EnsEMBL::DBEntry objects
Exceptions : none
Caller : TranslationAdaptor::store
Status : Stable
get_all_object_xrefs
Arg [1] : (optional) String, external database name
Arg [2] : (optional) String, external_db type
Example : @oxrefs = @{ $translation->get_all_object_xrefs() };
Description: Retrieves xrefs for this translation.
This method will attempt to lazy-load xrefs from a
database if an adaptor is available and no xrefs
are present on the translation (i.e. they have not
already been added or loaded).
NB: This method is an alias for the
get_all_DBentries() method.
Return type: Listref of Bio::EnsEMBL::DBEntry objects
Status : Stable
add_DBEntry
Arg [1] : Bio::EnsEMBL::DBEntry $dbe
The dbEntry to be added
Example : $translation->add_DBEntry($xref);
Description: Associates a DBEntry with this translation. Note that adding
DBEntries will prevent future lazy-loading of DBEntries for this
translation (see get_all_DBEntries).
Returntype : none
Exceptions : thrown on incorrect argument type
Caller : general
Status : Stable
get_all_DBLinks
Arg [1] : String database name (optional)
SQL wildcard characters (_ and %) can be used to
specify patterns.
Arg [2] : (optional) String, external database type, can be one of
('ARRAY','ALT_TRANS','ALT_GENE','MISC','LIT','PRIMARY_DB_SYNONYM','ENSEMBL'),
SQL wildcard characters (_ and %) can be used to
specify patterns.
Example : my @dblinks = @{ $translation->get_all_DBLinks() };
@dblinks = @{ $translation->get_all_DBLinks('Uniprot%') };
@dblinks = @{ $translation->get_all_DBLinks('%', 'ENSEMBL') };
Description: This is here for consistancy with the Transcript
and Gene classes. It is a synonym for the
get_all_DBEntries() method.
Return type: Listref to Bio::EnsEMBL::DBEntry objects
Exceptions : none
Caller : general
Status : Stable
get_all_xrefs
Arg [1] : String database name (optional)
SQL wildcard characters (_ and %) can be used to
specify patterns.
Example : @xrefs = @{ $translation->get_all_xrefs() };
@xrefs = @{ $translation->get_all_xrefs('Uniprot%') };
Description: This method is here for consistancy with the Gene
and Transcript classes. It is an alias for the
get_all_DBLinks() method, which in turn directly
calls get_all_DBEntries().
Return type: Listref of Bio::EnsEMBL::DBEntry objects
Status : Stable
get_all_ProteinFeatures
Arg [1] : (optional) string $logic_name
The analysis logic_name of the features to retrieve. If not
specified, all features are retrieved instead.
If no logic_name is found, looking for analysis db name instead.
Example : $features = $self->get_all_ProteinFeatures('PFam');
Description: Retrieves all ProteinFeatures associated with this
Translation. If a logic_name is specified, only features with
that logic_name are returned. If no logic_name is provided all
associated protein_features are returned.
ProteinFeatures are lazy-loaded from the database unless they
added manually to the Translation or had already been loaded.
Returntype : Listref of Bio::EnsEMBL::ProteinFeature
Exceptions : none
Caller : general
Status : Stable
get_all_DomainFeatures
Example : @domain_feats = @{$translation->get_all_DomainFeatures};
Description: A convenience method which retrieves all protein features
that are considered to be 'Domain' features. Features which
are 'domain' features are those with analysis logic names:
'pfscan', 'scanprosite', 'superfamily', 'pfam', 'prints',
'smart', 'pirsf', 'tigrfam'.
Returntype : listref of Bio::EnsEMBL::ProteinFeature
Exceptions : none
Caller : webcode (protview)
Status : Stable
add_ProteinFeature
Arg [1] : Bio::EnsEMBL::ProteinFeature $pf
The ProteinFeature to be added
Example : $translation->add_ProteinFeature($pf);
Description: Associates a ProteinFeature with this translation. Note that
adding ProteinFeatures will prevent future lazy-loading of
ProteinFeatures for this translation (see
get_all_ProteinFeatures).
Returntype : none
Exceptions : thrown on incorrect argument type
Caller : general
Status : Stable
display_id
Example : print $translation->display_id();
Description: This method returns a string that is considered to be
the 'display' identifier. For translations this is (depending on
availability and in this order) the stable Id, the dbID or an
empty string.
Returntype : string
Exceptions : none
Caller : web drawing code
Status : Stable
length
Example : print "Peptide length =", $translation->length();
Description: Retrieves the length of the peptide sequence (i.e. number of
amino acids) represented by this Translation object.
Returntype : int
Exceptions : none
Caller : webcode (protview etc.)
Status : Stable
seq
Example : print $translation->seq();
Description: Retrieves a string representation of the peptide sequence
of this Translation. This retrieves the transcript from the
database and gets its sequence, or retrieves the sequence which
was set via the constructor.
Returntype : string
Exceptions : warning if the sequence is not set and cannot be retrieved from
the database.
Caller : webcode (protview etc.)
Status : Stable
get_all_Attributes
Arg [1] : optional string $attrib_code
The code of the attribute type to retrieve values for.
Example : ($sc_attr) = @{$tl->get_all_Attributes('_selenocysteine')};
@tl_attributes = @{$translation->get_all_Attributes()};
Description: Gets a list of Attributes of this translation.
Optionally just get Attrubutes for given code.
Recognized attribute "_selenocysteine"
Returntype : listref Bio::EnsEMBL::Attribute
Exceptions : warning if translation does not have attached adaptor and
attempts lazy load.
Caller : general, modify_translation
Status : Stable
add_Attributes
Arg [1..N] : Bio::EnsEMBL::Attribute $attribute
Attributes to add.
Example : $translation->add_Attributes($selenocysteine_attribute);
Description: Adds an Attribute to the Translation. Usefull to
do _selenocysteine.
If you add an attribute before you retrieve any from database,
lazy load will be disabled.
Returntype : none
Exceptions : throw on incorrect arguments
Caller : general
Status : Stable
get_all_SeqEdits
Arg [1] : ArrayRef $edits. Specify the name of the edits to fetch
Example : my @seqeds = @{$translation->get_all_SeqEdits()};
my @seqeds = @{$translation->get_all_SeqEdits('_selenocysteine')};
Description: Retrieves all post transcriptional sequence modifications for
this translation.
Returntype : Bio::EnsEMBL::SeqEdit
Exceptions : none
Caller : spliced_seq()
Status : Stable
get_all_selenocysteine_SeqEdits
Example : my @edits = @{$translation->get_all_selenocysteine_SeqEdits()};
Description: Retrieves all post transcriptional sequence modifications related
to selenocysteine PTMs
Returntype : Bio::EnsEMBL::SeqEdit
Exceptions : none
get_all_stop_codon_SeqEdits
Example : my @edits = @{$translation->get_all_stop_codon_SeqEdits()};
Description: Retrieves all post transcriptional sequence modifications related
to stop codon readthrough
Returntype : Bio::EnsEMBL::SeqEdit
Exceptions : none
modify_translation
Arg [1] : Bio::Seq $peptide
Example : my $seq = Bio::Seq->new(-SEQ => $dna)->translate();
$translation->modify_translation($seq);
Description: Applies sequence edits such as selenocysteines to the Bio::Seq
peptide thats passed in
Returntype : Bio::Seq
Exceptions : none
Caller : Bio::EnsEMBL::Transcript->translate
Status : Stable
load
Arg [1] : Boolean $load_xrefs
Load (or don't load) xrefs. Default is to load xrefs.
Example : $translation->load();
Description : The Ensembl API makes extensive use of
lazy-loading. Under some circumstances (e.g.,
when copying genes between databases), all data of
an object needs to be fully loaded. This method
loads the parts of the object that are usually
lazy-loaded.
Returns : none
get_all_DASFactories
Function : Retrieves a listref of registered DAS objects
Returntype: Listref of DAS Objects
Exceptions: none
Caller : webcode
Example : $dasref = $prot->get_all_DASFactories;
Status : Stable
get_all_DAS_Features
Example : $features = $prot->get_all_DAS_Features;
Description: Retrieves a hash reference to a hash of DAS feature
sets, keyed by the DNS, NOTE the values of this hash
are an anonymous array containing:
(1) a pointer to an array of features;
(2) a pointer to the DAS stylesheet
Returntype : hashref of Bio::SeqFeatures
Exceptions : none
Caller : webcode
Status : Stable
summary_as_hash
Example : $translation_summary = $translation->summary_as_hash();
Description : Retrieves a textual summary of this Translation.
Not inherited from Feature.
Returns : hashref of arrays of descriptive strings
Status : Intended for internal use