@@ -301,15 +301,18 @@ def from_json(cls, json):
301301 nodes = pd .DataFrame (json ["data" ]["nodes" ])
302302 nodes ["x_pos_01" ] = (nodes ["x" ] - x_shift ) / (width - 100 )
303303 if json ["plot_type" ] == "full" :
304- samples = nodes .loc [bool (nodes ["ts_flags" ] & tskit .NODE_IS_SAMPLE ),["id" , "fx" ]]
304+ samples = nodes .loc [(nodes ["ts_flags" ] & tskit .NODE_IS_SAMPLE ) != 0 ,["id" , "fx" ]]
305305 num_samples = samples .shape [0 ]
306306 sample_order = [sample for _ , sample in sorted (zip (samples ["fx" ], samples ["id" ]))]
307307 else :
308308 num_samples = - 1
309309 sample_order = []
310310 return cls (
311311 nodes = nodes ,
312- edges = pd .DataFrame (json ["data" ]["links" ]),
312+ edges = pd .DataFrame (
313+ json ["data" ]["links" ]["data" ],
314+ columns = json ["data" ]["links" ]["columns" ],
315+ ),
313316 mutations = pd .DataFrame (json ["data" ]["mutations" ]),
314317 breakpoints = pd .DataFrame (json ["data" ]["breakpoints" ]),
315318 num_samples = num_samples ,
@@ -1065,7 +1068,6 @@ def _prepare_json(
10651068 transformed_bps ["x_pos" ] = transformed_bps ["x_pos_01" ] * width + y_axis_left_spacing
10661069 transformed_bps ["width" ] = transformed_bps ["width_01" ] * width
10671070 transformed_bps ["included" ] = "true"
1068- transformed_bps = transformed_bps .to_dict ("records" )
10691071
10701072 if shift_for_y_axis :
10711073 width += 50
@@ -1078,9 +1080,9 @@ def _prepare_json(
10781080 arg = {
10791081 "data" :{
10801082 "nodes" :transformed_nodes ,
1081- "links" :edges .to_dict ("records " ),
1083+ "links" :edges .to_dict ("split " ),
10821084 "mutations" :transformed_muts ,
1083- "breakpoints" :transformed_bps ,
1085+ "breakpoints" :transformed_bps . to_dict ( "records" ) ,
10841086 "evenly_distributed_positions" :sample_positions ,
10851087 },
10861088 "width" :width ,
0 commit comments