From 3365da5033a406104455e9bf7ddd829345cabfdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Kusalananda=20K=C3=A4h=C3=A4ri?= <ak4@sanger.ac.uk> Date: Wed, 17 Oct 2007 10:01:45 +0000 Subject: [PATCH] Small optimization to coding_region_start() and coding_region_end(): If the coding region does not start/end in this exon, it also will not end/start here. --- modules/Bio/EnsEMBL/Exon.pm | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/Bio/EnsEMBL/Exon.pm b/modules/Bio/EnsEMBL/Exon.pm index c9c5048610..607c711422 100755 --- a/modules/Bio/EnsEMBL/Exon.pm +++ b/modules/Bio/EnsEMBL/Exon.pm @@ -650,6 +650,7 @@ sub coding_region_start { if ( $transcript->coding_region_end() < $start ) { # ... and also ends upstream of this exon. $self->{'coding_region_start'}->{$transcript_id} = undef; + $self->{'coding_region_end'}->{$transcript_id} = undef; } else { # ... and does not end upstream of this exon. $self->{'coding_region_start'}->{$transcript_id} = $start; @@ -665,6 +666,7 @@ sub coding_region_start { } else { # Coding region starts downstream of this exon. $self->{'coding_region_start'}->{$transcript_id} = undef; + $self->{'coding_region_end'}->{$transcript_id} = undef; } } } ## end else [ if ( !defined($transcript_coding_start... @@ -723,7 +725,8 @@ sub coding_region_end { if ( $transcript->coding_region_start() > $end ) { # ... and also starts downstream of this exon. - $self->{'coding_region_end'}->{$transcript_id} = undef; + $self->{'coding_region_start'}->{$transcript_id} = undef; + $self->{'coding_region_end'}->{$transcript_id} = undef; } else { # ... and does not start downstream of this exon. $self->{'coding_region_end'}->{$transcript_id} = $end; @@ -738,7 +741,8 @@ sub coding_region_end { $transcript_coding_end; } else { # Coding region ends upstream of this exon. - $self->{'coding_region_end'}->{$transcript_id} = undef; + $self->{'coding_region_start'}->{$transcript_id} = undef; + $self->{'coding_region_end'}->{$transcript_id} = undef; } } } ## end else [ if ( !defined($transcript_coding_end... -- GitLab