From: paradis Date: Wed, 27 Feb 2008 16:07:52 +0000 (+0000) Subject: fixing a few bugs... X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;ds=sidebyside;h=cc052f3adebcde0dbf4531719f84dfc349373f2c;p=ape.git fixing a few bugs... git-svn-id: https://svn.mpl.ird.fr/ape/dev/ape@19 6e262413-ae40-0410-9e79-b911bd7a66b7 --- diff --git a/Changes b/Changes index ae08426..c488bf7 100644 --- a/Changes +++ b/Changes @@ -6,6 +6,25 @@ NEW FEATURES o root() gains the options 'node' and 'resolve.root' (FALSE by default) as well as its code being improved. + o mltt.plot() has now an option 'log' used in the same way + than in plot.default() + + +BUG FIXES + + o mltt.plot() failed to display the legend with an unnamed + list of trees. + + o nodelabels() with pies now correcly uses the argument + 'cex' to draw symbols of different sizes (which has + worked already for thermometers). + + +OTHER CHANGES + + o The argument 'family' of compar.gee() can now be a function + as well as a character string. + CHANGES IN APE VERSION 2.1-1 diff --git a/DESCRIPTION b/DESCRIPTION index d6759e9..f7c1c7a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: ape Version: 2.1-2 -Date: 2008-02-11 +Date: 2008-02-21 Title: Analyses of Phylogenetics and Evolution Author: Emmanuel Paradis, Ben Bolker, Julien Claude, Hoa Sien Cuong, Richard Desper, Benoit Durand, Julien Dutheil, Olivier Gascuel, diff --git a/R/compar.gee.R b/R/compar.gee.R index f8a7b6a..9c52460 100644 --- a/R/compar.gee.R +++ b/R/compar.gee.R @@ -1,4 +1,4 @@ -## compar.gee.R (2008-01-14) +## compar.gee.R (2008-02-21) ## Comparative Analysis with GEEs @@ -30,7 +30,9 @@ do not match: the former were ignored in the analysis.") corstr = "fixed", scale.fix = scale.fix, scale.value = scale.value)) W <- geemod$naive.variance - if (family == "binomial") + fname <- + if is.function(family) deparse(substitute(family)) else family + if (fname == "binomial") W <- summary(glm(formula, family = quasibinomial, data = data))$cov.scaled N <- geemod$nobs dfP <- sum(phy$edge.length)*N / sum(diag(vcv.phylo(phy))) diff --git a/R/dist.topo.R b/R/dist.topo.R index f6784a9..04313b4 100644 --- a/R/dist.topo.R +++ b/R/dist.topo.R @@ -1,9 +1,9 @@ -## dist.topo.R (2007-07-04) +## dist.topo.R (2008-02-27) ## Topological Distances, Tree Bipartitions, ## Consensus Trees, and Bootstrapping Phylogenies -## Copyright 2005-2007 Emmanuel Paradis +## Copyright 2005-2008 Emmanuel Paradis ## This file is part of the R-package `ape'. ## See the file ../COPYING for licensing issues. @@ -165,12 +165,15 @@ prop.clades <- function(phy, ..., part = NULL) boot.phylo <- function(phy, x, FUN, B = 100, block = 1) { if (is.list(x)) { - nm <- names(x) - n <- length(x) - x <- unlist(x) - nL <- length(x) - x <- matrix(x, n, nL/n, byrow = TRUE) - rownames(x) <- nm + if (class(x) == "DNAbin") x <- as.matrix(x) + else { + nm <- names(x) + n <- length(x) + x <- unlist(x) + nL <- length(x) + x <- matrix(x, n, nL/n, byrow = TRUE) + rownames(x) <- nm + } } boot.tree <- vector("list", B) for (i in 1:B) { diff --git a/R/ltt.plot.R b/R/ltt.plot.R index 17f7497..2a0179c 100644 --- a/R/ltt.plot.R +++ b/R/ltt.plot.R @@ -1,8 +1,8 @@ -## ltt.plot.R (2007-12-22) +## ltt.plot.R (2008-02-22) ## Lineages Through Time Plot -## Copyright 2002-2007 Emmanuel Paradis +## Copyright 2002-2008 Emmanuel Paradis ## This file is part of the R-package `ape'. ## See the file ../COPYING for licensing issues. @@ -12,8 +12,8 @@ ltt.plot <- function(phy, xlab = "Time", ylab = "N", ...) if (class(phy) != "phylo") stop('object "phy" is not of class "phylo"') time <- sort(branching.times(phy), decreasing = TRUE) N <- 1:(length(time) + 1) - plot(-c(time, 0), N, xlab = xlab, ylab = ylab, - xaxs = "r", yaxs = "r", type = "S", ...) + plot.default(-c(time, 0), N, xlab = xlab, ylab = ylab, + xaxs = "r", yaxs = "r", type = "S", ...) } ltt.lines <- function(phy, ...) @@ -24,7 +24,7 @@ ltt.lines <- function(phy, ...) } mltt.plot <- function(phy, ..., dcol = TRUE, dlty = FALSE, legend = TRUE, - xlab = "Time", ylab = "N") + xlab = "Time", ylab = "N", log = "") { ltt.xy <- function(phy) { x <- -c(sort(branching.times(phy), decreasing = TRUE), 0) @@ -38,6 +38,9 @@ mltt.plot <- function(phy, ..., dcol = TRUE, dlty = FALSE, legend = TRUE, } else { # a list of trees TREES <- lapply(phy, ltt.xy) names(TREES) <- names(phy) + if (is.null(names(TREES))) + names(TREES) <- + paste(deparse(substitute(phy)), "-", 1:length(TREES)) } dts <- list(...) n <- length(dts) @@ -51,6 +54,9 @@ mltt.plot <- function(phy, ..., dcol = TRUE, dlty = FALSE, legend = TRUE, } else { # a list of trees a <- lapply(dts[[i]], ltt.xy) names(a) <- names(dts[[i]]) + if (is.null(names(a))) + names(a) <- + paste(deparse(substitute(phy)), "-", 1:length(a)) } TREES <- c(TREES, a) } @@ -59,8 +65,8 @@ mltt.plot <- function(phy, ..., dcol = TRUE, dlty = FALSE, legend = TRUE, xl <- c(min(unlist(lapply(TREES, function(x) min(x[, 1])))), 0) yl <- c(1, max(unlist(lapply(TREES, function(x) max(x[, 2]))))) - plot(0, 0, type = "n", xlim = xl, ylim = yl, xaxs = "r", yaxs = "r", - xlab = xlab, ylab = ylab) + plot.default(1, 1, type = "n", xlim = xl, ylim = yl, xaxs = "r", + yaxs = "r", xlab = xlab, ylab = ylab, log = log) lty <- if (!dlty) rep(1, n) else 1:n col <- if (!dcol) rep(1, n) else topo.colors(n) diff --git a/R/nodelabels.R b/R/nodelabels.R index fd87d85..0b73597 100644 --- a/R/nodelabels.R +++ b/R/nodelabels.R @@ -1,4 +1,4 @@ -## nodelabels.R (2008-02-08) +## nodelabels.R (2008-02-21) ## Labelling Trees @@ -106,9 +106,10 @@ BOTHlabels <- function(text, sel, XX, YY, adj, frame, pch, thermo, if (!is.null(pie)) { if (is.vector(pie)) pie <- cbind(pie, 1 - pie) xrad <- CEX * diff(par("usr")[1:2]) / 50 + xrad <- rep(xrad, length(sel)) for (i in 1:length(sel)) floating.pie.asp(XX[i], YY[i], pie[i, ], - radius = xrad, col = piecol) + radius = xrad[i], col = piecol) } if (!is.null(text)) text(XX, YY, text, adj = adj, col = col, ...) if (!is.null(pch)) points(XX + adj[1] - 0.5, YY + adj[2] - 0.5, diff --git a/man/ltt.plot.Rd b/man/ltt.plot.Rd index 9d0b929..b090250 100644 --- a/man/ltt.plot.Rd +++ b/man/ltt.plot.Rd @@ -6,8 +6,8 @@ \usage{ ltt.plot(phy, xlab = "Time", ylab = "N", ...) ltt.lines(phy, ...) -mltt.plot(phy, ..., dcol = TRUE, dlty = FALSE, - legend = TRUE, xlab = "Time", ylab = "N") +mltt.plot(phy, ..., dcol = TRUE, dlty = FALSE, legend = TRUE, + xlab = "Time", ylab = "N", log = "")) } \arguments{ \item{phy}{an object of class \code{"phylo"}; this could be an object @@ -27,6 +27,9 @@ mltt.plot(phy, ..., dcol = TRUE, dlty = FALSE, \code{FALSE}).} \item{legend}{a logical specifying whether a legend should be plotted.} + \item{log}{a character string specifying which axis(es) to be + log-transformed; must be one of the followings: \code{""}, + \code{"x"}, \code{"y"}, or \code{"xy"}.} } \description{ These functions plot, on the current graphical device, the minimum