[Phylobase-commits] r620 - in pkg: R tests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Sep 3 23:59:20 CEST 2009


Author: francois
Date: 2009-09-03 23:59:20 +0200 (Thu, 03 Sep 2009)
New Revision: 620

Modified:
   pkg/R/setAs-Methods.R
   pkg/tests/roundtrip.R
Log:
changed order of elements in phylo object returned by conversion, reverted tests in roundtrip.R

Modified: pkg/R/setAs-Methods.R
===================================================================
--- pkg/R/setAs-Methods.R	2009-09-03 21:17:54 UTC (rev 619)
+++ pkg/R/setAs-Methods.R	2009-09-03 21:59:20 UTC (rev 620)
@@ -100,17 +100,6 @@
     storage.mode(edgemat) <- "integer"
     phy$edge <- edgemat
 
-    ## nNodes
-    phy$Nnode <- as.integer(nNodes(from))
-
-    ## Tip labels
-    phy$tip.label <- unname(from at tip.label)
-
-    ## Node labels
-    if(hasNodeLabels(from)) {
-        phy$node.label <- unname(nodeLabels(from))
-    }
-
     ## Edge lengths
     if(hasEdgeLength(from)) {
         edge.length <- edgeLength(from)
@@ -124,6 +113,17 @@
         }
     }
 
+    ## Tip labels
+    phy$tip.label <- unname(from at tip.label)
+
+    ## nNodes
+    phy$Nnode <- as.integer(nNodes(from))
+
+    ## Node labels
+    if(hasNodeLabels(from)) {
+        phy$node.label <- unname(nodeLabels(from))
+    }
+
     ## Root edge
     if(isRooted(from) && hasEdgeLength(from)) {
         root.edge <- unname(edgeLength(from,rootNode(from)))

Modified: pkg/tests/roundtrip.R
===================================================================
--- pkg/tests/roundtrip.R	2009-09-03 21:17:54 UTC (rev 619)
+++ pkg/tests/roundtrip.R	2009-09-03 21:59:20 UTC (rev 620)
@@ -16,11 +16,7 @@
 ## phylo -> phylo4 -> phylo
 t1 <- as(t0,"phylo4")
 t5 <- as(t1,"phylo")
-## stopifnot(identical(t0,t5)) ## aren't identical because difference in attributes
-stopifnot(identical(t0$edge, t5$edge) &&
-          identical(t0$edge.length, t5$edge.length) &&
-          identical(t0$tip.label, t5$tip.label) &&
-          identical(t0$Nnode, t5$Nnode))
+stopifnot(identical(t0,t5))
 
 ## phylo4 -> phylo4vcov -> phylo4 -> phylo
 t2<-as(t1,"phylo4vcov")
@@ -38,19 +34,11 @@
 storage.mode(t6$edge) <- "integer"
 storage.mode(t6$Nnode) <- "integer"
 t7 <- as(as(t6,"phylo4"),"phylo")
-## stopifnot(identical(t6,t7))
-stopifnot(identical(t6$edge, t7$edge) &&
-          identical(t6$edge.length, t7$edge.length) &&
-          identical(t6$tip.label, t7$tip.label) &&
-          identical(t6$Nnode, t7$Nnode))
+stopifnot(identical(t6,t7))
 
 
 ## EXPLICIT ROOT EDGE
 t8 <- t0
 t8$root.edge <- 0.5
 t9 <- as(as(t8,"phylo4"),"phylo")
-## stopifnot(identical(t8,t9))
-stopifnot(identical(t8$edge, t9$edge) &&
-          identical(t8$edge.length, t9$edge.length) &&
-          identical(t8$tip.label, t9$tip.label) &&
-          identical(t8$Nnode, t9$Nnode))
+stopifnot(identical(t8,t9))



More information about the Phylobase-commits mailing list