From 81f06bd0764533ad0cfa1ee58279709d18da6af8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20Kusalananda=20K=C3=A4h=C3=A4ri?=
 <ak4@sanger.ac.uk>
Date: Fri, 13 Aug 2010 09:17:31 +0000
Subject: [PATCH] If the translations do not have stable IDs, use their dbIDs
 to compare them instead.  Bug fix for Amy.

---
 modules/Bio/EnsEMBL/Translation.pm | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/modules/Bio/EnsEMBL/Translation.pm b/modules/Bio/EnsEMBL/Translation.pm
index 61ccaeccd3..ee11346f58 100755
--- a/modules/Bio/EnsEMBL/Translation.pm
+++ b/modules/Bio/EnsEMBL/Translation.pm
@@ -848,8 +848,17 @@ sub seq {
     my $transcript = $self->transcript();
 
     my $canonical_translation = $transcript->translation();
-    my $is_alternative =
-      ( $canonical_translation->stable_id() ne $self->stable_id() );
+    my $is_alternative;
+
+    if (    defined( $canonical_translation->stable_id() )
+         && defined( $self->stable_id() ) )
+    {
+      $is_alternative =
+        ( $canonical_translation->stable_id() ne $self->stable_id() );
+    } else {
+      $is_alternative =
+        ( $canonical_translation->dbID() != $self->dbID() );
+    }
 
     if ($is_alternative) {
       # To deal with non-canonical (alternative) translations, subsitute
-- 
GitLab