From 43d320450cc70ceddc00684956b54e70b1ff1a49 Mon Sep 17 00:00:00 2001 From: Fontrodona Nicolas <nicolas.fontrodona@ens-lyon.fr> Date: Wed, 10 Jun 2020 14:27:00 +0200 Subject: [PATCH] src/nt_composition/config.py: Creation of a config file that stores every variable used in submodule ,t_composition --- src/nt_composition/config.py | 62 ++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 src/nt_composition/config.py diff --git a/src/nt_composition/config.py b/src/nt_composition/config.py new file mode 100644 index 00000000..dea52748 --- /dev/null +++ b/src/nt_composition/config.py @@ -0,0 +1,62 @@ +#!/usr/bin/env python3 + +# -*- coding: UTF-8 -*- + +""" +Description: This file contains the location of every input and result \ +file that will be produced by this module. +""" + +from ..db_utils.config import Config + + +def get_density_file(project: str, ft_type: str, ft: str, + fig: bool = False): + """ + Get the filename that will contain the density data or figure. + + :param project: A project name + :param ft_type: A feature type + :param ft: A feature + :param fig: Say if the result file is a figure or not + :return: The filename that will contain the density data or figure. + """ + if fig: + ext = "pdf" + else: + ext = "txt" + res_folder = ConfigNt.density_folder / project + res_folder.mkdir(exist_ok=True, parents=True) + return res_folder / f"{project}_{ft_type}_{ft}_density.{ext}" + + +def get_density_recap(ft_type: str, ft: str, fig: bool = False): + """ + Get the density correlation recap file. + + :param ft_type: A feature type + :param ft: A feature + :return: + """ + if fig: + ext = "pdf" + else: + ext = "txt" + ConfigNt.density_folder.mkdir(exist_ok=True, parents=True) + return ConfigNt.density_folder / f"{ft_type}_{ft}_density_recap.{ext}" + + +class ConfigNt: + """ + A class containing every parameters used in the submodule nt_composition + """ + data = Config.data + result = Config.results + db_file = Config.db_file + output_folder = result / "nt_composition" + interaction = output_folder / 'interaction_number' + interaction_file = interaction / "interaction_number_by_project.txt" + density_folder = output_folder / 'density_fig' + get_density_recap = get_density_recap + selected_project = interaction / "selected_sample.txt" + get_density_file = get_density_file \ No newline at end of file -- GitLab