Browse Source

corrected most bugs !

nicolas-zimmermann 4 years ago
parent
commit
62a46d113f
1 changed files with 28 additions and 0 deletions
  1. 28 0
      debruijn/debruijn.py

+ 28 - 0
debruijn/debruijn.py View File

2
 Small assembly module based on de bruijn graphs
2
 Small assembly module based on de bruijn graphs
3
 """
3
 """
4
 import os
4
 import os
5
+import sys
5
 import statistics
6
 import statistics
6
 import networkx as nx
7
 import networkx as nx
7
 from networkx import algorithms
8
 from networkx import algorithms
259
         graph, nx.DiGraph: the same graph without the bubble
260
         graph, nx.DiGraph: the same graph without the bubble
260
     """
261
     """
261
     paths = algorithms.all_simple_paths(graph, ancestor_node, descendent_node)
262
     paths = algorithms.all_simple_paths(graph, ancestor_node, descendent_node)
263
+    paths2= []
264
+    for p in paths:
265
+        paths2.append(p)
266
+
267
+    paths = paths2
262
 
268
 
263
     weights = []
269
     weights = []
264
     path_lens = []
270
     path_lens = []
294
 
300
 
295
 def solve_out_tips():
301
 def solve_out_tips():
296
     pass
302
     pass
303
+
304
+def main():
305
+    fichier = str(sys.argv[1])
306
+    k-size = int(sys.argv[2])
307
+    hash_table = build_kmer_dict(fichier, k-size)
308
+    G = build_graph(hash_table)
309
+    
310
+    nb = 0
311
+    for n in G:
312
+        if G.in_degree(n) > 1:
313
+            nb += 1
314
+    
315
+    print("il y a {} bulles dans le graphe\n".format(nb))
316
+    
317
+    simplify_bubbles(G)
318
+    
319
+    nb = 0
320
+    for n in G:
321
+        if G.in_degree(n) > 1:
322
+            nb += 1
323
+
324
+    print("il y a {} bulles dans le graphe\n".format(nb))