From 6dbed007a6663728aaf3c47a65268ade92f6cfa2 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 13:45:26 +0000
Subject: [PATCH] Modified previous bugfix in seq():  If stable IDs are not
 available, and dbIDs are not available, use genomic start/end coordinates to
 figure out whether "this" translation is the same as the canonical
 translation or not.

---
 modules/Bio/EnsEMBL/Translation.pm | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/modules/Bio/EnsEMBL/Translation.pm b/modules/Bio/EnsEMBL/Translation.pm
index ee11346f58..32b3738418 100755
--- a/modules/Bio/EnsEMBL/Translation.pm
+++ b/modules/Bio/EnsEMBL/Translation.pm
@@ -853,11 +853,21 @@ sub seq {
     if (    defined( $canonical_translation->stable_id() )
          && defined( $self->stable_id() ) )
     {
+      # Try stable ID.
       $is_alternative =
         ( $canonical_translation->stable_id() ne $self->stable_id() );
-    } else {
+    } elsif (    defined( $canonical_translation->dbID() )
+              && defined( $self->dbID() ) )
+    {
+      # Try dbID.
       $is_alternative =
         ( $canonical_translation->dbID() != $self->dbID() );
+    } else {
+      # Resort to using geomic start/end coordinates.
+      $is_alternative = ( ($canonical_translation->genomic_start() !=
+                             $self->genomic_start() )
+                           || ( $canonical_translation->genomic_end() !=
+                                $self->genomic_end() ) );
     }
 
     if ($is_alternative) {
-- 
GitLab