From 9203fae40fb37c5a26854b8ab27c613b75a780f8 Mon Sep 17 00:00:00 2001
From: Floreal Cabanettes <floreal.cabanettes@inra.fr>
Date: Fri, 15 Sep 2017 11:12:48 +0200
Subject: [PATCH] Some fixes, and set ylim 0-100 for recall figure

---
 build_figures.py | 1 +
 build_results.py | 4 ++--
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/build_figures.py b/build_figures.py
index c73e724..39654ca 100755
--- a/build_figures.py
+++ b/build_figures.py
@@ -156,6 +156,7 @@ def __draw_recall_fig(recall, output_dir):
     plt.set_ylabel("Recall (%)", fontsize=15)
     plt.set_xlabel("Tool", fontsize=15)
     plt.tick_params(labelsize=8)
+    plt.set_ylim([0,100])
     pyplot.savefig(os.path.join(output_dir, "recall_per_tool.pdf"))
 
 
diff --git a/build_results.py b/build_results.py
index 4497366..b67cd9f 100755
--- a/build_results.py
+++ b/build_results.py
@@ -449,7 +449,7 @@ def fill_genotypes_data(row, col, cells_gt, cells_gq, record, my_genotypes, hapl
             geno = "N/N"
 
         # Format:
-        gt_format = {"bg_color": get_quality_color(int(record["qualities"][gt]))}
+        gt_format = {"bg_color": get_quality_color(int(record["qualities"][gt]) if record["qualities"][gt] is not None else 0)}
         if (not haploid and geno != true_gt) or \
                 (haploid and ((true_gt == "1" and geno != "1/1") or (true_gt == "0" and geno != "0/0"))):
             gt_format["font_color"] = "#ff0000"
@@ -457,7 +457,7 @@ def fill_genotypes_data(row, col, cells_gt, cells_gq, record, my_genotypes, hapl
         # Genotype:
         cells_gt[XLSX_COLS[col + gt] + str(row)] = {"text": geno, "format": gt_format}
         # Quality:
-        cells_gq[XLSX_COLS[col + gt] + str(row)] = {"text": int(record["qualities"][gt]), "format": gt_format}
+        cells_gq[XLSX_COLS[col + gt] + str(row)] = {"text": int(record["qualities"][gt]) if record["qualities"][gt] is not None else 0, "format": gt_format}
 
     return cells_gt, cells_gq
 
-- 
GitLab