From a5d38a9b2fdc771e66b1ab1d1773573e01414059 Mon Sep 17 00:00:00 2001
From: Graham McVicker <mcvicker@sanger.ac.uk>
Date: Tue, 13 Jan 2004 12:09:01 +0000
Subject: [PATCH] return empty list instead of throwing in
 get_all_translateable_Exons when there is no Translation

---
 modules/Bio/EnsEMBL/Transcript.pm | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/modules/Bio/EnsEMBL/Transcript.pm b/modules/Bio/EnsEMBL/Transcript.pm
index 2b44576cb5..21df29edc4 100755
--- a/modules/Bio/EnsEMBL/Transcript.pm
+++ b/modules/Bio/EnsEMBL/Transcript.pm
@@ -350,7 +350,7 @@ sub translation {
   } elsif( !exists $self->{'translation'} and defined $self->adaptor() ) {
     $self->{'translation'} = 
       $self->adaptor()->db()->get_TranslationAdaptor()->
-	fetch_by_Transcript( $self );
+        fetch_by_Transcript( $self );
   }
   return $self->{'translation'};
 }
@@ -1103,7 +1103,7 @@ sub three_prime_utr {
   Description: Returns a list of exons that translate with the
                start and end exons truncated to the CDS regions.
   Returntype : listref Bio::EnsEMBL::Exon
-  Exceptions : If there is no Translation object
+  Exceptions : throw if translation has invalid information
   Caller     : Genebuild, $self->translate()
 
 =cut
@@ -1112,8 +1112,8 @@ sub three_prime_utr {
 sub get_all_translateable_Exons {
   my ( $self ) = @_;
 
-  my $translation = $self->translation
-    or throw("No translation attached to transcript object");
+  #return an empty list if there is no translation (i.e. pseudogene)
+  my $translation = $self->translation or return [];  
   my $start_exon      = $translation->start_Exon;
   my $end_exon        = $translation->end_Exon;
   my $t_start         = $translation->start;
-- 
GitLab