From: paradis Date: Fri, 3 Jun 2011 04:08:54 +0000 (+0000) Subject: various fixes and small news X-Git-Url: https://git.donarmstrong.com/?p=ape.git;a=commitdiff_plain;h=29792fb8cef8ddab4553474398369fb6c24c1d8b various fixes and small news git-svn-id: https://svn.mpl.ird.fr/ape/dev/ape@159 6e262413-ae40-0410-9e79-b911bd7a66b7 --- diff --git a/DESCRIPTION b/DESCRIPTION index 4005e70..5ac5ac7 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: ape Version: 2.7-2 -Date: 2011-05-19 +Date: 2011-06-01 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, Klaus Schliep, Korbinian Strimmer, Damien de Vienne Maintainer: Emmanuel Paradis diff --git a/NEWS b/NEWS index f9af949..f80ec46 100644 --- a/NEWS +++ b/NEWS @@ -5,19 +5,24 @@ NEW FEATURES o plot.phylo() has a new option 'draw = TRUE'. If FALSE, the tree is not plotted but the graphical device is set and the - coordinates are saved as normal. + coordinates are saved as usual. o diversity.contrast.test() gains a fourth version of the test with method = "logratio"; the literature citations have been clarified. + o add.scale.bar() has two new options, 'lwd' and 'lcol', to modify + the aspect of the bar. + BUG FIXES - o bionj() made R crash if distances were two large. It now returns + o bionj() made R crash if distances were too large. It now returns an error if at least one distance is greater than 100. o drop.tip() returned a wrong tree if 'tip' was of zero length. + o read.nexus.data() failed with URLs. + CHANGES IN APE VERSION 2.7-1 diff --git a/R/read.nexus.data.R b/R/read.nexus.data.R index 076173c..cd261a4 100644 --- a/R/read.nexus.data.R +++ b/R/read.nexus.data.R @@ -2,7 +2,8 @@ { # Simplified NEXUS data parser. # - # Version: 09/13/2006 01:01:59 PM CEST + # Version: 09/13/2006 01:01:59 PM CEST + # (modified by EP 2011-06-01) # # By: Johan Nylander, nylander @ scs.fsu.edu # @@ -53,7 +54,7 @@ } "trim.whitespace" <- function (x) - { + { gsub("\\s+", "", x) } @@ -62,10 +63,6 @@ gsub(";", "", x) } - if(file.access(file, mode = 4)) { - stop("file could not be found") - } - X <- scan(file = file, what = character(), sep = "\n", quiet = TRUE, comment.char = "[", strip.white = TRUE) ntax <- find.ntax(X) @@ -117,7 +114,7 @@ tot.ntax <- tot.ntax + 1 if (tot.ntax == ntax) { i <- 1 - tot.ntax <- 0 + tot.ntax <- 0 tot.nchar <- tot.nchar + chars.done if (tot.nchar == nchar*ntax) { print("ntot was more than nchar*ntax") diff --git a/R/scales.R b/R/scales.R index 2243278..7176d1f 100644 --- a/R/scales.R +++ b/R/scales.R @@ -1,16 +1,17 @@ -## scales.R (2009-12-16) +## scales.R (2011-05-31) ## Add a Scale Bar or Axis to a Phylogeny Plot ## add.scale.bar: add a scale bar to a phylogeny plot ## axisPhylo: add a scale axis on the side of a phylogeny plot -## Copyright 2002-2009 Emmanuel Paradis +## Copyright 2002-2011 Emmanuel Paradis ## This file is part of the R-package `ape'. ## See the file ../COPYING for licensing issues. -add.scale.bar <- function(x, y, length = NULL, ask = FALSE, ...) +add.scale.bar <- function(x, y, length = NULL, ask = FALSE, + lwd = 1, lcol = "black", ...) { lastPP <- get("last_plot.phylo", envir = .PlotPhyloEnv) direc <- lastPP$direction @@ -55,19 +56,19 @@ add.scale.bar <- function(x, y, length = NULL, ask = FALSE, ...) switch(direc, "rightwards" = { - segments(x, y, x + length, y) + segments(x, y, x + length, y, col = lcol, lwd = lwd) text(x + length * 1.1, y, as.character(length), adj = c(0, 0.5), ...) }, "leftwards" = { - segments(x - length, y, x, y) + segments(x - length, y, x, y, col = lcol, lwd = lwd) text(x - length * 1.1, y, as.character(length), adj = c(1, 0.5), ...) }, "upwards" = { - segments(x, y, x, y + length) + segments(x, y, x, y + length, col = lcol, lwd = lwd) text(x, y + length * 1.1, as.character(length), adj = c(0, 0.5), srt = 90, ...) }, "downwards" = { - segments(x, y - length, x, y) + segments(x, y - length, x, y, col = lcol, lwd = lwd) text(x, y - length * 1.1, as.character(length), adj = c(0, 0.5), srt = 270, ...) }) } diff --git a/man/add.scale.bar.Rd b/man/add.scale.bar.Rd index ecef307..3f1ee59 100644 --- a/man/add.scale.bar.Rd +++ b/man/add.scale.bar.Rd @@ -2,7 +2,8 @@ \alias{add.scale.bar} \title{Add a Scale Bar to a Phylogeny Plot} \usage{ -add.scale.bar(x, y, length = NULL, ask = FALSE, ...) +add.scale.bar(x, y, length = NULL, ask = FALSE, + lwd = 1, lcol = "black", ...) } \arguments{ \item{x}{x location of the bar (can be left missing).} @@ -11,6 +12,9 @@ add.scale.bar(x, y, length = NULL, ask = FALSE, ...) none is supplied, a value is calculated from the data.} \item{ask}{a logical; if \code{TRUE} the user is asked to click where to draw the bar. The default is \code{FALSE}.} + \item{lwd}{the width of the bar.} + \item{lcol}{the colour of the bar (use \code{col} for the colour of + the text).} \item{\dots}{further arguments to be passed to \code{text}.} } \description{