[Phylobase-commits] r775 - pkg/tests
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Apr 1 22:02:26 CEST 2010
Author: francois
Date: 2010-04-01 22:02:26 +0200 (Thu, 01 Apr 2010)
New Revision: 775
Added:
pkg/tests/misctests.Rout.save
pkg/tests/nexusdata.Rout.save
pkg/tests/phylo4dtests.Rout.save
pkg/tests/phylotorture.Rout.save
pkg/tests/testprune.Rout.save
Modified:
pkg/tests/RUnit-tests.Rout.save
pkg/tests/doRUnit.Rout.save
pkg/tests/phylosubtest.Rout.save
pkg/tests/plottest.Rout.save
pkg/tests/roundtrip.Rout.save
Log:
other updates tests and their output
Modified: pkg/tests/RUnit-tests.Rout.save
===================================================================
--- pkg/tests/RUnit-tests.Rout.save 2010-04-01 20:01:05 UTC (rev 774)
+++ pkg/tests/RUnit-tests.Rout.save 2010-04-01 20:02:26 UTC (rev 775)
@@ -28,4 +28,4 @@
>
> proc.time()
user system elapsed
- 0.372 0.028 0.400
+ 0.376 0.028 0.399
Modified: pkg/tests/doRUnit.Rout.save
===================================================================
--- pkg/tests/doRUnit.Rout.save 2010-04-01 20:01:05 UTC (rev 774)
+++ pkg/tests/doRUnit.Rout.save 2010-04-01 20:02:26 UTC (rev 775)
@@ -175,7 +175,7 @@
Executing test function test.formatDataWithDup ... [1] 10
-<environment: 0x9e777c4>
+<environment: 0x935e7c4>
Error in formatData(phy.dup, phy.dup) :
phy.dup must be a vector, factor, matrix, or data frame
Error in switch(missing.data, warn = warning(msg), fail = stop(msg)) :
@@ -677,7 +677,7 @@
------------------- UNIT TEST SUMMARY ---------------------
-RUNIT TEST PROTOCOL -- Thu Apr 1 15:22:36 2010
+RUNIT TEST PROTOCOL -- Thu Apr 1 16:01:34 2010
***********************************************
Number of test functions: 101
Number of errors: 0
@@ -689,4 +689,4 @@
>
> proc.time()
user system elapsed
- 10.712 0.144 10.940
+ 11.060 0.216 11.483
Added: pkg/tests/misctests.Rout.save
===================================================================
--- pkg/tests/misctests.Rout.save (rev 0)
+++ pkg/tests/misctests.Rout.save 2010-04-01 20:02:26 UTC (rev 775)
@@ -0,0 +1,500 @@
+
+R version 2.10.1 (2009-12-14)
+Copyright (C) 2009 The R Foundation for Statistical Computing
+ISBN 3-900051-07-0
+
+R is free software and comes with ABSOLUTELY NO WARRANTY.
+You are welcome to redistribute it under certain conditions.
+Type 'license()' or 'licence()' for distribution details.
+
+ Natural language support but running in an English locale
+
+R is a collaborative project with many contributors.
+Type 'contributors()' for more information and
+'citation()' on how to cite R or R packages in publications.
+
+Type 'demo()' for some demos, 'help()' for on-line help, or
+'help.start()' for an HTML browser interface to help.
+Type 'q()' to quit R.
+
+> library(phylobase)
+Loading required package: grid
+Loading required package: ape
+Loading required package: Rcpp
+
+Attaching package: 'phylobase'
+
+
+ The following object(s) are masked from package:ape :
+
+ edges
+
+> library(ape)
+>
+> set.seed(1)
+>
+> data(geospiza)
+>
+> ## make sure geospiza is properly formatted
+> if(is.character(checkval <- checkPhylo4(geospiza)))
++ stop(checkval)
+>
+>
+> geospiza0 <-
++ list(geospiza.tree=as(geospiza,"phylo"),geospiza.data=tipData(geospiza))
+Warning messages:
+1: In asMethod(object) : losing data while coercing phylo4d to phylo
+2: In asMethod(object) : trees with unknown order may be unsafe in ape
+> ## push data back into list form as in geiger
+>
+> t1 <- try(p1 <- phylo4d(geospiza0$geospiza.tree,geospiza0$geospiza.data))
+> ## Error in checkData(res, ...) :
+> ## Tip data names are a subset of tree tip labels.
+>
+> p2 <- as(geospiza0$geospiza.tree,"phylo4")
+> plot(p2)
+>
+> lab1 <- tipLabels(p2)
+> lab2 <- rownames(geospiza0$geospiza.data)
+>
+> lab1[!lab1 %in% lab2] ## missing data
+named character(0)
+> lab2[!lab2 %in% lab1] ## extra data (none)
+character(0)
+> p1 <- phylo4d(p2,geospiza0$geospiza.data, missing.data="warn")
+> p1 <- phylo4d(p2,geospiza0$geospiza.data, missing.data="OK")
+>
+> plot(p1)
+> plot(p1,show.node.label=TRUE)
+> ## one way to deal with it:
+>
+> p1B <- prune(p1,tip="olivacea")
+>
+> ## or ...
+> p1C <- na.omit(p1)
+>
+> labels(p1C, "all") <- tolower(labels(p1C, "all"))
+>
+> ## trace("prune",browser,signature="phylo4d")
+> r1 <- read.tree(text="((t4:0.3210275554,(t2:0.2724586465,t3:0.2724586465):0.0485689089):0.1397952619,(t5:0.07551818331,t1:0.07551818331):0.385304634);")
+>
+> ## trace("phylo4d", browser, signature = "phylo")
+> ## untrace("phylo4d", signature = "phylo")
+> tipdat <- data.frame(a=1:5, row.names=r1$tip.label)
+> q1 <- phylo4d(r1,tip.data=tipdat, node.data=data.frame(a=6:9), match.data=FALSE)
+> q2 <- prune(q1,1)
+> summary(q2)
+
+ Phylogenetic tree : as(x, "phylo4")
+
+ Number of tips : 4
+ Number of nodes : 3
+ Branch lengths:
+ mean : 0.2116037
+ variance : 0.01503145
+ distribution :
+ Min. 1st Qu. Median Mean 3rd Qu. Max.
+0.07552 0.10370 0.23040 0.21160 0.27250 0.38530
+
+Comparative data:
+
+Tips: data.frame with 4 taxa and 1 variable(s)
+
+ a
+ Min. :2.00
+ 1st Qu.:2.75
+ Median :3.50
+ Mean :3.50
+ 3rd Qu.:4.25
+ Max. :5.00
+
+Nodes: data.frame with 3 internal nodes and 1 variables
+
+ a
+ Min. :6.000
+ 1st Qu.:7.000
+ Median :8.000
+ Mean :7.667
+ 3rd Qu.:8.500
+ Max. :9.000
+>
+> tipdat2 <- tipdat
+> row.names(tipdat2)[1] <- "s1"
+> t1 <- try(q1 <- phylo4d(r1,tip.data=tipdat2))
+Error in switch(missing.data, warn = warning(msg), fail = stop(msg)) :
+ The following nodes are not found in the dataset: t4
+>
+> plot(q2)
+> plot(q2,type="cladogram")
+> ## plot(p2,type="dotchart",labels.nodes=nodeLabels(p2))
+> ## trace("plot", browser, signature = c("phylo4d","missing"))
+> tipLabels(q1) <- paste("q",1:5,sep="")
+> nodeLabels(q1) <- paste("n",1:4,sep="")
+> p3 <- phylo4d(r1,tip.data=tipdat,node.data=data.frame(b=6:9), match.data=FALSE)
+> summary(p3)
+
+ Phylogenetic tree : as(x, "phylo4")
+
+ Number of tips : 5
+ Number of nodes : 4
+ Branch lengths:
+ mean : 0.1988313
+ variance : 0.0167175
+ distribution :
+ Min. 1st Qu. Median Mean 3rd Qu. Max.
+0.04857 0.07552 0.20610 0.19880 0.28460 0.38530
+
+Comparative data:
+
+Tips: data.frame with 5 taxa and 2 variable(s)
+
+ a b
+ Min. :1 Min. : NA
+ 1st Qu.:2 1st Qu.: NA
+ Median :3 Median : NA
+ Mean :3 Mean :NaN
+ 3rd Qu.:4 3rd Qu.: NA
+ Max. :5 Max. : NA
+ NA's : 5
+
+Nodes: data.frame with 4 internal nodes and 2 variables
+
+ a b
+ Min. : NA Min. :6.00
+ 1st Qu.: NA 1st Qu.:6.75
+ Median : NA Median :7.50
+ Mean :NaN Mean :7.50
+ 3rd Qu.: NA 3rd Qu.:8.25
+ Max. : NA Max. :9.00
+ NA's : 4
+>
+> plot(p1)
+>
+> plot(subset(p1,tips.include=c("fuliginosa","fortis","magnirostris",
++ "conirostris","scandens")))
+> ## better error?
+> ## Error in phy$edge[, 2] : incorrect number of dimensions
+>
+> if(dev.cur() == 1) get(getOption("device"))()
+> plot(subset(p2,tips.include=c("fuliginosa","fortis","magnirostris",
++ "conirostris","scandens")))
+>
+> plot(p2,show.node.label=TRUE)
+>
+> tree.owls <- read.tree(text="(((Strix_aluco:4.2,Asio_otus:4.2):3.1,Athene_noctua:7.3):6.3,Tyto_alba:13.5);")
+>
+> z <- as(tree.owls,"phylo4")
+>
+> example("phylo4d")
+
+phyl4d> treeOwls <- "((Strix_aluco:4.2,Asio_otus:4.2):3.1,Athene_noctua:7.3);"
+
+phyl4d> tree.owls.bis <- read.tree(text=treeOwls)
+
+phyl4d> try(phylo4d(as(tree.owls.bis,"phylo4"),data.frame(wing=1:3)), silent=TRUE)
+ label node ancestor edge.length node.type wing
+1 Strix_aluco 1 5 4.2 tip 1
+2 Asio_otus 2 5 4.2 tip 2
+3 Athene_noctua 3 4 7.3 tip 3
+4 <NA> 4 0 NA root NA
+5 <NA> 5 4 3.1 internal NA
+
+phyl4d> obj <- phylo4d(as(tree.owls.bis,"phylo4"),data.frame(wing=1:3), match.data=FALSE)
+
+phyl4d> obj
+ label node ancestor edge.length node.type wing
+1 Strix_aluco 1 5 4.2 tip 1
+2 Asio_otus 2 5 4.2 tip 2
+3 Athene_noctua 3 4 7.3 tip 3
+4 <NA> 4 0 NA root NA
+5 <NA> 5 4 3.1 internal NA
+
+phyl4d> print(obj)
+ label node ancestor edge.length node.type wing
+1 Strix_aluco 1 5 4.2 tip 1
+2 Asio_otus 2 5 4.2 tip 2
+3 Athene_noctua 3 4 7.3 tip 3
+4 <NA> 4 0 NA root NA
+5 <NA> 5 4 3.1 internal NA
+
+phyl4d> ####
+phyl4d>
+phyl4d> data(geospiza_raw)
+
+phyl4d> geoTree <- geospiza_raw$tree
+
+phyl4d> geoData <- geospiza_raw$data
+
+phyl4d> ## fix differences in tip names between the tree and the data
+phyl4d> geoData <- rbind(geoData, array(, dim = c(1,ncol(geoData)),
+phyl4d+ dimnames = list("olivacea", colnames(geoData))))
+
+phyl4d> ### Example using a tree of class 'phylo'
+phyl4d> exGeo1 <- phylo4d(geoTree, tip.data = geoData)
+
+phyl4d> ### Example using a tree of class 'phylo4'
+phyl4d> geoTree <- as(geoTree, "phylo4")
+
+phyl4d> ## some random node data
+phyl4d> rNodeData <- data.frame(randomTrait = rnorm(nNodes(geoTree)),
+phyl4d+ row.names = nodeId(geoTree, "internal"))
+
+phyl4d> exGeo2 <- phylo4d(geoTree, tip.data = geoData, node.data = rNodeData)
+
+phyl4d> ### Example using 'merge.data'
+phyl4d> data(geospiza)
+
+phyl4d> trGeo <- extractTree(geospiza)
+
+phyl4d> tDt <- data.frame(a=rnorm(nTips(trGeo)), row.names=nodeId(trGeo, "tip"))
+
+phyl4d> nDt <- data.frame(a=rnorm(nNodes(trGeo)), row.names=nodeId(trGeo, "internal"))
+
+phyl4d> (matchData1 <- phylo4d(trGeo, tip.data=tDt, node.data=nDt, merge.data=FALSE))
+ label node ancestor edge.length node.type a.tip a.node
+1 fuliginosa 1 24 0.05500 tip -2.21469989 NA
+2 fortis 2 24 0.05500 tip 1.12493092 NA
+3 magnirostris 3 23 0.11000 tip -0.04493361 NA
+4 conirostris 4 22 0.18333 tip -0.01619026 NA
+5 scandens 5 21 0.19250 tip 0.94383621 NA
+6 difficilis 6 20 0.22800 tip 0.82122120 NA
+7 pallida 7 25 0.08667 tip 0.59390132 NA
+8 parvulus 8 27 0.02000 tip 0.91897737 NA
+9 psittacula 9 27 0.02000 tip 0.78213630 NA
+10 pauper 10 26 0.03500 tip 0.07456498 NA
+11 Platyspiza 11 18 0.46550 tip -1.98935170 NA
+12 fusca 12 17 0.53409 tip 0.61982575 NA
+13 Pinaroloxias 13 16 0.58333 tip -0.05612874 NA
+14 olivacea 14 15 0.88077 tip -0.15579551 NA
+15 N15 15 0 NA root NA -1.47075238
+16 N16 16 15 0.29744 internal NA -0.47815006
+17 N17 17 16 0.04924 internal NA 0.41794156
+18 N18 18 17 0.06859 internal NA 1.35867955
+19 N19 19 18 0.13404 internal NA -0.10278773
+20 N20 20 19 0.10346 internal NA 0.38767161
+21 N21 21 20 0.03550 internal NA -0.05380504
+22 N22 22 21 0.00917 internal NA -1.37705956
+23 N23 23 22 0.07333 internal NA -0.41499456
+24 N24 24 23 0.05500 internal NA -0.39428995
+25 N25 25 19 0.24479 internal NA -0.05931340
+26 N26 26 25 0.05167 internal NA 1.10002537
+27 N27 27 26 0.01500 internal NA 0.76317575
+
+phyl4d> (matchData2 <- phylo4d(trGeo, tip.data=tDt, node.data=nDt, merge.data=TRUE))
+ label node ancestor edge.length node.type a
+1 fuliginosa 1 24 0.05500 tip -2.21469989
+2 fortis 2 24 0.05500 tip 1.12493092
+3 magnirostris 3 23 0.11000 tip -0.04493361
+4 conirostris 4 22 0.18333 tip -0.01619026
+5 scandens 5 21 0.19250 tip 0.94383621
+6 difficilis 6 20 0.22800 tip 0.82122120
+7 pallida 7 25 0.08667 tip 0.59390132
+8 parvulus 8 27 0.02000 tip 0.91897737
+9 psittacula 9 27 0.02000 tip 0.78213630
+10 pauper 10 26 0.03500 tip 0.07456498
+11 Platyspiza 11 18 0.46550 tip -1.98935170
+12 fusca 12 17 0.53409 tip 0.61982575
+13 Pinaroloxias 13 16 0.58333 tip -0.05612874
+14 olivacea 14 15 0.88077 tip -0.15579551
+15 N15 15 0 NA root -1.47075238
+16 N16 16 15 0.29744 internal -0.47815006
+17 N17 17 16 0.04924 internal 0.41794156
+18 N18 18 17 0.06859 internal 1.35867955
+19 N19 19 18 0.13404 internal -0.10278773
+20 N20 20 19 0.10346 internal 0.38767161
+21 N21 21 20 0.03550 internal -0.05380504
+22 N22 22 21 0.00917 internal -1.37705956
+23 N23 23 22 0.07333 internal -0.41499456
+24 N24 24 23 0.05500 internal -0.39428995
+25 N25 25 19 0.24479 internal -0.05931340
+26 N26 26 25 0.05167 internal 1.10002537
+27 N27 27 26 0.01500 internal 0.76317575
+
+phyl4d> ## Example with 'all.data'
+phyl4d> nodeLabels(geoTree) <- as.character(nodeId(geoTree, "internal"))
+
+phyl4d> rAllData <- data.frame(randomTrait = rnorm(nTips(geoTree) + nNodes(geoTree)),
+phyl4d+ row.names = labels(geoTree, 'all'))
+
+phyl4d> exGeo5 <- phylo4d(geoTree, all.data = rAllData)
+
+phyl4d> ## Examples using 'rownamesAsLabels' and comparing with match.data=FALSE
+phyl4d> tDt <- data.frame(x=letters[1:nTips(trGeo)],
+phyl4d+ row.names=sample(nodeId(trGeo, "tip")))
+
+phyl4d> tipLabels(trGeo) <- as.character(sample(1:nTips(trGeo)))
+
+phyl4d> (exGeo6 <- phylo4d(trGeo, tip.data=tDt, rownamesAsLabels=TRUE))
+ label node ancestor edge.length node.type x
+1 2 1 24 0.05500 tip i
+2 12 2 24 0.05500 tip l
+3 8 3 23 0.11000 tip b
+4 7 4 22 0.18333 tip c
+5 4 5 21 0.19250 tip n
+6 5 6 20 0.22800 tip f
+7 9 7 25 0.08667 tip h
+8 14 8 27 0.02000 tip a
+9 10 9 27 0.02000 tip e
+10 1 10 26 0.03500 tip m
+11 11 11 18 0.46550 tip g
+12 13 12 17 0.53409 tip j
+13 3 13 16 0.58333 tip k
+14 6 14 15 0.88077 tip d
+15 N15 15 0 NA root <NA>
+16 N16 16 15 0.29744 internal <NA>
+17 N17 17 16 0.04924 internal <NA>
+18 N18 18 17 0.06859 internal <NA>
+19 N19 19 18 0.13404 internal <NA>
+20 N20 20 19 0.10346 internal <NA>
+21 N21 21 20 0.03550 internal <NA>
+22 N22 22 21 0.00917 internal <NA>
+23 N23 23 22 0.07333 internal <NA>
+24 N24 24 23 0.05500 internal <NA>
+25 N25 25 19 0.24479 internal <NA>
+26 N26 26 25 0.05167 internal <NA>
+27 N27 27 26 0.01500 internal <NA>
+
+phyl4d> (exGeo7 <- phylo4d(trGeo, tip.data=tDt, rownamesAsLabels=FALSE))
+ label node ancestor edge.length node.type x
+1 2 1 24 0.05500 tip m
+2 12 2 24 0.05500 tip i
+3 8 3 23 0.11000 tip k
+4 7 4 22 0.18333 tip n
+5 4 5 21 0.19250 tip f
+6 5 6 20 0.22800 tip d
+7 9 7 25 0.08667 tip c
+8 14 8 27 0.02000 tip b
+9 10 9 27 0.02000 tip h
+10 1 10 26 0.03500 tip e
+11 11 11 18 0.46550 tip g
+12 13 12 17 0.53409 tip l
+13 3 13 16 0.58333 tip j
+14 6 14 15 0.88077 tip a
+15 N15 15 0 NA root <NA>
+16 N16 16 15 0.29744 internal <NA>
+17 N17 17 16 0.04924 internal <NA>
+18 N18 18 17 0.06859 internal <NA>
+19 N19 19 18 0.13404 internal <NA>
+20 N20 20 19 0.10346 internal <NA>
+21 N21 21 20 0.03550 internal <NA>
+22 N22 22 21 0.00917 internal <NA>
+23 N23 23 22 0.07333 internal <NA>
+24 N24 24 23 0.05500 internal <NA>
+25 N25 25 19 0.24479 internal <NA>
+26 N26 26 25 0.05167 internal <NA>
+27 N27 27 26 0.01500 internal <NA>
+
+phyl4d> (exGeo8 <- phylo4d(trGeo, tip.data=tDt, match.data=FALSE))
+ label node ancestor edge.length node.type x
+1 2 1 24 0.05500 tip a
+2 12 2 24 0.05500 tip b
+3 8 3 23 0.11000 tip c
+4 7 4 22 0.18333 tip d
+5 4 5 21 0.19250 tip e
+6 5 6 20 0.22800 tip f
+7 9 7 25 0.08667 tip g
+8 14 8 27 0.02000 tip h
+9 10 9 27 0.02000 tip i
+10 1 10 26 0.03500 tip j
+11 11 11 18 0.46550 tip k
+12 13 12 17 0.53409 tip l
+13 3 13 16 0.58333 tip m
+14 6 14 15 0.88077 tip n
+15 N15 15 0 NA root <NA>
+16 N16 16 15 0.29744 internal <NA>
+17 N17 17 16 0.04924 internal <NA>
+18 N18 18 17 0.06859 internal <NA>
+19 N19 19 18 0.13404 internal <NA>
+20 N20 20 19 0.10346 internal <NA>
+21 N21 21 20 0.03550 internal <NA>
+22 N22 22 21 0.00917 internal <NA>
+23 N23 23 22 0.07333 internal <NA>
+24 N24 24 23 0.05500 internal <NA>
+25 N25 25 19 0.24479 internal <NA>
+26 N26 26 25 0.05167 internal <NA>
+27 N27 27 26 0.01500 internal <NA>
+
+phyl4d> require(ape) ## for rcoal
+
+phyl4d> ## generate a tree and some data
+phyl4d> set.seed(1)
+
+phyl4d> p3 <- rcoal(5)
+
+phyl4d> dat <- data.frame(a = rnorm(5), b = rnorm(5), row.names = p3$tip.label)
+
+phyl4d> dat.defaultnames <- dat
+
+phyl4d> row.names(dat.defaultnames) <- NULL
+
+phyl4d> dat.superset <- rbind(dat, rnorm(2))
+
+phyl4d> dat.subset <- dat[-1, ]
+
+phyl4d> ## create a phylo4 object from a phylo object
+phyl4d> p4 <- as(p3, "phylo4")
+
+phyl4d> ## create phylo4d objects with tip data
+phyl4d> p4d <- phylo4d(p4, dat)
+
+phyl4d> ###checkData(p4d)
+phyl4d> p4d.sorted <- phylo4d(p4, dat[5:1, ])
+
+phyl4d> try(p4d.nonames <- phylo4d(p4, dat.defaultnames))
+
+phyl4d> p4d.nonames <- phylo4d(p4, dat.defaultnames, match.data=FALSE)
+
+phyl4d> ## Not run:
+phyl4d> ##D p4d.subset <- phylo4d(p4, dat.subset)
+phyl4d> ##D p4d.subset <- phylo4d(p4, dat.subset)
+phyl4d> ##D try(p4d.superset <- phylo4d(p4, dat.superset))
+phyl4d> ##D p4d.superset <- phylo4d(p4, dat.superset)
+phyl4d> ## End(Not run)
+phyl4d>
+phyl4d> ## create phylo4d objects with node data
+phyl4d> nod.dat <- data.frame(a = rnorm(4), b = rnorm(4))
+
+phyl4d> p4d.nod <- phylo4d(p4, node.data = nod.dat, match.data=FALSE)
+
+phyl4d> ## create phylo4 objects with node and tip data
+phyl4d> p4d.all1 <- phylo4d(p4, node.data = nod.dat, tip.data = dat, match.data=FALSE)
+
+phyl4d> nodeLabels(p4) <- as.character(nodeId(p4, "internal"))
+
+phyl4d> p4d.all2 <- phylo4d(p4, all.data = rbind(dat, nod.dat, match.data=FALSE))
+Warning message:
+In switch(extra.data, warn = warning(msg), fail = stop(msg)) :
+ The following names are not found in the tree: match.data
+> obj1 <- obj2 <- obj3 <- phylo4d(z, data.frame(wing=1:4,color=factor(c("b","w","b","b")), tail=runif(4)*10), match.data=FALSE)
+>
+> obj2 at data <- as.data.frame(obj2 at data[,1])
+> obj3 at data <- cbind(obj1 at data,obj2 at data)
+> obj4 <- obj1
+> obj4 at data[2,3] <- NA
+> obj4 at data[1,1] <- NA
+>
+> nodeLabels(obj4) <- character(0)
+>
+> obj5 <- obj1
+> tipData(obj4) <- subset(tipData(obj4),select=sapply(tipData(obj4),class)=="numeric")
+>
+> treePlot(obj4)
+>
+> E <- matrix(c(
++ 8, 9,
++ 9, 10,
++ 10, 1,
++ 10, 2,
++ 9, 3,
++ 9, 4,
++ 8, 11,
++ 11, 5,
++ 11, 6,
++ 11, 7,
++ 0, 8), ncol=2,byrow=TRUE)
+>
+> P2 <- phylo4(E)
+>
+> proc.time()
+ user system elapsed
+ 3.436 0.080 3.882
Added: pkg/tests/nexusdata.Rout.save
===================================================================
--- pkg/tests/nexusdata.Rout.save (rev 0)
+++ pkg/tests/nexusdata.Rout.save 2010-04-01 20:02:26 UTC (rev 775)
@@ -0,0 +1,40 @@
+
+R version 2.10.1 (2009-12-14)
+Copyright (C) 2009 The R Foundation for Statistical Computing
+ISBN 3-900051-07-0
+
+R is free software and comes with ABSOLUTELY NO WARRANTY.
+You are welcome to redistribute it under certain conditions.
+Type 'license()' or 'licence()' for distribution details.
+
+ Natural language support but running in an English locale
+
+R is a collaborative project with many contributors.
+Type 'contributors()' for more information and
+'citation()' on how to cite R or R packages in publications.
+
+Type 'demo()' for some demos, 'help()' for on-line help, or
+'help.start()' for an HTML browser interface to help.
+Type 'q()' to quit R.
+
+> ## try to read NEXUS files
+> ## library(phylobase)
+> ## fn <- system.file("nexusfiles/treepluscharV01.nex",package="phylobase")
+> ## td<-NexusToPhylo4D(fn)
+> ## summary(td)
+> ## would try plotting, but typically don't have enough room
+> ## to plot data
+> ## Error in .local(x, ...) :
+> ## No room left to plot data; please try reducing ratio.tree or cex.label.
+> ## plot(as(td,"phylo4"))
+>
+> ## try to read a nexus file where the newick string describing the tree is split
+> ## across several lines
+> ## multiLine <- system.file("nexusfiles/MultiLineTrees.nex",package="phylobase")
+> ## multiLineTrees <-NexusToPhylo4(multiLine)
+> ## summary(multiLineTrees)
+>
+>
+> proc.time()
+ user system elapsed
+ 0.280 0.036 0.304
Added: pkg/tests/phylo4dtests.Rout.save
===================================================================
--- pkg/tests/phylo4dtests.Rout.save (rev 0)
+++ pkg/tests/phylo4dtests.Rout.save 2010-04-01 20:02:26 UTC (rev 775)
@@ -0,0 +1,95 @@
+
+R version 2.10.1 (2009-12-14)
+Copyright (C) 2009 The R Foundation for Statistical Computing
+ISBN 3-900051-07-0
+
+R is free software and comes with ABSOLUTELY NO WARRANTY.
+You are welcome to redistribute it under certain conditions.
+Type 'license()' or 'licence()' for distribution details.
+
+ Natural language support but running in an English locale
+
+R is a collaborative project with many contributors.
+Type 'contributors()' for more information and
+'citation()' on how to cite R or R packages in publications.
+
+Type 'demo()' for some demos, 'help()' for on-line help, or
+'help.start()' for an HTML browser interface to help.
+Type 'q()' to quit R.
+
+> library(phylobase)
+Loading required package: grid
+Loading required package: ape
+Loading required package: Rcpp
+
+Attaching package: 'phylobase'
+
+
+ The following object(s) are masked from package:ape :
+
+ edges
+
+> require(ape)
+> tree.phylo <- read.tree(text="(((A,B)C,D),E);") #only one node is labelled
+> tree <- as(tree.phylo, "phylo4")
+>
+> tree.phylo2 <- read.tree(text="(((A,B)C,D)F,E)G;") # all nodes labelled
+> tree2 <- as(tree.phylo2, "phylo4")
+>
+> tip.data <- data.frame(size=c(1, 2, 3, 4))
+> rownames(tip.data) <- c("A", "B", "E", "D")
+>
+> treed <- phylo4d(tree, tip.data)
+> dat2 <- data.frame(size=c(0,1,2), row.names=c("G", "F", "C"))
+>
+> try(phylo4d(tree, node.data=dat2), silent = TRUE) # error, cannot match data because no node labels on tree
+> phylo4d(tree2, node.data=dat2) -> treed2 # OK tree labelled; has node data, no tip data
+>
+> plot(treed2) # works with a warning about no tip data to plot
+Warning message:
+In treePlot(x, ...) : tree has no tip data to plot
+> tipData(treed2, empty.columns=FALSE) #returns empty 4-row data.frame
+data frame with 0 columns and 4 rows
+>
+> phylo4d(tree2, tip.data=tip.data, node.data=dat2) -> treed3 #node+tip data
+>
+> plot(treed3) # works
+> tipData(treed3) #works, but returns tips only
+ size
+A 1
+B 2
+D 4
+E 3
+> tdata(treed3, "all")
+ size
+A 1
+B 2
+D 4
+E 3
+G 0
+F 1
+C 2
+>
+> print(tree)
+ label node ancestor edge.length node.type
+1 A 1 7 NA tip
+2 B 2 7 NA tip
+3 D 3 6 NA tip
+4 E 4 5 NA tip
+5 <NA> 5 0 NA root
+6 <NA> 6 5 NA internal
+7 C 7 6 NA internal
+> print(treed)
+ label node ancestor edge.length node.type size
+1 A 1 7 NA tip 1
+2 B 2 7 NA tip 2
+3 D 3 6 NA tip 4
+4 E 4 5 NA tip 3
+5 <NA> 5 0 NA root NA
+6 <NA> 6 5 NA internal NA
+7 C 7 6 NA internal NA
+>
+>
+> proc.time()
+ user system elapsed
+ 1.496 0.052 1.540
Modified: pkg/tests/phylosubtest.Rout.save
===================================================================
--- pkg/tests/phylosubtest.Rout.save 2010-04-01 20:01:05 UTC (rev 774)
+++ pkg/tests/phylosubtest.Rout.save 2010-04-01 20:02:26 UTC (rev 775)
@@ -47,4 +47,4 @@
>
> proc.time()
user system elapsed
- 1.264 0.040 1.311
+ 1.312 0.040 1.349
Added: pkg/tests/phylotorture.Rout.save
===================================================================
--- pkg/tests/phylotorture.Rout.save (rev 0)
+++ pkg/tests/phylotorture.Rout.save 2010-04-01 20:02:26 UTC (rev 775)
@@ -0,0 +1,206 @@
+
+R version 2.10.1 (2009-12-14)
+Copyright (C) 2009 The R Foundation for Statistical Computing
+ISBN 3-900051-07-0
+
+R is free software and comes with ABSOLUTELY NO WARRANTY.
+You are welcome to redistribute it under certain conditions.
+Type 'license()' or 'licence()' for distribution details.
+
+ Natural language support but running in an English locale
+
+R is a collaborative project with many contributors.
+Type 'contributors()' for more information and
+'citation()' on how to cite R or R packages in publications.
+
+Type 'demo()' for some demos, 'help()' for on-line help, or
+'help.start()' for an HTML browser interface to help.
+Type 'q()' to quit R.
+
+> ## torture-testing phylo4 objects.
+> require(phylobase)
+Loading required package: phylobase
+Loading required package: grid
+Loading required package: ape
+Loading required package: Rcpp
+
+Attaching package: 'phylobase'
+
+
+ The following object(s) are masked from package:ape :
+
+ edges
+
+> set.seed(1001)
+> p1 <- list()
+> n <- 10
+> ## don't want to slow down R CMD check by doing this every time:
+> ## n <- 10000
+> for (i in 1:n) {
++ ## e2 <- c(sample(1:5,replace=FALSE,size=5),sample(6:10,replace=FALSE,size=5))
++ ## e1 <- sample(6:10,replace=TRUE
++ e <- matrix(sample(1:10,replace=TRUE,size=10),ncol=2)
++ p1[[i]] <- try(phylo4(e),silent=TRUE)
++ }
+There were 13 warnings (use warnings() to see them)
+> OKvals <- sapply(p1,class)!="try-error"
+> table(sapply(p1[!OKvals],as.character))
+
+ Error in .local(x, ...) : \n tips and nodes incorrectly numbered, All tips must have associated tip labels. Use tipLabels<- (and nodeLabels<- if needed) to update them., One or more tip/node label has an unmatched ID name Use tipLabels<- (and nodeLabels<- if needed) to update them.\n
+ 1
+ Error in .local(x, ...) : \n tips and nodes incorrectly numbered, nodes 1 to nTips must all be tips, nodes (nTips+1) to (nTips+nNodes) must all be internal nodes, All tips must have associated tip labels. Use tipLabels<- (and nodeLabels<- if needed) to update them.\n
+ 1
+Error in .local(x, ...) : \n tips and nodes incorrectly numbered, nodes 1 to nTips must all be tips, nodes (nTips+1) to (nTips+nNodes) must all be internal nodes, All tips must have associated tip labels. Use tipLabels<- (and nodeLabels<- if needed) to update them., One or more tip/node label has an unmatched ID name Use tipLabels<- (and nodeLabels<- if needed) to update them.\n
+ 7
+ Error in .local(x, ...) : \n tips and nodes incorrectly numbered, nodes 1 to nTips must all be tips, nodes (nTips+1) to (nTips+nNodes) must all be internal nodes, One or more tip/node label has an unmatched ID name Use tipLabels<- (and nodeLabels<- if needed) to update them.\n
+ 1
+>
+> if (any(OKvals)) {
++ p2 <- p1[OKvals]
++ length(p2)
++ has.poly <- sapply(p2,hasPoly)
++ has.sing <- sapply(p2,hasSingle)
++ has.retic <- sapply(p2,hasRetic)
++ ##
++ if (any(has.sing)) {
++ p4 <- p2[has.sing]
++ plot(p4[[1]]) ## gives descriptive error
++ t2 <- try(plot(collapse.singles(as(p2[[1]],"phylo"))))
++ ## "incorrect number of dimensions"
++ }
++ if (any(!has.sing)) {
++ ## first tree without singles -- HANGS!
++ ## don't try the plot in an R session you care about ...
++ p3 <- p2[!has.sing]
++ ## plot(p2[[13]])
++ }
++ }
+>
+> ## elements 8 and 34 are
+> ## what SHOULD the rules for trees be?
+>
+> ## (a) reduce node numbers to 1 ... N ?
+> ## (b) check: irreducible, non-cyclic, ... ?
+>
+> ## convert to matrix format for checking?
+>
+> reduce_nodenums <- function(e) {
++ matrix(as.numeric(factor(e)),ncol=2)
++ }
+>
+> # make an illegal phylo4 object, does it pass checks?
+> # a disconnected node:
+>
+> t1 <- read.tree (text="((a,b), (c,(d, e)));")
+> plot(t1)
+>
+> broke1 <- t1
+> broke1$edge[broke1$edge[,2] ==9, 1] <- 9 # disconnect the node, two subtrees, ((a, b), c) and (d,e)
+>
+> try(as(broke1, "phylo4") -> tree, silent=TRUE) # makes a phylo4 object with no warning
+Warning message:
+In checkTree(object) : tree contains singleton nodes
+> try(phylo4(broke1$edge), silent=TRUE) # constructor makes a phylo4 object with no warning
+ label node ancestor edge.length node.type
+1 T1 1 7 NA tip
+2 T2 2 7 NA tip
+3 T3 3 8 NA tip
+4 T4 4 9 NA tip
+5 T5 5 9 NA tip
+6 <NA> 6 0 NA internal
+7 <NA> 7 6 NA internal
+8 <NA> 8 6 NA internal
+9 <NA> 9 9 NA internal
+Warning messages:
+1: In checkTree(object) : tree contains singleton nodes
+2: In checkTree(object) : tree contains singleton nodes
+> ## error message comes from ape, not phylo? -- AND
+> ## error is about singles, not disconnected nodes
+> ## print(try(plot(tree), silent=TRUE )) ## pdc couldn't get this to work, so temporarily commenting
+>
[TRUNCATED]
To get the complete diff run:
svnlook diff /svnroot/phylobase -r 775
More information about the Phylobase-commits
mailing list