diff --git a/src/find_interaction_cluster/community_finder.py b/src/find_interaction_cluster/community_finder.py index 5df05555d40497188d3aaafc71742dc03d3e520d..82dfbf920cfc9def17a15487a71b9c61851c1a10 100644 --- a/src/find_interaction_cluster/community_finder.py +++ b/src/find_interaction_cluster/community_finder.py @@ -122,7 +122,7 @@ def find_communities(graph: nx.Graph, project: str, logging.debug("Finding community ...") if not result_file.is_file(): cmd = f"mpirun -np 1 {ConfigGraph.get_hipmcl_prog()} -M {outfile} " \ - f"-I 1.2 -per-process-mem 32 -o {result_file}" + f"-I 1.2 -per-process-mem 50 -o {result_file}" sp.check_call(cmd, shell=True, stderr=sp.STDOUT) communities = get_communities(result_file) dic_community = {} @@ -369,16 +369,7 @@ def get_projects(global_weight: int) -> List[str]: if global_weight != 0: return [f'Global-weight-{global_weight}'] else: - cnx = sqlite3.connect(ConfigGraph.db_file) - c = cnx.cursor() - query = f"SELECT DISTINCT id_sample " \ - f"FROM cin_projects " \ - f"WHERE id_sample = 'GSM1872888' " - c.execute(query) - res = list(np.asarray(c.fetchall()).flatten()) - c.close() - cnx.close() - return res + return ConfigGraph.good_projects def get_projects_name(global_weights: List[int]) -> Tuple[List[str], Dict]: diff --git a/src/find_interaction_cluster/config.py b/src/find_interaction_cluster/config.py index 0cbd7d15c54f1b9e5a7100c432e730dae5e89766..a35de0553d9e9dcbe82eb7596d369610d26f4b2d 100644 --- a/src/find_interaction_cluster/config.py +++ b/src/find_interaction_cluster/config.py @@ -8,6 +8,7 @@ Description: Configuration folder from ..db_utils.config import Config from pathlib import Path +from ..figures_utils.config_figures import get_good_project def get_weight_folder(weight: int, global_weight: int): @@ -91,4 +92,5 @@ class ConfigGraph: hip_zip = data / 'hipMCL.zip' get_hip_folder = get_hipmcl_folder get_hipmcl_prog = get_hipmcl_prog + good_projects = get_good_project() diff --git a/src/nt_composition/config.py b/src/nt_composition/config.py index 70feec3649d7ed3cc56ce786cecfbd24b1fcb374..97f29467185b1638c80bdeda17bf706b4027b83d 100644 --- a/src/nt_composition/config.py +++ b/src/nt_composition/config.py @@ -9,6 +9,7 @@ file that will be produced by this module. from ..db_utils.config import Config from typing import List +from ..figures_utils.config_figures import get_good_project def get_weight_folder(weight: int, global_weight: int, ft_type: str): @@ -149,3 +150,4 @@ class ConfigNt: selected_project = interaction / "selected_sample.txt" get_density_file = get_density_file get_features = get_features + good_projects = get_good_project() diff --git a/src/nt_composition/make_nt_correlation.py b/src/nt_composition/make_nt_correlation.py index 286daa528b0ea3f34777fac8c755909b58e8a5eb..fff9326f3480508dff2a5b2eb44f13964813ea1f 100644 --- a/src/nt_composition/make_nt_correlation.py +++ b/src/nt_composition/make_nt_correlation.py @@ -91,10 +91,12 @@ def get_project_colocalisation(cnx: sqlite3.Connection, project: str, AND t1.exon2 = t3.id AND t2.id_gene != t3.id_gene""" else: + good_projects = tuple(ConfigNt.good_projects) if same_gene: query = f"SELECT exon1, exon2{select_add} " \ f"FROM cin_exon_interaction " \ f"WHERE weight >= {weight} " \ + f"AND id_project IN {good_projects}" \ f"GROUP BY exon1, exon2 " \ f"HAVING COUNT(*) >= {global_weight}" else: @@ -104,6 +106,7 @@ def get_project_colocalisation(cnx: sqlite3.Connection, project: str, AND t1.exon1 = t2.id AND t1.exon2 = t3.id AND t2.id_gene != t3.id_gene + AND t1.id_project IN {good_projects} GROUP BY exon1, exon2 HAVING COUNT(*) >= {global_weight}""" @@ -435,7 +438,7 @@ def create_all_frequency_figures(ps: int, weight: int = 1, logging_def(ConfigNt.interaction, __file__, logging_level) if global_weight == 0: di = pd.read_csv(ConfigNt.get_interaction_file(weight), sep="\t") - projects = di.loc[di['interaction_count'] > 300, 'projects'].values + projects = ConfigNt.good_projects else: di = pd.DataFrame() projects = [f"Global_projects_{global_weight}"]