-
Notifications
You must be signed in to change notification settings - Fork 78
Core
Wiki ▸ phylotree.js API ▸ Core
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.
- name - the name of the node (set by d3_phylotree_newick_parser).
- original_child_oder - the order (left-to-right) in which this node appeared in its parents children list (set by d3_phylotree_newick_parser).
-
children -
null
for leafs, otherwise an array ofnode
objects (set by d3_phylotree_newick_parser). - [bootstrap_values] - if available, bootstrap (or other) support for the node/split/branch (set by d3_phylotree_newick_parser).
- [attribute] - if available, the value following the ':' in the Newick string; usually a branch length (set by d3_phylotree_newick_parser).
- annotation - any string included in [] following the node definition; see an example in d3_phylotree_newick_parser (set by d3_phylotree_newick_parser)
- *angle * - the angle (in radians) of the node in polar coordinates (radial layout only, set by placenodes).
[Log] Object (radial_layout, line 44) angle: 6.200511816295645 annotation: "" attribute: "0.166557" depth: 5 id: 68 name: "ELEPHANT" original_child_order: 2 parent: Object radius: 142.65957195950017 screen_x: 343.6222618092085 screen_y: 189.66921053762294 text_align: "start" text_angle: 355.2631578947369 x: 189.66921053762294 y: 343.6222618092085 proto: Object