diff --git a/src/db_utils/__main__.py b/src/db_utils/__main__.py index 355ec6947cabb7178af9f5c48b914f38670769a5..5b7637e9a9291c88684e12e8d894a57b49951af1 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")