Skip to content
Snippets Groups Projects
Commit 906f1470 authored by nfontrod's avatar nfontrod
Browse files

src/nt_composition/config.py: Add a parameter ft_type in get_weight_folder

parent d83855e0
No related branches found
No related tags found
No related merge requests found
...@@ -11,7 +11,7 @@ from ..db_utils.config import Config ...@@ -11,7 +11,7 @@ from ..db_utils.config import Config
from typing import List 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. Get the weight folder.
...@@ -20,14 +20,17 @@ def get_weight_folder(weight: int, global_weight: int): ...@@ -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 \ the global weight is equal to 0 then then density figure are calculated \
by project, else all projet are merge together and the interaction \ by project, else all projet are merge together and the interaction \
seen in `global_weight` project are taken into account 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 \ :return: The folder that will contains the interaction with a weight \
greater or equal to `weigh` in ChIA-PET projects greater or equal to `weigh` in ChIA-PET projects
""" """
if global_weight == 0: 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: else:
weight_folder = ConfigNt.density_folder / \ 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) weight_folder.mkdir(parents=True, exist_ok=True)
return weight_folder return weight_folder
...@@ -52,7 +55,7 @@ def get_density_file(weight: int, global_weight: int, project: str, ...@@ -52,7 +55,7 @@ def get_density_file(weight: int, global_weight: int, project: str,
ext = "pdf" ext = "pdf"
else: else:
ext = "txt" 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) res_folder.mkdir(exist_ok=True, parents=True)
return res_folder / f"{project}_{ft_type}_{ft}_density.{ext}" return res_folder / f"{project}_{ft_type}_{ft}_density.{ext}"
...@@ -76,7 +79,7 @@ def get_density_recap(weight: int, global_weight: int, ...@@ -76,7 +79,7 @@ def get_density_recap(weight: int, global_weight: int,
ext = "pdf" ext = "pdf"
else: else:
ext = "txt" 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) outfolder.mkdir(exist_ok=True, parents=True)
return outfolder / f"{ft_type}_{ft}_density_recap.{ext}" return outfolder / f"{ft_type}_{ft}_density_recap.{ext}"
...@@ -132,7 +135,7 @@ class ConfigNt: ...@@ -132,7 +135,7 @@ class ConfigNt:
""" """
A class containing every parameters used in the submodule nt_composition A class containing every parameters used in the submodule nt_composition
""" """
cpu = Config.cpu cpu = 7 # Config.cpu
data = Config.data data = Config.data
result = Config.results result = Config.results
db_file = Config.db_file db_file = Config.db_file
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment