diff --git a/debruijn/debruijn.py b/debruijn/debruijn.py index 855fd94..01159ba 100644 --- a/debruijn/debruijn.py +++ b/debruijn/debruijn.py @@ -2,6 +2,7 @@ Small assembly module based on de bruijn graphs """ import os +import sys import statistics import networkx as nx from networkx import algorithms @@ -259,6 +260,11 @@ def solve_bubble(graph, ancestor_node, descendent_node): graph, nx.DiGraph: the same graph without the bubble """ paths = algorithms.all_simple_paths(graph, ancestor_node, descendent_node) + paths2= [] + for p in paths: + paths2.append(p) + + paths = paths2 weights = [] path_lens = [] @@ -294,3 +300,25 @@ def solve_entry_tips(): def solve_out_tips(): pass + +def main(): + fichier = str(sys.argv[1]) + k-size = int(sys.argv[2]) + hash_table = build_kmer_dict(fichier, k-size) + G = build_graph(hash_table) + + nb = 0 + for n in G: + if G.in_degree(n) > 1: + nb += 1 + + print("il y a {} bulles dans le graphe\n".format(nb)) + + simplify_bubbles(G) + + nb = 0 + for n in G: + if G.in_degree(n) > 1: + nb += 1 + + print("il y a {} bulles dans le graphe\n".format(nb))