From cc0a96584e410fc7ebc1c7a41ace31e7b6f20ed4 Mon Sep 17 00:00:00 2001
From: Daniel Rios <dr2@sanger.ac.uk>
Date: Mon, 15 Jan 2007 16:16:02 +0000
Subject: [PATCH] fixed bug when mapping indels

---
 modules/Bio/EnsEMBL/Mapper.pm | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/modules/Bio/EnsEMBL/Mapper.pm b/modules/Bio/EnsEMBL/Mapper.pm
index fe652d249f..766710bc06 100644
--- a/modules/Bio/EnsEMBL/Mapper.pm
+++ b/modules/Bio/EnsEMBL/Mapper.pm
@@ -665,7 +665,7 @@ sub map_indel {
      $mid_idx = ($start_idx+$end_idx)>>1;
      $pair = $lr->[$mid_idx];
      $self_coord   = $pair->{$from};
-     if( $self_coord->{'end'} < $start ) {
+     if( $self_coord->{'end'} <= $start ) {
        $start_idx = $mid_idx;
      } else {
        $end_idx = $mid_idx;
@@ -678,7 +678,13 @@ sub map_indel {
      my $target_coord = $pair->{$to};
 
      if  (exists $pair->{'indel'}){
-	 push @indel_coordinates, $target_coord;
+	 #need to return unit coordinate
+	 my $to   =
+	     Bio::EnsEMBL::Mapper::Unit->new($target_coord->{'id'},
+						      $target_coord->{'start'},
+						      $target_coord->{'end'},
+					     );
+	 push @indel_coordinates, $to;
 	 last;
      }
      $last_used_pair = $pair;
-- 
GitLab