[Phylobase-commits] r127 - in pkg: R tests
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Feb 27 16:37:59 CET 2008
Author: bbolker
Date: 2008-02-27 16:37:59 +0100 (Wed, 27 Feb 2008)
New Revision: 127
Modified:
pkg/R/plot.R
pkg/tests/phylotorture.R
Log:
made check_phylo4 calls in plot.R actually do something
Modified: pkg/R/plot.R
===================================================================
--- pkg/R/plot.R 2008-02-26 21:58:17 UTC (rev 126)
+++ pkg/R/plot.R 2008-02-27 15:37:59 UTC (rev 127)
@@ -12,7 +12,8 @@
setGeneric("plot")
setMethod("plot",signature(x="phylo4",y="missing"), function(x,...){
- invisible(check_phylo4(x))
+ if (is.character(chk <- check_phylo4(x)))
+ stop("bad phylo4 object: ",chk)
if(!require(ape)) stop("the ape package is required")
x <- as(x, "phylo")
plot(x, ...)
@@ -27,10 +28,13 @@
## plot phylo4d
################
setMethod("plot", signature(x="phylo4d",y="missing"),
- function(x, treetype=c("phylogram","cladogram"), symbol=c("circles", "squares"), center=TRUE, scale=TRUE, legend=TRUE, grid=TRUE, box=TRUE, show.tip.label=TRUE, show.node.label=TRUE, show.var.label=TRUE, ratio.tree=1/3, font=3, tip.label=x at tip.label, var.label=colnames(x at tip.data), cex.symbol=1, cex.label=1, cex.legend=1, ...){
+ function(x, treetype=c("phylogram","cladogram"), symbol=c("circles", "squares"), center=TRUE, scale=TRUE, legend=TRUE, grid=TRUE, box=TRUE, show.tip.label=TRUE, show.node.label=TRUE, show.var.label=TRUE, ratio.tree=1/3, font=3, tip.label=x at tip.label, var.label=colnames(x at tip.data), cex.symbol=1, cex.label=1, cex.legend=1, ...)
+ {
- #### preliminary stuff and checks
- invisible(check_phylo4(x))
+ ## preliminary stuff and checks
+ if (is.character(chk <- check_phylo4(x)))
+ stop("bad phylo4d object: ",chk)
+
if(!require(ape)) stop("the ape package is required")
## if(ncol(tdata(x,which="tip")) == 0) stop("no data in this phylo4d object")
Modified: pkg/tests/phylotorture.R
===================================================================
--- pkg/tests/phylotorture.R 2008-02-26 21:58:17 UTC (rev 126)
+++ pkg/tests/phylotorture.R 2008-02-27 15:37:59 UTC (rev 127)
@@ -93,3 +93,9 @@
print(try(phylo4(broke4$edge),silent=TRUE)) # error message saying tree has more than one root
# 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)))
+
More information about the Phylobase-commits
mailing list