3 See the NOTICE file distributed with
this work
for additional information
4 regarding copyright ownership.
6 Licensed under the Apache License, Version 2.0 (the
"License");
7 you may not use
this file except in compliance with the License.
8 You may obtain a copy of the License at
12 Unless required by applicable law or agreed to in writing, software
13 distributed under the License is distributed on an
"AS IS" BASIS,
14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 See the License
for the specific language governing permissions and
16 limitations under the License.
23 Please email comments or questions to the
public Ensembl
24 developers list at <http:
26 Questions may also be sent to the Ensembl help desk at
40 package Bio::EnsEMBL::Intron;
51 Arg [2] : Bio::EnsEMBL::Exon The 3' exon for the intron; required
54 Description: Create an
Intron object from two exons and an optional analysis
56 Exceptions : exons not on the same strand or slice.
63 my ( $proto, $e1, $e2, $analysis ) = @_;
65 my $class = ref $proto || $proto;
67 my $self = $class->SUPER::new();
69 if ( $e1->strand() == -1 ) {
70 $self->{
'end'} = $e1->
start() - 1;
71 $self->{
'start'} = $e2->end() + 1;
73 $self->{
'start'} = $e1->end() + 1;
74 $self->{
'end'} = $e2->start() - 1;
77 if ( $e1->strand() != $e2->strand() ) {
78 # throw("Exons on different strand. Not allowed");
80 $self->{
'strand'} = $e1->strand();
83 if ( $e1->slice() != $e2->slice() ) {
84 if ( ( $e1->slice()->seq_region_name() ne
85 $e2->slice()->seq_region_name() )
86 && ( $e1->slice()->coord_system_name() ne
87 $e2->slice()->coord_system_name() ) )
89 throw(
"Exons on different slices. Not allowed");
91 warning(
"Exons have different slice references to the same seq_region");
94 $self->{
'slice'} = $e1->slice();
98 $self->analysis($analysis);
101 $self->{
'prev'} = $e1;
102 $self->{
'next'} = $e2;
110 Example : $length = $intron->length();
111 Description: Returns the length of
this intron
122 # TODO: Introns on circular slices, see Feature.pm but allow for
123 # zero-length introns.
125 return $self->{
'end'} - $self->{
'start'} + 1;
132 Example : $exon = $intron->prev_Exon
133 Description: Returns the
exon before
this Intron
144 return $self->{
'prev'};
151 Example : $exon = $intron->next_Exon
152 Description: Returns the
exon after
this Intron
163 return $self->{
'next'};
169 Example : $rank = $intron->
rank
170 Description: Returns the rank of
this Intron
179 my ($self, $transcript) = @_;
181 return $self->prev_Exon->rank($transcript);
184 =head2 is_splice_canonical
186 Example : my $canonical = $intron->is_splice_canonical();
187 Description : Indicates
if the splice site is considered normal. This means
188 splice site variants equal to (D == donor, A == acceptor)
192 Returntype : Boolean indicating
if the splice was as expected
193 Exceptions : See splice_seq
197 sub is_splice_canonical {
199 my $splice = join q{}, @{$self->splice_seq()};
201 'GTAG' => 1,
'ATAC' => 1,
'GCAG' => 1
203 return $canonical || 0;
208 Example : my ($donor, $acceptor) = @{$intron->splice_seq};
209 Description : Get the donor and acceptor splice sites
for this intron
210 Returntype : ArrayRef[String] The donor and acceptor sequences as Strings
211 Exceptions : Thrown
if a feature Slice cannot be found
217 my $slice = $self->feature_Slice();
218 throw "Cannot retrieve feature_Slice() for this Intron" unless $slice;
219 my $length = $self->length();
220 my $donor_seq = uc($slice->subseq(1,2));
221 my $acceptor_seq = uc($slice->subseq($length - 1, $length));
222 return [$donor_seq, $acceptor_seq];