Skip to content
Snippets Groups Projects
Commit 721ea805 authored by nfontrod's avatar nfontrod
Browse files

modification to use only good chia-pet projects

parent 4ed00998
Branches
No related tags found
No related merge requests found
...@@ -122,7 +122,7 @@ def find_communities(graph: nx.Graph, project: str, ...@@ -122,7 +122,7 @@ def find_communities(graph: nx.Graph, project: str,
logging.debug("Finding community ...") logging.debug("Finding community ...")
if not result_file.is_file(): if not result_file.is_file():
cmd = f"mpirun -np 1 {ConfigGraph.get_hipmcl_prog()} -M {outfile} " \ 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) sp.check_call(cmd, shell=True, stderr=sp.STDOUT)
communities = get_communities(result_file) communities = get_communities(result_file)
dic_community = {} dic_community = {}
...@@ -369,16 +369,7 @@ def get_projects(global_weight: int) -> List[str]: ...@@ -369,16 +369,7 @@ def get_projects(global_weight: int) -> List[str]:
if global_weight != 0: if global_weight != 0:
return [f'Global-weight-{global_weight}'] return [f'Global-weight-{global_weight}']
else: else:
cnx = sqlite3.connect(ConfigGraph.db_file) return ConfigGraph.good_projects
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
def get_projects_name(global_weights: List[int]) -> Tuple[List[str], Dict]: def get_projects_name(global_weights: List[int]) -> Tuple[List[str], Dict]:
......
...@@ -8,6 +8,7 @@ Description: Configuration folder ...@@ -8,6 +8,7 @@ Description: Configuration folder
from ..db_utils.config import Config from ..db_utils.config import Config
from pathlib import Path from pathlib import Path
from ..figures_utils.config_figures import get_good_project
def get_weight_folder(weight: int, global_weight: int): def get_weight_folder(weight: int, global_weight: int):
...@@ -91,4 +92,5 @@ class ConfigGraph: ...@@ -91,4 +92,5 @@ class ConfigGraph:
hip_zip = data / 'hipMCL.zip' hip_zip = data / 'hipMCL.zip'
get_hip_folder = get_hipmcl_folder get_hip_folder = get_hipmcl_folder
get_hipmcl_prog = get_hipmcl_prog get_hipmcl_prog = get_hipmcl_prog
good_projects = get_good_project()
...@@ -9,6 +9,7 @@ file that will be produced by this module. ...@@ -9,6 +9,7 @@ file that will be produced by this module.
from ..db_utils.config import Config from ..db_utils.config import Config
from typing import List 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): def get_weight_folder(weight: int, global_weight: int, ft_type: str):
...@@ -149,3 +150,4 @@ class ConfigNt: ...@@ -149,3 +150,4 @@ class ConfigNt:
selected_project = interaction / "selected_sample.txt" selected_project = interaction / "selected_sample.txt"
get_density_file = get_density_file get_density_file = get_density_file
get_features = get_features get_features = get_features
good_projects = get_good_project()
...@@ -91,10 +91,12 @@ def get_project_colocalisation(cnx: sqlite3.Connection, project: str, ...@@ -91,10 +91,12 @@ def get_project_colocalisation(cnx: sqlite3.Connection, project: str,
AND t1.exon2 = t3.id AND t1.exon2 = t3.id
AND t2.id_gene != t3.id_gene""" AND t2.id_gene != t3.id_gene"""
else: else:
good_projects = tuple(ConfigNt.good_projects)
if same_gene: if same_gene:
query = f"SELECT exon1, exon2{select_add} " \ query = f"SELECT exon1, exon2{select_add} " \
f"FROM cin_exon_interaction " \ f"FROM cin_exon_interaction " \
f"WHERE weight >= {weight} " \ f"WHERE weight >= {weight} " \
f"AND id_project IN {good_projects}" \
f"GROUP BY exon1, exon2 " \ f"GROUP BY exon1, exon2 " \
f"HAVING COUNT(*) >= {global_weight}" f"HAVING COUNT(*) >= {global_weight}"
else: else:
...@@ -104,6 +106,7 @@ def get_project_colocalisation(cnx: sqlite3.Connection, project: str, ...@@ -104,6 +106,7 @@ def get_project_colocalisation(cnx: sqlite3.Connection, project: str,
AND t1.exon1 = t2.id AND t1.exon1 = t2.id
AND t1.exon2 = t3.id AND t1.exon2 = t3.id
AND t2.id_gene != t3.id_gene AND t2.id_gene != t3.id_gene
AND t1.id_project IN {good_projects}
GROUP BY exon1, exon2 GROUP BY exon1, exon2
HAVING COUNT(*) >= {global_weight}""" HAVING COUNT(*) >= {global_weight}"""
...@@ -435,7 +438,7 @@ def create_all_frequency_figures(ps: int, weight: int = 1, ...@@ -435,7 +438,7 @@ def create_all_frequency_figures(ps: int, weight: int = 1,
logging_def(ConfigNt.interaction, __file__, logging_level) logging_def(ConfigNt.interaction, __file__, logging_level)
if global_weight == 0: if global_weight == 0:
di = pd.read_csv(ConfigNt.get_interaction_file(weight), sep="\t") 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: else:
di = pd.DataFrame() di = pd.DataFrame()
projects = [f"Global_projects_{global_weight}"] projects = [f"Global_projects_{global_weight}"]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment