Commit aba36815 authored by Yoann Dufresne's avatar Yoann Dufresne
Browse files

simplify d2 snakemake interface and remove parasit prints

parent aedced90
......@@ -42,3 +42,11 @@ Config parameters:
export PYTHONPATH=deconvolution/
pytest tests
export PYTHONPATH=
## Tests for Cedric
```bash
snakemake -s Snakefile_data_simu --config n=10000 m=[4,6,8,10,12] m_dev=[0,0.5,1,2,3]
snakemake -s Snakefile_d2 --config input=[snakemake -s Snakefile_d2 --config input=[snake_exec/simu_bar_n10000_d5_m10-dev0.5.gexf,snake_exec/simu_bar_n10000_d5_m10-dev0.gexf,snake_exec/simu_bar_n10000_d5_m10-dev1.gexf,snake_exec/simu_bar_n10000_d5_m10-dev2.gexf,snake_exec/simu_bar_n10000_d5_m10-dev3.gexf,snake_exec/simu_bar_n10000_d5_m12-dev0.5.gexf,snake_exec/simu_bar_n10000_d5_m12-dev0.gexf,snake_exec/simu_bar_n10000_d5_m12-dev1.gexf,snake_exec/simu_bar_n10000_d5_m12-dev2.gexf,snake_exec/simu_bar_n10000_d5_m12-dev3.gexf,snake_exec/simu_bar_n10000_d5_m4-dev0.5.gexf,snake_exec/simu_bar_n10000_d5_m4-dev0.gexf,snake_exec/simu_bar_n10000_d5_m4-dev1.gexf,snake_exec/simu_bar_n10000_d5_m4-dev2.gexf,snake_exec/simu_bar_n10000_d5_m4-dev3.gexf,snake_exec/simu_bar_n10000_d5_m6-dev0.5.gexf,snake_exec/simu_bar_n10000_d5_m6-dev0.gexf,snake_exec/simu_bar_n10000_d5_m6-dev1.gexf,snake_exec/simu_bar_n10000_d5_m6-dev2.gexf,snake_exec/simu_bar_n10000_d5_m6-dev3.gexf,snake_exec/simu_bar_n10000_d5_m8-dev0.5.gexf,snake_exec/simu_bar_n10000_d5_m8-dev0.gexf,snake_exec/simu_bar_n10000_d5_m8-dev1.gexf,snake_exec/simu_bar_n10000_d5_m8-dev2.gexf,snake_exec/simu_bar_n10000_d5_m8-dev3.gexf]]
```
import glob
WORKDIR = "snake_exec" if "workdir" not in config else config["workdir"]
INPUT = "snake_tests/simu_bar_n1000_d5_m2-dev0.gexf" if "input" not in config else config["input"]
SAMPLE_NAME = INPUT[INPUT.rfind('/')+1:INPUT.rfind('.')]
INPUT = ["snake_tests/simu_bar_n1000_d5_m2-dev0.gexf"] if "input" not in config else config["input"]
INPUT = INPUT if isinstance(INPUT, list) else [INPUT]
SAMPLE_NAME = [name[name.rfind('/')+1:name.rfind('.')] for name in INPUT]
rule all:
input:
f"{WORKDIR}/{SAMPLE_NAME}.tar.gz"
expand(f"{WORKDIR}/{{name}}.tar.gz", name=SAMPLE_NAME)
rule compress_data:
input:
......
......@@ -237,7 +237,7 @@ def compute_all_max_d_graphs(graph, debug=False, clique_mode=None):
for idx, node in enumerate(list(graph.nodes())):
#if "MI" not in str(node): continue # for debugging; only look at deconvolved nodes
print(f"\r{idx+1}/{len(graph.nodes())}")
#print(f"\r{idx+1}/{len(graph.nodes())}")
neighbors = list(graph.neighbors(node))
neighbors_graph = nx.Graph(graph.subgraph(neighbors))
......@@ -278,7 +278,7 @@ def compute_all_max_d_graphs(graph, debug=False, clique_mode=None):
cliques = list(cliques_dict2.values())
mode_str += "(testing)"
print("cliques", len(cliques))
#print("cliques", len(cliques))
if debug: print("node",node,"has",len(cliques),"cliques in neighborhood (of size",len(neighbors),")")
cliques_debugging = True
......@@ -289,7 +289,7 @@ def compute_all_max_d_graphs(graph, debug=False, clique_mode=None):
from collections import Counter
len_cliques = Counter(map(len,cliques))
print("sizes of found cliques%s:" % mode_str, len_cliques)
#print("sizes of found cliques%s:" % mode_str, len_cliques)
# Pair halves to create d-graphes
for idx, clq1 in enumerate(cliques):
......@@ -306,9 +306,9 @@ def compute_all_max_d_graphs(graph, debug=False, clique_mode=None):
if d_graph.get_link_divergence() <= d_graph.get_optimal_score() * factor:
node_d_graphs.add(d_graph)
print("d-graphs", len(node_d_graphs))
#print("d-graphs", len(node_d_graphs))
d_graphs[node] = brutal_list_domination_filter(sorted(node_d_graphs))
print("filtered", len(d_graphs[node]))
#print("filtered", len(d_graphs[node]))
return d_graphs
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment