Class: Ensembl::Core::Intron
- Inherits:
-
Object
- Object
- Ensembl::Core::Intron
- Includes:
- Sliceable
- Defined in:
- lib/bio-ensembl/core/transcript.rb
Overview
The Intron class describes an intron.
This class does not use ActiveRecord and is only defined within the API. There is no introns table in the Ensembl database.
This class includes the mixin Sliceable, which means that it is mapped to a SeqRegion object and a Slice can be created for objects o this class. See Sliceable and Slice for more information.
Instance Attribute Summary collapse
-
#next_exon ⇒ Object
Returns the value of attribute next_exon.
-
#previous_exon ⇒ Object
Returns the value of attribute previous_exon.
-
#seq_region ⇒ Object
Returns the value of attribute seq_region.
-
#seq_region_end ⇒ Object
Returns the value of attribute seq_region_end.
-
#seq_region_start ⇒ Object
Returns the value of attribute seq_region_start.
-
#seq_region_strand ⇒ Object
Returns the value of attribute seq_region_strand.
-
#transcript ⇒ Object
Returns the value of attribute transcript.
Instance Method Summary collapse
-
#initialize(exon_1, exon_2) ⇒ Intron
constructor
A new instance of Intron.
Methods included from Sliceable
#length, #project, #seq, #slice, #start, #stop, #strand, #transform
Constructor Details
#initialize(exon_1, exon_2) ⇒ Intron
Returns a new instance of Intron.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/bio-ensembl/core/transcript.rb', line 34 def initialize(exon_1, exon_2) # Check if these are actually two adjacent exons from the same transcript ok = true transcript = nil exon_1.transcripts.each do |t| transcript = t if exon_2.transcripts.include?(t) end raise ArgumentError, "Arguments should be adjacent exons of same transcript" if transcript.nil? rank_1 = ExonTranscript.find_by_transcript_id_and_exon_id(transcript.id, exon_1.id).rank rank_2 = ExonTranscript.find_by_transcript_id_and_exon_id(transcript.id, exon_2.id).rank raise ArgumentError, "Arguments should be adjacent exons of same transcript" if (rank_2 - rank_1).abs > 1 @previous_exon, @next_exon = [exon_1, exon_2].sort_by{|e| e.seq_region_start} @transcript = transcript @seq_region = @previous_exon.seq_region @seq_region_start = @previous_exon.seq_region_end + 1 @seq_region_end = @next_exon.seq_region_start - 1 @seq_region_strand = @previous_exon.seq_region_strand end |
Instance Attribute Details
#next_exon ⇒ Object
Returns the value of attribute next_exon.
32 33 34 |
# File 'lib/bio-ensembl/core/transcript.rb', line 32 def next_exon @next_exon end |
#previous_exon ⇒ Object
Returns the value of attribute previous_exon.
32 33 34 |
# File 'lib/bio-ensembl/core/transcript.rb', line 32 def previous_exon @previous_exon end |
#seq_region ⇒ Object
Returns the value of attribute seq_region.
31 32 33 |
# File 'lib/bio-ensembl/core/transcript.rb', line 31 def seq_region @seq_region end |
#seq_region_end ⇒ Object
Returns the value of attribute seq_region_end.
31 32 33 |
# File 'lib/bio-ensembl/core/transcript.rb', line 31 def seq_region_end @seq_region_end end |
#seq_region_start ⇒ Object
Returns the value of attribute seq_region_start.
31 32 33 |
# File 'lib/bio-ensembl/core/transcript.rb', line 31 def seq_region_start @seq_region_start end |
#seq_region_strand ⇒ Object
Returns the value of attribute seq_region_strand.
31 32 33 |
# File 'lib/bio-ensembl/core/transcript.rb', line 31 def seq_region_strand @seq_region_strand end |
#transcript ⇒ Object
Returns the value of attribute transcript.
32 33 34 |
# File 'lib/bio-ensembl/core/transcript.rb', line 32 def transcript @transcript end |