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::DBSQL::TranscriptAdaptor - An adaptor which performs database interaction relating to the storage and retrieval of Transcripts

SYNOPSIS

use Bio::EnsEMBL::Registry;

Bio::EnsEMBL::Registry->load_registry_from_db(
  -host => 'ensembldb.ensembl.org',
  -user => 'anonymous'
);

$transcript_adaptor =
  Bio::EnsEMBL::Registry->get_adaptor( 'Human', 'Core',
  'Transcript' );

$transcript = $transcript_adaptor->fetch_by_dbID(1234);

$transcript =
  $transcript_adaptor->fetch_by_stable_id('ENST00000201961');

$slice =
  $slice_adaptor->fetch_by_region( 'Chromosome', '3', 1, 1000000 );
@transcripts = @{ $transcript_adaptor->fetch_all_by_Slice($slice) };

($transcript) =
  @{ $transcript_adaptor->fetch_all_by_external_name('NP_065811.1') };

DESCRIPTION

This adaptor provides a means to retrieve and store information related to Transcripts. Primarily this involves the retrieval or storage of Bio::EnsEMBL::Transcript objects from a database.

See Bio::EnsEMBL::Transcript for details of the Transcript class.

fetch_by_stable_id

Arg [1]    : String $stable_id 
             The stable id of the transcript to retrieve
Example    : my $tr = $tr_adaptor->fetch_by_stable_id('ENST00000309301');
Description: Retrieves a transcript via its stable id.
Returntype : Bio::EnsEMBL::Transcript
Exceptions : none
Caller     : general
Status     : Stable

fetch_by_stable_id_version

Arg [1]    : String $id 
             The stable ID of the transcript to retrieve
Arg [2]    : Integer $version
             The version of the stable_id to retrieve
Example    : $tr = $tr_adaptor->fetch_by_stable_id('ENST00000309301', 3);
Description: Retrieves a transcript object from the database via its 
             stable id and version.
             The transcript will be retrieved in its native coordinate system (i.e.
             in the coordinate system it is stored in the database). It may
             be converted to a different coordinate system through a call to
             transform() or transfer(). If the transcript is not found
             undef is returned instead.
Returntype : Bio::EnsEMBL::Transcript or undef
Exceptions : if we cant get the transcript in given coord system
Caller     : general
Status     : Stable

fetch_all_versions_by_stable_id

Arg [1]     : String $stable_id 
              The stable ID of the transcript to retrieve
Example     : my $tr = $tr_adaptor->fetch_all_version_by_stable_id
                ('ENST00000309301');
Description : Similar to fetch_by_stable_id, but retrieves all versions of a
              transcript stored in the database.
Returntype  : listref of Bio::EnsEMBL::Transcript objects
Exceptions  : if we cant get the gene in given coord system
Caller      : general
Status      : At Risk

fetch_by_rnaproduct_id

Arg [1]    : Int $id
             The internal identifier of the RNAProduct whose transcript
             is to be retrieved
Example    : my $tr = $tr_adaptor->fetch_by_rnaproduct_id($rnap->dbID);
Description: Given the internal identifier of a RNAProduct this method
             retrieves the transcript associated with that RNAProduct.
             If the transcript cannot be found undef is returned instead.
Returntype : Bio::EnsEMBL::Transcript or undef
Exceptions : none
Caller     : general
Status     : Stable

fetch_by_translation_stable_id

Arg [1]    : String $transl_stable_id
             The stable identifier of the translation of the transcript to 
             retrieve
Example    : my $tr = $tr_adaptor->fetch_by_translation_stable_id
                ('ENSP00000311007');
Description: Retrieves a Transcript object using the stable identifier of
             its translation.
Returntype : Bio::EnsEMBL::Transcript or undef
Exceptions : none
Caller     : general
Status     : Stable

fetch_by_translation_stable_id_version

Arg [1]    : String $transl_stable_id
             The stable identifier of the translation of the transcript to 
             retrieve
Arg [2]    : Integer $version
             The version of the translation of the transcript to retrieve
Example    : my $tr = $tr_adaptor->fetch_by_translation_stable_id_version
                ('ENSP00000311007', 2);
Description: Retrieves a Transcript object using the stable identifier and
             version of its translation.
Returntype : Bio::EnsEMBL::Transcript or undef
Exceptions : none
Caller     : general
Status     : Stable

fetch_by_translation_id

Arg [1]    : Int $id
             The internal identifier of the translation whose transcript
             is to be retrieved
Example    : my $tr = $tr_adaptor->fetch_by_translation_id($transl->dbID);
Description: Given the internal identifier of a translation this method 
             retrieves the transcript associated with that translation.
             If the transcript cannot be found undef is returned instead.
Returntype : Bio::EnsEMBL::Transcript or undef
Exceptions : none
Caller     : general
Status     : Stable

fetch_all_by_Gene

Arg [1]    : Bio::EnsEMBL::Gene $gene
             The gene to fetch transcripts of
Example    : my $gene = $gene_adaptor->fetch_by_stable_id('ENSG0000123');
             my @transcripts = { $tr_adaptor->fetch_all_by_Gene($gene) };
Description: Retrieves Transcript objects for given gene. Puts Genes slice
             in each Transcript. 
Returntype : Listref of Bio::EnsEMBL::Transcript objects
Exceptions : none
Caller     : Gene->get_all_Transcripts()
Status     : Stable

fetch_all_by_Slice

Arg [1]    : Bio::EnsEMBL::Slice $slice
             The slice to fetch transcripts on
Arg [2]    : (optional) Boolean $load_exons
             If true, exons will be loaded immediately rather than
             lazy loaded later
Arg [3]    : (optional) String $logic_name
             The logic name of the type of features to obtain
ARG [4]    : (optional) String $constraint
             An extra contraint.
Example    : my @transcripts = @{ $tr_adaptor->fetch_all_by_Slice($slice) };
Description: Overrides superclass method to optionally load exons
             immediately rather than lazy-loading them later. This
             is more efficient when there are a lot of transcripts whose
             exons are going to be used.
Returntype : Listref of Bio::EnsEMBL::Transcript objects
Exceptions : thrown if exon cannot be placed on transcript slice
Caller     : Slice::get_all_Transcripts
Status     : Stable

fetch_all_by_external_name

Arg [1]    : String $external_name
             An external identifier of the transcript to be obtained
Arg [2]    : (optional) String $external_db_name
             The name of the external database from which the
             identifier originates.
Arg [3]    : Boolean override. Force SQL regex matching for users
             who really do want to find all 'NM%'
Example    : my @transcripts =
                @{ $tr_adaptor->fetch_all_by_external_name( 'NP_065811.1') };
             my @more_transcripts = 
                @{$tr_adaptor->fetch_all_by_external_name( 'NP_0658__._')};
Description: Retrieves all transcripts which are associated with
             an external identifier such as a GO term, Swissprot
             identifer, etc.  Usually there will only be a single
             transcript returned in the list reference, but not
             always.  Transcripts are returned in their native
             coordinate system, i.e. the coordinate system in which
             they are stored in the database.  If they are required
             in another coordinate system the Transcript::transfer or
             Transcript::transform method can be used to convert them.
             If no transcripts with the external identifier are found,
             a reference to an empty list is returned.
             SQL wildcards % and _ are supported in the $external_name
             but their use is somewhat restricted for performance reasons.
             Users that really do want % and _ in the first three characters
             should use argument 3 to prevent optimisations
Returntype : listref of Bio::EnsEMBL::Transcript
Exceptions : none
Caller     : general
Status     : Stable

fetch_all_by_GOTerm

Arg [1]   : Bio::EnsEMBL::OntologyTerm
            The GO term for which transcripts should be fetched.

Example:  @transcripts = @{
            $transcript_adaptor->fetch_all_by_GOTerm(
              $go_adaptor->fetch_by_accession('GO:0030326') ) };

Description   : Retrieves a list of transcripts that are
                associated with the given GO term, or with any of
                its descendent GO terms.  The transcripts returned
                are in their native coordinate system, i.e. in
                the coordinate system in which they are stored
                in the database.  If another coordinate system
                is required then the Transcript::transfer or
                Transcript::transform method can be used.

Return type   : listref of Bio::EnsEMBL::Transcript
Exceptions    : Throws of argument is not a GO term
Caller        : general
Status        : Stable

fetch_all_by_GOTerm_accession

Arg [1]   : String
            The GO term accession for which genes should be
            fetched.

Example   :

  @genes =
    @{ $gene_adaptor->fetch_all_by_GOTerm_accession(
      'GO:0030326') };

Description   : Retrieves a list of genes that are associated with
                the given GO term, or with any of its descendent
                GO terms.  The genes returned are in their native
                coordinate system, i.e. in the coordinate system
                in which they are stored in the database.  If
                another coordinate system is required then the
                Gene::transfer or Gene::transform method can be
                used.

Return type   : listref of Bio::EnsEMBL::Gene
Exceptions    : Throws of argument is not a GO term accession
Caller        : general
Status        : Stable

fetch_by_display_label

Arg [1]    : String $label - display label of transcript to fetch
Example    : my $tr = $tr_adaptor->fetch_by_display_label("BRCA2");
Description: Returns the transcript which has the given display label or
             undef if there is none. If there are more than 1, only the first
             is reported.
Returntype : Bio::EnsEMBL::Transcript
Exceptions : none
Caller     : general
Status     : Stable

fetch_all_by_exon_stable_id

Arg [1]    : String $stable_id 
             The stable id of an exon in a transcript
Example    : my $tr = $tr_adaptor->fetch_all_by_exon_stable_id
                ('ENSE00000309301');
Description: Retrieves a list of transcripts via an exon stable id.
Returntype : Listref of Bio::EnsEMBL::Transcript objects
Exceptions : none
Caller     : general
Status     : Stable

fetch_all_by_source

Arg [1]    : String $source
             listref of $sources
             The source of the transcript to retrieve. You can have as an argument a reference
             to a list of sources
Example    : $transcripts = $transcript_adaptor->fetch_all_by_source('havana'); 
             $transcripts = $transcript_adaptor->fetch_all_by_source(['ensembl', 'vega']);
Description: Retrieves an array reference of transcript objects from the database via its source or sources.
             The transcript will be retrieved in its native coordinate system (i.e.
             in the coordinate system it is stored in the database). It may
             be converted to a different coordinate system through a call to
             transform() or transfer(). If the gene or exon is not found
             undef is returned instead.
Returntype  : listref of Bio::EnsEMBL::Transcript
Exceptions : if we cant get the gene in given coord system
Caller     : general
Status     : Stable

source_constraint

Arg [1]    : String $source
             listref of $sources
             The source of the transcript to retrieve. You can have as an argument a reference
             to a list of sources
Description: Used internally to generate a SQL constraint to restrict a transcript query by source
Returntype  : String
Exceptions : If source is not supplied
Caller     : general
Status     : Stable

count_all_by_source

Arg [1]     : String $source
              listref of $source
              The source of the transcript to retrieve. You can have as an argument a reference
              to a list of sources
Example     : $cnt = $transcript_adaptor->count_all_by_source('ensembl'); 
              $cnt = $transcript_adaptor->count_all_by_source(['havana', 'vega']);
Description : Retrieves count of transcript objects from the database via its source or sources.
Returntype  : integer
Caller      : general
Status      : Stable

count_all_by_Slice

Arg [1]    : Bio::EnsEMBL::Slice $slice
             The slice to count transcripts on.
Arg [2]    : (optional) biotype(s) string or arrayref of strings
              the biotype of the features to count.
Arg [1]    : (optional) string $source
             the source name of the features to count.
Example    : $cnt = $transcript_adaptor->count_all_by_Slice();
Description: Method to count transcripts on a given slice, filtering by biotype and source
Returntype : integer
Exceptions : thrown if exon cannot be placed on transcript slice
Status     : Stable
Caller     : general

fetch_all_by_biotype

Arg [1]    : String $biotype 
             listref of $biotypes
             The biotype of the transcript to retrieve. You can have as an argument a reference
             to a list of biotypes
Example    : $gene = $transcript_adaptor->fetch_all_by_biotype('protein_coding'); 
             $gene = $transcript_adaptor->fetch_all_by_biotypes(['protein_coding', 'sRNA', 'miRNA']);
Description: Retrieves an array reference of transcript objects from the database via its biotype or biotypes.
             The transcript will be retrieved in its native coordinate system (i.e.
             in the coordinate system it is stored in the database). It may
             be converted to a different coordinate system through a call to
             transform() or transfer(). If the gene or exon is not found
             undef is returned instead.
Returntype  : listref of Bio::EnsEMBL::Transcript
Exceptions : if we cant get the gene in given coord system
Caller     : general
Status     : Stable

biotype_constraint

Arg [1]    : String $biotypes 
             listref of $biotypes
             The biotype of the transcript to retrieve. You can have as an argument a reference
             to a list of biotypes
Description: Used internally to generate a SQL constraint to restrict a transcript query by biotype
Returntype  : String
Exceptions : If biotype is not supplied
Caller     : general
Status     : Stable

count_all_by_biotype

Arg [1]     : String $biotype 
              listref of $biotypes
              The biotype of the transcript to retrieve. You can have as an argument a reference
              to a list of biotypes
Example     : $cnt = $transcript_adaptor->count_all_by_biotype('protein_coding'); 
              $cnt = $transcript_adaptor->count_all_by_biotypes(['protein_coding', 'sRNA', 'miRNA']);
Description : Retrieves count of transcript objects from the database via its biotype or biotypes.
Returntype  : integer
Caller      : general
Status      : Stable

store

Arg [1]    : Bio::EnsEMBL::Transcript $transcript
             The transcript to be written to the database
Arg [2]    : Int $gene_dbID
             The identifier of the gene that this transcript is associated 
             with
Arg [3]    : DEPRECATED (optional) Int $analysis_id
             The analysis_id to use when storing this gene. This is for 
             backward compatibility only and used to fall back to the gene
             analysis_id if no analysis object is attached to the transcript
             (which you should do for new code).
Arg [4]    : prevent coordinate recalculation if you are persisting 
             transcripts with this gene
Example    : $transID = $tr_adaptor->store($transcript, $gene->dbID);
Description: Stores a transcript in the database and returns the new
             internal identifier for the stored transcript.
Returntype : Int 
Exceptions : none
Caller     : general
Status     : Stable

get_Interpro_by_transid

Arg [1]    : String $trans_stable_id
             The stable if of the transcript to obtain
Example    : @i = $tr_adaptor->get_Interpro_by_transid($trans->stable_id()); 
Description: Gets interpro accession numbers by transcript stable id.
             A hack really - we should have a much more structured 
             system than this.
Returntype : listref of strings (Interpro_acc:description)
Exceptions : none 
Caller     : domainview? , GeneView
Status     : Stable

is_Transcript_canonical()

Arg [1]     : Bio::EnsEMBL::Transcript $transcript
              The transcript to query with
Example     : $tr_adaptor->is_Transcript_canonical($transcript);
Description : Returns a boolean if the given transcript is considered
              canonical with respect to a gene
Returntype  : Boolean
Exceptions  : None
Caller      : Bio::EnsEMBL::Transcript
Status      : Beta

remove

Arg [1]    : Bio::EnsEMBL::Transcript $transcript
             The transcript to remove from the database
Arg [2]    : Boolean, update Gene coordinates after removal. WARNING: this does not alter any other copies of the 
             gene currently in memory. Other copies will retain their original coordinates. Either refetch them
             or go directly through Gene->remove_Transcript first, then remove the Transcript here.
Example    : $tr_adaptor->remove($transcript);
Description: Removes a transcript completely from the database, and all
             associated information.
             This method is usually called by the GeneAdaptor::remove method
             because this method will not preform the removal of genes
             which are associated with this transcript. Do not call this
             method directly unless you know there are no genes associated
             with the transcript!
Returntype : none
Exceptions : throw on incorrect arguments
             warning if transcript is not in this database
Caller     : GeneAdaptor::remove
Status     : Stable

update

Arg [1]    : Bio::EnsEMBL::Transcript $transcript
             The transcript to update
Example    : $tr_adaptor->update($transcript);
Description: Updates a transcript in the database.
Returntype : None
Exceptions : thrown if the $transcript is not a Bio::EnsEMBL::Transcript.
             warn if the method is called on a transcript that does not exist 
             in the database.
             Should warn if trying to update the number of attached exons, but
             this is a far more complex process and is not yet implemented.
Caller     : general
Status     : Stable

list_dbIDs

Example    : @transcript_ids = @{ $t_adaptor->list_dbIDs };
Description: Gets a list of internal ids for all transcripts in the db.
Arg[1]     : <optional> int. not 0 for the ids to be sorted by the seq_region.  Returntype : Listref of Ints
Exceptions : none
Caller     : general
Status     : Stable

list_stable_ids

Example    : @stable_trans_ids = @{ $transcript_adaptor->list_stable_ids };
Description: Gets a list of stable ids for all transcripts in the current
             database.
Returntype : Listref of Strings
Exceptions : none
Caller     : general
Status     : Stable

fetch_all_by_exon_supporting_evidence

Arg [1]    : String $hit_name
             Name of supporting feature
Arg [2]    : String $feature_type 
             one of "dna_align_feature" or "protein_align_feature"
Arg [3]    : (optional) Bio::Ensembl::Analysis
Example    : $tr = $tr_adaptor->fetch_all_by_exon_supporting_evidence
                ('XYZ', 'dna_align_feature');
Description: Gets all the transcripts with exons which have a specified hit
             on a particular type of feature. Optionally filter by analysis.
Returntype : Listref of Bio::EnsEMBL::Transcript objects
Exceptions : If feature_type is not of correct type.
Caller     : general
Status     : Stable

fetch_all_by_transcript_supporting_evidence

Arg [1]    : String $hit_name
             Name of supporting feature
Arg [2]    : String $feature_type 
             one of "dna_align_feature" or "protein_align_feature"
Arg [3]    : (optional) Bio::Ensembl::Analysis
Example    : $transcripts = $transcript_adaptor->fetch_all_by_transcript_supporting_evidence('XYZ', 'dna_align_feature');
Description: Gets all the transcripts with evidence from a specified hit_name on a particular type of feature, stored in the  
             transcript_supporting_feature table. Optionally filter by analysis.  For hits stored in the supporting_feature 
             table (linked to exons) use fetch_all_by_exon_supporting_evidence instead.
Returntype : Listref of Bio::EnsEMBL::Transcript objects
Exceptions : If feature_type is not of correct type.
Caller     : general
Status     : Stable