Skip to content

Commit

Permalink
Avoid network modification
Browse files Browse the repository at this point in the history
  • Loading branch information
nickjcroucher committed Nov 15, 2024
1 parent 86257c6 commit 12e8c8c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions PopPUNK/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,16 +562,17 @@ def outputsForCytoscape(G, G_mst, isolate_names, clustering, outPrefix, epiCsv,
component_assignments, component_hist = gt.label_components(G)
print("All assignments: " + str(component_assignments))
for component_idx in range(len(component_hist)):
G_copy = G
remove_list = []
for vidx, v_component in enumerate(component_assignments.a):
print("Index: " + str(vidx))
print("Component: " + str(v_component))
print("Name: " + str(seqLabels[vidx]))
if v_component != component_idx:
remove_list.append(vidx)
G.remove_vertex(remove_list)
G.purge_vertices()
save_network(G, prefix = outPrefix, suffix = "_component_" + str(component_idx + 1), use_graphml = True)
G_copy.remove_vertex(remove_list)
G_copy.purge_vertices()
save_network(G_copy, prefix = outPrefix, suffix = "_component_" + str(component_idx + 1), use_graphml = True)

if G_mst != None:
isolate_labels = isolateNameToLabel(G_mst.vp.id)
Expand Down

0 comments on commit 12e8c8c

Please sign in to comment.