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 phylo class object, phylo4 class object, or a character that can be a newick literal or apath to newick-containing file.


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 TRUE. Whether to collapse the node.

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 phylo4 object.

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, phylo class object, phylo4 class object,, or path to newick-containing file.

treetype

Optional. Default "rectangular". Can be one of "rectengular", "circular", "hierarchical", "diagonal", or "radial".

nodestyles

Optional. Default NULL. Let nodes b stylized.

nodesize

Optional. Default 30. Global nodesize.

textsize

Optional. Default 30. Global textsize.

linewidth

Optional. Default 3. Global linewidth.

showlabels

Optional. Default TRUE. Whether to show labels.

alignlabels

Optional. Default FALSE. Whether to align node labels

showhistory

Optional. Default FALSE. Whether to use/show the history plugin.

showcontextmenu

Optional. Default TRUE. Whether to use/show the mouse context menu.

showscalebar

Optional. Default FALSE. Whether to use/show the scalebar.

width

Optional. Default NULL. HTMLWidget width

height

Optional. Default NULL. HTMLWidget width

elementId

Optional. Default NULL. HTMLWidget ID


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 '100%', '400px', 'auto') or a number, which will be coerced to a string and have 'px' appended.

expr

An expression that generates a phylocanvas

env

The environment in which to evaluate expr.

quoted

Is expr a quoted expression (with quote())? This is useful if you want to save an expression in a variable.


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 FALSE

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 FALSE. Whether to highlight the node.

color

Optional. Color of the node/branch

shape

Optional. Default 'circle'. Can be either 'circle', 'square' or 'traingle'.

nodesizeratio

Optional. Default 1. Scale ratio of the nodesize to the base node size.

strokecolor

Optional. Default "black". Colors are strings in the format of names, rgb strings or hex values.

fillcolor

Optional. Default "black". Scale ratio of the node.

linewidth

Optional. Default 1.

labelcolor

Optional. Default "black". Label color. Colors are strings in the format of names, rgb strings or hex values.

labeltextsize

Optional.Default 20. Label size.

labelfont

Optional. Default "Arial". Label font.

labelformat

Optional. Default "bold". Label format.

Details

given a phylocanvas object and nodeid, apply the given styles to that node.

See Also

http://phylocanvas.org/docs/features/#style-branches-individually