diff --git a/pyproject.toml b/pyproject.toml index 0cbb00cc..6c4cdf73 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "laptrack" -version = "0.5.1" +version = "0.6.0" description = "LapTrack" authors = ["Yohsuke Fukai "] license = "BSD-3-Clause" diff --git a/src/laptrack/data_conversion.py b/src/laptrack/data_conversion.py index 5fe18e98..1f333e91 100644 --- a/src/laptrack/data_conversion.py +++ b/src/laptrack/data_conversion.py @@ -209,8 +209,8 @@ def convert_tree_to_dataframe( splits.append((node, children)) if len(parents) > 1: for parent in parents: - if tree2.has_edge(node, parent): - tree2.remove_edge(node, parent) + if tree2.has_edge(parent, node): + tree2.remove_edge(parent, node) if node not in [p[0] for p in merges]: merges.append((node, parents)) diff --git a/tests/test_tracking.py b/tests/test_tracking.py index 06f67db4..a66e81a0 100644 --- a/tests/test_tracking.py +++ b/tests/test_tracking.py @@ -127,6 +127,8 @@ def test_reproducing_trackmate(testdata, tracker_class) -> None: ) df = pd.concat(data) track_df, split_df, merge_df = lt.predict_dataframe(df, ["x", "y"]) + assert not any(split_df.duplicated()) + assert not any(merge_df.duplicated()) track_df2, split_df2, merge_df2 = convert_tree_to_dataframe(track_tree, coords) track_df2 = track_df2.rename(columns={"coord-0": "x", "coord-1": "y"}) assert all(track_df == track_df2)