]> git.donarmstrong.com Git - ape.git/commitdiff
various changes for ape 2.3
authorparadis <paradis@6e262413-ae40-0410-9e79-b911bd7a66b7>
Mon, 30 Mar 2009 07:26:50 +0000 (07:26 +0000)
committerparadis <paradis@6e262413-ae40-0410-9e79-b911bd7a66b7>
Mon, 30 Mar 2009 07:26:50 +0000 (07:26 +0000)
git-svn-id: https://svn.mpl.ird.fr/ape/dev/ape@69 6e262413-ae40-0410-9e79-b911bd7a66b7

12 files changed:
ChangeLog
DESCRIPTION
R/phymltest.R
R/read.tree.R
R/write.tree.R
data/woodmouse.R
man/CADM.global.Rd
man/mat3.Rd [new file with mode: 0644]
man/mat5M3ID.Rd [new file with mode: 0644]
man/mat5Mrand.Rd [new file with mode: 0644]
man/phymltest.Rd
man/yule.time.Rd

index a32f0f85000533f0a45e9b61985d41a600a77391..ffbca029d4e12518c0b3f326641a93dc80e44e73 100644 (file)
--- 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
 
index bcf5e6810b88860d6b5a6a47eae6f85aacf26608..f98af1440d09d75f3698df1a64484ec3c0ea615a 100644 (file)
@@ -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 <Emmanuel.Paradis@ird.fr>
 Depends: R (>= 2.6.0)
 Suggests: gee
index a3545071902ed1d1a51d081d3d9d42309658375c..a87d46dfe6ed843216238ad061378138982c6548 100644 (file)
@@ -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)
 
index aa508b0eab5d37879162a9a0a16746cbc4e68041..aa0b0294e0b695f82d58ab677d3732cd175b0756 100644 (file)
@@ -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)
index 6bb4f825d06b5f3511065e80725eacd6507c4508..058565c1364fbe4c1437620e0f4740ae9ef934b1 100644 (file)
@@ -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]
index 644fd919b16c89b0ef969717b08f76694469a942..716be9a0299c5c5a27aee7ef23177c4ef82c331a 100644 (file)
@@ -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")
index efd57297b5c5a5983c4d3b91262497542d470f24..ee153acf8681e99a2ceb8f9281fc9e0d36cf1262 100644 (file)
@@ -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 (file)
index 0000000..791cc2b
--- /dev/null
@@ -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 (file)
index 0000000..adc38cf
--- /dev/null
@@ -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 (file)
index 0000000..a567de1
--- /dev/null
@@ -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}
index d71789aa3fc7d393a76ff2fa31a1037dfdf0adc8..d4587cc6e104b6418c106117b5f63f61abf32de5 100644 (file)
@@ -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
index a5c268960a6477fbd8f5dad31b8bf53652dce6ba..a6574b0ba8b64ee2ec8c4e532d3b3b072a15908c 100644 (file)
@@ -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}