]> git.donarmstrong.com Git - ape.git/commitdiff
fix a few bugs + correct some the man page of sh.test()
authorparadis <paradis@6e262413-ae40-0410-9e79-b911bd7a66b7>
Thu, 18 Sep 2008 14:37:04 +0000 (14:37 +0000)
committerparadis <paradis@6e262413-ae40-0410-9e79-b911bd7a66b7>
Thu, 18 Sep 2008 14:37:04 +0000 (14:37 +0000)
git-svn-id: https://svn.mpl.ird.fr/ape/dev/ape@49 6e262413-ae40-0410-9e79-b911bd7a66b7

Changes
DESCRIPTION
R/DNA.R
R/read.nexus.R
man/sh.test.Rd

diff --git a/Changes b/Changes
index 988dd6f1956c1ff5ea4138980f73348327f6bd73..0ca803e625cf2c19cdcc255bfb30f5a2cc1a3a95 100644 (file)
--- a/Changes
+++ b/Changes
@@ -12,11 +12,18 @@ BUG FIXES
     o prop.part() failed with a single tree with the default option
      'check.labels = TRUE'.
 
+   o summary.DNAbin() failed to display correctly the summary of
+     sequence lengths with lists of sequences of 10,000 bases or more
+     (because summary.default uses 4 significant digits by default).
+
+   o read.nexus() failed to read a file with a single tree with line
+     breaks in the Newick string.
+
 
 OTHER CHANGES
 
     o The data sets bird.orders and bird.families are now stored as
-      Newick strings; e.g., the command data(bird.orders) calls
+      Newick strings; i.e., the command data(bird.orders) calls
       read.tree().
 
 
index 7d0413a0cd7733142072f81a29e877cf222930c7..1b4f9b925daec943abfe31ce6a24190e5c10f112 100644 (file)
@@ -1,6 +1,6 @@
 Package: ape
 Version: 2.2-2
-Date: 2008-07-22
+Date: 2008-09-17
 Title: Analyses of Phylogenetics and Evolution
 Author: Emmanuel Paradis, Ben Bolker, Julien Claude, Hoa Sien Cuong,
   Richard Desper, Benoit Durand, Julien Dutheil, Olivier Gascuel,
diff --git a/R/DNA.R b/R/DNA.R
index e51f252eb7b77421fad835d13ae7671ddae32d00..90e841badb278b4aed61031d6df4f4a50cfe14d2 100644 (file)
--- a/R/DNA.R
+++ b/R/DNA.R
@@ -1,4 +1,4 @@
-## DNA.R (2008-06-08)
+## DNA.R (2008-08-07)
 
 ##   Manipulations and Comparisons of DNA Sequences
 
@@ -141,8 +141,16 @@ summary.DNAbin <- function(object, printlen = 6, digits = 3, ...)
             cat("Label:", nms, "\n\n")
         } else {
             cat(n, "DNA sequences in binary format stored in a list.\n\n")
-            cat("Summary of sequence lengths:\n")
-            print(summary(unlist(lapply(object, length))))
+            tmp <- unlist(lapply(object, length))
+            mini <- min(tmp)
+            maxi <- max(tmp)
+            if (mini == maxi)
+                cat("All sequences of same length:", maxi, "\n")
+            else {
+                cat("Mean sequence length:", round(mean(tmp), 3), "\n")
+                cat("   Shortest sequence:", mini, "\n")
+                cat("    Longest sequence:", maxi, "\n")
+            }
             TAIL <- "\n\n"
             if (printlen < n) {
                 nms <- nms[1:printlen]
index d2520962f9b99ce8258c3fadca4fc83225400af2..cbf0f20e7a42ff1bc6bd2c90090c695477995f47 100644 (file)
@@ -1,4 +1,4 @@
-## read.nexus.R (2008-07-11)
+## read.nexus.R (2008-09-17)
 
 ##   Read Tree File in Nexus Format
 
@@ -156,13 +156,15 @@ read.nexus <- function(file, tree.names = NULL)
     semico <- grep(";", tree)
     Ntree <- length(semico)
     ## are some trees on several lines?
-    if (any(diff(semico) != 1)) {
-        STRING <- character(Ntree)
-        s <- c(1, semico[-Ntree] + 1)
-        j <- mapply(":", s, semico)
-        for (i in 1:Ntree)
-            STRING[i] <- paste(tree[j[, i]], collapse = "")
-    } else STRING <- tree
+    if (Ntree == 1 && length(tree) > 1) STRING <- paste(tree, collapse = "") else {
+        if (any(diff(semico) != 1)) {
+            STRING <- character(Ntree)
+            s <- c(1, semico[-Ntree] + 1)
+            j <- mapply(":", s, semico)
+            for (i in 1:Ntree)
+                STRING[i] <- paste(tree[j[, i]], collapse = "")
+        } else STRING <- tree
+    }
     rm(tree)
     STRING <- gsub(" ", "", STRING)
     colon <- grep(":", STRING)
index ec367cd567b60c936d002fcffbb7cdde39685b3c..57e6a5d5ecad3d4981061cb70489b1544666efb6 100644 (file)
@@ -7,8 +7,7 @@ sh.test(..., x, model = DNAmodel(), B = 100)
 \arguments{
   \item{...}{either a series of objects of class \code{"phylo"}
     separated by commas, or a list containing such objects.}
-  \item{x}{a list, a matrix, or a data frame containing the (aligned)
-    DNA sequences.}
+  \item{x}{a list or a matrix containing the (aligned) DNA sequences.}
   \item{model}{the model to be fitted to each tree (as an object of
     \code{"DNAmodel"}).}
   \item{B}{the number of bootstrap replicates.}
@@ -19,9 +18,9 @@ sh.test(..., x, model = DNAmodel(), B = 100)
 }
 \details{
   The present implementation follows the original formulation of
-  Shimodaira and Hasegawa (1999). A difference is that the bootstrap
+  Shimodaira and Hasegawa (1999) with the difference that the bootstrap
   resampling is done on the original sequence data rather than the RELL
-  method as sugested by Shimodaira and Hasegawa.
+  method suggested by Shimodaira and Hasegawa.
 }
 \value{
   a numeric vector with the P-value associated with each tree given in