From 6603d33385e67db10a1d48f3ab7ec1910ce295ca Mon Sep 17 00:00:00 2001 From: paradis Date: Tue, 1 Feb 2011 03:15:05 +0000 Subject: [PATCH] bug fix in read.dna + change the default of tol in drop.fossil git-svn-id: https://svn.mpl.ird.fr/ape/dev/ape@144 6e262413-ae40-0410-9e79-b911bd7a66b7 --- ChangeLog | 8 ++++++++ DESCRIPTION | 2 +- R/CDF.birth.death.R | 2 +- R/read.dna.R | 14 ++++++++------ man/rlineage.Rd | 2 +- 5 files changed, 19 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index dd37289..a4985e5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -14,6 +14,14 @@ BUG FIXES o as.hclust.phylo() failed with trees with node labels (thanks to Jinlong Zhang for pointing this bug out). + o read.dna(, "fasta") failed if sequences were not all of the same + length. + + +OTHER CHANGES + + o In drop.fossil() the default tol = 0 has been raised to 1e-8. + CHANGES IN APE VERSION 2.6-2 diff --git a/DESCRIPTION b/DESCRIPTION index f5a28e0..c3f4954 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: ape Version: 2.6-3 -Date: 2010-12-24 +Date: 2011-02-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/R/CDF.birth.death.R b/R/CDF.birth.death.R index 5fa088a..847c37d 100644 --- a/R/CDF.birth.death.R +++ b/R/CDF.birth.death.R @@ -287,7 +287,7 @@ rlineage <- .makePhylo(edge[1:j, ], edge.length[1:j], i) } -drop.fossil <- function(phy, tol = 0) +drop.fossil <- function(phy, tol = 1e-8) { n <- Ntip(phy) x <- dist.nodes(phy)[n + 1, ][1:n] diff --git a/R/read.dna.R b/R/read.dna.R index 98ebd65..88f3d61 100644 --- a/R/read.dna.R +++ b/R/read.dna.R @@ -1,8 +1,8 @@ -## read.dna.R (2010-05-17) +## read.dna.R (2011-02-01) ## Read DNA Sequences in a File -## Copyright 2003-2010 Emmanuel Paradis +## Copyright 2003-2011 Emmanuel Paradis ## This file is part of the R-package `ape'. ## See the file ../COPYING for licensing issues. @@ -107,10 +107,12 @@ read.dna <- function(file, format = "interleaved", skip = 0, obj <- lapply(obj, tolower) LENGTHS <- unique(unlist(lapply(obj, length))) allSameLength <- length(LENGTHS) == 1 - if (is.logical(as.matrix) && as.matrix && !allSameLength) - stop("sequences in FASTA file not of the same length") - if (is.null(as.matrix) && allSameLength) - as.matrix <- TRUE + if (is.logical(as.matrix)) { + if (as.matrix && !allSameLength) + stop("sequences in FASTA file not of the same length") + } else { + as.matrix <- allSameLength + } if (as.matrix) { obj <- matrix(unlist(obj), ncol = LENGTHS, byrow = TRUE) rownames(obj) <- seq.names diff --git a/man/rlineage.Rd b/man/rlineage.Rd index b2b1aed..5b20568 100644 --- a/man/rlineage.Rd +++ b/man/rlineage.Rd @@ -15,7 +15,7 @@ rlineage(birth, death, Tmax = 50, BIRTH = NULL, DEATH = NULL, eps = 1e-6) rbdtree(birth, death, Tmax = 50, BIRTH = NULL, DEATH = NULL, eps = 1e-6) -drop.fossil(phy, tol = 0) +drop.fossil(phy, tol = 1e-8) } \arguments{ \item{birth, death}{a numeric value or a (vectorized) function -- 2.39.2