From: paradis Date: Mon, 30 Mar 2009 07:26:50 +0000 (+0000) Subject: various changes for ape 2.3 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=ab6699f9054798268ce371d664e6d9d45bb4dd3a;p=ape.git various changes for ape 2.3 git-svn-id: https://svn.mpl.ird.fr/ape/dev/ape@69 6e262413-ae40-0410-9e79-b911bd7a66b7 --- diff --git a/ChangeLog b/ChangeLog index a32f0f8..ffbca02 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19,6 +19,8 @@ NEW FEATURES o plot.phylo() has a new argument 'edge.lty' that specifies the types of lines used for the edges (plain, dotted, dashed, ...) + o phymltest() has been updated to work with PhyML 3.0.1. + BUG FIXES diff --git a/DESCRIPTION b/DESCRIPTION index bcf5e68..f98af14 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,26 +1,8 @@ Package: ape Version: 2.3 -Date: 2009-03-27 +Date: 2009-03-29 Title: Analyses of Phylogenetics and Evolution -Author: Emmanuel Paradis, -Ben Bolker, -Julien Claude, -Hoa Sien Cuong, -Richard Desper, -Benoit Durand, -Julien Dutheil, -Olivier Gascuel, -Gangolf Jobb, -Christoph Heibl, -Daniel Lawson, -Vincent Lefort, -Pierre Legendre, -Jim Lemon, -Yvonnick Noel, -Johan Nylander, -Rainer Opgen-Rhein, -Korbinian Strimmer, -Damien de Vienne +Author: Emmanuel Paradis, Ben Bolker, Julien Claude, Hoa Sien Cuong, Richard Desper, Benoit Durand, Julien Dutheil, Olivier Gascuel, Gangolf Jobb, Christoph Heibl, Daniel Lawson, Vincent Lefort, Pierre Legendre, Jim Lemon, Yvonnick Noel, Johan Nylander, Rainer Opgen-Rhein, Korbinian Strimmer, Damien de Vienne Maintainer: Emmanuel Paradis Depends: R (>= 2.6.0) Suggests: gee diff --git a/R/phymltest.R b/R/phymltest.R index a354507..a87d46d 100644 --- a/R/phymltest.R +++ b/R/phymltest.R @@ -1,8 +1,8 @@ -## phymltest.R (2008-10-08) +## phymltest.R (2009-03-29) ## Fits a Bunch of Models with PhyML -## Copyright 2004-2008 Emmanuel Paradis +## Copyright 2004-2009 Emmanuel Paradis ## This file is part of the R-package `ape'. ## See the file ../COPYING for licensing issues. @@ -26,9 +26,9 @@ phymltest <- function(seqfile, format = "interleaved", itree = NULL, os <- Sys.info()[1] ## default names of PhyML: if (is.null(execname)) { - if (os == "Linux") execname <- "phyml_3.0_linux32" - if (os == "Darwin") execname <- "phyml_3.0_macintel" - if (os == "Windows") execname <- "phyml_3.0_win32" + if (os == "Linux") execname <- "phyml_3.0.1_linux32" + if (os == "Darwin") execname <- "phyml_3.0.1_macintel" + if (os == "Windows") execname <- "phyml_3.0.1_win32" } if (is.null(execname)) stop("you must give an executable file name for PHYML") @@ -41,7 +41,7 @@ phymltest <- function(seqfile, format = "interleaved", itree = NULL, tstv <- rep("-t e", N) # ignored by PhyML with JC69 or F81 inv <- rep(c("", "-v e"), length.out = N) ## no need to use the -c option of PhyML (4 categories by default if '-a e' is set): - alpha <- rep(rep(c("", "-a e"), each = 2), length.out = N) + alpha <- rep(rep(c("-c 1", "-a e"), each = 2), length.out = N) tree <- rep("", N) if (!is.null(itree)) tree[] <- paste("-u ", itree) diff --git a/R/read.tree.R b/R/read.tree.R index aa508b0..aa0b029 100644 --- a/R/read.tree.R +++ b/R/read.tree.R @@ -1,4 +1,4 @@ -## read.tree.R (2009-03-09) +## read.tree.R (2009-03-29) ## Read Tree Files in Parenthetic Format @@ -98,12 +98,13 @@ read.tree <- function(file = "", text = NULL, tree.names = NULL, skip = 0, comment.char = "#", keep.multi = FALSE, ...) { unname <- function(treetext) { + nc <- nchar(treetext) tstart <- 1 - while (substr(treetext, tstart, tstart) != "(" && tstart <= nchar(treetext)) + while (substr(treetext, tstart, tstart) != "(" && tstart <= nc) tstart <- tstart + 1 if (tstart > 1) return(c(substr(treetext, 1, tstart - 1), - substr(treetext, tstart, nchar(treetext)))) + substr(treetext, tstart, nc))) return(c("", treetext)) } if (!is.null(text)) { @@ -114,10 +115,6 @@ read.tree <- function(file = "", text = NULL, tree.names = NULL, skip = 0, tree <- scan(file = file, what = "", sep = "\n", quiet = TRUE, skip = skip, comment.char = comment.char, ...) } - tmp <- lapply(tree, unname) - tmpnames <- sapply(tmp, function(x) x[1]) - tree <- sapply(tmp, function(x) x[2]) - if (is.null(tree.names) && any(nzchar(tmpnames))) tree.names <- tmpnames ## Suggestion from Eric Durand and Nicolas Bortolussi (added 2005-08-17): if (identical(tree, character(0))) { warning("empty character string.") @@ -133,6 +130,13 @@ read.tree <- function(file = "", text = NULL, tree.names = NULL, skip = 0, STRING <- character(Ntree) for (i in 1:Ntree) STRING[i] <- paste(tree[x[i]:y[i]], sep = "", collapse = "") + + tmp <- unlist(lapply(STRING, unname)) + tmpnames <- tmp[c(TRUE, FALSE)] + tree <- tmp[c(FALSE, TRUE)] + if (is.null(tree.names) && any(nzchar(tmpnames))) + tree.names <- tmpnames + colon <- grep(":", STRING) if (!length(colon)) { obj <- lapply(STRING, clado.build) diff --git a/R/write.tree.R b/R/write.tree.R index 6bb4f82..058565c 100644 --- a/R/write.tree.R +++ b/R/write.tree.R @@ -83,8 +83,8 @@ write.tree <- } } n <- length(phy$tip.label) - if(tree.names){STRING <- paste(tname,"(",sep="") - }else STRING <- "(" + STRING <- + if (output.tree.names) paste(tree.names, "(", sep = "") else "(" br <- which(phy$edge[, 1] == n + 1) for (j in br) { desc <- phy$edge[j, 2] diff --git a/data/woodmouse.R b/data/woodmouse.R index 644fd91..716be9a 100644 --- a/data/woodmouse.R +++ b/data/woodmouse.R @@ -1,2 +1,2 @@ -require(ape, quietly = TRUE, save = FALSE) # added line +require(ape, quietly = TRUE, save = FALSE) woodmouse <- read.dna("woodmouse.txt", format = "sequential") diff --git a/man/CADM.global.Rd b/man/CADM.global.Rd index efd5729..ee153ac 100644 --- a/man/CADM.global.Rd +++ b/man/CADM.global.Rd @@ -10,8 +10,10 @@ Function \code{\link{CADM.post}} carries out a posteriori permutation tests of t Use in phylogenetic analysis: to identify congruence among distance matrices (D) representing different genes or different types of data. Congruent D matrices correspond to data tables that can be used together in a combined phylogenetic or other type of multivariate analysis. } \usage{ -CADM.global(Dmat, nmat, n, nperm=99, make.sym=TRUE, weights=NULL, silent=FALSE) -CADM.post (Dmat, nmat, n, nperm=99, make.sym=TRUE, weights=NULL, mult="holm", mantel=FALSE, silent=FALSE) +CADM.global(Dmat, nmat, n, nperm=99, make.sym=TRUE, weights=NULL, + silent=FALSE) +CADM.post (Dmat, nmat, n, nperm=99, make.sym=TRUE, weights=NULL, + mult="holm", mantel=FALSE, silent=FALSE) } \arguments{ @@ -34,23 +36,23 @@ The corrections used for multiple testing are applied to the list of P-values (P The Holm correction is computed after ordering the P-values in a list with the smallest value to the left. Compute adjusted P-values as: -\eqn{P_corr = (k-i+1)*P} +\deqn{P_{corr} = (k-i+1)*P}{P_corr = (k-i+1)*P} -where i is the position in the ordered list. Final step: from left to right, if an adjusted P_corr in the ordered list is smaller than the one occurring at its left, make the smallest one equal to the largest one. +where i is the position in the ordered list. Final step: from left to right, if an adjusted \eqn{P_{corr}}{P_corr} in the ordered list is smaller than the one occurring at its left, make the smallest one equal to the largest one. The Sidak correction is: -\eqn{P_corr = 1 - (1 - P)^k} +\deqn{P_{corr} = 1 - (1 - P)^k}{P_corr = 1 - (1 - P)^k} The Bonferonni correction is: -\eqn{P_corr = k*P} +\deqn{P_{corr} = k*P}{P_corr = k*P} } \value{ -\code{CADM.global} produces a small table containing the W, Chi2, and Prob.perm statistics described in the following list. -\code{CADM.post} produces a table stored in element $A_posteriori_tests, containing Mantel.mean, Prob, and Corrected.prob statistics in rows; the columns correspond to the k distance matrices under study, labeled Dmat.1 to Dmat.k. +\code{CADM.global} produces a small table containing the W, Chi2, and Prob.perm statistics described in the following list. +\code{CADM.post} produces a table stored in element \code{A_posteriori_tests}, containing Mantel.mean, Prob, and Corrected.prob statistics in rows; the columns correspond to the k distance matrices under study, labeled Dmat.1 to Dmat.k. If parameter \code{mantel} is TRUE, tables of Mantel statistics and P-values are computed among the matrices. \item{W }{Kendall's coefficient of concordance, W (Kendall and Babington Smith 1939). } @@ -84,7 +86,7 @@ Legendre, P. et F.-J. Lapointe. 2005. Congruence entre matrices de distance. P. Siegel, S. and N. J. Castellan, Jr. 1988. Nonparametric statistics for the behavioral sciences. 2nd edition. McGraw-Hill, New York. } -\seealso{ \code{\link{kendall.W}}, \code{\link[ape:ape-package]{ape}} } + \author{ Pierre Legendre, Universite de Montreal } \examples{ diff --git a/man/mat3.Rd b/man/mat3.Rd new file mode 100644 index 0000000..791cc2b --- /dev/null +++ b/man/mat3.Rd @@ -0,0 +1,23 @@ +\name{mat3} +\alias{mat3} +\title{Three Matrices} +\description{ + Three matrices respectively representing Serological (asymmetric), + DNA hybridization (asymmetric) and Anatomical (symmetric) distances + among 9 families. +} +\usage{ +data(mat3) +} +\format{ + A data frame with 27 observations and 9 variables. +} +\source{ + Lapointe, F.-J., J. A. W. Kirsch and J. M. Hutcheon. 1999. Total + evidence, consensus, and bat phylogeny: a distance-based + approach. Molecular Phylogenetics and Evolution 11: 55-66. +} +\seealso{ + \code{\link{mat5Mrand}}, \code{\link{mat5M3ID}} +} +\keyword{datasets} diff --git a/man/mat5M3ID.Rd b/man/mat5M3ID.Rd new file mode 100644 index 0000000..adc38cf --- /dev/null +++ b/man/mat5M3ID.Rd @@ -0,0 +1,19 @@ +\name{mat5M3ID} +\alias{mat5M3ID} +\title{Five Trees} +\description{ + Three partly similar trees, two independent trees. +} +\usage{ +data(mat5M3ID) +} +\format{ + A data frame with 250 observations and 50 variables. +} +\source{ + Data provided by V. Campbell. +} +\seealso{ + \code{\link{mat5Mrand}}, \code{\link{mat3}} +} +\keyword{datasets} diff --git a/man/mat5Mrand.Rd b/man/mat5Mrand.Rd new file mode 100644 index 0000000..a567de1 --- /dev/null +++ b/man/mat5Mrand.Rd @@ -0,0 +1,19 @@ +\name{mat5Mrand} +\alias{mat5Mrand} +\title{Five Independent Trees} +\description{ + Five independent additive trees. +} +\usage{ +data(mat5Mrand) +} +\format{ + A data frame with 250 observations and 50 variables. +} +\source{ + Data provided by V. Campbell. +} +\seealso{ + \code{\link{mat5M3ID}}, \code{\link{mat3}} +} +\keyword{datasets} diff --git a/man/phymltest.Rd b/man/phymltest.Rd index d71789a..d4587cc 100644 --- a/man/phymltest.Rd +++ b/man/phymltest.Rd @@ -45,7 +45,7 @@ phymltest(seqfile, format = "interleaved", itree = NULL, returned in R as a vector with the log-likelihood value of each model. } \details{ - The present function requires version 3.0 of PhyML; it won't work with + The present function requires version 3.0.1 of PhyML; it won't work with older versions. The user must take care to set correctly the three different paths diff --git a/man/yule.time.Rd b/man/yule.time.Rd index a5c2689..a6574b0 100644 --- a/man/yule.time.Rd +++ b/man/yule.time.Rd @@ -60,7 +60,7 @@ birth.step <- function(l1, l2, Tcl) { # 2 rates with one break-point ans } ### ... and their primitives: -BIRTH.logis <- function(a, b) log(exp(-a*t) + exp(b))/a + t +BIRTH.logis <- function(t) log(exp(-a*t) + exp(b))/a + t BIRTH.step <- function(t) { if (t <= Tcl) return(t*l1) @@ -70,7 +70,7 @@ data(bird.families) ### fit both models: yule.time(bird.families, birth.logis) yule.time(bird.families, birth.logis, BIRTH.logis) # same but faster -yule.time(bird.families, birth.step) # fails +\dontrun{yule.time(bird.families, birth.step)} # fails yule.time(bird.families, birth.step, BIRTH.step) } \keyword{models}