Commit aa092fa2 authored by Yoann Dufresne's avatar Yoann Dufresne
Browse files

path simple

parent 93af6c95
...@@ -5,6 +5,7 @@ import argparse ...@@ -5,6 +5,7 @@ import argparse
import sys import sys
from deconvolution.d2graph import d2_graph as d2, path_optimization as po from deconvolution.d2graph import d2_graph as d2, path_optimization as po
from deconvolution.d2graph.d2_path import Path
def parse_arguments(): def parse_arguments():
...@@ -50,22 +51,17 @@ def main(): ...@@ -50,22 +51,17 @@ def main():
spl2 = nx.shortest_path_length(largest_component,one_extremity) spl2 = nx.shortest_path_length(largest_component,one_extremity)
other_extremity = max(spl2.items(),key=lambda x:x[1])[0] other_extremity = max(spl2.items(),key=lambda x:x[1])[0]
path = nx.shortest_path(largest_component,one_extremity, other_extremity) node_path = nx.shortest_path(largest_component,one_extremity, other_extremity)
nodes = [largest_component.node_by_idx[int(x)] for x in node_path]
path = Path(d2g)
path.add_path(nodes)
solution = po.Solution(largest_component) print(f"covering score: {path.covering_score()}")
nodes = [largest_component.node_by_idx[int(x)] for x in path]
solution.add_path(nodes)
print(f"covering score: {solution.covering_score()}")
# solution.save_path_in_graph(f"{args.out_prefix}_d2_path.gexf") # solution.save_path_in_graph(f"{args.out_prefix}_d2_path.gexf")
solution.save_path(f"{args.out_prefix}_path.gexf") path.save_gexf(f"{args.out_prefix}_path.gexf")
solution.save_barcode_path(f"{args.out_prefix}_barcode_count.gexf")
print("Solution saved") print("Solution saved")
# from d2_path import d2_path_to_barcode_path
# d2_path_to_barcode_path(solution)
if __name__ == "__main__": if __name__ == "__main__":
main() main()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment