Commit 17971a94 by Yoann Dufresne

evaluate longest path ok

parent 76239d13
 ... ... @@ -138,7 +138,7 @@ class D2Graph(object): def to_nx_graph(self): next_idx = 0 # next_idx = 0 nodes = {} G = nx.Graph() ... ... @@ -146,8 +146,8 @@ class D2Graph(object): for d_idx, dg in enumerate(self.index[dmer]): # Create a node name if not dg in nodes: nodes[dg] = next_idx next_idx += 1 nodes[dg] = str(dg) # next_idx += 1 # Add the node G.add_node(nodes[dg]) ... ...
 ... ... @@ -166,7 +166,8 @@ class Dgraph(object): def __repr__(self): # print(self.halves) representation = str(self.center) + " " + str(self.score) + "/" + str(self.get_optimal_score()) + " " representation = "" if self.idx == -1 else f"{self.idx} " representation += str(self.center) + " " + str(self.score) + "/" + str(self.get_optimal_score()) + " " representation += "[" + ", ".join([f"{node} {self.connexity[0][node]}" for node in self.halves[0]]) + "]" representation += "[" + ", ".join([f"{node} {self.connexity[1][node]}" for node in self.halves[1]]) + "]" return representation ... ... @@ -174,10 +175,9 @@ class Dgraph(object): """ From a barcode graph, compute all the possible max d-graphs by node. @param graph A barcode graph @param n_best Only keep n d-graphs (the nearest to 1.0 ratio) @return A dictionary associating each node to its list of all possible d-graphs. The d-graphs are sorted by decreasing ratio. """ def compute_all_max_d_graphs(graph, n_best=100, debug=False): def compute_all_max_d_graphs(graph, debug=False): d_graphs = {} for node in list(graph.nodes()): ... ...