o plot(phy, root.edge = TRUE) failed if there was no $root.edge in
the tree: the argument is now ignored.
+ o add.scale.bar() failed when 'x' and 'y' were given (thanks to Janet
+ Young for the fix).
+
OTHER CHANGES
o The argument 'adj' in [node][tip][edge]labels() now works when
using 'pie' or 'thermo'.
+ o A more informative message error is now returned by dist.dna() when
+ 'model' is badly specified (partial matching of this argument is
+ done now).
+
o Deprecated functions are now listed in a help page: see
help("ape-defunct") with the quotes.
-## DNA.R (2009-09-18)
+## DNA.R (2009-10-02)
## Manipulations and Comparisons of DNA Sequences
{
MODELS <- c("RAW", "JC69", "K80", "F81", "K81", "F84", "T92", "TN93",
"GG95", "LOGDET", "BH87", "PARALIN", "N")
- imod <- which(MODELS == toupper(model))
+ imod <- pmatch(toupper(model), MODELS)
+ if (is.na(imod))
+ stop(paste("'model' must be one of:",
+ paste("\"", MODELS, "\"", sep = "", collapse = " ")))
if (imod == 11 && variance) {
warning("computing variance temporarily not available for model BH87.")
variance <- FALSE
add.scale.bar <- function(x, y, length = NULL, ...)
{
lastPP <- get("last_plot.phylo", envir = .PlotPhyloEnv)
+ direc <- lastPP$direction
if (is.null(length)) {
nb.digit <-
- if (lastPP$direction %in% c("rightwards", "leftwards")) diff(range(lastPP$xx))
+ if (direc %in% c("rightwards", "leftwards")) diff(range(lastPP$xx))
else diff(range(lastPP$yy))
nb.digit <- ceiling(log10(nb.digit)) - 2
length <- eval(parse(text = paste("1e", nb.digit, sep = "")))
}
- if (missing(x) || missing(y)) {
- switch(lastPP$direction,
+
+ if (missing(x) || missing(y))
+ switch(direc,
"rightwards" = {
x <- 0
y <- 1
- segments(x, y, x + length, y)
- text(x + length * 1.1, y, as.character(length), adj = c(0, 0.5), ...)
},
"leftwards" = {
x <- max(lastPP$xx)
y <- 1
- segments(x - length, y, x, y)
- text(x - length * 1.1, y, as.character(length), adj = c(1, 0.5), ...)
},
"upwards" = {
x <- max(lastPP$xx)
y <- 0
- segments(x, y, x, y + length)
- text(x, y + length * 1.1, as.character(length), adj = c(0, 0.5), srt = 90, ...)
},
"downwards" = {
x <- 1
y <- max(lastPP$yy)
- segments(x, y - length, x, y)
- text(x, y - length * 1.1, as.character(length), adj = c(0, 0.5), srt = 270, ...)
- }
- )
- }
+ })
+
+ switch(direc,
+ "rightwards" = {
+ segments(x, y, x + length, y)
+ text(x + length * 1.1, y, as.character(length), adj = c(0, 0.5), ...)
+ },
+ "leftwards" = {
+ segments(x - length, y, x, y)
+ text(x - length * 1.1, y, as.character(length), adj = c(1, 0.5), ...)
+ },
+ "upwards" = {
+ segments(x, y, x, y + length)
+ text(x, y + length * 1.1, as.character(length), adj = c(0, 0.5), srt = 90, ...)
+ },
+ "downwards" = {
+ segments(x, y - length, x, y)
+ text(x, y - length * 1.1, as.character(length), adj = c(0, 0.5), srt = 270, ...)
+ })
}
axisPhylo <- function(side = 1, ...)
fcat("BEGIN DATA;\n")
fcat(indent,"DIMENSIONS", " ", NTAX, " ", NCHAR, ";\n")
if (format %in% c("dna", "protein")) {
- fcat(indent, "FORMAT", " ", MISSING, " ", GAP, " ", DATATYPE, " ", INTERLEAVE, ";\n")
+ fcat(indent, "FORMAT", " ", DATATYPE, " ", MISSING, " ", GAP, " ", INTERLEAVE, ";\n") # from François Michonneau (2009-10-02)
}
fcat(indent,"MATRIX\n")
print.matrix(x)
Significant bug fixes were provided by Cécile Ané, James Bullard,
Éric Durand, Olivier François, Rich FitzJohn, Bret Larget, Nick Matzke,
Michael Phelan, Elizabeth Purdom, Dan Rabosky, Klaus Schliep, Tim
-Wallstrom, Li-San Wang, Yan Wong, and Peter Wragg. Contact me if I
-forgot someone.
+Wallstrom, Li-San Wang, Yan Wong, Peter Wragg, and Janet Young. Contact
+me if I forgot someone.
Kurt Hornik, of the R Core Team, helped in several occasions to
fix some problems and bugs.
\item{y}{y location of the bar (can be left missing).}
\item{length}{a numeric value giving the length of the scale bar. If
none is supplied, a value is calculated from the data.}
- \item{...}{further arguments to be passed to \code{text}.}
+ \item{\dots}{further arguments to be passed to \code{text}.}
}
\description{
This function adds a horizontal bar giving the scale of the branch
\details{
By default, the bar is placed in a corner of the graph depending on
the direction of the tree. Otherwise both \code{x} and \code{y} must
- be specified (if only one is given it is ignored).
+ be specified (if only one is given it is ignored).
- The further arguments (\code{...}) are used to format the text. They
+ The further arguments (\code{\dots}) are used to format the text. They
may be \code{font}, \code{cex}, \code{col}, and so on (see examples
below, and the help page on \code{\link[graphics]{text}}).