Title: | Interactive Phylogenetic Trees Using the 'Phylocanvas' JavaScript Library |
Version: | 0.1.3 |
Description: | Create and customize interactive phylogenetic trees using the 'phylocanvas' JavaScript library and the 'htmlwidgets' package. These trees can be used directly from the R console, from 'RStudio', in Shiny apps, and in R Markdown documents. See http://phylocanvas.org/ for more information on the 'phylocanvas' library. |
URL: | https://github.com/zachcp/phylocanvas, http://phylocanvas.org/ |
BugReports: | https://github.com/zachcp/phylocanvas/issues |
Depends: | R (≥ 3.3.1) |
Imports: | ape (≥ 4.0), phylobase, htmlwidgets, methods (≥ 3.3.0) |
Suggests: | magrittr, knitr, rmarkdown |
License: | MIT + file LICENSE |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 6.0.1 |
VignetteBuilder: | knitr |
Collate: | 'load.tree.R' 'as_tree.R' 'get.descendants.R' 'nodes.branches.R' 'phylocanvas.R' |
NeedsCompilation: | no |
Packaged: | 2017-10-30 20:12:39 UTC; zach |
Author: | zachary charlop-powers [aut, cre] |
Maintainer: | zachary charlop-powers <zach.charlop.powers@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2017-10-30 20:21:35 UTC |
as_tree
Description
Convert objects to newick strings
Usage
as_tree(phy)
## S4 method for signature 'phylo'
as_tree(phy)
## S4 method for signature 'phylo4'
as_tree(phy)
Arguments
phy |
Required. phy is either a |
collapse branch
Description
given a phylocanvas
object and an id node,
collapse the node.
Usage
collapse_branch(phycnv, nodeid, collapse = TRUE)
Arguments
phycnv |
Required. |
nodeid |
Required. |
collapse |
Optional. Default |
See Also
http://phylocanvas.org/docs/features/#collapse-branches
get descendants
Description
get the names of the tips of descendants given a tree and the name of an internal node.
Usage
get.descendants(tree, nodename)
Arguments
tree |
Required. A |
nodename |
Required. A character corresponding to an internal node. |
Value
a character vector of descendant names
Examples
birdfile <- system.file("treedata/birdfamilies.tree", package="phylocanvas")
tree <- load.tree(birdfile)
node <- phylobase::MRCA(tree, c("Cerylidae", "Upupidae"))
get.descendants(tree, node)
highlight node
Description
given a phylocanvas
object and an nodeid,
highlight the node.
Usage
highlight_node(phycnv, nodeid)
Arguments
phycnv |
Required. |
nodeid |
Required. |
See Also
http://phylocanvas.org/docs/features/#highlight-leaves
load tree
Description
load a newick tree.
Usage
load.tree(treefile, ...)
Arguments
treefile |
Required. Path of phylogenetic tree to read |
... |
Optional. Pass any other arguments to read.tree |
Details
this is the recommended way to load a tree for use with phylocanvas. The reason is that
all of the javascript selector methods require that the nodes are named and the
selection of nodes based on names is straightforward with phylo4
objects. Therefore this function will read your newick tree, add names, and return a
phylo4
object that can be easily manipulated and subsetted
generating custom displays.
Value
a phylo4
tree object.
Examples
birdfile <- system.file("treedata/birdfamilies.tree", package="phylocanvas")
tree <- load.tree(birdfile)
phylocanvas
Description
An html widget wrapper of the phylocanvas.js JS library.
Usage
phylocanvas(tree, treetype = "rectangular", nodestyles = NULL,
nodesize = 30, textsize = 30, linewidth = 3, showlabels = TRUE,
alignlabels = FALSE, showhistory = FALSE, showcontextmenu = TRUE,
showscalebar = FALSE, width = NULL, height = NULL, elementId = NULL)
Arguments
tree |
Required. Newick string of a phyloseq tree, |
treetype |
Optional. Default |
nodestyles |
Optional. Default |
nodesize |
Optional. Default |
textsize |
Optional. Default |
linewidth |
Optional. Default |
showlabels |
Optional. Default |
alignlabels |
Optional. Default |
showhistory |
Optional. Default |
showcontextmenu |
Optional. Default |
showscalebar |
Optional. Default |
width |
Optional. Default |
height |
Optional. Default |
elementId |
Optional. Default |
Shiny bindings for phylocanvas
Description
Output and render functions for using phylocanvas within Shiny applications and interactive Rmd documents.
Usage
phylocanvasOutput(outputId, width = "100%", height = "400px")
renderPhylocanvas(expr, env = parent.frame(), quoted = FALSE)
Arguments
outputId |
output variable to read from |
width , height |
Must be a valid CSS unit (like |
expr |
An expression that generates a phylocanvas |
env |
The environment in which to evaluate |
quoted |
Is |
prune branch
Description
given a phylocanvas
object and an nodeid for
an internal node, prune the branch.
Usage
prune_branch(phycnv, nodeid)
Arguments
phycnv |
Required. |
nodeid |
Required. |
See Also
http://phylocanvas.org/docs/features/#prune-branches
rotate a branch
Description
given a phylocanvas
object and an nodeid for
an internal node, rotate the branch defined by the node
Usage
rotate_branch(phycnv, nodeid)
Arguments
phycnv |
Required. |
nodeid |
Required. |
See Also
http://phylocanvas.org/docs/features/#rotate-branches
select branch
Description
given a phylocanvas
object and an nodeid for
an internal node, select the branch defined by the node
Usage
select_branch(phycnv, nodeid, cascade = FALSE)
Arguments
phycnv |
Required. |
nodeid |
Required. |
cascade |
Optional. Default |
See Also
http://phylocanvas.org/docs/features/#select-branches
style node
Description
add styles to a node
Usage
style_node(phycnv, nodeid, highlighted = FALSE, color = "black",
shape = "circle", nodesizeratio = 1, strokecolor = "black",
fillcolor = "black", linewidth = 1, labelcolor = "black",
labeltextsize = 20, labelfont = "Arial", labelformat = "bold")
Arguments
phycnv |
Required. |
nodeid |
Required. |
highlighted |
Optional. Default |
color |
Optional. Color of the node/branch |
shape |
Optional. Default |
nodesizeratio |
Optional. Default |
strokecolor |
Optional. Default |
fillcolor |
Optional. Default |
linewidth |
Optional. Default |
labelcolor |
Optional. Default |
labeltextsize |
Optional.Default |
labelfont |
Optional. Default |
labelformat |
Optional. Default |
Details
given a phylocanvas
object and nodeid, apply
the given styles to that node.
See Also
http://phylocanvas.org/docs/features/#style-branches-individually