[Phylobase-commits] r334 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Fri Dec 19 19:48:51 CET 2008


Author: francois
Date: 2008-12-19 19:48:51 +0100 (Fri, 19 Dec 2008)
New Revision: 334

Modified:
   pkg/R/methods-phylo4.R
   pkg/R/phylo4.R
   pkg/R/setAs-Methods.R
Log:
changed nodeType to typeNode

Modified: pkg/R/methods-phylo4.R
===================================================================
--- pkg/R/methods-phylo4.R	2008-12-19 16:18:58 UTC (rev 333)
+++ pkg/R/methods-phylo4.R	2008-12-19 18:48:51 UTC (rev 334)
@@ -57,22 +57,22 @@
     ## fixme - may fail with explicit root node in edge matrix
 })
 
-setMethod("typeNode", "phylo4", function(x) {
-    if(nTips(x) == 0)
+setMethod("nodeType", "phylo4", function(phy) {
+    if(nTips(phy) == 0)
         return(NULL)
     else {
-        listNodes <- sort(unique(as.vector(edges(x))))
+        listNodes <- sort(unique(as.vector(edges(phy))))
         t <- rep("internal", length(listNodes)) # FM: internal is default (I think it's safer)
         names(t) <- listNodes
 
         ## node number of real internal nodes
-        iN <- names(table(edges(x)[,1]))
+        iN <- names(table(edges(phy)[,1]))
         ## node number that are not internal nodes (ie that are tips)
         tN <- names(t)[!names(t) %in% iN]
         t[tN] <- "tip"
 
         ## if the tree is rooted
-        if(isRooted(x)) t[rootNode(x)] <- "root"
+        if(isRooted(phy)) t[rootNode(phy)] <- "root"
 
         return(t)
     }

Modified: pkg/R/phylo4.R
===================================================================
--- pkg/R/phylo4.R	2008-12-19 16:18:58 UTC (rev 333)
+++ pkg/R/phylo4.R	2008-12-19 18:48:51 UTC (rev 334)
@@ -14,8 +14,8 @@
     standardGeneric("rootEdge")
 })
 
-setGeneric("typeNode", function(x) {
-    standardGeneric("typeNode")
+setGeneric("nodeType", function(phy) {
+    standardGeneric("nodeType")
 })
 
 setGeneric("isRooted", function(x) {

Modified: pkg/R/setAs-Methods.R
===================================================================
--- pkg/R/setAs-Methods.R	2008-12-19 16:18:58 UTC (rev 333)
+++ pkg/R/setAs-Methods.R	2008-12-19 18:48:51 UTC (rev 334)
@@ -12,7 +12,7 @@
         }
         if (!is.null(from$edge.label)) {
             from$edge.label <- c(from$edge.label,paste("E",from$root.edge,sep=""))
-        }   
+        }
     }
     newobj <- phylo4(from$edge, from$edge.length, from$tip.label,
         node.label = from$node.label, edge.label = from$edge.label,
@@ -129,7 +129,7 @@
     }
     tl <- labels(x)
     label <- c(nl, tl)
-    node.type <- typeNode(x)[node]
+    node.type <- nodeType(x)[node]
     return(data.frame(label, node, ancestor, branch.length,
         node.type,stringsAsFactors=FALSE))
 })



More information about the Phylobase-commits mailing list