gneiss.balances.balanceplot

gneiss.balances.balanceplot(balances, tree, layout=None, mode=’c’)[source]

Plots balances on tree.

Parameters:
  • balances (np.array) – A vector of internal nodes and their associated real-valued balances. The order of the balances will be assumed to be in level order.
  • tree (skbio.TreeNode) – A strictly bifurcating tree defining a hierarchical relationship between all of the features within table.
  • layout (function, optional) – A layout for formatting the tree visualization. Must take a ete.tree as a parameter.
  • mode (str) – Type of display to show the tree. (‘c’: circular, ‘r’: rectangular).

Notes

The tree is assumed to strictly bifurcating and whose tips match balances. It is not recommended to attempt to plot trees with a ton of leaves (i.e. more than 4000 leaves).

Examples

>>> from gneiss.balances import balanceplot
>>> from skbio import TreeNode
>>> tree = u"((b,c)a, d)root;"
>>> t = TreeNode.read([tree])
>>> balances = [10, -10]
>>> tr, ts = balanceplot(balances, t)
>>> print(tr.get_ascii())

       /-b
    /a|
-root  \-c
   |
    \-d

See also

skbio.TreeNode.levelorder()