diff --git a/sc2ts/inference.py b/sc2ts/inference.py index fbf9a28..1c073cd 100644 --- a/sc2ts/inference.py +++ b/sc2ts/inference.py @@ -1110,7 +1110,7 @@ def add_matching_results( tables.compute_mutation_parents() ts = tables.tree_sequence() ts = tree_ops.push_up_reversions(ts, attach_nodes, date) - ts = tree_ops.coalesce_mutations(ts, attach_nodes) + ts = tree_ops.coalesce_mutations(ts, attach_nodes, date) ts = delete_immediate_reversion_nodes(ts, attach_nodes) return ts, added_groups diff --git a/sc2ts/info.py b/sc2ts/info.py index d285432..abbc9be 100644 --- a/sc2ts/info.py +++ b/sc2ts/info.py @@ -781,14 +781,14 @@ def _node_summary(self, u, child_mutations=True): else: md = md["sc2ts"] if flags == 1 << 21: - if "overlap" in md: - strain = f"Overlap {len(md['overlap'])} mut {len(md['sibs'])} sibs" - else: + try: + strain = f"Overlap added={md['date_added']} {md['mutations']}" + except KeyError: strain = "Overlap debug missing" elif flags == 1 << 22: - if "sites" in md: - strain = f"Push {len(md['sites'])} reversions" - else: + try: + strain = f"Push added={md['date_added']} {md['mutations']}" + except KeyError: strain = "Push debug missing" elif "group_id" in md: strain = md["group_id"] diff --git a/sc2ts/tree_ops.py b/sc2ts/tree_ops.py index 6961a45..1efa998 100644 --- a/sc2ts/tree_ops.py +++ b/sc2ts/tree_ops.py @@ -276,7 +276,7 @@ def update_tables(tables, edges_to_delete, mutations_to_delete): return tables.tree_sequence() -def coalesce_mutations(ts, samples=None): +def coalesce_mutations(ts, samples=None, date="1999-01-01"): """ Examine all time-0 samples and their (full-sequence) sibs and create new nodes to represent overlapping sets of mutations. The algorithm @@ -380,6 +380,7 @@ def coalesce_mutations(ts, samples=None): "sc2ts": { "mutations": md_overlap, "sibs": md_sibs, + "date_added": date, } }, )