Class Ensembl::Core::Transcript
In: lib/ensembl/core/transcript.rb
Parent: DBConnection

DESCRIPTION

The Transcript class provides an interface to the transcript table. This table contains mappings of transcripts for a Gene to a SeqRegion.

This class uses ActiveRecord to access data in the Ensembl database. See the general documentation of the Ensembl module for more information on what this means and what methods are available.

This class includes the mixin Sliceable, which means that it is mapped to a SeqRegion object and a Slice can be created for objects of this class. See Sliceable and Slice for more information.

USAGE

 #TODO

Methods

Included Modules

Sliceable

External Aliases

transcript_attribs -> attribs

Public Class methods

DESCRIPTION

The Transcript#find_all_by_stable_id class method returns an array of transcripts with the given stable_id. If none were found, an empty array is returned.

[Source]

    # File lib/ensembl/core/transcript.rb, line 84
84:       def self.find_all_by_stable_id(stable_id)
85:         answer = Array.new
86:         transcript_stable_id_objects = Ensembl::Core::TranscriptStableId.find_all_by_stable_id(stable_id)
87:         transcript_stable_id_objects.each do |transcript_stable_id_object|
88:           answer.push(Ensembl::Core::Transcript.find(transcript_stable_id_object.transcript_id))
89:         end
90:       
91:         return answer
92:       end

DESCRIPTION

The Transcript#find_all_by_stable_id class method returns a transcripts with the given stable_id. If none was found, nil is returned.

[Source]

     # File lib/ensembl/core/transcript.rb, line 97
 97:       def self.find_by_stable_id(stable_id)
 98:         all = self.find_all_by_stable_id(stable_id)
 99:         if all.length == 0
100:           return nil
101:         else
102:           return all[0]
103:         end
104:       end

DESCRIPTION

The Transcript#find_by_stable_id class method fetches a Transcript object based on its stable ID (i.e. the "ENST" accession number). If the name is not found, it returns nil.

[Source]

     # File lib/ensembl/core/transcript.rb, line 110
110:       def self.find_by_stable_id(stable_id)
111:         transcript_stable_id = TranscriptStableId.find_by_stable_id(stable_id)
112:         if transcript_stable_id.nil?
113:           return nil
114:         else
115:           return transcript_stable_id.transcript
116:         end
117:       end

Public Instance methods

DESCRIPTION

The Transcript#cdna2genomic method converts cDNA coordinates to genomic coordinates for this transcript.


Arguments:

  • position:: position on the cDNA (required)
Returns:integer

[Source]

     # File lib/ensembl/core/transcript.rb, line 275
275:       def cdna2genomic(pos)
276:         #FIXME: Still have to check for when pos is outside of scope of cDNA.
277:         # Identify the exon we're looking at.
278:         exon_with_target = self.exon_for_cdna_position(pos)
279:         
280:         accumulated_position = 0
281:         self.exons.each do |exon|
282:           if exon == exon_with_target
283:             answer = exon.start + ( pos - accumulated_position )
284:             return answer
285:           else
286:             accumulated_position += exon.length
287:           end
288:         end
289:       end

DESCRIPTION

The Transcript#cds2genomic method converts CDS coordinates to genomic coordinates for this transcript.


Arguments:

  • pos:: position on the CDS (required)

Returns::

[Source]

     # File lib/ensembl/core/transcript.rb, line 298
298:       def cds2genomic(pos)
299:         return self.cdna2genomic(pos + self.coding_region_cdna_start)
300:       end

DESCRIPTION

The Transcript#cds_seq method returns the coding sequence of the transcript, i.e. the concatenated sequence of all exons minus the UTRs.

[Source]

     # File lib/ensembl/core/transcript.rb, line 135
135:       def cds_seq
136:         cds_length = self.coding_region_cdna_end - self.coding_region_cdna_start + 1
137:         
138:         return self.seq[(self.coding_region_cdna_start - 1), cds_length]
139:       end

DESCRIPTION

The Transcript#coding_region_cdna_end returns the stop position of the CDS in cDNA coordinates. Note that, in contrast to the Transcript#coding_region_genomic_end, the CDS start position is always at the border of the 3‘UTR. So for genes on the reverse strand, the CDS start position in cDNA coordinates will be ’’right’’ of the CDS stop position.

[Source]

     # File lib/ensembl/core/transcript.rb, line 223
223:       def coding_region_cdna_end
224:         answer = 0
225:         
226:         self.exons.each do |exon|
227:           if exon == self.translation.end_exon
228:             answer += self.translation.seq_end
229:             return answer
230:           else
231:             answer += exon.length
232:           end
233:         end
234:       end

DESCRIPTION

The Transcript#coding_region_cdna_start returns the start position of the CDS in cDNA coordinates. Note that, in contrast to the Transcript#coding_region_genomic_start, the CDS start position is always at the border of the 5‘UTR. So for genes on the reverse strand, the CDS start position in cDNA coordinates will be ’’right’’ of the CDS stop position.

[Source]

     # File lib/ensembl/core/transcript.rb, line 202
202:       def coding_region_cdna_start
203:         answer = 0
204:         
205:         self.exons.each do |exon|
206:           if exon == self.translation.start_exon
207:             answer += self.translation.seq_start
208:             return answer
209:           else
210:             answer += exon.length
211:           end
212:         end
213:         
214:       end

DESCRIPTION

The Transcript#coding_region_genomic_end returns the stop position of the CDS in genomic coordinates. Note that, in contrast to Transcript#coding_region_cdna_end, the CDS stop position is always ’’right’’ of the start position. So for transcripts on the reverse strand, the CDS stop position is at the border of the 5‘UTR instead of the 3‘UTR.

[Source]

     # File lib/ensembl/core/transcript.rb, line 186
186:       def coding_region_genomic_end
187:         strand = self.translation.start_exon.seq_region_strand
188:         if strand == 1
189:           return self.translation.end_exon.seq_region_start + ( self.translation.seq_end - 1 )
190:         else
191:           return self.translation.start_exon.seq_region_end - ( self.translation.seq_start - 1 )
192:         end
193:       end

DESCRIPTION

The Transcript#coding_region_genomic_start returns the start position of the CDS in genomic coordinates. Note that, in contrast to Transcript#coding_region_cdna_start, the CDS start position is always ’’left’’ of the end position. So for transcripts on the reverse strand, the CDS start position is at the border of the 3‘UTR instead of the 5‘UTR.

[Source]

     # File lib/ensembl/core/transcript.rb, line 170
170:       def coding_region_genomic_start
171:         strand = self.translation.start_exon.seq_region_strand
172:         if strand == 1
173:           return self.translation.start_exon.seq_region_start + ( self.translation.seq_start - 1 )
174:         else
175:           return self.translation.end_exon.seq_region_end - ( self.translation.seq_end - 1 )
176:         end
177:       end

DESCRIPTION

The Transcript#display_label method returns the default name of the transcript.

[Source]

    # File lib/ensembl/core/transcript.rb, line 73
73:       def display_label
74:         return Xref.find(self.display_xref_id).display_label
75:       end
display_name()

Alias for display_label

DESCRIPTION

The Transcript#exon_for_position identifies the exon that covers a given position of the cDNA.

[Source]

     # File lib/ensembl/core/transcript.rb, line 255
255:       def exon_for_cdna_position(pos)
256:         # FIXME: Still have to check for when pos is outside of scope of cDNA.
257:         accumulated_exon_length = 0
258:         
259:         self.exons.each do |exon|
260:           accumulated_exon_length += exon.length
261:           if accumulated_exon_length > pos
262:             return exon
263:           end
264:         end
265:         raise RuntimeError, "Position outside of cDNA scope"
266:       end

DESCRIPTION

The Transcript#exon_for_position identifies the exon that covers a given genomic position. Returns the exon object, or nil if in intron.

[Source]

     # File lib/ensembl/core/transcript.rb, line 240
240:       def exon_for_genomic_position(pos)
241:         if pos < coding_region_genomic_start or pos > coding_region_genomic_end
242:           raise RuntimeError, "Position has to be within transcript"
243:         end
244:         self.exons.each do |exon|
245:           if exon.start <= pos and exon.stop >= pos
246:             return exon
247:           end
248:         end
249:         return nil
250:       end

The Transcript#exons method returns the exons for this transcript in the order of their ranks in the exon_transcript table.


Arguments:none
Returns:sorted array of Exon objects

[Source]

    # File lib/ensembl/core/transcript.rb, line 56
56:       def exons
57:         if @exons.nil?
58:           @exons = self.exon_transcripts.sort_by{|et| et.rank.to_i}.collect{|et| et.exon}
59:         end
60:         return @exons
61:       end

DESCRIPTION

The Transcript#five_prime_utr_seq method returns the sequence of the 5‘UTR of the transcript.

[Source]

     # File lib/ensembl/core/transcript.rb, line 144
144:       def five_prime_utr_seq
145:         return self.seq[0, self.coding_region_cdna_start - 1]
146:       end

DESCRIPTION

The Transcript#genomic2cdna method converts genomic coordinates to cDNA coordinates for this transcript.


Arguments:

  • pos:: position on the chromosome (required)

Returns::

[Source]

     # File lib/ensembl/core/transcript.rb, line 320
320:       def genomic2cdna(pos)
321:         #FIXME: Still have to check for when pos is outside of scope of cDNA.
322:         # Identify the exon we're looking at.
323:         exon_with_target = self.exon_for_genomic_position(pos)
324:         
325:         accumulated_position = 0
326:         self.exons.each do |exon|
327:           if exon == exon_with_target
328:             accumulated_position += ( pos - exon.start )
329:             return accumulated_position
330:           else
331:             accumulated_position += exon.length
332:           end
333:         end
334:         return RuntimeError, "Position outside of cDNA scope"
335:       end

DESCRIPTION

The Transcript#genomic2cds method converts genomic coordinates to CDS coordinates for this transcript.


Arguments:

  • pos:: position on the chromosome (required)

Returns::

[Source]

     # File lib/ensembl/core/transcript.rb, line 344
344:       def genomic2cds(pos)
345:         return self.genomic2cdna(pos) - self.coding_region_cdna_start
346:       end

DESCRIPTION

The Transcript#genomic2pep method converts genomic coordinates to peptide coordinates for this transcript.


Arguments:

  • pos:: position on the chromosome (required)

Returns::

[Source]

     # File lib/ensembl/core/transcript.rb, line 355
355:       def genomic2pep(pos)
356:         raise NotImplementedError
357:       end
label()

Alias for display_label

name()

Alias for display_label

DESCRIPTION

The Transcript#pep2genomic method converts peptide coordinates to genomic coordinates for this transcript.


Arguments:

  • pos:: position on the peptide (required)

Returns::

[Source]

     # File lib/ensembl/core/transcript.rb, line 309
309:       def pep2genomic(pos)
310:         raise NotImplementedError
311:       end

DESCRIPTION

The Transcript#protein_seq method returns the sequence of the protein of the transcript.

[Source]

     # File lib/ensembl/core/transcript.rb, line 158
158:       def protein_seq
159:         return Bio::Sequence::NA.new(self.cds_seq).translate.seq
160:       end

DESCRIPTION

The Transcript#seq method returns the full sequence of all concatenated exons.

[Source]

     # File lib/ensembl/core/transcript.rb, line 122
122:       def seq
123:         if @seq.nil?
124:           @seq = ''
125:           self.exons.each do |exon|
126:             @seq += exon.seq
127:           end
128:         end
129:         return @seq
130:       end

The Transcript#stable_id method returns the stable ID of the transcript.


Arguments:none
Returns:String

[Source]

    # File lib/ensembl/core/transcript.rb, line 67
67:       def stable_id
68:         return self.transcript_stable_id.stable_id
69:       end

DESCRIPTION

The Transcript#three_prime_utr_seq method returns the sequence of the 3‘UTR of the transcript.

[Source]

     # File lib/ensembl/core/transcript.rb, line 151
151:       def three_prime_utr_seq
152:         return self.seq[self.coding_region_cdna_end..-1]
153:       end

[Validate]