Skip to content

Commit

Permalink
allow multi-furcating starting trees, no RF warnings for multi-furcat…
Browse files Browse the repository at this point in the history
…ing trees
  • Loading branch information
KlausVigo committed Feb 13, 2019
1 parent 487c960 commit 1223171
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion R/parsimony.R
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ pratchet <- function(data, start = NULL, method = "fitch", maxit = 1000,
while (length(trees) > 0) {
# rf <- sapply(trees, RF.dist, res, FALSE)
class(trees) <- "multiPhylo"
rf <- RF.dist(res, trees, FALSE)
rf <- suppressWarnings( RF.dist(res, trees, FALSE) )
# end new code
if (any(rf == 0)) trees <- trees[-which(rf == 0)]
if (length(trees) > 0) {
Expand All @@ -542,6 +542,9 @@ pratchet <- function(data, start = NULL, method = "fitch", maxit = 1000,
if(is.null(start)) start <- optim.parsimony(nj(dist.hamming(data)), data,
trace = trace, method = method,
rearrangements = rearrangements, ...)
else{
if(!is.binary(start)) start <- multi2di(start)
}
tree <- start
data <- subset(data, tree$tip.label)
attr(tree, "pscore") <- parsimony(tree, data, method = method, ...)
Expand Down

0 comments on commit 1223171

Please sign in to comment.