From 1ad48c7a70983375138a6500372db588c8a3a134 Mon Sep 17 00:00:00 2001 From: paradis Date: Fri, 13 Jan 2012 01:47:39 +0000 Subject: [PATCH] final wrap for ape 3.0 git-svn-id: https://svn.mpl.ird.fr/ape/dev/ape@175 6e262413-ae40-0410-9e79-b911bd7a66b7 --- DESCRIPTION | 4 +-- NEWS | 7 ++++- R/DNA.R | 4 +-- R/clustal.R | 6 ++-- R/read.nexus.R | 2 +- R/read.tree.R | 2 +- man/DNAbin.Rd | 2 +- man/read.tree.Rd | 5 ++- src/dist_dna.c | 79 +++++++++++++++++++++++++++++++++--------------- 9 files changed, 74 insertions(+), 37 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index f63f9a3..d86b0c6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: ape -Version: 2.8-1 -Date: 2011-12-03 +Version: 3.0 +Date: 2012-01-13 Title: Analyses of Phylogenetics and Evolution Author: Emmanuel Paradis, Ben Bolker, Julien Claude, Hoa Sien Cuong, Richard Desper, Benoit Durand, Julien Dutheil, Olivier Gascuel, Christoph Heibl, Daniel Lawson, Vincent Lefort, Pierre Legendre, Jim Lemon, Yvonnick Noel, Johan Nylander, Rainer Opgen-Rhein, Andrei-Alin Popescu, Klaus Schliep, Korbinian Strimmer, Damien de Vienne Maintainer: Emmanuel Paradis diff --git a/NEWS b/NEWS index cc8d3af..55d0adc 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ - CHANGES IN APE VERSION 2.8-1 + CHANGES IN APE VERSION 3.0 NEW FEATURES @@ -15,6 +15,8 @@ BUG FIXES o extract.clade() sometimes shuffled some tip labels (thanks to Ludovic Mallet and Mahendra Mariadassou for the fix). + o clustal() should now by default find the executable under Windows. + OTHER CHANGES @@ -24,6 +26,9 @@ OTHER CHANGES o The code of mantel.test() has been adjusted to be consistent with common permutation tests. + o The C code of base.freq() has been improved and is now nearly 8 + times faster. + CHANGES IN APE VERSION 2.8 diff --git a/R/DNA.R b/R/DNA.R index df5b892..54898cf 100644 --- a/R/DNA.R +++ b/R/DNA.R @@ -1,8 +1,8 @@ -## DNA.R (2011-03-21) +## DNA.R (2012-01-10) ## Manipulations and Comparisons of DNA Sequences -## Copyright 2002-2011 Emmanuel Paradis +## Copyright 2002-2012 Emmanuel Paradis ## This file is part of the R-package `ape'. ## See the file ../COPYING for licensing issues. diff --git a/R/clustal.R b/R/clustal.R index 3cfd1c0..656ecb2 100644 --- a/R/clustal.R +++ b/R/clustal.R @@ -1,8 +1,8 @@ -## clustal.R (2011-03-16) +## clustal.R (2012-01-12) ## Multiple Sequence Alignment with External Applications -## Copyright 2011 Emmanuel Paradis +## Copyright 2011-2012 Emmanuel Paradis ## This file is part of the R-package `ape'. ## See the file ../COPYING for licensing issues. @@ -15,7 +15,7 @@ clustal <- function(x, pw.gapopen = 10, pw.gapext = 0.1, if (is.null(exec)) { if (os == "Linux") exec <- "clustalw" if (os == "Darwin") exec <- "clustalw2" - if (os == "Windows") exec <- "C:/Program Files/ClustalW2/clustalw2" + if (os == "Windows") shortPathName("C:/Program Files/ClustalW2/clustalw2.exe") } if (missing(x)) { diff --git a/R/read.nexus.R b/R/read.nexus.R index cdbc291..642bee7 100644 --- a/R/read.nexus.R +++ b/R/read.nexus.R @@ -222,7 +222,7 @@ read.nexus <- function(file, tree.names = NULL) if (!translation) n <- length(tr$tip.label) ROOT <- n + 1 if (sum(tr$edge[, 1] == ROOT) == 1 && dim(tr$edge)[1] > 1) { - stop(paste("There is apparently two root edges in your file: cannot read tree file.\n Reading NEXUS file aborted at tree no.", i, sep = "")) + stop(paste("The tree has apparently singleton node(s): cannot read tree file.\n Reading NEXUS file aborted at tree no.", i, sep = "")) } } if (Ntree == 1) { diff --git a/R/read.tree.R b/R/read.tree.R index 87ae296..cba51d1 100644 --- a/R/read.tree.R +++ b/R/read.tree.R @@ -158,7 +158,7 @@ read.tree <- function(file = "", text = NULL, tree.names = NULL, skip = 0, ## is a bifurcation at the root ROOT <- length(obj[[i]]$tip.label) + 1 if(sum(obj[[i]]$edge[, 1] == ROOT) == 1 && dim(obj[[i]]$edge)[1] > 1) - stop(paste("There is apparently two root edges in your file: cannot read tree file.\n Reading Newick file aborted at tree no.", i, sep = "")) + stop(paste("The tree has apparently singleton node(s): cannot read tree file.\n Reading Newick file aborted at tree no.", i)) } if (Ntree == 1 && !keep.multi) obj <- obj[[1]] else { if (!is.null(tree.names)) names(obj) <- tree.names diff --git a/man/DNAbin.Rd b/man/DNAbin.Rd index eb6983e..bd9abcc 100644 --- a/man/DNAbin.Rd +++ b/man/DNAbin.Rd @@ -83,7 +83,7 @@ \url{http://ape.mpl.ird.fr/misc/BitLevelCodingScheme_20April2007.pdf} Paradis, E. (2012) \emph{Analysis of Phylogenetics and Evolution with - R (Second Edition)}. New York: Springer. + R (Second Edition).} New York: Springer. } \author{Emmanuel Paradis} \seealso{ diff --git a/man/read.tree.Rd b/man/read.tree.Rd index 5e31c55..64bc829 100644 --- a/man/read.tree.Rd +++ b/man/read.tree.Rd @@ -48,7 +48,7 @@ read.tree(file = "", text = NULL, tree.names = NULL, skip = 0, message is issued. If there are any characters preceding the first "(" in a line then - this is assigned to the name. This is returned when a "multiphylo" + this is assigned to the name. This is returned when a "multiPhylo" object is returned and \code{tree.names = NULL}. } \value{ @@ -83,6 +83,9 @@ read.tree(file = "", text = NULL, tree.names = NULL, skip = 0, Paradis, E. (2008) Definition of Formats for Coding Phylogenetic Trees in R. \url{http://ape.mpl.ird.fr/misc/FormatTreeR_28July2008.pdf} + + Paradis, E. (2012) \emph{Analysis of Phylogenetics and Evolution with + R (Second Edition).} New York: Springer. } \author{Emmanuel Paradis and Daniel Lawson \email{dan.lawson@bristol.ac.uk}} diff --git a/src/dist_dna.c b/src/dist_dna.c index 210479e..7174af6 100644 --- a/src/dist_dna.c +++ b/src/dist_dna.c @@ -1,6 +1,6 @@ -/* dist_dna.c 2011-06-23 */ +/* dist_dna.c 2012-01-10 */ -/* Copyright 2005-2011 Emmanuel Paradis +/* Copyright 2005-2012 Emmanuel Paradis /* This file is part of the R-package `ape'. */ /* See the file ../COPYING for licensing issues. */ @@ -989,31 +989,60 @@ void distDNA_ParaLin_pairdel(unsigned char *x, int *n, int *s, double *d, /* if (! *freq) for (i = 0; i < 4; i++) BF[i] /= m; */ /* } */ +/* void BaseProportion(unsigned char *x, int *n, double *BF) */ +/* { */ +/* int i; */ + +/* for (i = 0; i < *n; i++) { */ +/* switch (x[i]) { */ +/* case 136 : BF[0]++; break; */ +/* case 40 : BF[1]++; break; */ +/* case 72 : BF[2]++; break; */ +/* case 24 : BF[3]++; break; */ +/* case 192 : BF[4]++; break; */ +/* case 160 : BF[5]++; break; */ +/* case 144 : BF[6]++; break; */ +/* case 96 : BF[7]++; break; */ +/* case 80 : BF[8]++; break; */ +/* case 48 : BF[9]++; break; */ +/* case 224 : BF[10]++; break; */ +/* case 176 : BF[11]++; break; */ +/* case 208 : BF[12]++; break; */ +/* case 112 : BF[13]++; break; */ +/* case 240 : BF[14]++; break; */ +/* case 4 : BF[15]++; break; */ +/* case 2 : BF[16]++; break; */ +/* } */ +/* } */ +/* } */ + +/* a hash table is much faster than switch (2012-01-10) */ void BaseProportion(unsigned char *x, int *n, double *BF) { - int i; - - for (i = 0; i < *n; i++) { - switch (x[i]) { - case 136 : BF[0]++; break; - case 40 : BF[1]++; break; - case 72 : BF[2]++; break; - case 24 : BF[3]++; break; - case 192 : BF[4]++; break; - case 160 : BF[5]++; break; - case 144 : BF[6]++; break; - case 96 : BF[7]++; break; - case 80 : BF[8]++; break; - case 48 : BF[9]++; break; - case 224 : BF[10]++; break; - case 176 : BF[11]++; break; - case 208 : BF[12]++; break; - case 112 : BF[13]++; break; - case 240 : BF[14]++; break; - case 4 : BF[15]++; break; - case 2 : BF[16]++; break; - } - } + int i; + double count[256]; + + memset(count, 0, 256*sizeof(double)); + + for (i = 0; i < *n; i++) count[x[i]]++; + + BF[0] = count[136]; + BF[1] = count[40]; + BF[2] = count[72]; + BF[3] = count[24]; + BF[4] = count[192]; + BF[5] = count[160]; + BF[6] = count[144]; + BF[7] = count[96]; + BF[8] = count[80]; + BF[9] = count[48]; + BF[10] = count[224]; + BF[11] = count[176]; + BF[12] = count[208]; + BF[13] = count[112]; + BF[14] = count[240]; + BF[15] = count[4]; + BF[16] = count[2]; } void SegSites(unsigned char *x, int *n, int *s, int *seg) -- 2.39.2