[Phylobase-commits] r582 - in pkg: R inst/unitTests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Aug 25 02:03:18 CEST 2009


Author: regetz
Date: 2009-08-25 02:03:18 +0200 (Tue, 25 Aug 2009)
New Revision: 582

Modified:
   pkg/R/class-phylo4d.R
   pkg/R/subset.R
   pkg/inst/unitTests/runit.subset.R
Log:
now passing the 'order' slot value in both phylo4d('phylo4') method and
in extractTree (bug #604); modified tests


Modified: pkg/R/class-phylo4d.R
===================================================================
--- pkg/R/class-phylo4d.R	2009-08-24 23:26:23 UTC (rev 581)
+++ pkg/R/class-phylo4d.R	2009-08-25 00:03:18 UTC (rev 582)
@@ -161,6 +161,7 @@
     res at tip.label <- x at tip.label
     res at node.label <- x at node.label
     res at edge.label <- x at edge.label
+    res at order <- x at order
 
     ## taking care of the data
     tmpData <- .phylo4Data(x=x, tip.data=tip.data, node.data=node.data,

Modified: pkg/R/subset.R
===================================================================
--- pkg/R/subset.R	2009-08-24 23:26:23 UTC (rev 581)
+++ pkg/R/subset.R	2009-08-25 00:03:18 UTC (rev 582)
@@ -121,6 +121,6 @@
 
 extractTree <- function(from) {
     phylo4(from at edge, edge.length = from at edge.length,
-           tip.label = from at tip.label,
-           node.label = from at node.label, edge.label = from at edge.label)
+           tip.label = from at tip.label, node.label = from at node.label,
+           edge.label = from at edge.label, order = from at order)
   }

Modified: pkg/inst/unitTests/runit.subset.R
===================================================================
--- pkg/inst/unitTests/runit.subset.R	2009-08-24 23:26:23 UTC (rev 581)
+++ pkg/inst/unitTests/runit.subset.R	2009-08-25 00:03:18 UTC (rev 582)
@@ -6,6 +6,11 @@
 tr <- read.tree(text="(((t1:0.2,(t2:0.1,t3:0.1):0.15):0.5,t4:0.7):0.2,t5:1):0.4;")
 tr.sub2 <- read.tree(text="(t2:0.95,t5:1);")
 tr.sub4 <- read.tree(text="(((t1:0.2,t2:0.25):0.5,t4:0.7):0.2,t5:1);")
+# Explicitly set order as 'cladewise', to match behavior of
+# ape::drop.tip in test comparisons below
+tr <- reorder(tr, "cladewise")
+tr.sub2 <- reorder(tr.sub2, "cladewise")
+tr.sub4 <- reorder(tr.sub4, "cladewise")
 
 test.subset.phylo <- function() {
     # subset 2 tips
@@ -29,7 +34,6 @@
 }
 
 test.subset.phylo4 <- function() {
-  DEACTIVATED("Broken?: subset changes phy order from 'unknown' to 'preorder'")
     phy <- phylo4(tr)
     phy.sub2 <- phylo4(tr.sub2)
     phy.sub4 <- phylo4(tr.sub4)
@@ -50,10 +54,10 @@
     checkEquals(phy, phy[tipLabels(phy)])
     checkEquals(phy, phy[seq_len(nTips(phy))])
     # error if only one valid tip requested
-    checkException(subset(phy, tip.include="t1"))
-    checkException(subset(phy, tip.include=c("t1", "t999")))
+    checkException(subset(phy, tips.include="t1"))
+    checkException(subset(phy, tips.include=c("t1", "t999")))
     # error if zero valid tips requested
-    checkException(subset(phy, tip.include="t999"))
+    checkException(subset(phy, tips.include="t999"))
     # error if more than one subset criteria are supplied
     checkException(subset(phyd, tips.include="t1", tips.exclude="t3"))
 }



More information about the Phylobase-commits mailing list