A JavaScript library for developing applications and interactive visualizations involving [phylogenetic trees](https://en.wikipedia.org/wiki/Phylogenetic_tree), written as an extension of the [D3](http://d3js.org) [hierarchy layout](https://github.com/d3/
npm install @lichong/phylotreenpm install phylotree. Otherwise, the latest release can be
git clone https://github.com/veg/phylotree.js.git
yarn
yarn serve
`
This will run rollup in watch mode and start a local server (default port is 8080). Refresh upon editing to view changes.
Fundamentals
This section describes basic commands for displaying trees, such as those found
in the Introduction section.
Note that many methods follow the getter/setter pattern, commonly used in D3.
That is, they can either be used to retrieve an underlying parameter by being
invoked without arguments (get), or can be used to change an underlying
parameter by being invoked with the proper arguments (set).
$3
Phylotree supports the Newick format, as well the extension of this format that
is used by HyPhy. This allows assigning a category to each branch by the use of
curly braces directly after identifiers, e.g.:
`
((((Pig:0.147969,Cow:0.21343):0.085099,Horse:0.165787,Cat:0.264806):0.058611, ((RhMonkey{Foreground}:0.002015,Baboon{Foreground}:0.003108){Foreground}:0.022733 ,(Human{Foreground}:0.004349,Chimp{Foreground}:0.000799){Foreground}:0.011873):0.101856) :0.340802,Rat:0.050958,Mouse:0.09795)
`
Examples
* Simple Example
* Unscaled IAV HA colored by host
* HIV RT
* NGS Copy Diversity
* HIV-1 env multiple timepoints and compartments
* Computing Root-to-Tip Distances with Phylotree.js
* Computing the Center of the Tree with Phylotree.js
* Identifying Clusters in a Phylogenetic Tree with Phylotree.js
* Identifying Clusters in a Phylogenetic Tree with Phylotree.js Part II
Options
phylotree.js supports a variety of options for common features, which can be set using
the following function.
The following are a list of possible options, along with their types, meanings, and possible values.
$3
(String) Determines layout size from left to right. Defaults to "fixed-step".
* "fixed-step" - Determine width from padding and spacing.
* "fit-to-size" - Determine width from size array.
$3
(String) Determines layout size from top to bottom. Defaults to "fixed-step".
* "fixed-step" - Determine width from padding and spacing.
* "fit-to-size" - Determine width from size array.
$3
(Boolean) Whether or not the brush should be activated. Defaults to true.
$3
(Boolean) Whether or not hiding a given node or subtree is enabled. Defaults to true.
$3
(Boolean) Whether or not rerooting on a given node is enabled. Defaults to true.
$3
(Number) The percentage of original size for a collapsed node. Defaults to .2.
$3
(Boolean) Determines whether or not scale bar for branch lengths is shown.
$3
(Number) Amount of space on left side of phylotree. Defaults to 0.
$3
(Boolean) Determines whether nodes are drawn with a given size. Defaults to false.
$3
(Number) Set an upper bound on the radius in a radial layout. Defaults to 768.
$3
(Boolean) Determines whether or not nodes are collapsible. Defaults to true.
$3
(Boolean) Determines whether or not individual branches are selectable. Defaults to true.
$3
(Boolean) Determines whether or not zooming is enabled. Defaults to false.
$3
(Array) Determines what types of global selection actions are possible. Defaults to false.
* false - No restrictions placed on global selection.
* "all" - Allow users to select all branches.
* "none" - Allow users to unselect all branches.
* "all-leaf-nodes" - Allow users to select all leaf nodes.
* "all-internal-branches" - Allow users to select all internal branches.
$3
(Boolean) Determines whether tip names are aligned or not. Defaults to false.
$3
(Number) Determines maximum node spacing allocated when laying out left to right. Defaults to 100.
$3
(Number) Determines minimum node spacing allocated when laying out left to right. Defaults to 2.
$3
(Number) Determines maximum node spacing allocated when laying out top to bottom. Defaults to 100.
$3
(Number)` Determines minimum node spacing allocated when laying out top to bottom. Defaults to 10.