From 169d20577838008ccf6c805273ec41050a16f5d4 Mon Sep 17 00:00:00 2001
From: NMarthe <nina.marthe@ird.fr>
Date: Fri, 3 Nov 2023 14:59:52 +0100
Subject: [PATCH] =?UTF-8?q?corrig=C3=A9=20le=20calcul=20de=20la=20position?=
 =?UTF-8?q?=20des=20insertions=20sur=20le=20g=C3=A9nome=20target?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 Functions.py | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/Functions.py b/Functions.py
index eed43ab..05fc414 100644
--- a/Functions.py
+++ b/Functions.py
@@ -350,15 +350,14 @@ def get_old_new_pos_substitution(feat_start,variation,list_segfeat_azu,feat):
     start_feat=get_feature_start_on_genome(list_segfeat_azu[0][1:],feat)
     start_var=int(segments_on_target_genome[variation.start_on_target][1])
     pos_new=str(start_var-start_feat+1)
-    return [pos_old,pos_new]
+    return [pos_old,pos_new] # pos_old and pos_new are the first base changed
 
 def get_old_new_pos_insertion(variation,feat_start,list_segfeat_azu,feat):
     pos_old=str(int(Segments[variation.start_var].start)-int(feat_start)+1)
-
     start_feat=get_feature_start_on_genome(list_segfeat_azu[0][1:],feat) 
-    start_var=int(segments_on_target_genome[variation.start_var][1])-1
+    start_var=int(segments_on_target_genome[variation.start_var][1])-len(variation.alt)+1
     pos_new=str(start_var-start_feat+1)
-    return [pos_old,pos_new]
+    return [pos_old,pos_new] # pos_old is the base right after the insertion. pos_new SHOULD BE the first inserted base.
 
 def get_old_new_pos_deletion(variation,feat_start,list_segfeat_azu,feat,i):
     if i==0:
@@ -374,8 +373,7 @@ def get_old_new_pos_deletion(variation,feat_start,list_segfeat_azu,feat,i):
         start_feat=get_feature_start_on_genome(list_segfeat_azu[0][1:],feat) 
         start_var=int(segments_on_target_genome[variation.last_seg_in_target][2])+1 
         pos_new=str(start_var-start_feat+1)
-    
-    return [pos_old,pos_new]
+    return [pos_old,pos_new] # pos_old is the first base deleted. pos_new is the base right after the deletion
 
 
 
-- 
GitLab