[Phylobase-commits] r920 - pkg/R
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Apr 8 23:15:27 CEST 2014
Author: francois
Date: 2014-04-08 23:15:26 +0200 (Tue, 08 Apr 2014)
New Revision: 920
Modified:
pkg/R/ancestors.R
pkg/R/checkdata.R
pkg/R/edgeLength-methods.R
pkg/R/extractTree.R
pkg/R/phylo4-accessors.R
pkg/R/phylobase-package.R
pkg/R/print-methods.R
pkg/R/reorder-methods.R
Log:
fixed @include for correct order in NAMESPACE collate, and cosmetic changes to roxygen doc
Modified: pkg/R/ancestors.R
===================================================================
--- pkg/R/ancestors.R 2014-04-08 21:14:16 UTC (rev 919)
+++ pkg/R/ancestors.R 2014-04-08 21:15:26 UTC (rev 920)
@@ -1,85 +1,86 @@
-#' Tree traversal and utility functions
-#'
-#' Functions for describing relationships among phylogenetic nodes (i.e.
-#' internal nodes or tips).
-#'
-#' \code{ancestors} and \code{descendants} can take \code{node} vectors of
-#' arbitrary length, returning a list of output vectors if the number of valid
-#' input nodes is greater than one. List element names are taken directly from
-#' the input node vector.
-#'
-#' If any supplied nodes are not found in the tree, the behavior currently
-#' varies across functions.
-#'
-#' \item Invalid nodes are automatically omitted by \code{ancestors}
-#' and \code{descendants}, with a warning.
-#'
-#' \item \code{ancestor}
-#' will return \code{NA} for any invalid nodes, with a warning.
-#'
-#' \item Both \code{children} and \code{siblings} will return an empty
-#' vector, again with a warning.
-#'
-#' @param phy a \linkS4class{phylo4} object (or one inheriting from
-#' \linkS4class{phylo4}, e.g. a \linkS4class{phylo4d} object)
-#' @param x a \linkS4class{phylo4} object (or one inheriting from
-#' \linkS4class{phylo4}, e.g. a \linkS4class{phylo4d} object)
-#' @param node either an integer corresponding to a node ID number, or a
-#' character corresponding to a node label; for \code{ancestors} and
-#' \code{descendants}, this may be a vector of multiple node numbers or names
-#' @param type (\code{ancestors}) specify whether to return just direct
-#' ancestor ("parent"), all ancestor nodes ("all"), or all ancestor nodes
-#' including self ("ALL"); (\code{descendants}) specify whether to return just
-#' direct descendants ("children"), all extant descendants ("tips"), or all
-#' descendant nodes ("all")
-#' @param include.self whether to include self in list of siblings
-#' @param \dots a list of node numbers or names, or a vector of node numbers or
-#' names
-#' @return \item{\code{ancestors}}{ return a named vector (or a list
-#' of such vectors in the case of multiple input nodes) of the
-#' ancestors and descendants of a node}
-#'
-#' \item{\code{descendants}}{ return a named vector (or a list of
-#' such vectors in the case of multiple input nodes) of the ancestors
-#' and descendants of a node}
-#'
-#' \item{\code{ancestor}}{ \code{ancestor} is analogous to
-#' \code{ancestors(\dots{}, type="parent")} (i.e. direct ancestor
-#' only), but returns a single concatenated vector in the case of
-#' multiple input nodes}
-#'
-#' \item{\code{children}}{is analogous to \code{descendants(\dots{},
-#' type="children")} (i.e. direct descendants only), but is not
-#' currently intended to be used with multiple input nodes }
-#'
-#' \item{\code{siblings}}{ returns sibling nodes (children of the same
-#' parent)}
-#'
-#' @seealso \code{\link[ape]{mrca}}, in the ape package, gives a list of all
-#' subtrees
-#' @export
-#' @include getNode-methods.R
-#' @include phylo4-accessors.R
-#' @examples
-#'
-#' data(geospiza)
-#' nodeLabels(geospiza) <- LETTERS[1:nNodes(geospiza)]
-#' plot(as(geospiza, "phylo4"), show.node.label=TRUE)
-#' ancestor(geospiza, "E")
-#' children(geospiza, "C")
-#' descendants(geospiza, "D", type="tips")
-#' descendants(geospiza, "D", type="all")
-#' ancestors(geospiza, "D")
-#' MRCA(geospiza, "conirostris", "difficilis", "fuliginosa")
-#' MRCA(geospiza, "olivacea", "conirostris")
-#'
-#' ## shortest path between 2 nodes
-#' shortestPath(geospiza, "fortis", "fuliginosa")
-#' shortestPath(geospiza, "F", "L")
-#'
-#' ## branch length from a tip to the root
-#' sumEdgeLength(geospiza, ancestors(geospiza, "fortis", type="ALL"))
+##' Tree traversal and utility functions
+##'
+##' Functions for describing relationships among phylogenetic nodes (i.e.
+##' internal nodes or tips).
+##'
+##' \code{ancestors} and \code{descendants} can take \code{node} vectors of
+##' arbitrary length, returning a list of output vectors if the number of valid
+##' input nodes is greater than one. List element names are taken directly from
+##' the input node vector.
+##'
+##' If any supplied nodes are not found in the tree, the behavior currently
+##' varies across functions.
+##'
+##' \item Invalid nodes are automatically omitted by \code{ancestors}
+##' and \code{descendants}, with a warning.
+##'
+##' \item \code{ancestor}
+##' will return \code{NA} for any invalid nodes, with a warning.
+##'
+##' \item Both \code{children} and \code{siblings} will return an empty
+##' vector, again with a warning.
+##'
+##' @param phy a \linkS4class{phylo4} object (or one inheriting from
+##' \linkS4class{phylo4}, e.g. a \linkS4class{phylo4d} object)
+##' @param x a \linkS4class{phylo4} object (or one inheriting from
+##' \linkS4class{phylo4}, e.g. a \linkS4class{phylo4d} object)
+##' @param node either an integer corresponding to a node ID number, or a
+##' character corresponding to a node label; for \code{ancestors} and
+##' \code{descendants}, this may be a vector of multiple node numbers or names
+##' @param type (\code{ancestors}) specify whether to return just direct
+##' ancestor ("parent"), all ancestor nodes ("all"), or all ancestor nodes
+##' including self ("ALL"); (\code{descendants}) specify whether to return just
+##' direct descendants ("children"), all extant descendants ("tips"), or all
+##' descendant nodes ("all")
+##' @param include.self whether to include self in list of siblings
+##' @param \dots a list of node numbers or names, or a vector of node numbers or
+##' names
+##' @return \item{\code{ancestors}}{ return a named vector (or a list
+##' of such vectors in the case of multiple input nodes) of the
+##' ancestors and descendants of a node}
+##'
+##' \item{\code{descendants}}{ return a named vector (or a list of
+##' such vectors in the case of multiple input nodes) of the ancestors
+##' and descendants of a node}
+##'
+##' \item{\code{ancestor}}{ \code{ancestor} is analogous to
+##' \code{ancestors(\dots{}, type="parent")} (i.e. direct ancestor
+##' only), but returns a single concatenated vector in the case of
+##' multiple input nodes}
+##'
+##' \item{\code{children}}{is analogous to \code{descendants(\dots{},
+##' type="children")} (i.e. direct descendants only), but is not
+##' currently intended to be used with multiple input nodes }
+##'
+##' \item{\code{siblings}}{ returns sibling nodes (children of the same
+##' parent)}
+##'
+##' @seealso \code{\link[ape]{mrca}}, in the ape package, gives a list of all
+##' subtrees
+##' @export
+##' @include phylo4-class.R
+##' @include phylo4-methods.R
+##' @include getNode-methods.R
+##' @examples
+##'
+##' data(geospiza)
+##' nodeLabels(geospiza) <- LETTERS[1:nNodes(geospiza)]
+##' plot(as(geospiza, "phylo4"), show.node.label=TRUE)
+##' ancestor(geospiza, "E")
+##' children(geospiza, "C")
+##' descendants(geospiza, "D", type="tips")
+##' descendants(geospiza, "D", type="all")
+##' ancestors(geospiza, "D")
+##' MRCA(geospiza, "conirostris", "difficilis", "fuliginosa")
+##' MRCA(geospiza, "olivacea", "conirostris")
+##'
+##' ## shortest path between 2 nodes
+##' shortestPath(geospiza, "fortis", "fuliginosa")
+##' shortestPath(geospiza, "F", "L")
+##'
+##' ## branch length from a tip to the root
+##' sumEdgeLength(geospiza, ancestors(geospiza, "fortis", type="ALL"))
ancestor <- function(phy,node) {
node2 <- getNode(phy,node)
## r <- which(edges(phy)[,2]==node)
Modified: pkg/R/checkdata.R
===================================================================
--- pkg/R/checkdata.R 2014-04-08 21:14:16 UTC (rev 919)
+++ pkg/R/checkdata.R 2014-04-08 21:15:26 UTC (rev 920)
@@ -1,49 +1,51 @@
## REQUIRED for all trees
-#' Validity checking for phylo4 objects
-#'
-#' Basic checks on the validity of S4 phylogenetic objects
-#'
-#'
-#' @aliases checkPhylo4 checkTree checkPhylo4Data
-#' @param object A prospective phylo4 or phylo4d object
-#' @return As required by \code{\link[methods]{validObject}}, returns an error
-#' string (describing problems) or TRUE if everything is OK.
-#' @note
-#'
-#' These functions are only intended to be called by other phylobase functions.
-#'
-#' \code{checkPhylo4} is an (inflexible) wrapper for \code{checkTree}. The
-#' rules for \code{phylo4} objects essentially follow those for \code{phylo}
-#' objects from the \code{ape} package, which are in turn defined in
-#' \url{http://ape.mpl.ird.fr/misc/FormatTreeR_28July2008.pdf}. These are
-#' essentially that: \itemize{ \item if the tree has edge lengths defined, the
-#' number of edge lengths must match the number of edges; \item the number of
-#' tip labels must match the number of tips; \item in a tree with \code{ntips}
-#' tips and \code{nnodes} (total) nodes, nodes 1 to \code{ntips} must be tips
-#' \item if the tree is rooted, the root must be node number \code{ntips+1} and
-#' the root node must be the first row of the edge matrix \item tip labels,
-#' node labels, edge labels, edge lengths must have proper internal names (i.e.
-#' internal names that match the node numbers they document) \item tip and node
-#' labels must be unique }
-#'
-#' You can alter some of the default options by using the function
-#' \code{phylobase.options}.
-#'
-#' For \code{phylo4d} objects, \code{checkTree} also calls
-#' \code{checkPhylo4Data} to check the validity of the data associated with the
-#' tree. It ensures that (1) the data associated with the tree have the correct
-#' dimensions, (2) that the row names for the data are correct.
-#' @author Ben Bolker, Steven Kembel, Francois Michonneau
-#' @seealso the \code{\link{phylo4}} constructor and \linkS4class{phylo4}
-#' class; \code{\link{formatData}}, the \code{\link{phylo4d}} constructor and
-#' the \linkS4class{phylo4d} class do checks for the data associated with
-#' trees. See \code{\link{coerce-methods}} for translation functions and
-#' \code{\link{phylobase.options} to change some of the default options of the
-#' validator.}
-#' @include RcppExports.R phylo4-accessors.R
-#' @keywords misc
+##' Validity checking for phylo4 objects
+##'
+##' Basic checks on the validity of S4 phylogenetic objects
+##'
+##'
+##' @aliases checkPhylo4 checkTree checkPhylo4Data
+##' @param object A prospective phylo4 or phylo4d object
+##' @return As required by \code{\link[methods]{validObject}}, returns an error
+##' string (describing problems) or TRUE if everything is OK.
+##' @note
+##'
+##' These functions are only intended to be called by other phylobase functions.
+##'
+##' \code{checkPhylo4} is an (inflexible) wrapper for \code{checkTree}. The
+##' rules for \code{phylo4} objects essentially follow those for \code{phylo}
+##' objects from the \code{ape} package, which are in turn defined in
+##' \url{http://ape.mpl.ird.fr/misc/FormatTreeR_28July2008.pdf}. These are
+##' essentially that: \itemize{ \item if the tree has edge lengths defined, the
+##' number of edge lengths must match the number of edges; \item the number of
+##' tip labels must match the number of tips; \item in a tree with \code{ntips}
+##' tips and \code{nnodes} (total) nodes, nodes 1 to \code{ntips} must be tips
+##' \item if the tree is rooted, the root must be node number \code{ntips+1} and
+##' the root node must be the first row of the edge matrix \item tip labels,
+##' node labels, edge labels, edge lengths must have proper internal names (i.e.
+##' internal names that match the node numbers they document) \item tip and node
+##' labels must be unique }
+##'
+##' You can alter some of the default options by using the function
+##' \code{phylobase.options}.
+##'
+##' For \code{phylo4d} objects, \code{checkTree} also calls
+##' \code{checkPhylo4Data} to check the validity of the data associated with the
+##' tree. It ensures that (1) the data associated with the tree have the correct
+##' dimensions, (2) that the row names for the data are correct.
+##' @author Ben Bolker, Steven Kembel, Francois Michonneau
+##' @seealso the \code{\link{phylo4}} constructor and \linkS4class{phylo4}
+##' class; \code{\link{formatData}}, the \code{\link{phylo4d}} constructor and
+##' the \linkS4class{phylo4d} class do checks for the data associated with
+##' trees. See \code{\link{coerce-methods}} for translation functions and
+##' \code{\link{phylobase.options} to change some of the default options of the
+##' validator.}
+##' @include RcppExports.R
+##' @include phylo4-class.R
+##' @include phylo4-methods.R
+##' @keywords misc
checkPhylo4 <- function(object) {
ct <- checkTree(object)
Modified: pkg/R/edgeLength-methods.R
===================================================================
--- pkg/R/edgeLength-methods.R 2014-04-08 21:14:16 UTC (rev 919)
+++ pkg/R/edgeLength-methods.R 2014-04-08 21:15:26 UTC (rev 920)
@@ -49,7 +49,9 @@
##' @docType methods
##' @aliases hasEdgeLength
##' @rdname edgeLength-methods
-##' @include phylo4-class.R phylo4-methods.R phylo4-accessors.R nodeId-methods.R
+##' @include phylo4-class.R
+##' @include phylo4-methods.R
+##' @include nodeId-methods.R
##' @examples
##' data(geospiza)
##' hasEdgeLength(geospiza) # TRUE
Modified: pkg/R/extractTree.R
===================================================================
--- pkg/R/extractTree.R 2014-04-08 21:14:16 UTC (rev 919)
+++ pkg/R/extractTree.R 2014-04-08 21:15:26 UTC (rev 920)
@@ -20,6 +20,7 @@
##' \code{\link{coerce-methods}} for translation functions.
##' @keywords methods
##' @export
+##' @include setAs-methods.R
##' @examples
##' tree.phylo <- ape::read.tree(text = "((a,b),c);")
##' tree <- as(tree.phylo, "phylo4")
Modified: pkg/R/phylo4-accessors.R
===================================================================
--- pkg/R/phylo4-accessors.R 2014-04-08 21:14:16 UTC (rev 919)
+++ pkg/R/phylo4-accessors.R 2014-04-08 21:15:26 UTC (rev 920)
@@ -10,7 +10,7 @@
##' edge respectively.
##' @docType methods
##' @export
-##' @include phylo4-methods.R
+##' @include phylo4-class.R phylo4-methods.R
##' @rdname nTips-methods
setGeneric("nTips", function(x) {
standardGeneric("nTips")
Modified: pkg/R/phylobase-package.R
===================================================================
--- pkg/R/phylobase-package.R 2014-04-08 21:14:16 UTC (rev 919)
+++ pkg/R/phylobase-package.R 2014-04-08 21:15:26 UTC (rev 920)
@@ -71,6 +71,7 @@
#' @importFrom stats reorder
#' @importFrom utils head tail
#' @importFrom ade4 newick2phylog
+#'
#'
#' @exportMethod print head tail reorder plot summary
#' @exportMethod phylo4 phylo4d
@@ -82,7 +83,6 @@
#' @exportMethod [<- [[ [[<-
#' @exportMethod labels labels<- nodeLabels nodeLabels<- tipLabels tipLabels<- edgeLabels edgeLabels<-
#' @exportMethod hasNodeLabels hasEdgeLabels hasDuplicatedLabels
-#'
NULL
Modified: pkg/R/print-methods.R
===================================================================
--- pkg/R/print-methods.R 2014-04-08 21:14:16 UTC (rev 919)
+++ pkg/R/print-methods.R 2014-04-08 21:15:26 UTC (rev 920)
@@ -32,8 +32,8 @@
##' @note This is the default show() method for phylo4, phylo4d. It prints the
##' user-supplied information for building a phylo4 object. For a full
##' description of the phylo4 S4 object and slots, see \code{\link{phylo4}}.
-##' @author Marguerite Butler Thibaut Jombart
-##' \email{jombart@@biomserv.univ-lyon1.fr} Steve Kembel
+##' @author Marguerite Butler, Thibaut Jombart \email{jombart@@biomserv.univ-lyon1.fr}, Steve Kembel
+##' @include setAs-methods.R
##' @keywords methods
##' @examples
##'
@@ -72,7 +72,6 @@
}
})
-
##' @rdname print-methods
##' @aliases show
setGeneric("show")
Modified: pkg/R/reorder-methods.R
===================================================================
--- pkg/R/reorder-methods.R 2014-04-08 21:14:16 UTC (rev 919)
+++ pkg/R/reorder-methods.R 2014-04-08 21:15:26 UTC (rev 920)
@@ -37,7 +37,7 @@
##' \code{\link{children}} \code{\link{descendants}}
##' @keywords methods
##' @include phylo4-class.R
-##' @include phylo4-accessors.R
+##' @include phylo4-methods.R
##' @export
##' @examples
##' phy <- phylo4(ape::rtree(5))
More information about the Phylobase-commits
mailing list