Skip to content

Commit

Permalink
Warn on MRCA for unrooted tree
Browse files Browse the repository at this point in the history
Closes #152
  • Loading branch information
mmore500 committed May 18, 2024
1 parent 05a65c0 commit ef2c39c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/dendropy/datamodel/treemodel/_tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# -*- coding: utf-8 -*-

import copy
import warnings
from io import StringIO
from dendropy.utility import terminal
from dendropy.utility import error
Expand Down Expand Up @@ -1522,6 +1523,13 @@ def mrca(self, **kwargs):
The most-recent common ancestor of the nodes specified, or |None|
if no such node exists.
"""
if not self.is_rooted:
warnings.warn(
"Calculating MRCA on an unrooted tree implicitly implicitly "
"treats seed node as root. "
"Set tree.is_rooted = True to silence this warning.",
)

start_node = kwargs.get("start_node", self.seed_node)
leafset_bitmask = None
if "leafset_bitmask" in kwargs:
Expand Down

0 comments on commit ef2c39c

Please sign in to comment.