Skip to content

Commit

Permalink
fix gap character ambiguity bug (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
willdumm authored Aug 10, 2023
1 parent 3768fd3 commit 23a7152
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions gctree/branching_processes.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@
from typing import Tuple, Dict, List, Union, Set, Callable, Mapping, Sequence, Optional
from decimal import Decimal

sequence_resolutions = hdag.parsimony_utils.standard_nt_ambiguity_map_gap_as_char.get_sequence_resolution_func(
"sequence"
)
sequence_resolutions_count = hdag.parsimony_utils.standard_nt_ambiguity_map_gap_as_char.get_sequence_resolution_count_func(
"sequence"
)


class CollapsedTree:
r"""A collapsed tree, modeled as an infinite type Galton-Watson process run
Expand Down Expand Up @@ -1669,7 +1676,7 @@ def _is_ambiguous(sequence):
return any(base not in gctree.utils.bases for base in sequence)


def _make_dag(trees, from_copy=True):
def _make_dag(trees, from_copy=True, quick_sankoff=False):
"""Build a history DAG from ambiguous or disambiguated trees, whose nodes
have abundance, name, and sequence attributes."""
# preprocess trees so they're acceptable inputs
Expand Down Expand Up @@ -1777,7 +1784,7 @@ def trees_to_dag(trees):
def test_explode_individually():
try:
if (
dag.count_trees(expand_count_func=hdag.utils.sequence_resolutions_count)
dag.count_trees(expand_count_func=sequence_resolutions_count)
/ dag.count_trees()
> 5000000
):
Expand All @@ -1794,7 +1801,7 @@ def test_explode_individually():
)
distrees = [disambiguate(tree) for tree in trees]
dag = trees_to_dag(distrees)
dag.explode_nodes(expand_func=hdag.utils.sequence_resolutions)
dag.explode_nodes(expand_func=sequence_resolutions)
# Look for (even) more trees:
dag.add_all_allowed_edges(adjacent_labels=True)
dag.trim_optimal_weight()
Expand Down

0 comments on commit 23a7152

Please sign in to comment.