There seem to be more edges than necessary in the standard tskit output. It might be useful to squash the edges for export (or allow that to be a parameter):
import arg_needle_lib
argneedle = arg_needle_lib.deserialize_arg("examples/" + "arg_needle.argn")
argn_ts = arg_needle_lib.arg_to_tskit(argneedle, mutations=True)
print(f"Original ARG-Needle tree sequence has {argn_ts.num_edges} edges")
tables = argn_ts.dump_tables()
tables.edges.squash()
tables.sort()
squashed_edge_ts = tables.tree_sequence()
print(f"This can be reduced to {squashed_edge_ts.num_edges} edges")
print(f"A reduction of {squashed_edge_ts.num_edges/argn_ts.num_edges * 100:.2f}%")
Original ARG-Needle tree sequence has 1089859 edges
This can be reduced to 450255 edges
A reduction of 41.31%
There seem to be more edges than necessary in the standard tskit output. It might be useful to squash the edges for export (or allow that to be a parameter):