Skip to content

Commit

Permalink
fix dowser issue
Browse files Browse the repository at this point in the history
  • Loading branch information
KlausVigo committed Sep 17, 2024
1 parent eeb8a02 commit 1dee696
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
11 changes: 7 additions & 4 deletions R/ancestral.R
Original file line number Diff line number Diff line change
Expand Up @@ -360,16 +360,19 @@ fitchCoding2ambiguous <- function(x, type = "DNA") {
#' @rdname ancestral.pml
#' @export
ancestral.pars <- function(tree, data, type = c("MPR", "ACCTRAN", "POSTORDER"),
cost = NULL, return = "prob") {
cost = NULL, return = "prob", ...) {
call <- match.call()
if (hasArg(tips)) tips <- list(...)$tips
else tips <- TRUE
type <- match.arg(type)
tree$nodel.label <- makeAncNodeLabel(tree)
if (type == "ACCTRAN" || type=="POSTORDER") {
res <- ptree(tree, data, return = return, acctran=(type == "ACCTRAN"))
res <- ptree(tree, data, return = return, acctran=(type == "ACCTRAN"),
tips=tips)
attr(res, "call") <- call
}
if (type == "MPR") {
res <- mpr(tree, data, cost = cost, return = return) #, tips=TRUE)
res <- mpr(tree, data, cost = cost, return = return, tips=tips)
attr(res, "call") <- call
}
res
Expand All @@ -388,7 +391,7 @@ anc_pars <- function(tree, data, type = c("MPR", "ACCTRAN", "POSTORDER"),
contrast <- attr(data, "contrast")
data <- data[tree$tip.label,]

prob <- ancestral.pars(tree, data, type, cost)
prob <- ancestral.pars(tree, data, type, cost, tips=FALSE)
joint <- joint_sankoff(tree, data, cost)
ind <- identical_sites(data)
if(length(ind)>0){
Expand Down
6 changes: 3 additions & 3 deletions R/joint_ASR.R
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,9 @@ joint_sankoff <- function(tree, data, cost=NULL){
count_mutations <- function(tree, data){
site <- "pscore"
tree <- reorder(tree, "postorder")
if(is.null(tree$node.label)) tree <- makeNodeLabel(tree)
anc <- joint_sankoff(tree, data)
dat <- rbind(data, anc)[c(tree$tip.label, tree$node.label)]
tree_tmp <- makeNodeLabel(tree)
anc <- joint_sankoff(tree_tmp, data)
dat <- rbind(data, anc)[c(tree_tmp$tip.label, tree_tmp$node.label)]
nr <- attr(data, "nr")
l <- length(dat)
fun <- function(x, site="pscore", nr){
Expand Down
4 changes: 2 additions & 2 deletions man/ancestral.pml.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1dee696

Please sign in to comment.