From 14a3e59cf2c7b6b9c6b1812a7ef905d60f2e0c06 Mon Sep 17 00:00:00 2001
From: NMarthe <nina.marthe@ird.fr>
Date: Mon, 23 Oct 2023 10:41:36 +0200
Subject: [PATCH] =?UTF-8?q?corrig=C3=A9=20la=20position=20des=20d=C3=A9l?=
 =?UTF-8?q?=C3=A9tions=20en=20d=C3=A9but=20de=20g=C3=A8ne?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 Functions.py        | 10 +++++-----
 Functions_output.py |  3 +++
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/Functions.py b/Functions.py
index fd28c3d..4ba703c 100644
--- a/Functions.py
+++ b/Functions.py
@@ -3,7 +3,7 @@ global segments_on_target_genome
 segments_on_target_genome={}
 
 global target_genome_name
-target_genome_name="CM020635.1_Azucena_chromosome10"
+target_genome_name="CM020642.1_Azucena_chromosome10"
 target_genome_name="genome4_chr10"
 
 # get the start position of the features on the linear genome, using their coordinates on the graph and the coordinantes of the segments on the genome
@@ -365,14 +365,14 @@ def get_old_new_pos_insertion(variation,feat_start,list_segfeat_azu,feat):
 
 def get_old_new_pos_deletion(variation,feat_start,list_segfeat_azu,feat,i):
     if i==0:
-        pos_old=int(Segments[variation.start_var].start)-int(feat_start)+1+Features[feat].pos_start
+        pos_old=int(Segments[variation.start_var].start)-int(feat_start)+Features[feat].pos_start+1
     else:
         pos_old=int(Segments[variation.start_var].start)-int(feat_start)+1
-        if pos_old<0:
-            pos_old=0
+        if pos_old<1:
+            pos_old=1
 
     if variation.last_seg_in_target=="": # deletion of the beggining of the feature, so no segment placed in the new genome yet. 
-        pos_new="1"
+        pos_new=1
     else:
         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 
diff --git a/Functions_output.py b/Functions_output.py
index 7d9c184..d5d23e5 100644
--- a/Functions_output.py
+++ b/Functions_output.py
@@ -150,6 +150,9 @@ def print_variations(first_seg,last_seg,feat,paths,seg_seq):
         # loop to go through both paths with i and j
         [i,j,var_count]=[0,0,0]
 
+        if feat=="LOC_Os10g01770":
+            print(list_segfeat_nb[0:2],"\n",list_segfeat_azu[0:2],seg_seq[list_segfeat_nb[0][1:]],feature.pos_start)
+
         # detect and print variations ignoring the strands
         while (i<len(list_segfeat_nb)) & (j<len(list_segfeat_azu)):
             if list_segfeat_nb[i] != list_segfeat_azu[j]: # if there is a difference between the two paths
-- 
GitLab