load_tree#

load_tree(filename: str | pathlib.Path, format: str | None = None, underscore_unmunge: bool = False) PhyloNode | TreeNode#

Constructor for tree.

Parameters:
filenamestr

a file path containing a newick or xml formatted tree.

formatstr

either xml or json, all other values default to newick. Overrides file name suffix.

underscore_unmungebool

replace underscores with spaces in all names read, i.e. “sp_name” becomes “sp name”.

Returns:
PhyloNode

Notes

Underscore unmunging is turned off by default, although it is part of the Newick format. Only the cogent3 json and xml tree formats are supported.

filename is assigned to root node tree.source attribute.