From 268fcbf62f0f77f8003c91d15dc82aa179e02528 Mon Sep 17 00:00:00 2001
From: rchikhi <rayan.chikhi@univ-lille1.fr>
Date: Fri, 24 Jan 2020 14:09:41 +0100
Subject: [PATCH] merge

---
 Snakefile_d2                 |  2 +-
 Snakefile_data_simu          |  2 +-
 deconvolution/d_graph.py     |  2 +-
 deconvolution/to_d2_graph.py |  2 +-
 test_louvain.sh              | 26 ++++++++++++++------------
 5 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/Snakefile_d2 b/Snakefile_d2
index dd3ad73..14c096a 100644
--- a/Snakefile_d2
+++ b/Snakefile_d2
@@ -1,7 +1,7 @@
 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"]
+INPUT = ["snake_tests/simu_bar_n10000_d5_m2-dev0.gexf"] if "input" not in config else config["input"]
 if "," in INPUT:
     if INPUT[0] == "[":
         INPUT = INPUT[1:-1]
diff --git a/Snakefile_data_simu b/Snakefile_data_simu
index 5a4638d..318918e 100644
--- a/Snakefile_data_simu
+++ b/Snakefile_data_simu
@@ -1,6 +1,6 @@
 
 OUTDIR="snake_exec" if "outdir" not in config else config["outdir"]
-N=[1000] if "n" not in config else config["n"] # Number of molecule to simulate
+N=[10000] if "n" not in config else config["n"] # Number of molecule to simulate
 D=[5] if "d" not in config else config["d"] # Average coverage of each molecule
 M=[2] if "m" not in config else config["m"] # Average number of molecule per barcode
 M_DEV=[0] if "m_dev" not in config else config["m_dev"] # Std deviation for merging number
diff --git a/deconvolution/d_graph.py b/deconvolution/d_graph.py
index de03bc0..c5eebf5 100644
--- a/deconvolution/d_graph.py
+++ b/deconvolution/d_graph.py
@@ -258,7 +258,7 @@ def compute_all_max_d_graphs(graph, debug=False, clique_mode=None):
                 # further decompose! into necessarily 2 communities
                 community_as_graph = nx.Graph(graph.subgraph(comm))
                 if len(community_as_graph.nodes()) <= 2:
-                    cliques += [community_as_graph.nodes()]
+                    cliques += [list(community_as_graph.nodes())]
                 else:
                     cliques += map(list,nx.community.asyn_fluidc(community_as_graph,2))
                 
diff --git a/deconvolution/to_d2_graph.py b/deconvolution/to_d2_graph.py
index b233393..59ed951 100755
--- a/deconvolution/to_d2_graph.py
+++ b/deconvolution/to_d2_graph.py
@@ -53,7 +53,7 @@ def main():
     d2g = d2.D2Graph(G)
     dprint("D2 graph object created")
     dprint("constructing d2 graph from barcode graph")
-    index_size = 8 #if clique_mode is None else 3
+    index_size = 12 #if clique_mode is None else 3
     d2g.construct_from_barcodes(index_size=index_size, debug=debug, clique_mode=clique_mode)
     dprint("[debug] d2 graph constructed")
     
diff --git a/test_louvain.sh b/test_louvain.sh
index 813d1cc..ee79f24 100755
--- a/test_louvain.sh
+++ b/test_louvain.sh
@@ -1,12 +1,14 @@
-rm -Rf snake_tests/simu_bar_n1000_d5_m2*
+prefix=simu_bar_n1000_d6_m2
+
+rm -Rf snake_tests/$prefix*
 
 snakemake -s Snakefile_data_simu 
 snakemake -s Snakefile_d2 
-mv snake_exec/simu_bar_n1000_d5_m2.tar.gz snake_tests/simu_bar_n1000_d5_m2.tar.gz
+mv snake_exec/$prefix.tar.gz snake_tests/$prefix.tar.gz
 
 
 cd snake_tests
-tar xf simu_bar_n1000_d5_m2.tar.gz
+tar xf $prefix.tar.gz
 cd ..
 
 do_max_cliques=1
@@ -15,11 +17,11 @@ then
 
     echo "max-cliques"
 
-    python deconvolution/evaluate.py  --type d2 --barcode_graph snake_tests/simu_bar_n1000_d5_m2/simu_bar_n1000_d5_m2.gexf snake_tests/simu_bar_n1000_d5_m2/simu_bar_n1000_d5_m2_d2_simplified.gexf
+    python deconvolution/evaluate.py  --type d2 --barcode_graph snake_tests/"$prefix"/"$prefix".gexf snake_tests/"$prefix"/"$prefix"_d2_simplified.gexf
 
-    python deconvolution/d2_to_path.py  snake_tests/simu_bar_n1000_d5_m2/simu_bar_n1000_d5_m2.gexf snake_tests/simu_bar_n1000_d5_m2/simu_bar_n1000_d5_m2_d2_simplified.gexf
+    python deconvolution/d2_to_path.py  snake_tests/"$prefix"/"$prefix".gexf snake_tests/"$prefix"/"$prefix"_d2_simplified.gexf
 
-    python deconvolution/evaluate.py  --type path --barcode_graph snake_tests/simu_bar_n1000_d5_m2/simu_bar_n1000_d5_m2.gexf _path.gexf
+    python deconvolution/evaluate.py  --type path --barcode_graph snake_tests/"$prefix"/"$prefix".gexf _path.gexf
 fi
 
 
@@ -29,11 +31,11 @@ then
 
     echo "louvain"
 
-    python deconvolution/evaluate.py  --type d2 --barcode_graph snake_tests/simu_bar_n1000_d5_m2/simu_bar_n1000_d5_m2.gexf snake_tests/simu_bar_n1000_d5_m2/simu_bar_n1000_d5_m2_d2_simplified_louvain.gexf
+    python deconvolution/evaluate.py  --type d2 --barcode_graph snake_tests/"$prefix"/"$prefix".gexf snake_tests/"$prefix"/"$prefix"_d2_simplified_louvain.gexf
 
-    python deconvolution/d2_to_path.py  snake_tests/simu_bar_n1000_d5_m2/simu_bar_n1000_d5_m2.gexf snake_tests/simu_bar_n1000_d5_m2/simu_bar_n1000_d5_m2_d2_simplified_louvain.gexf
+    python deconvolution/d2_to_path.py  snake_tests/"$prefix"/"$prefix".gexf snake_tests/"$prefix"/"$prefix"_d2_simplified_louvain.gexf
 
-    python deconvolution/evaluate.py  --type path --barcode_graph snake_tests/simu_bar_n1000_d5_m2/simu_bar_n1000_d5_m2.gexf _path.gexf
+    python deconvolution/evaluate.py  --type path --barcode_graph snake_tests/"$prefix"/"$prefix".gexf _path.gexf
 fi
 
 do_comtest=0
@@ -43,10 +45,10 @@ then
 
     echo "******************************* Testing algorithm"
 
-    python deconvolution/evaluate.py  --type d2 --barcode_graph snake_tests/simu_bar_n1000_d5_m2/simu_bar_n1000_d5_m2.gexf snake_tests/simu_bar_n1000_d5_m2/simu_bar_n1000_d5_m2_d2_simplified_comtest.gexf
+    python deconvolution/evaluate.py  --type d2 --barcode_graph snake_tests/"$prefix"/"$prefix".gexf snake_tests/"$prefix"/"$prefix"_d2_simplified_comtest.gexf
 
-    python deconvolution/d2_to_path.py  snake_tests/simu_bar_n1000_d5_m2/simu_bar_n1000_d5_m2.gexf snake_tests/simu_bar_n1000_d5_m2/simu_bar_n1000_d5_m2_d2_simplified_comtest.gexf
+    python deconvolution/d2_to_path.py  snake_tests/"$prefix"/"$prefix".gexf snake_tests/"$prefix"/"$prefix"_d2_simplified_comtest.gexf
 
-    python deconvolution/evaluate.py  --type path --barcode_graph snake_tests/simu_bar_n1000_d5_m2/simu_bar_n1000_d5_m2.gexf _path.gexf
+    python deconvolution/evaluate.py  --type path --barcode_graph snake_tests/"$prefix"/"$prefix".gexf _path.gexf
 
 fi
-- 
GitLab