Skip to content
Snippets Groups Projects
Commit ac0bef09 authored by Magali Ruffier's avatar Magali Ruffier
Browse files

ENSCORESW-1663: get_all_CDS_introns method

parent 6f1510c6
No related branches found
No related tags found
No related merge requests found
......@@ -1644,6 +1644,37 @@ sub get_all_Introns {
return \@introns;
}
=head2 get_all_CDS_Introns
Arg [1] : none
Example : my @introns = @{$transcript->get_all_CDS_Introns()};
Description: Returns an listref of the introns between coding exons in this transcript in order.
Returntype : listref to Bio::EnsEMBL::Intron objects
Exceptions : none
Caller : general
Status : Stable
=cut
sub get_all_CDS_Introns {
my ($self) = @_;
# return an empty list if there is no translation
my $translation = $self->translation or return [];
if( ! defined $self->{'_trans_exon_array'} && defined $self->adaptor() ) {
$self->{'_trans_exon_array'} = $self->adaptor()->db()->
get_ExonAdaptor()->fetch_all_by_Transcript( $self );
}
my @introns=();
my @exons = @{$self->{'_trans_exon_array'}};
for(my $i=0; $i < scalar(@exons)-1; $i++){
if (!$exons[$i]->is_coding($self)) { next; }
my $intron = new Bio::EnsEMBL::Intron($exons[$i],$exons[$i+1]);
push(@introns, $intron)
}
return \@introns;
}
=head2 length
......
......@@ -351,11 +351,19 @@ foreach my $stable_id (qw(ENST00000201961 ENST00000217347)){ #test both strands
my @exons = (@{$transcript->get_all_Exons()});
my @introns = (@{$transcript->get_all_Introns()});
my @cds = (@{$transcript->get_all_CDS()});
my @cds_introns = (@{$transcript->get_all_CDS_Introns()});
my $orig_seq = $transcript->slice->subseq(
$transcript->start(),
$transcript->end(),
$transcript->strand());
my $cds_orig_seq = $transcript->slice->subseq(
$transcript->coding_region_start(),
$transcript->coding_region_end(),
$transcript->strand());
my $idl=0;
my $new_seq = $exons[0]->seq()->seq();
foreach my $intron (@introns){
......@@ -367,6 +375,17 @@ foreach my $stable_id (qw(ENST00000201961 ENST00000217347)){ #test both strands
is($orig_seq, $new_seq, 'Correct new origin seq');
my $cds_idl=0;
my $new_cds_seq = $cds[0]->seq();
foreach my $cds_intron (@cds_introns){
$new_cds_seq .= $cds_intron->seq;
$new_cds_seq .= $cds[$cds_idl+1]->seq();
$cds_idl++;
}
is($cds_orig_seq, $new_cds_seq, 'Correct new cds origin seq');
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment