Skip to content
Sergei Pond edited this page Jul 13, 2015 · 24 revisions

Wikiphylotree.js APICore

Functions tasked with creating phylogenetic tree objects, binding them to SVG elements, reading tree data, and accessing object data.

# d3.layout.phylotree([container])

Create a phylogenetic tree viewer with default settings (which can be modified before rendering). If container is specified (as a CSS selector), sets the DOM element whose events will be tracked by the tree viewer to; by default this is set to body. If multiple tree viewers are shown on the same page, this needs to be set to different values for different objects (e.g. to enclosing <div> elements).

Returns a phylotree function (object) which is then instantiated with tree data (e.g. through Newick string).

var tree_object   = d3.layout.phylotree ("#my_container");
... apply settings ...
tree_object       = tree_object (newick_string);

# phylotree(data, [bootstrap])

Instantiate a tree object: build the tree structure and lay it out to screen coordinates (but do not render yet), using current settings.

If data is a string, calls an internal Newick string parser d3_phylotree_newick_parser to convert the string to an hierarchical collection of nodes consumed by d3.layout.hierarchy, with default accessor functions. If data is not a string, it is expected to be an object having the same format as that produced by d3_phylotree_newick_parser.

When set, bootstrap controls how internal node names are interpreted: as names (if false), or bootstrap support values (numeric, if true).

Returns the instantiated phylotree object.

# node

A constituent component of the phylotree object, which represents a node in the phylogenetic tree, together with the incident branch (except for the root node). This is a JavaScript Object with the following keys, of which those shown in [] can be missing or null.

Clone this wiki locally