Skip to content

Commit

Permalink
Add reference documentation about the tree matcher (TreePattern).
Browse files Browse the repository at this point in the history
  • Loading branch information
jordibc committed Nov 21, 2023
1 parent e5de02d commit 1fbd905
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions doc/reference/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ Reference Guide
reference_taxonomy
reference_smartview
reference_treeview
reference_treematcher
7 changes: 7 additions & 0 deletions doc/reference/reference_treematcher.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Tree matcher
============

.. automodule:: ete4.treematcher.treematcher
:members:
:undoc-members:
:special-members: __init__
10 changes: 10 additions & 0 deletions ete4/treematcher/treematcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,16 @@ class TreePattern(Tree):
"""

def __init__(self, pattern='', children=None, parser=1, safer=False):
"""
:param pattern: Tree pattern to match, as a newick string. Optionally
with conditions on the nodes too (in place of node names).
:param safer: If True, calls to eval() will be safer by strongly
restricting the Python keywords that can be used.
The other parameters (children and parser) are needed to call
Tree's constructor appropriately, but should not be used when
creating a TreePattern.
"""
if type(pattern) == str:
# We expect a newick tree whose names will be the conditions
# to check for in each node. No need to end with ";".
Expand Down

0 comments on commit 1fbd905

Please sign in to comment.