The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

Advanced Use of Phylocanvas

zach charlop-powers

2017-10-30

Base Tree

library(magrittr)
library(ape)
library(phylocanvas)

data("bird.families")
phylocanvas(bird.families, treetype = "radial", 
            width = 700, textsize = 10, nodesize = 10)

Most Recent Common Ancestor

Highlight the most recent common ancestor (MRCA).

# add internal nodenames
birds  <- makeNodeLabel(bird.families)

# convert to phylo4 which has a few nice convenicnece methods including the
# ability to get names with nodes.
birds <- phylobase::phylo4(birds)

# get MRCA
node  <- phylobase::MRCA(birds,c("Cerylidae", "Upupidae"))

# get the node name
nodename <- names(node)

# highlight all submembers of the MRCA
phylocanvas(birds, width = 700, textsize = 10, nodesize = 10) %>%
  select_branch(nodeid=nodename, cascade=T)
phylocanvas(birds, width = 700, textsize = 10, nodesize = 10, treetype = "radial") %>% 
  select_branch(nodeid=nodename, cascade=T)

Multiple MRCA

To highlight multiple clades, you can identify clades by node nubmer, in this case by MRCA. Then you can stylize the descendant nodes.

phycanv     <- phylocanvas(birds, width = 700, textsize = 10, nodesize = 10, treetype = "radial") 
nodenames   <- get.descendants(birds, nodename)
clade2names <- get.descendants(birds, phylobase::MRCA(birds, c("Pteroclidae", "Jacanidae")))

for (nodename in nodenames) {
  phycanv <- style_node(phycanv, nodeid = nodename, fillcolor="green")
}
for (nodename in clade2names) {
  phycanv <- style_node(phycanv, nodeid = nodename, fillcolor="red")
}


phycanv

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.