TreeViz Class
TreeViz
TreeViz(
tree_data: str | Path | Tree,
*,
format: str = "newick",
outer: bool = True,
align_leaf_label: bool = True,
ignore_branch_length: bool = False,
leaf_label_size: float = 12,
leaf_label_rmargin: float = 2.0,
reverse: bool = False,
ladderize: bool = False,
line_kws: dict[str, Any] | None = None,
align_line_kws: dict[str, Any] | None = None,
label_formatter: Callable[[str], str] | None = None,
track: Track
)
Phylogenetic Tree Visualization Class
Interface for changing tree properties and adding tree annotations in a track
PARAMETER | DESCRIPTION |
---|---|
tree_data
|
Tree data (
TYPE:
|
format
|
Tree format (
TYPE:
|
outer
|
If True, plot tree on outer side. If False, plot tree on inner side.
TYPE:
|
align_leaf_label
|
If True, align leaf label.
TYPE:
|
ignore_branch_length
|
If True, ignore branch length for plotting tree.
TYPE:
|
leaf_label_size
|
Leaf label size
TYPE:
|
leaf_label_rmargin
|
Leaf label radius margin
TYPE:
|
reverse
|
If True, reverse tree
TYPE:
|
ladderize
|
If True, ladderize tree
TYPE:
|
line_kws
|
Patch properties (e.g.
TYPE:
|
align_line_kws
|
Patch properties (e.g.
TYPE:
|
label_formatter
|
User-defined label text format function to change plot label text content.
For example, if you want to change underscore of the label to space,
set
TYPE:
|
track
|
Track for tree visualization
TYPE:
|
max_tree_depth
cached
property
Max tree depth (root -> leaf max branch length)
name2xr
cached
property
Tree node name & node xr coordinate dict
load_tree
staticmethod
Load tree data
PARAMETER | DESCRIPTION |
---|---|
data
|
Tree data
TYPE:
|
format
|
Tree format
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
tree
|
Tree object
TYPE:
|
search_target_node_name
Search target node name from query
PARAMETER | DESCRIPTION |
---|---|
query
|
Search query node name(s). If multiple node names are set, MRCA(Most Recent Common Ancester) node is set.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
target_node_name
|
Target node name
TYPE:
|
get_target_xlim
Get target node x limit by query
PARAMETER | DESCRIPTION |
---|---|
query
|
Search query node name(s) for getting x limit. If multiple node names are set, MRCA(Most Recent Common Ancester) node is set.
TYPE:
|
RETURNS | DESCRIPTION |
---|---|
xlim
|
X limit tuple
TYPE:
|
show_confidence
show_confidence(
*,
size: float = 8,
orientation: str = "vertical",
label_formatter: Callable[[float], str] | None = None,
**kwargs
) -> None
Show confidence value on each internal node of the phylogenetic tree
PARAMETER | DESCRIPTION |
---|---|
size
|
Text size
TYPE:
|
orientation
|
Text orientation (
TYPE:
|
label_formatter
|
User-defined function for label format.
TYPE:
|
**kwargs
|
Text properties (e.g.
TYPE:
|
highlight
highlight(
query: str | list[str] | tuple[str], *, color: str, alpha: float = 0.5, **kwargs
) -> None
Plot highlight for target node
PARAMETER | DESCRIPTION |
---|---|
query
|
Search query node name(s) for highlight. If multiple node names are set, MRCA(Most Recent Common Ancester) node is set.
TYPE:
|
color
|
Highlight color
TYPE:
|
alpha
|
Highlight color alpha(transparancy) value
TYPE:
|
**kwargs
|
Patch properties (e.g.
TYPE:
|
marker
marker(
query: str | list[str] | tuple[str],
*,
marker: str = "o",
size: int = 6,
descendent: bool = True,
**kwargs
) -> None
Plot marker on target node(s)
PARAMETER | DESCRIPTION |
---|---|
query
|
Search query node name(s) for plotting marker. If multiple node names are set, MRCA(Most Recent Common Ancester) node is set.
TYPE:
|
marker
|
Marker type (e.g.
TYPE:
|
size
|
Marker size
TYPE:
|
descendent
|
If True, plot markers on target node's descendent as well.
TYPE:
|
**kwargs
|
Axes.scatter properties (e.g.
TYPE:
|
set_node_label_props
Set tree node label properties
PARAMETER | DESCRIPTION |
---|---|
target_node_label
|
Target node label name
TYPE:
|
kwargs
|
Text properties (e.g.
TYPE:
|
set_node_line_props
set_node_line_props(
query: str | list[str] | tuple[str],
*,
descendent: bool = True,
apply_label_color: bool = False,
**kwargs
) -> None
Set tree node line properties
PARAMETER | DESCRIPTION |
---|---|
query
|
Search query node name(s) for coloring tree node line. If multiple node names are set, MRCA(Most Recent Common Ancester) node is set.
TYPE:
|
descendent
|
If True, set properties on target node's descendent as well.
TYPE:
|
apply_label_color
|
If True &
TYPE:
|
**kwargs
|
Patch properties (e.g.
TYPE:
|