Commit caecf3d6 by MARIJON Pierre

If node in link didn't exist add it

parent 4b603c9b
......@@ -24,6 +24,11 @@ def read_gfa(filename):
if row[0] == "S":
G.add_node(correct_name(row[1]), {"color": "#000000FF"})
elif row[0] == "L":
if not G.has_node(row[1]):
G.add_node(correct_name(row[1]), {"color": "#000000FF"})
if not G.has_node(row[3]):
G.add_node(correct_name(row[3]), {"color": "#000000FF"})
G.add_edge(correct_name(row[1]), correct_name(row[3]), {"nothing": "empty"})
return G
......@@ -142,8 +147,6 @@ def main(first_gfa: "A gfa file",
for c in connected_components:
for n in c:
first_graph.node[n]["color"] = rgb2hex(color_map(i))
i += 1
# Order of graph is important to keep the color
......@@ -155,8 +158,10 @@ def main(first_gfa: "A gfa file",
with open(out_csv, "w") as outfile:
out_csv_writer = csv.writer(outfile, delimiter=",")
out_csv_writer.writerow(["Node name", "color"])
for node in composed_graph.nodes_iter():
out_csv_writer.writerow([node, composed_graph.node[node]["color"]])
if canu_tig_file != "" and (node in id2name or canu_mode):
node_canu_id = id2name[node]
if node_canu_id in read2info:
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