kitchensjn / tskit_arg_visualizer

Interactive visualization method for ancestral recombination graphs
MIT License
11 stars 3 forks source link

Getting "Node not a sample and cannot be included in sample order." when re-running #73

Closed hyanwong closed 3 months ago

hyanwong commented 3 months ago

When I repeatedly run the visualiser in a jupyterlab cell, but change the input tree sequence, I often get an error about "node not a sample". It appears as if some global variable is being cached somehow.

This triggers the bug for me:

import msprime
import tskit_arg_visualizer

ts = msprime.simulate(10)

d3arg = tskit_arg_visualizer.D3ARG.from_ts(ts)
d3arg.draw(width=600, height=600, edge_type="line")

d3arg = tskit_arg_visualizer.D3ARG.from_ts(ts.simplify([0,1,2]))
d3arg.draw(width=600, height=600, edge_type="line")
kitchensjn commented 3 months ago

By default draw(..., sample_order=[]) which is a mutable object and wasn't behaving as intended. This is changed to draw(..., sample_order=None) and then later updated to be an empty list. Closing as this should be solved now, but let me know if it's still causing trouble.

hyanwong commented 3 months ago

Ah yes! The "don't use lists as defaults" issue. I've been bitten by that too! Thanks for fixing it.