Skip to content

Commit

Permalink
phylotree.py: PhyloTree will warn if you set both species and _specie…
Browse files Browse the repository at this point in the history
…sFunction.
  • Loading branch information
jordibc committed Nov 8, 2023
1 parent 476ec80 commit 92f28c7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ete4/phylo/phylotree.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import sys
import re
import warnings
import itertools
from collections import defaultdict
from ete4 import Tree, SeqGroup, NCBITaxa, GTDBTaxa
Expand Down Expand Up @@ -300,6 +301,9 @@ def __init__(self, newick=None, children=None, alignment=None,
@property
def species(self):
if self.props.get('_speciesFunction'):
if 'species' in self.props:
warnings.warn('Ambiguous species: both species and _speciesFunction'
'defined. You can remove "species" from this node.')
try:
return self.props.get('_speciesFunction')(self.name)
except:
Expand Down

0 comments on commit 92f28c7

Please sign in to comment.