From 497c95bb25efe1a95a140729829c6adcc35843a0 Mon Sep 17 00:00:00 2001
From: Graham McVicker <mcvicker@sanger.ac.uk>
Date: Wed, 31 Mar 2004 13:01:19 +0000
Subject: [PATCH] made it possible to unset a translation; it was not possible
 to do this once one was set before

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

diff --git a/modules/Bio/EnsEMBL/Transcript.pm b/modules/Bio/EnsEMBL/Transcript.pm
index d4d6f2cee7..db22c91920 100755
--- a/modules/Bio/EnsEMBL/Transcript.pm
+++ b/modules/Bio/EnsEMBL/Transcript.pm
@@ -344,12 +344,13 @@ sub translation {
   my $self = shift;
   if( @_ ) {
     my $value = shift;
-    if( ! ref $value || !$value->isa('Bio::EnsEMBL::Translation') ) {
-      throw("This [$value] is not a translation");
+    if( defined($value) &&
+        (!ref($value) || !$value->isa('Bio::EnsEMBL::Translation'))) {
+      throw("Bio::EnsEMBL::Translation argument expected.");
     }
     $self->{'translation'} = $value;
-  } elsif( !exists $self->{'translation'} and defined $self->adaptor() ) {
-    $self->{'translation'} = 
+  } elsif( !exists($self->{'translation'}) and defined($self->adaptor())) {
+    $self->{'translation'} =
       $self->adaptor()->db()->get_TranslationAdaptor()->
         fetch_by_Transcript( $self );
   }
-- 
GitLab