From c56e7f0bffc4458cc5374eb076810d40198b7b7f Mon Sep 17 00:00:00 2001
From: hjulienn <hanna.julienne@pasteur.fr>
Date: Wed, 18 May 2022 23:00:18 +0200
Subject: [PATCH] test to fix gencov

---
 jass/models/worktable.py | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/jass/models/worktable.py b/jass/models/worktable.py
index fe0f6a46..05546e14 100644
--- a/jass/models/worktable.py
+++ b/jass/models/worktable.py
@@ -865,11 +865,18 @@ def get_worktable_gencov(project_hdf_path: str):
 
     for i in range(gencov.shape[0]):
         for j in range(i, gencov.shape[0]):
-            lines.append({
-                "phenotypeID_A": sorted_trait.iloc[i],
-                "phenotypeID_B": sorted_trait.iloc[j],
-                "gencov":gencov.loc[sorted_trait.index[i], sorted_trait.index[j]]
-                })
+            if np.isnan(gencov.loc[sorted_trait.index[i], sorted_trait.index[j]]):
+                lines.append({
+                    "phenotypeID_A": sorted_trait.iloc[i],
+                    "phenotypeID_B": sorted_trait.iloc[j],
+                    "gencov":"null"
+                    })
+            else:
+                lines.append({
+                    "phenotypeID_A": sorted_trait.iloc[i],
+                    "phenotypeID_B": sorted_trait.iloc[j],
+                    "gencov":gencov.loc[sorted_trait.index[i], sorted_trait.index[j]]
+                    })
 
     print(lines)
     return lines
@@ -1062,4 +1069,4 @@ def create_genome_full_csv_lock_file(project_hdf_path):
     the_lock = "The lock is set on : workTable.csv is not yet available"
     file_lock = open(the_lock_path, "w")
     file_lock.write(the_lock)
-    file_lock.close()
\ No newline at end of file
+    file_lock.close()
-- 
GitLab