From c5f457760b0445b55bd2a1972ea1da373e4d837f Mon Sep 17 00:00:00 2001 From: alapendr <audrey.lapendry@ens-lyon.fr> Date: Fri, 10 Apr 2020 09:40:20 +0200 Subject: [PATCH] __main__.py: update to integrate the filling of cin_exon_interaction and cin_gene_interaction tables --- src/db_utils/__main__.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/db_utils/__main__.py b/src/db_utils/__main__.py index 355ec694..5b7637e9 100755 --- a/src/db_utils/__main__.py +++ b/src/db_utils/__main__.py @@ -15,6 +15,24 @@ from .frequency_scripts.create_n_fill_exon_frequency_file import \ fill_frequency_tables import logging from .projects_metadata.get_fill_metadata import fill_projects_table +import subprocess + + +def launch_features_interactions(opt: str): + """ + Allows to launch the script features_interactions.py: + - to determine which couples of genomic regions interact, e.g. exons or + genes, that for each ChIA-PET dataset + - to fill the cin_gene_interaction and cin_exon_interaction tables + + :param opt: which genomic regions are we studying, --exon or --gene + """ + subprocess.check_call(f"for file in `ls {Config.chia_pet_files}" f"/*` ; " + f"do " f"basename_file=$(basename -s .bed " f"$file)" + f" ; " f"python -m " + f"src.db_utils.interactions.features_interactions " + "${basename_file} " f"{opt} ; done", shell=True, + stderr=subprocess.STDOUT) def launcher(logging_level: str = "INFO"): @@ -32,6 +50,10 @@ def launcher(logging_level: str = "INFO"): fill_frequency_tables(Config.cpu, 'DISABLE') logging.info('Filling projects table') fill_projects_table('DISABLE') + logging.info('Filling cin_exon_interaction table') + launch_features_interactions("--exon") + logging.info('Filling cin_gene_interaction table') + launch_features_interactions("--gene") launcher(logging_level="DEBUG") -- GitLab