From d6679fec7f0c13f35efdd9d500d7c110bbf8e86e Mon Sep 17 00:00:00 2001 From: Emily Dolson Date: Tue, 16 Jul 2024 00:16:24 +1000 Subject: [PATCH] Add first stab at collapsing unifurcations --- Empirical | 2 +- systematics_bindings.cpp | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Empirical b/Empirical index d74c09c..e009fa4 160000 --- a/Empirical +++ b/Empirical @@ -1 +1 @@ -Subproject commit d74c09c7f5aea0e91c2e6eb435236bed848e01d9 +Subproject commit e009fa4182a701aa8fd4c7e07d24fde19c8d86f7 diff --git a/systematics_bindings.cpp b/systematics_bindings.cpp index a425c7c..f8ce965 100644 --- a/systematics_bindings.cpp +++ b/systematics_bindings.cpp @@ -352,6 +352,18 @@ PYBIND11_MODULE(systematics, m) { val : bool Value representing whether a synchronous population is being tracked. )mydelimiter") + .def("set_collapse_unifurcations", static_cast(&sys_t::SetCollapseUnifurcations), R"mydelimiter( + A setter method to configure whether unifurcations (sequences of extinct parents with exactly one offspring taxon) + should be collapsed (i.e. extinct taxon with one offspring will be removed and the offspring's parent will be set to be + what was formerly its grandparent). This setting will save space and be more consistent with a lot of biological representations + but will sacrifice information. + This option defaults to False. + + Parameters + ---------- + val : bool + Value representing whether to collapse unifurcations + )mydelimiter") .def("set_update", static_cast(&sys_t::SetUpdate), R"mydelimiter( A setter method to modify the current time step. This should be used if you want PhylotrackPy to track when events occur. @@ -388,6 +400,10 @@ PYBIND11_MODULE(systematics, m) { It is recommended to verify this setting before any tracking. Can be set using the `set_track_synchronous()` method. )mydelimiter") + .def("get_collapse_unifurcations", static_cast(&sys_t::GetCollapseUnifurcations), R"mydelimiter( + Whether the Systematics Manager is configured to collapse unifurcations. + Can be set using the `set_collapse_unifurcations()` method. + )mydelimiter") .def("get_update", static_cast(&sys_t::GetUpdate), R"mydelimiter( Returns the current timestep of the simulation. This time step can be overriden using the `set_update()` method.