From 906f1470e07f70a8292916f8fbb32834b9919f4b Mon Sep 17 00:00:00 2001
From: Fontrodona Nicolas <nicolas.fontrodona@ens-lyon.fr>
Date: Tue, 23 Jun 2020 14:34:45 +0200
Subject: [PATCH] src/nt_composition/config.py: Add a parameter ft_type in
 get_weight_folder

---
 src/nt_composition/config.py | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/nt_composition/config.py b/src/nt_composition/config.py
index ae790526..c4a674bf 100644
--- a/src/nt_composition/config.py
+++ b/src/nt_composition/config.py
@@ -11,7 +11,7 @@ from ..db_utils.config import Config
 from typing import List
 
 
-def get_weight_folder(weight: int, global_weight: int):
+def get_weight_folder(weight: int, global_weight: int, ft_type: str):
     """
     Get the weight folder.
 
@@ -20,14 +20,17 @@ def get_weight_folder(weight: int, global_weight: int):
     the global weight is equal to 0 then then density figure are calculated \
     by project, else all projet are merge together and the interaction \
     seen in `global_weight` project are taken into account
+    :parma ft_type: The type fo featrue of interst
     :return: The folder that will contains the interaction with a weight \
     greater or equal to `weigh` in ChIA-PET projects
     """
     if global_weight == 0:
-        weight_folder = ConfigNt.density_folder / f"project_weight:{weight}"
+        weight_folder = ConfigNt.density_folder / \
+                        f"{ft_type}_project_weight-{weight}"
     else:
         weight_folder = ConfigNt.density_folder / \
-                        f"weight:{weight}-global_weight:{global_weight}"
+                        f"{ft_type}_weight-{weight}_" \
+                        f"global_weight-{global_weight}"
     weight_folder.mkdir(parents=True, exist_ok=True)
     return weight_folder
 
@@ -52,7 +55,7 @@ def get_density_file(weight: int, global_weight: int, project: str,
         ext = "pdf"
     else:
         ext = "txt"
-    res_folder = get_weight_folder(weight, global_weight) / project
+    res_folder = get_weight_folder(weight, global_weight, ft_type) / project
     res_folder.mkdir(exist_ok=True, parents=True)
     return res_folder / f"{project}_{ft_type}_{ft}_density.{ext}"
 
@@ -76,7 +79,7 @@ def get_density_recap(weight: int, global_weight: int,
         ext = "pdf"
     else:
         ext = "txt"
-    outfolder = get_weight_folder(weight, global_weight)
+    outfolder = get_weight_folder(weight, global_weight, ft_type)
     outfolder.mkdir(exist_ok=True, parents=True)
     return outfolder / f"{ft_type}_{ft}_density_recap.{ext}"
 
@@ -132,7 +135,7 @@ class ConfigNt:
     """
     A class containing every parameters used in the submodule nt_composition
     """
-    cpu = Config.cpu
+    cpu = 7 # Config.cpu
     data = Config.data
     result = Config.results
     db_file = Config.db_file
-- 
GitLab