PONY Tree is an open-source JavaScript library for vizualisation of Phylogenetic tree.
How it works?
You need to add the ponytree javascript script
<script src="ponytree.js"></script>
and to have a svg
with a specific id
(here the id
is my_svg)
<svg id="my_svg" viewBox="0 0 1000 800" preserveAspectRatio="xMidYMin slice">
</svg>
and a string represented a phylogenic tree in newick format for example (here it corresponds to the value
of the textarea
of id
input_newick).
<textarea class="form-control" id="input_newick">
</textarea>
Now, you must initialize a variable pony with initiate_pony, compute a tree l with pony.tree, add some options with pony.option and build the tree l with the options of pony in the svg of id my_svg with pony.build.
var pony = initiate_pony(); var newick_text = document.getElementById(input_newick).value; var l = pony.tree(newick_text,"Newick_Beast"); pony.option["use_scale"] = false; pony.build(l,"my_svg");
And we obtain this tree.
To see more examples, go to section Demos.