Visualizing Phylogenetic Trees with R and jsPhyloSVG

[This article was first published on Posts on GGVY, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

During the last year I’ve been working on a daily basis with phylogenetic trees, objects that in graph jargon are called Directed Acyclic Graphs. While R does have some cool packages out there to visualize these–including phylocanvas which looks great!–I wanted to tryout jsPhyloSVG, and moreover, to learn how to use htmlwidgets.

So, after a week-long process of playing with JavaScript, of which I had no prior knowledge (so thank you W3shools)!, and hours of head-scratching, I created this R package, jsPhyloSVG that provides an htmlwidget for the library of the same name. An example follows

# I'll be using the ape package to simulate a tree
library(ape)
# You can get it from github USCBiostats/jsPhyloSVG
library(jsPhyloSVG)

# A random phylogenetic tree with 50 tips
tree <- rtree(50)

jsPhyloSVG(write.tree(tree))

You can take a look at the project repo here.

To leave a comment for the author, please follow the link and comment on their blog: Posts on GGVY.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)