[Phylobase-commits] r140 - in pkg: . R inst/doc man tests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Mar 6 11:03:04 CET 2008


Author: jombart
Date: 2008-03-06 11:03:04 +0100 (Thu, 06 Mar 2008)
New Revision: 140

Modified:
   pkg/R/identify.R
   pkg/R/phylo4.R
   pkg/R/treestruc.R
   pkg/R/treewalk.R
   pkg/TODO
   pkg/inst/doc/phylobase.Rnw
   pkg/man/hasSingles.Rd
   pkg/man/nNodes-methods.Rd
   pkg/tests/misctests.R
Log:
Moved some CamelCases to camelCases. 
Changes concern: RootEdge, EdgeLength, NodeLabels, EdgeLabels.


Modified: pkg/R/identify.R
===================================================================
--- pkg/R/identify.R	2008-03-06 03:10:33 UTC (rev 139)
+++ pkg/R/identify.R	2008-03-06 10:03:04 UTC (rev 140)
@@ -11,7 +11,7 @@
                tips <- labels(x)
                if (!hasNodeLabels(x)) {
                    nodes <- (N.tip+1):(N.tip+N.node)
-               } else nodes <- NodeLabels(x)
+               } else nodes <- nodeLabels(x)
                labs<-c(rep("",N.tip), nodes)
                click <- identify(last$xx, last$yy, labels=labs, n=n)
                ##    if (click > N.tip) {

Modified: pkg/R/phylo4.R
===================================================================
--- pkg/R/phylo4.R	2008-03-06 03:10:33 UTC (rev 139)
+++ pkg/R/phylo4.R	2008-03-06 10:03:04 UTC (rev 140)
@@ -84,10 +84,10 @@
     x at edge
 })
 
-setGeneric("RootEdge", function(x,order,...) {
-    standardGeneric("RootEdge")
+setGeneric("rootEdge", function(x,order,...) {
+    standardGeneric("rootEdge")
 })
-setMethod("RootEdge","phylo4", function(x,order,...) {
+setMethod("rootEdge","phylo4", function(x,order,...) {
     x at root.edge
 })
 
@@ -131,10 +131,10 @@
     length(x at edge.length)>0
 })
 
-setGeneric("EdgeLength", function(x) {
-    standardGeneric("EdgeLength")
+setGeneric("edgeLength", function(x) {
+    standardGeneric("edgeLength")
 })
-setMethod("EdgeLength","phylo4", function(x) {
+setMethod("edgeLength","phylo4", function(x) {
     if (!hasEdgeLength(x)) NULL else x at edge.length
 })
 
@@ -174,37 +174,37 @@
     object
 })
 
-setGeneric("NodeLabels", function(x) {
-    standardGeneric("NodeLabels")
+setGeneric("nodeLabels", function(x) {
+    standardGeneric("nodeLabels")
 })
-setMethod("NodeLabels","phylo4", function(x) {
+setMethod("nodeLabels","phylo4", function(x) {
     x at node.label
 })
 
-setGeneric("NodeLabels<-",
+setGeneric("nodeLabels<-",
            function(object,...,value) {
-               standardGeneric("NodeLabels<-")
+               standardGeneric("nodeLabels<-")
            })
 
-setMethod("NodeLabels<-","phylo4", function(object,...,value) {
+setMethod("nodeLabels<-","phylo4", function(object,...,value) {
     object at node.label <- value
     object
 })
 
 
-setGeneric("EdgeLabels", function(x) {
-    standardGeneric("EdgeLabels")
+setGeneric("edgeLabels", function(x) {
+    standardGeneric("edgeLabels")
 })
-setMethod("EdgeLabels","phylo4", function(x) {
+setMethod("edgeLabels","phylo4", function(x) {
     x at edge.label
 })
 
-setGeneric("EdgeLabels<-",
+setGeneric("edgeLabels<-",
            function(object,...,value) {
-               standardGeneric("EdgeLabels<-")
+               standardGeneric("edgeLabels<-")
            })
 
-setMethod("EdgeLabels<-","phylo4", function(object,...,value) {
+setMethod("edgeLabels<-","phylo4", function(object,...,value) {
     object at edge.label <- value
     object
 })
@@ -297,9 +297,9 @@
         # if (length(ancestor)>0) ancestor <- c(NA, ancestor)
         ancestor <- E[idx,1]
         # branch.length <- c(x at root.edge, x at edge.length) # root.edge is not an edge length
-        branch.length <- EdgeLength(x)[idx]
+        branch.length <- edgeLength(x)[idx]
         # if (length(branch.length) == 1) branch.length <- rep("", n.tip+n.int)
-        if(is.null(EdgeLength(x))) branch.length <- rep(NA, length(node))
+        if(is.null(edgeLength(x))) branch.length <- rep(NA, length(node))
         ## node and tip labels ##
         ## beware: they cannot be NULL
         ## there are always tip labels (or check_phylo4 complains)
@@ -392,9 +392,9 @@
         nod <- unique(E[,1])
         idx <- match(nod,E[,1])
         res$degree <- res$degree[idx]
-        names(res$degree) <- NodeLabels(x)
+        names(res$degree) <- nodeLabels(x)
         res$polytomy <- res$polytomy[idx]
-        names(res$polytomy) <- NodeLabels(x)
+        names(res$polytomy) <- nodeLabels(x)
     }
     
     ## model info
@@ -476,7 +476,7 @@
 ##   cat("  Tree plus data object of type:", class(x), "\n")
 ##   cat("  Species Names                :", labels(x), "\n")
 ##   if (hasEdgeLength(x)){ 
-##     cat("  Has Branch Lengths (first 10):", EdgeLength(x)[1:min(length(EdgeLength(x)),10)], "\n")
+##     cat("  Has Branch Lengths (first 10):", edgeLength(x)[1:min(length(edgeLength(x)),10)], "\n")
 ##   } 
 ##   cat("  Rooted                       :", isRooted(x), "\n\n\n")
 ##  
@@ -557,7 +557,7 @@
     nrow(x at node.data)>0
 })
 
-setMethod("NodeLabels<-","phylo4d", function(object,...,value) {
+setMethod("nodeLabels<-","phylo4d", function(object,...,value) {
     object at node.label <- value
     rownames(object at node.data) <- value
     object

Modified: pkg/R/treestruc.R
===================================================================
--- pkg/R/treestruc.R	2008-03-06 03:10:33 UTC (rev 139)
+++ pkg/R/treestruc.R	2008-03-06 10:03:04 UTC (rev 140)
@@ -2,7 +2,7 @@
 ## not bothering to check for zero branch lengths:
 ##   consensus is that this isn't very important,
 ##  and that it's simple enough to do
-##   any(EdgeLength(x)==0) if necessary
+##   any(edgeLength(x)==0) if necessary
 hasPoly <- function(object) {
   if(!check_phylo4(object)) stop("to be used with a phylo4 object")
   degree <- tabulate(edges(object)[, 1])

Modified: pkg/R/treewalk.R
===================================================================
--- pkg/R/treewalk.R	2008-03-06 03:10:33 UTC (rev 139)
+++ pkg/R/treewalk.R	2008-03-06 10:03:04 UTC (rev 140)
@@ -2,7 +2,7 @@
 ## matching node labels with node numbers ...
 ## e.g.
 ## 14 tips, 13 int nodes
-## N04 = NodeLabels[4]
+## N04 = nodeLabels[4]
 ##   <-> node 18
 ## x = n-nTips(phy)
 ## so:     n = x+nTips(phy)
@@ -18,7 +18,7 @@
         vals <- ifelse(!is.na(tipmatch),
                        tipmatch,
                        if (!hasNodeLabels(phy)) { NA } else {
-                           nt+match(node,NodeLabels(phy))
+                           nt+match(node,nodeLabels(phy))
                        })
         names(vals) <- node
         return(vals)
@@ -30,7 +30,7 @@
                        ifelse(node<=nt+nNodes(phy),
                               if (!hasNodeLabels(phy)) { NA }
                               else {
-                                  NodeLabels(phy)[pmax(0,node-nt)]
+                                  nodeLabels(phy)[pmax(0,node-nt)]
                               },NA))
         ## pmax above to avoid error from negative indices
         names(node) <- vals

Modified: pkg/TODO
===================================================================
--- pkg/TODO	2008-03-06 03:10:33 UTC (rev 139)
+++ pkg/TODO	2008-03-06 10:03:04 UTC (rev 140)
@@ -70,7 +70,7 @@
 ### Some things to think about (re)naming:
 * tree walking: `getDescend`, `getAncest`, `allDescend`, `allAncest` -- sons and fathers, daughters and mothers, tips/leaves, ?
 * should `check_data` be `check_phylo4d` for consistency with `check_phylo4` (or should `check_phylo4` be `check_tree`?)
-* EdgeLength/BranchLength?
+* edgeLength/BranchLength?
 * root, Root, rootNode, RootNode?
 * `subset(phy,node.subtree= )` == `subset(phy,subtree= )` ?
 

Modified: pkg/inst/doc/phylobase.Rnw
===================================================================
--- pkg/inst/doc/phylobase.Rnw	2008-03-06 03:10:33 UTC (rev 139)
+++ pkg/inst/doc/phylobase.Rnw	2008-03-06 10:03:04 UTC (rev 140)
@@ -115,12 +115,12 @@
 
 Print internal node labels (R automatically assigns values):
 <<>>=
-NodeLabels(g1)
+nodeLabels(g1)
 @ 
 
 Print edge labels (also automatically assigned):
 <<>>=
-EdgeLabels(g1)
+edgeLabels(g1)
 @ 
 
 Is it rooted?

Modified: pkg/man/hasSingles.Rd
===================================================================
--- pkg/man/hasSingles.Rd	2008-03-06 03:10:33 UTC (rev 139)
+++ pkg/man/hasSingles.Rd	2008-03-06 10:03:04 UTC (rev 140)
@@ -24,7 +24,7 @@
   We haven't bothered to check for zero branch lengths:
   the consensus is that it doesn't come up much,
   and that it's simple enough to
-  test \code{any(EdgeLength(x)==0)} in these cases.
+  test \code{any(edgeLength(x)==0)} in these cases.
   (Single-descendant nodes are used e.g. in OUCH, or in
   other cases to represent events occurring along a branch.)
 }

Modified: pkg/man/nNodes-methods.Rd
===================================================================
--- pkg/man/nNodes-methods.Rd	2008-03-06 03:10:33 UTC (rev 139)
+++ pkg/man/nNodes-methods.Rd	2008-03-06 10:03:04 UTC (rev 140)
@@ -20,15 +20,15 @@
 \alias{hasEdgeLength}
 \alias{hasEdgeLength-methods}
 \alias{hasEdgeLength,phylo4-method}
-\alias{EdgeLength}
-\alias{EdgeLength-methods}
-\alias{EdgeLength,phylo4-method}
+\alias{edgeLength}
+\alias{edgeLength-methods}
+\alias{edgeLength,phylo4-method}
 \alias{isRooted}
 \alias{isRooted-methods}
 \alias{isRooted,phylo4-method}
-\alias{RootEdge}
-\alias{RootEdge-methods}
-\alias{RootEdge,phylo4-method}
+\alias{rootEdge}
+\alias{rootEdge-methods}
+\alias{rootEdge,phylo4-method}
 \alias{rootNode}
 \alias{rootNode-methods}
 \alias{rootNode,phylo4-method}
@@ -40,20 +40,20 @@
 \alias{hasNodeData}
 \alias{hasNodeData-methods}
 \alias{hasNodeData,phylo4d-method}
-\alias{NodeLabels}
-\alias{NodeLabels-methods}
-\alias{NodeLabels,phylo4-method}
-\alias{NodeLabels<-}
-\alias{NodeLabels<-,phylo4-method}
-\alias{NodeLabels<-,phylo4d-method}
+\alias{nodeLabels}
+\alias{nodeLabels-methods}
+\alias{nodeLabels,phylo4-method}
+\alias{nodeLabels<-}
+\alias{nodeLabels<-,phylo4-method}
+\alias{nodeLabels<-,phylo4d-method}
 \alias{hasEdgeLabels}
 \alias{hasEdgeLabels-methods}
 \alias{hasEdgeLabels,phylo4-method}
-\alias{EdgeLabels}
-\alias{EdgeLabels<-}
-\alias{EdgeLabels-methods}
-\alias{EdgeLabels,phylo4-method}
-\alias{EdgeLabels<-,phylo4-method}
+\alias{edgeLabels}
+\alias{edgeLabels<-}
+\alias{edgeLabels-methods}
+\alias{edgeLabels,phylo4-method}
+\alias{edgeLabels<-,phylo4-method}
 
 \alias{tdata}
 \alias{tdata-methods}
@@ -71,23 +71,23 @@
     tree has (internal) node labels}
   \item{hasNodeData}{\code{signature(object = "phylo4d")}: whether
     tree has (internal) node data}
-  \item{NodeLabels}{\code{signature(object = "phylo4")}: internal
+  \item{nodeLabels}{\code{signature(object = "phylo4")}: internal
     node labels}
   \item{nEdges}{\code{signature(object = "phylo4")}: number of edges}
   \item{edges}{\code{signature(object = "phylo4")}: edge matrix}
   \item{hasEdgeLength}{\code{signature(object = "phylo4")}: whether
     tree has edge (branch) lengths}
-  \item{EdgeLength}{\code{signature(object = "phylo4")}: edge (branch)
+  \item{edgeLength}{\code{signature(object = "phylo4")}: edge (branch)
     lengths (or NULL if none)}
   \item{hasEdgeLabels}{\code{signature(object = "phylo4")}: whether
     tree has (internal) edge labels}
-  \item{EdgeLabels}{\code{signature(object = "phylo4")}: internal
+  \item{edgeLabels}{\code{signature(object = "phylo4")}: internal
     edge labels}
 
   \item{isRooted}{\code{signature(object = "phylo4")}: whether tree is
     rooted (i.e. has explicit root edge defined \emph{or} root node has
     <= 2 descendants)}
-  \item{RootEdge}{\code{signature(object = "phylo4")}: root edge}
+  \item{rootEdge}{\code{signature(object = "phylo4")}: root edge}
   \item{tdata}{\code{signature(object = "phylo4d")}: trait data}
 }
 }

Modified: pkg/tests/misctests.R
===================================================================
--- pkg/tests/misctests.R	2008-03-06 03:10:33 UTC (rev 139)
+++ pkg/tests/misctests.R	2008-03-06 10:03:04 UTC (rev 140)
@@ -48,10 +48,10 @@
 
 plot(q2)
 plot(q2,treetype="cladogram")
-## plot(p2,type="dotchart",labels.nodes=NodeLabels(p2))
+## plot(p2,type="dotchart",labels.nodes=nodeLabels(p2))
 ## trace("plot", browser, signature = c("phylo4d","missing"))
 labels(q1) <- paste("q",1:5,sep="")
-NodeLabels(q1) <- paste("n",1:4,sep="")
+nodeLabels(q1) <- paste("n",1:4,sep="")
 p3 <- phylo4d(r1,tip.data=tipdat,node.data=data.frame(b=6:9))
 summary(p3)
 



More information about the Phylobase-commits mailing list