]> git.donarmstrong.com Git - ape.git/commitdiff
some small changes
authorparadis <paradis@6e262413-ae40-0410-9e79-b911bd7a66b7>
Fri, 22 Jun 2012 08:15:03 +0000 (08:15 +0000)
committerparadis <paradis@6e262413-ae40-0410-9e79-b911bd7a66b7>
Fri, 22 Jun 2012 08:15:03 +0000 (08:15 +0000)
git-svn-id: https://svn.mpl.ird.fr/ape/dev/ape@189 6e262413-ae40-0410-9e79-b911bd7a66b7

DESCRIPTION
NEWS
R/DNA.R
R/root.R
R/write.dna.R
man/rlineage.Rd
man/rtree.Rd
man/unique.multiPhylo.Rd
src/me_balanced.c

index 0f031c13dacf5c207506a9c113cd3ea00e52140a..66a9e92b6f0fb2e7db8259dd79de42f9506ecbff 100644 (file)
@@ -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 <Emmanuel.Paradis@ird.fr>
diff --git a/NEWS b/NEWS
index e4235a9a0cf397de73f5f19215f6401525e98f96..ec8918ae97f2c4e7d9bfe7e8a7d19fc2a6599041 100644 (file)
--- 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 70b210b14c9622212d05cbd775475e4b09d039dd..2bd752060805a657374051f7493775f5d402ceb4 100644 (file)
--- 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")
index c51184dc3645d6014c497febf91d00fa07a88cac..5655873a75398cdc16d8e84de39a53904ebc2e45 100644 (file)
--- 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)) {
index 47686db3a4b133877c0cfeb6ab85cff5c9962015..3f53cb91d3e44ed82e7fda200add179bda13f1c3 100644 (file)
@@ -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)
             }
         }
-    }
+    })
 }
index c37bd6d405ec21ad627d4d621bd08a5d79cfffbd..e01a810ec06178b5b6315c7167556b9c890802f3 100644 (file)
@@ -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}.
 }
index b30109cdcbf86eafcd99942067edb0ab04f497fb..514f39bbdbf1ec9a50c73329fb178d1c96b9ec00 100644 (file)
@@ -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}}
index 4be3ef8c0175cfa94b0dffcd574ab521154da98b..4c99159c393a0b137b82f7d41a67d87b670d20f6 100644 (file)
@@ -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}
index cd135695b3910d7d30512c6aacf5b57ae3fd7e01..defd23b8a230457eb7f47423d850ecb4dff5333c 100644 (file)
@@ -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*/