From: paradis Date: Fri, 22 Jun 2012 08:15:03 +0000 (+0000) Subject: some small changes X-Git-Url: https://git.donarmstrong.com/?p=ape.git;a=commitdiff_plain;h=199144b0297c3fc76d76c29e561151235e39f0af some small changes git-svn-id: https://svn.mpl.ird.fr/ape/dev/ape@189 6e262413-ae40-0410-9e79-b911bd7a66b7 --- diff --git a/DESCRIPTION b/DESCRIPTION index 0f031c1..66a9e92 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: ape -Version: 3.0-4 -Date: 2012-05-03 +Version: 3.0-5 +Date: 2012-06-22 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 e4235a9..ec8918a 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,16 @@ + CHANGES IN APE VERSION 3.0-5 + + +OTHER CHANGES + + o write.dna(format = "fasta") now conforms more closely to the + FASTA standard thanks to François Michonneau. + + o print.DNAbin() does not print base compositions if there are more + than one million nucleotides. + + + CHANGES IN APE VERSION 3.0-4 @@ -7,8 +20,7 @@ BUG FIXES tabulations instead of white spaces. o read.dna() failed to read Phylip or Clustal files with less than - 10 nucleotides failed. (See other changes in this function - below.) + 10 nucleotides. (See other changes in this function below.) OTHER CHANGES @@ -16,6 +28,8 @@ OTHER CHANGES taxa names and the sequences (whatever the length of taxa names). write.dna() now follows the same rule. + o The option 'seq.names' of read.dna has been removed. + o The files ape-defunct.R and ape-defunct.Rd, which have not been modified for almost two years, have been removed. diff --git a/R/DNA.R b/R/DNA.R index 70b210b..2bd7520 100644 --- a/R/DNA.R +++ b/R/DNA.R @@ -1,4 +1,4 @@ -## DNA.R (2012-02-14) +## DNA.R (2012-06-19) ## Manipulations and Comparisons of DNA Sequences @@ -184,13 +184,16 @@ print.DNAbin <- function(x, printlen = 6, digits = 3, ...) nms <- names(x) if (n == 1) { cat("1 DNA sequence in binary format stored in a list.\n\n") - cat("Sequence length:", length(x[[1]]), "\n\n") + nTot <- length(x[[1]]) + cat("Sequence length:", nTot, "\n\n") cat("Label:", nms, "\n\n") } else { cat(n, "DNA sequences in binary format stored in a list.\n\n") tmp <- unlist(lapply(x, length)) - mini <- min(tmp) - maxi <- max(tmp) + nTot <- sum(tmp) + mini <- range(tmp) + maxi <- mini[2] + mini <- mini[1] if (mini == maxi) cat("All sequences of same length:", maxi, "\n") else { @@ -205,23 +208,28 @@ print.DNAbin <- function(x, printlen = 6, digits = 3, ...) } cat("\nLabels:", paste(nms, collapse = " "), TAIL) } - } else if (is.matrix(x)) { - nd <- dim(x) - nms <- rownames(x) - cat(nd[1], "DNA sequences in binary format stored in a matrix.\n\n") - cat("All sequences of same length:", nd[2], "\n") - TAIL <- "\n\n" - if (printlen < nd[1]) { - nms <- nms[1:printlen] - TAIL <- "...\n\n" - } - cat("\nLabels:", paste(nms, collapse = " "), TAIL) } else { - cat("1 DNA sequence in binary format stored in a vector.\n\n") - cat("Sequence length:", length(x), "\n\n") + nTot <- length(x) + if (is.matrix(x)) { + nd <- dim(x) + nms <- rownames(x) + cat(nd[1], "DNA sequences in binary format stored in a matrix.\n\n") + cat("All sequences of same length:", nd[2], "\n") + TAIL <- "\n\n" + if (printlen < nd[1]) { + nms <- nms[1:printlen] + TAIL <- "...\n\n" + } + cat("\nLabels:", paste(nms, collapse = " "), TAIL) + } else { + cat("1 DNA sequence in binary format stored in a vector.\n\n") + cat("Sequence length:", nTot, "\n\n") + } } - cat("Base composition:\n") - print(round(base.freq(x), digits)) + if (nTot <= 1e6) { + cat("Base composition:\n") + print(round(base.freq(x), digits)) + } else cat("More than 1 million nucleotides: not printing base composition\n") } as.DNAbin <- function(x, ...) UseMethod("as.DNAbin") diff --git a/R/root.R b/R/root.R index c51184d..5655873 100644 --- a/R/root.R +++ b/R/root.R @@ -151,8 +151,8 @@ root <- function(phy, outgroup, node = NULL, phy$edge <- rbind(phy$edge[a, ], c(ROOT, newnod), phy$edge[b, ]) if (!is.null(phy$edge.length)) - phy$edge.length <- - c(phy$edge.length[a], 0, phy$edge.length[b]) + phy$edge.length <- + c(phy$edge.length[a], 0, phy$edge.length[b]) phy$Nnode <- phy$Nnode + 1L ## node renumbering (see comments below) newNb <- integer(n + oldNnode) @@ -314,8 +314,7 @@ root <- function(phy, outgroup, node = NULL, newNb[newroot] <- n + 1L sndcol <- phy$edge[, 2] > n ## executed from right to left, so newNb is modified before phy$edge: - phy$edge[sndcol, 2] <- newNb[phy$edge[sndcol, 2]] <- - (n + 2):(n + phy$Nnode) + phy$edge[sndcol, 2] <- newNb[phy$edge[sndcol, 2]] <- n + 2:phy$Nnode phy$edge[, 1] <- newNb[phy$edge[, 1]] if (!is.null(phy$node.label)) { diff --git a/R/write.dna.R b/R/write.dna.R index 47686db..3f53cb9 100644 --- a/R/write.dna.R +++ b/R/write.dna.R @@ -1,4 +1,4 @@ -## write.dna.R (2012-05-03) +## write.dna.R (2012-06-22) ## Write DNA Sequences in a File @@ -66,7 +66,7 @@ write.dna <- function(x, file, format = "interleaved", append = FALSE, fmt <- paste("%-", max.nc + 1, "s", sep = "") names(x) <- sprintf(fmt, names(x)) } - if (format == "interleaved") { + switch(format, "interleaved" = { ## Write the first block with the taxon names colsel <- if (nb.block == 1) 1:totalcol else 1:nbcol for (i in 1:N) { @@ -87,8 +87,7 @@ write.dna <- function(x, file, format = "interleaved", append = FALSE, } } - } - if (format == "sequential") { + }, "sequential" = { if (nb.block == 1) { for (i in 1:N) { cat(names(x)[i], file = zz) @@ -108,10 +107,9 @@ write.dna <- function(x, file, format = "interleaved", append = FALSE, } } } - } - if (format == "fasta") { + }, "fasta" = { for (i in 1:N) { - cat(">", names(x)[i], file = zz) + cat(">", names(x)[i], file = zz, sep = "") cat("\n", file = zz) X <- paste(x[[i]], collapse = "") S <- length(x[[i]]) @@ -129,5 +127,5 @@ write.dna <- function(x, file, format = "interleaved", append = FALSE, cat("\n", file = zz) } } - } + }) } diff --git a/man/rlineage.Rd b/man/rlineage.Rd index c37bd6d..e01a810 100644 --- a/man/rlineage.Rd +++ b/man/rlineage.Rd @@ -19,7 +19,7 @@ drop.fossil(phy, tol = 1e-8) } \arguments{ \item{birth, death}{a numeric value or a (vectorized) function - specifying how speciation and extinction through time.} + specifying how speciation and extinction rates vary through time.} \item{Tmax}{a numeric value giving the length of the simulation.} \item{BIRTH, DEATH}{a (vectorized) function which is the primitive of \code{birth} or \code{death}. This can be used to speed-up the @@ -37,7 +37,7 @@ drop.fossil(phy, tol = 1e-8) described in Kendall (1948). Speciation (birth) and extinction (death) rates may be constant or vary through time according to an \R function specified by the user. In the latter case, \code{BIRTH} and/or - \code{DEATH} may be used of the primitives of \code{birth} and + \code{DEATH} may be used if the primitives of \code{birth} and \code{death} are known. In these functions time is the formal argument and must be named \code{t}. } diff --git a/man/rtree.Rd b/man/rtree.Rd index b30109c..514f39b 100644 --- a/man/rtree.Rd +++ b/man/rtree.Rd @@ -3,6 +3,12 @@ \alias{rcoal} \alias{rmtree} \title{Generates Random Trees} +\description{ + These functions generate trees by splitting randomly the edges + (\code{rtree}) or randomly clustering the tips (\code{rcoal}). + \code{rtree} generates general trees, and \code{rcoal} generates + coalescent trees. The algorithms are described in Paradis (2012). +} \usage{ rtree(n, rooted = TRUE, tip.label = NULL, br = runif, ...) rcoal(n, tip.label = NULL, br = "coalescent", ...) @@ -23,12 +29,6 @@ rmtree(N, n, rooted = TRUE, tip.label = NULL, br = runif, ...) \item{\dots}{further argument(s) to be passed to \code{br}.} \item{N}{an integer giving the number of trees to generate.} } -\description{ - These functions generate trees by splitting randomly the edges - (\code{rtree}) or randomly clustering the tips (\code{rcoal}). - \code{rtree} generates general (non-ultrametric) trees, and - \code{rcoal} generates coalescent (ultrametric) trees. -} \details{ The trees generated are bifurcating. If \code{rooted = FALSE} in (\code{rtree}), the tree is trifurcating at its root. @@ -44,6 +44,10 @@ rmtree(N, n, rooted = TRUE, tip.label = NULL, br = runif, ...) An object of class \code{"phylo"} or of class \code{"multiPhylo"} in the case of \code{rmtree}. } +\references{ + Paradis, E. (2012) \emph{Analysis of Phylogenetics and Evolution with + R (Second Edition).} New York: Springer. +} \author{Emmanuel Paradis} \seealso{ \code{\link{stree}}, \code{\link{rlineage}} diff --git a/man/unique.multiPhylo.Rd b/man/unique.multiPhylo.Rd index 4be3ef8..4c99159 100644 --- a/man/unique.multiPhylo.Rd +++ b/man/unique.multiPhylo.Rd @@ -24,7 +24,7 @@ an object of class \code{"multiPhylo"} which is a list of objects of class \code{"phylo"}. } -\author{Emmanuel Paradis \email{Emmanuel.Paradis@mpl.ird.fr}} +\author{Emmanuel Paradis} \seealso{ \code{all.equal.phylo}, \code{\link[base]{unique}} for the generic R function, \code{read.tree}, \code{read.nexus} diff --git a/src/me_balanced.c b/src/me_balanced.c index cd13569..defd23b 100644 --- a/src/me_balanced.c +++ b/src/me_balanced.c @@ -6,7 +6,7 @@ /* This file is part of the R-package `ape'. */ /* See the file ../COPYING for licensing issues. */ -##include "me.h" +#include "me.h" void BalWFext(edge *e, double **A) /*works except when e is the one edge inserted to new vertex v by firstInsert*/