diff --git a/README.md b/README.md index 3e2486d92547440c295cd99714e0f62f211f62f5..6547fd1d2ef2c00e2427dec587eddecab2c43bd6 100644 --- a/README.md +++ b/README.md @@ -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]] +``` diff --git a/Snakefile_d2 b/Snakefile_d2 index 2b1bbdd9c3b1481bc01d035d76d4f2dd053e2e6d..357e01383fe0d8bb3749c059c8de55e419f11289 100644 --- a/Snakefile_d2 +++ b/Snakefile_d2 @@ -1,12 +1,13 @@ 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: diff --git a/deconvolution/d_graph.py b/deconvolution/d_graph.py index 2d9ce9789cef61dfec17b8a68ac3210a8e1e30f1..de03bc0f2d5ebdb783bf9dc5a96b71d965d0ad54 100644 --- a/deconvolution/d_graph.py +++ b/deconvolution/d_graph.py @@ -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