diff --git a/doc/reference/index.rst b/doc/reference/index.rst index 8e94bd376..e5ff831dc 100644 --- a/doc/reference/index.rst +++ b/doc/reference/index.rst @@ -13,3 +13,4 @@ Reference Guide reference_taxonomy reference_smartview reference_treeview + reference_treematcher diff --git a/doc/reference/reference_treematcher.rst b/doc/reference/reference_treematcher.rst new file mode 100644 index 000000000..8d7a80f4b --- /dev/null +++ b/doc/reference/reference_treematcher.rst @@ -0,0 +1,7 @@ +Tree matcher +============ + +.. automodule:: ete4.treematcher.treematcher + :members: + :undoc-members: + :special-members: __init__ diff --git a/ete4/treematcher/treematcher.py b/ete4/treematcher/treematcher.py index 682a2045f..8832f615b 100644 --- a/ete4/treematcher/treematcher.py +++ b/ete4/treematcher/treematcher.py @@ -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 ";".