TreeGraph#

missionbio.mosaic.plots.fishplot.TreeGraph

class TreeGraph(labels: Sequence[str], parents: Sequence[Optional[str]], description: Optional[Sequence[str]] = None, font_size: float = 14, marker_size: float = 18, margin: float = 10, marker_gap: Tuple[float, float] = (60, 30))#

Container for creating a phylogeny tree

Snippets#

A tree with 4 nodes with custom descriptions and colors

>>> from missionbio.mosaic.plots.fishplot import TreeGraph
>>> labels = ["1", "2", "3", "4"]
>>> parents = [None, "1", "1", "2"]
>>> descriptions = ["WT", "KIT HET", "KIT HET<br>TP53 HET", "KIT LOH"]
>>> graph = TreeGraph(labels, parents, descriptions)
>>> graph.draw(palette={"1": "#000000", "2": "crimson", "3": "skyblue", "4": "red"})

Functions#

draw([palette, fig, row, col])

Create and draw the subclone tree graph.

expected_fig_size([positions, node_sizes, ...])

The plot size needed to fit the tree

Create a new TreeGraph instance

Parameters:
labelsSequence[str]

The labels of the nodes in the tree.

parentsSequence[str]

The parent for each label. This must have the same length as labels and each parent must be present in labels.

descriptionSequence[str]

A long description for each label. This is the value shown on the plot.

font_sizefloat

The font size of the text in the plot

marker_sizefloat

The size of the circular markers used to represent the nodes.

marginfloat

The number of pixels that must be left empty within the plot boundaries on each edge of the plot

marker_gapTuple[float, float]

The gap between the nodes in the x and y direction respectively

Raises:
ValuError:

When the labels are not unique