[Phylobase-commits] r856 - pkg/tests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Mar 9 22:31:45 CET 2014


Author: francois
Date: 2014-03-09 22:31:45 +0100 (Sun, 09 Mar 2014)
New Revision: 856

Added:
   pkg/tests/phylotorture.Rout.save
Removed:
   pkg/tests/phylotorture.Rout.save
Modified:
   pkg/tests/phylotorture.R
Log:
update phylotorture output.

Modified: pkg/tests/phylotorture.R
===================================================================
--- pkg/tests/phylotorture.R	2014-03-09 21:29:44 UTC (rev 855)
+++ pkg/tests/phylotorture.R	2014-03-09 21:31:45 UTC (rev 856)
@@ -11,8 +11,8 @@
     e <- matrix(sample(1:10,replace=TRUE,size=10),ncol=2)
     p1[[i]] <- try(phylo4(e),silent=TRUE)
 }
-OKvals <- sapply(p1,class)!="try-error"
-table(sapply(p1[!OKvals],as.character))
+OKvals <- sapply(p1, class) != "try-error"
+table(sapply(p1[!OKvals], as.character))
 
 if (any(OKvals)) {
     p2 <- p1[OKvals]

Deleted: pkg/tests/phylotorture.Rout.save
===================================================================
--- pkg/tests/phylotorture.Rout.save	2014-03-09 21:29:44 UTC (rev 855)
+++ pkg/tests/phylotorture.Rout.save	2014-03-09 21:31:45 UTC (rev 856)
@@ -1,217 +0,0 @@
-
-R Under development (unstable) (2013-04-25 r62670) -- "Unsuffered Consequences"
-Copyright (C) 2013 The R Foundation for Statistical Computing
-Platform: i686-pc-linux-gnu (32-bit)
-
-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 is 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 messages:
-1: In checkTree(object) : tree contains singleton nodes
-2: In checkTree(object) : tree contains singleton nodes
-3: 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
-> 
-> # root node value != ntips + 1:
-> 
-> broke2 <- t1
-> broke2$edge[broke2$edge==6] <- 10
-> 
-> ## warning, but no error
-> ## plot(broke2)  ## seems to hang R CMD check??
-> ## generates error, but it's about wrong number of tips, not wrong value at root.
-> print(try(as(broke2, "phylo4"), silent=TRUE))
-[1] "Error in .createLabels(value = tip.label, ntips = ntips, nnodes = nnodes,  : \n  Number of labels does not match number of nodes.\n"
-attr(,"class")
-[1] "try-error"
-attr(,"condition")
-<simpleError in .createLabels(value = tip.label, ntips = ntips, nnodes = nnodes,     type = "tip"): Number of labels does not match number of nodes.>
-> ## error regarding number of tip labels vs edges and nodes
-> print(try(phylo4(broke2$edge), silent=TRUE))
-[1] "Error in .local(x, ...) : \n  tips and nodes incorrectly numbered, One or more tip/node label has an unmatched ID name Use tipLabels<- (and nodeLabels<- if needed) to update them.\n"
-attr(,"class")
-[1] "try-error"
-attr(,"condition")
-<simpleError in .local(x, ...): tips and nodes incorrectly numbered, One or more tip/node label has an unmatched ID name Use tipLabels<- (and nodeLabels<- if needed) to update them.>
-Warning message:
-In tips == 1:ntips :
-  longer object length is not a multiple of shorter object length
-> 
-> # switch root node value (6) with next internal node (7):
-> 
-> broke3 <- broke2
-> broke3$edge[broke3$edge==7] <- 6
-> broke3$edge[broke3$edge==10] <- 7
-> 
-> ## both of the following now fail with
-> ## "root node is not at position (nTips+1)
-> try(as(broke3,"phylo4") -> tree3)  # works with no error message
-> try(phylo4(broke3$edge))    # works with no error message
-  label node ancestor edge.length node.type
-1    T1    1        6          NA       tip
-2    T2    2        6          NA       tip
-3    T3    3        8          NA       tip
-4    T4    4        9          NA       tip
-5    T5    5        9          NA       tip
-6  <NA>    6        7          NA  internal
-7  <NA>    7        0          NA  internal
-8  <NA>    8        7          NA  internal
-9  <NA>    9        8          NA  internal
-> ## plot(tree3)  # would work if we could create it?
-> 
-> 
-> # tips have larger numbers than root node:
-> 
-> broke4 <- t1
-> broke4$edge[broke4$edge==1] <- 11
-> broke4$edge[broke4$edge==2] <- 12
-> broke4$edge[broke4$edge==3] <- 13
-> broke4$edge[broke4$edge==4] <- 14
-> broke4$edge[broke4$edge==5] <- 15
-> 
-> print(try(as(broke4, "phylo4"), silent=TRUE) )  # error message saying tree has more than one root
-[1] "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"
-attr(,"class")
-[1] "try-error"
-attr(,"condition")
-<simpleError in .local(x, ...): 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.>
-> print(try(phylo4(broke4$edge),silent=TRUE))     # error message saying tree has more than one root
-[1] "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"
-attr(,"class")
-[1] "try-error"
-attr(,"condition")
-<simpleError in .local(x, ...): 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.>
-> # print(try(plot(broke4), TRUE))   ## CAUSES R TO HANG!
-> 
-> ###
-> foo <- new('phylo4')
-> set.seed(1001)
-> foo at edge <- rcoal(10)$edge
-> print(try(plot(foo)))
-Error in treePlot(x, ...) : treePlot function requires a rooted tree.
-[1] "Error in treePlot(x, ...) : treePlot function requires a rooted tree.\n"
-attr(,"class")
-[1] "try-error"
-attr(,"condition")
-<simpleError in treePlot(x, ...): treePlot function requires a rooted tree.>
-> 
-> foo at label <- c(rep('blah',10), rep("",9))
-> 
-> #####
-> ## tree with only 2 tips: will fail under previous versions
-> ## with "Error in if (which(nAncest == 0) != nTips + 1) { : 
-> ##  argument is of length zero"
-> 
-> edge <- matrix(c(3,1,3,2),byrow=TRUE,ncol=2)
-> try(p2 <- phylo4(edge), silent=TRUE)
-> 
-> proc.time()
-   user  system elapsed 
-  1.996   2.228   4.109 

Added: pkg/tests/phylotorture.Rout.save
===================================================================
--- pkg/tests/phylotorture.Rout.save	                        (rev 0)
+++ pkg/tests/phylotorture.Rout.save	2014-03-09 21:31:45 UTC (rev 856)
@@ -0,0 +1,220 @@
+
+R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"
+Copyright (C) 2013 The R Foundation for Statistical Computing
+Platform: x86_64-pc-linux-gnu (64-bit)
+
+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 is 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)
++ }
+Warning messages:
+1: In checkTree(object) : Tree contains singleton nodes. 
+2: In checkTree(object) : Tree contains singleton nodes. 
+3: In checkTree(object) : Tree contains singleton nodes. 
+4: In checkTree(object) : Tree contains singleton nodes. 
+5: In checkTree(object) : Tree contains singleton nodes. 
+6: In checkTree(object) : Tree contains singleton nodes. 
+7: In checkTree(object) : Tree contains singleton nodes. 
+8: In checkTree(object) : Tree contains singleton nodes. 
+> OKvals <- sapply(p1, class) != "try-error"
+> table(sapply(p1[!OKvals], as.character))
+
+                                                                                                  Error in .local(x, ...) : Nodes incorrectly labeled. \n 
+                                                                                                                                                        1 
+                                                                    Error in .local(x, ...) : \n  Tips incorrectly labeled. Nodes incorrectly labeled. \n 
+                                                                                                                                                        7 
+Error in names(res) <- switch(type, tip = 1:ntips, internal = seq(from = ntips +  : \n  'names' attribute [2] must be the same length as the vector [1]\n 
+                                                                                                                                                        2 
+> 
+> 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 messages:
+1: In checkTree(object) : Tree contains singleton nodes. 
+2: In checkTree(object) : Tree contains singleton nodes. 
+3: 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
+> 
+> # root node value != ntips + 1:
+> 
+> broke2 <- t1
+> broke2$edge[broke2$edge==6] <- 10
+> 
+> ## warning, but no error
+> ## plot(broke2)  ## seems to hang R CMD check??
+> ## generates error, but it's about wrong number of tips, not wrong value at root.
+> print(try(as(broke2, "phylo4"), silent=TRUE))
+[1] "Error in .createLabels(value = tip.label, ntips = ntips, nnodes = nnodes,  : \n  Number of labels does not match number of nodes.\n"
+attr(,"class")
+[1] "try-error"
+attr(,"condition")
+<simpleError in .createLabels(value = tip.label, ntips = ntips, nnodes = nnodes,     type = "tip"): Number of labels does not match number of nodes.>
+> ## error regarding number of tip labels vs edges and nodes
+> print(try(phylo4(broke2$edge), silent=TRUE))
+[1] "Error in .local(x, ...) : Nodes incorrectly labeled. \n"
+attr(,"class")
+[1] "try-error"
+attr(,"condition")
+<simpleError in .local(x, ...): Nodes incorrectly labeled. >
+> 
+> # switch root node value (6) with next internal node (7):
+> 
+> broke3 <- broke2
+> broke3$edge[broke3$edge==7] <- 6
+> broke3$edge[broke3$edge==10] <- 7
+> 
+> ## both of the following now fail with
+> ## "root node is not at position (nTips+1)
+> try(as(broke3,"phylo4") -> tree3)  # works with no error message
+> try(phylo4(broke3$edge))    # works with no error message
+  label node ancestor edge.length node.type
+1    T1    1        6          NA       tip
+2    T2    2        6          NA       tip
+3    T3    3        8          NA       tip
+4    T4    4        9          NA       tip
+5    T5    5        9          NA       tip
+6  <NA>    6        7          NA  internal
+7  <NA>    7        0          NA  internal
+8  <NA>    8        7          NA  internal
+9  <NA>    9        8          NA  internal
+> ## plot(tree3)  # would work if we could create it?
+> 
+> 
+> # tips have larger numbers than root node:
+> 
+> broke4 <- t1
+> broke4$edge[broke4$edge==1] <- 11
+> broke4$edge[broke4$edge==2] <- 12
+> broke4$edge[broke4$edge==3] <- 13
+> broke4$edge[broke4$edge==4] <- 14
+> broke4$edge[broke4$edge==5] <- 15
+> 
+> print(try(as(broke4, "phylo4"), silent=TRUE) )  # error message saying tree has more than one root
+[1] "Error in .local(x, ...) : Nodes incorrectly labeled. \n"
+attr(,"class")
+[1] "try-error"
+attr(,"condition")
+<simpleError in .local(x, ...): Nodes incorrectly labeled. >
+> print(try(phylo4(broke4$edge),silent=TRUE))     # error message saying tree has more than one root
+[1] "Error in .local(x, ...) : Nodes incorrectly labeled. \n"
+attr(,"class")
+[1] "try-error"
+attr(,"condition")
+<simpleError in .local(x, ...): Nodes incorrectly labeled. >
+> # print(try(plot(broke4), TRUE))   ## CAUSES R TO HANG!
+> 
+> ###
+> foo <- new('phylo4')
+> set.seed(1001)
+> foo at edge <- rcoal(10)$edge
+> print(try(plot(foo)))
+Error in treePlot(x, ...) : treePlot function requires a rooted tree.
+[1] "Error in treePlot(x, ...) : treePlot function requires a rooted tree.\n"
+attr(,"class")
+[1] "try-error"
+attr(,"condition")
+<simpleError in treePlot(x, ...): treePlot function requires a rooted tree.>
+> 
+> foo at label <- c(rep('blah',10), rep("",9))
+> 
+> #####
+> ## tree with only 2 tips: will fail under previous versions
+> ## with "Error in if (which(nAncest == 0) != nTips + 1) { : 
+> ##  argument is of length zero"
+> 
+> edge <- matrix(c(3,1,3,2),byrow=TRUE,ncol=2)
+> try(p2 <- phylo4(edge), silent=TRUE)
+> 
+> proc.time()
+   user  system elapsed 
+  5.551   0.181   5.773 



More information about the Phylobase-commits mailing list