Skip to content

Commit

Permalink
big documentaiton push to comply with R CMD Check
Browse files Browse the repository at this point in the history
  • Loading branch information
zachcp committed Dec 29, 2016
1 parent 98f8c2b commit 8dcf0bd
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
^.*\.Rproj$
^\.Rproj\.user$
^\.eslintrc$
Readme.Rmd
docs/
man/
25 changes: 15 additions & 10 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,24 +1,29 @@
Package: phylocanvas
Title: Interactive phylogenetic trees using phylocanvas
Version: 0.0.0.92
Version: 0.0.0.93
Authors@R: person("zachary", "charlop-powers", email = "zach.charlop.powers@gmail.com", role = c("aut", "cre"))
Description: A package to allow use of the phylocanvas JS library from R.
URL: https://github.com/zachcp/phylocanvas
BugReports: https://github.com/zachcp/phylocanvas/issues
Depends:
R (>= 3.3.1)
Imports:
ape (>= 4.0),
phylobase,
htmlwidgets,
magrittr,
methods (>= 3.3.0)
ape (>= 4.0),
phylobase,
htmlwidgets,
magrittr,
methods (>= 3.3.0)
Suggests:
knitr,
rmarkdown,
dplyr
License: MIT
knitr,
rmarkdown
License: MIT + file LICENSE
Encoding: UTF-8
LazyData: true
RoxygenNote: 5.0.1
VignetteBuilder: knitr
Collate:
'load.tree.R'
'as.tree.R'
'get.descendants.R'
'nodes.branches.R'
'phylocanvas.R'
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Generated by roxygen2: do not edit by hand

export(as.tree)
export(as_tree)
export(collapse_branch)
export(get.descendants)
export(highlight_node)
Expand Down
38 changes: 26 additions & 12 deletions R/as.tree.R
Original file line number Diff line number Diff line change
@@ -1,26 +1,40 @@
#' as.tree
#' as_tree
#'
#' Convert objects to newick strings
#'
#' @importFrom ape write.tree
#' @importFrom ape read.tree
#' @importFrom methods as
#' @export
#' @param phy Required. phy is either a \code{\link[ape]{phylo}} class object,
#' \code{\link[phylobase]{phylo4}} class object, or a character that can be a newick
#' literal or apath to newick-containing file.
#' @importClassesFrom phylobase phylo4
#'
setGeneric("as.tree", function(phy, id) {standardGeneric("as.tree")})
#' @docType methods
#' @rdname as_tree-methods
#'
setMethod("as.tree", "phylo", function(phy, id) {
#' @export
setGeneric("as_tree", function(phy) {standardGeneric("as_tree")})
################################################################################
#' @aliases as_tree, phylo, phylo-method
#' @rdname as_tree-methods
#' @importFrom ape write.tree
setMethod("as_tree", "phylo", function(phy) {
write.tree(phy, file="")
})
#'
setMethod("as.tree", "phylo4", function(phy, id) {
################################################################################
#' @aliases as_tree, phylo4, phylo4-method
#' @rdname as_tree-methods
#' @importFrom methods as
setMethod("as_tree", "phylo4", function(phy) {
phy <- as(phy, "phylo")
as.tree(phy)
as_tree(phy)
})
setMethod("as.tree", "character", function(phy, id) {
################################################################################
#' @aliases as_tree, character, character-method
#' @rdname as_tree-methods
#' @include load.tree.R
setMethod("as_tree", "character", function(phy) {
if (file.exists(phy)) {
newphy <- NULL
try(newphy <- read.tree(phy))
try(newphy <- load.tree(phy))
if (!is.null(newphy)) {
return(newphy)
}
Expand Down
4 changes: 2 additions & 2 deletions R/get.descendants.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#' get descendants
#'
#' get the names of the tips of descendantds given a tree
#' get the names of the tips of descendants given a tree
#' and the name of an internal node.
#'
#' @param tree Required. A \code{\link[phlobase] phloy4} object.
#' @param tree Required. A \code{\link[phylobase]{phylo4}} object.
#' @param nodename Required. A character corresponding to an internal node.
#'
#' @return a character vector of descendant names
Expand Down
6 changes: 3 additions & 3 deletions R/load.tree.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
#'
#' 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 \code{\link[phylobase] phylo4}
#' selection of nodes based on names is straightforward with \code{\link[phylobase]{phylo4}}
#' objects. Therefore this function will read your newick tree, add names, and return a
#' \code{\link[phylobase] phylo4} object that can be easily manipulated and subsetted
#' \code{\link[phylobase]{phylo4}} object that can be easily manipulated and subsetted
#' generating custom displays.
#'
#' @param treefile Required. Path of phylogenetic tree to read
#' @param ... Optional. Pass any other arguments to read.tree
#'
#' @return a \code{\link[phylobase] phylo4} tree object.
#' @return a \code{\link[phylobase]{phylo4}} tree object.
#'
#' @importFrom ape read.tree
#' @importFrom ape makeNodeLabel
Expand Down
8 changes: 4 additions & 4 deletions R/nodes.branches.R
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ highlight_node <- function(phycnv, nodeid) {
#' @param linewidth Optional. Default \code{1}.
#' @param labelcolor Optional. Default \code{"black"}. Label color. Colors are strings in the format of names, rgb strings or hex values.
#' @param labeltextsize Optional.Default \code{20}. Label size.
#' @param linefont Optional. Default \code{"Arial"}. Label font.
#' @param lineformat Optional. Default \code{"bold"}. Label format.
#' @param labelfont Optional. Default \code{"Arial"}. Label font.
#' @param labelformat Optional. Default \code{"bold"}. Label format.
#'
#' @seealso \url{http://phylocanvas.org/docs/features/#style-branches-individually}
#' @export
Expand All @@ -105,7 +105,7 @@ style_node <- function(phycnv, nodeid,
strokecolor= "black",
fillcolor ='black',
linewidth = 1,
labelcolour='black',
labelcolor='black',
labeltextsize=20, #// points
labelfont ='Arial',
labelformat = 'bold'
Expand All @@ -121,7 +121,7 @@ style_node <- function(phycnv, nodeid,
lineWidth = linewidth
),
labelStyle = list(
colour=labelcolour,
colour=labelcolor,
textSize=labeltextsize,
font =labelfont,
format = labelformat
Expand Down
14 changes: 10 additions & 4 deletions R/phylocanvas.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,23 @@
#'
#' @import htmlwidgets
#'
#' @param tree Required. Newick string of a phyloseq tree, \code{\link[ape] phylo} class object, or path to newick-containing file.
#' @param nodestyles. Optional. Default \code{NULL}. Let nodes b stylized.
#' @param treetype. Optional. Default \code{"rectangular"}. Can be one of "rectengular", "circular",
#' @param tree Required. Newick string of a phyloseq tree, \code{\link[ape]{phylo}} class object,
#' \code{\link[phylobase]{phylo4}} class object,, or path to newick-containing file.
#' @param nodestyles Optional. Default \code{NULL}. Let nodes b stylized.
#' @param treetype Optional. Default \code{"rectangular"}. Can be one of "rectengular", "circular",
#' "hierarchical", "diagonal", or "radial".
#' @param nodesize Optional. Default \code{30}. Global nodesize.
#' @param textsize Optional. Default \code{30}. Global textsize.
#' @param linewidth Optional. Default \code{3}. Global linewidth.
#' @param showlabels Optional. Default \code{TRUE}. Whether to show labels.
#' @param showhistory Optional. Default \code{FALSE}. Whether to use/show the history plugin.
#' @param showcontextmenu Optional. Default \code{TRUE}. Whether to use/show the mouse context menu.
#' @param showscalebar Optional. Default \code{FALSE}. Whether to use/show the scalebar.
#' @param alignlabels Optional. Default \code{FALSE}. Whether to align node labels
#' @param width Optional. Default \code{NULL}. HTMLWidget width
#' @param height Optional. Default \code{NULL}. HTMLWidget width
#' @param elementId Optional. Default \code{NULL}. HTMLWidget ID

#' @export
phylocanvas <- function(tree,
treetype = "rectangular",
Expand All @@ -31,7 +37,7 @@ phylocanvas <- function(tree,

# forward options using x
x = list(
tree=as.tree(tree),
tree=as_tree(tree),
treetype=treetype,
nodesize=nodesize,
textsize=textsize,
Expand Down

0 comments on commit 8dcf0bd

Please sign in to comment.