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

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu Aug 20 05:34:38 CEST 2009


Author: bbolker
Date: 2009-08-20 05:34:38 +0200 (Thu, 20 Aug 2009)
New Revision: 527

Modified:
   pkg/R/setAs-Methods.R
   pkg/tests/roundtrip.R
Log:
  fixed identification of root node in phylo4 -> phylo export
  extended tests slightly (can't use identical() on edge lengths
when going to phylo4vcov and back ...)




Modified: pkg/R/setAs-Methods.R
===================================================================
--- pkg/R/setAs-Methods.R	2009-08-20 03:08:10 UTC (rev 526)
+++ pkg/R/setAs-Methods.R	2009-08-20 03:34:38 UTC (rev 527)
@@ -118,7 +118,7 @@
         y$node.label <- NULL
     ## how do we tell if there is an explicit root edge?
     if (isRooted(from)) {
-        root.edge <- brlen0[rootNode(from)]
+        root.edge <- edgeLength(from,rootNode(from))## brlen0[rootNode(from)]
         if (!is.na(root.edge)) y$root.edge <- root.edge
     }
     y

Modified: pkg/tests/roundtrip.R
===================================================================
--- pkg/tests/roundtrip.R	2009-08-20 03:08:10 UTC (rev 526)
+++ pkg/tests/roundtrip.R	2009-08-20 03:34:38 UTC (rev 527)
@@ -13,5 +13,9 @@
 t2<-as(t1,"phylo4vcov")
 t3<-as(t2,"phylo4")
 t4<-as(t3,"phylo")
-## stopifnot(identical(t0,t4))
+stopifnot(identical(t4$edge,t0$edge) &&
+          identical(t4$tip.label,t0$tip.label) &&
+          identical(t4$Nnode,t0$Nnode) &&
+          max(abs(t4$edge.length-t0$edge.length))<1e-10)
+           
 



More information about the Phylobase-commits mailing list