From d8fd649be4d28036f22d6a66db160af4e43b4ec3 Mon Sep 17 00:00:00 2001
From: Javier Herrero <jh7@sanger.ac.uk>
Date: Wed, 20 Apr 2005 11:57:12 +0000
Subject: [PATCH] Fix the length of the RepeatConsensus when the sequence is
 like "xxx(N)"

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

diff --git a/modules/Bio/EnsEMBL/DBSQL/RepeatConsensusAdaptor.pm b/modules/Bio/EnsEMBL/DBSQL/RepeatConsensusAdaptor.pm
index 11ca0faf0f..881b80492e 100644
--- a/modules/Bio/EnsEMBL/DBSQL/RepeatConsensusAdaptor.pm
+++ b/modules/Bio/EnsEMBL/DBSQL/RepeatConsensusAdaptor.pm
@@ -174,8 +174,7 @@ sub _generic_fetch {
         SELECT repeat_consensus_id
           , repeat_name
           , repeat_class
-	  , repeat_type
-          , LENGTH(repeat_consensus)
+          , repeat_type
           , repeat_consensus
         FROM repeat_consensus
         WHERE }. $where_clause);
@@ -185,11 +184,16 @@ sub _generic_fetch {
         \$repeat_consensus_id,
         \$repeat_name,
         \$repeat_class,
-	\$repeat_type,
-        \$repeat_length,
+        \$repeat_type,
         \$repeat_consensus
         );
 
+    
+    if ($repeat_consensus =~ /^(\d+)\(N\)$/) {
+      $repeat_length = $1;
+    } else {
+      $repeat_length = CORE::length($repeat_consensus);
+    }
     my @consensi;
     while ($sth->fetch) {
         push @consensi, Bio::EnsEMBL::RepeatConsensus->new
-- 
GitLab