From 2f66600c0028b9fa6d39d421e39a016bdb8a0144 Mon Sep 17 00:00:00 2001 From: Klaus Schliep Date: Thu, 25 Jan 2024 13:48:54 +0100 Subject: [PATCH] fix bug reported by @amizeranschi --- R/phylo.R | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/R/phylo.R b/R/phylo.R index 67863777..30be873c 100644 --- a/R/phylo.R +++ b/R/phylo.R @@ -700,23 +700,23 @@ optEdgeMulti <- function(object, control = pml.control(epsilon = 1e-8, # add data for internal use parent.frame(n) for higher nestings -update.pmlNew <- function(object, ..., evaluate = TRUE) { - call <- object$call - if (is.null(call)) - stop("need an object with call component") - extras <- match.call(expand.dots = FALSE)$... - if (length(extras)) { - existing <- !is.na(match(names(extras), names(call))) - for (a in names(extras)[existing]) call[[a]] <- extras[[a]] - if (any(!existing)) { - call <- c(as.list(call), extras[!existing]) - call <- as.call(call) - } - } - if (evaluate) - eval(call, object, parent.frame()) - else call -} +# update.pmlNew <- function(object, ..., evaluate = TRUE) { +# call <- object$call +# if (is.null(call)) +# stop("need an object with call component") +# extras <- match.call(expand.dots = FALSE)$... +# if (length(extras)) { +# existing <- !is.na(match(names(extras), names(call))) +# for (a in names(extras)[existing]) call[[a]] <- extras[[a]] +# if (any(!existing)) { +# call <- c(as.list(call), extras[!existing]) +# call <- as.call(call) +# } +# } +# if (evaluate) +# eval(call, object, parent.frame()) +# else call +# } #' @export @@ -2064,6 +2064,8 @@ optim.pml <- function(object, optNni = FALSE, optBf = FALSE, optQ = FALSE, orig.data <- data addTaxa <- TRUE tree <- drop.tip(tree, mapping[, 1]) + if(method=="unrooted") tree <- unroot(tree) + attr(tree, "order") <- NULL tree <- reorder(tree, "postorder") } }