]> git.donarmstrong.com Git - ape.git/blobdiff - R/DNA.R
final wrap for ape 3.0
[ape.git] / R / DNA.R
diff --git a/R/DNA.R b/R/DNA.R
index 747117d9600e3d7f0a94a85292e45750c9a41a79..54898cf4413358c94edf245d056baf1ab46b22b6 100644 (file)
--- a/R/DNA.R
+++ b/R/DNA.R
@@ -1,8 +1,8 @@
-## DNA.R (2011-03-16)
+## 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.
@@ -359,7 +359,7 @@ dist.dna <- function(x, model = "K80", variance = FALSE, gamma = FALSE,
         stop(paste("'model' must be one of:",
                    paste("\"", MODELS, "\"", sep = "", collapse = " ")))
     if (imod == 11 && variance) {
-        warning("computing variance temporarily not available for model BH87.")
+        warning("computing variance not available for model BH87.")
         variance <- FALSE
     }
     if (gamma && imod %in% c(1, 5:7, 9:15)) {
@@ -418,16 +418,18 @@ image.DNAbin <- function(x, what, col, bg = "white", xlab = "", ylab = "",
     y <- integer(N <- length(x))
     ncl <- length(what)
     col <- rep(col, length.out = ncl)
+    brks <- 0.5:(ncl + 0.5)
     sm <- 0L
     for (i in ncl:1) {
         k <- ._bs_[._cs_ == what[i]]
         sel <- which(x == k)
-        if (ll <- length(sel)) {
+        if (L <- length(sel)) {
             y[sel] <- i
-            sm <- sm + ll
+            sm <- sm + L
         } else {
             what <- what[-i]
             col <- col[-i]
+            brks <- brks[-i]
         }
     }
     dim(y) <- dx
@@ -439,10 +441,11 @@ image.DNAbin <- function(x, what, col, bg = "white", xlab = "", ylab = "",
         co <- c(bg, col)
         leg.txt <- c(toupper(what), "others")
         leg.co <- c(col, bg)
+        brks <- c(-0.5, brks)
     }
     yaxt <- if (show.labels) "n" else "s"
-    image(1:s, 1:n, t(y), col = co, xlab = xlab,
-          ylab = ylab, yaxt = yaxt, ...)
+    graphics::image.default(1:s, 1:n, t(y), col = co, xlab = xlab,
+                            ylab = ylab, yaxt = yaxt, breaks = brks, ...)
     if (show.labels)
         mtext(rownames(x), side = 2, line = 0.1, at = 1:n,
               cex = cex.lab, adj = 1, las = 1)