Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
KlausVigo committed Dec 3, 2024
1 parent 4aef7fc commit 7f744f3
Showing 1 changed file with 0 additions and 39 deletions.
39 changes: 0 additions & 39 deletions R/bootstrap.R
Original file line number Diff line number Diff line change
Expand Up @@ -206,42 +206,3 @@ bootstrap.phyDat <- function(x, FUN, bs = 100, multicore = FALSE,
}
res
}


cladeMatrix <- function(x, rooted = FALSE) {
if (!rooted) x <- unroot(x)
pp <- prop.part(x)
pplabel <- attr(pp, "labels")
if (!rooted) pp <- SHORTwise(pp)
x <- .uncompressTipLabel(x)
nnodes <- Nnode(x)
class(x) <- NULL
# nnodes <- sapply(x, Nnode)
l <- length(x)
from <- cumsum(c(1, nnodes[-l]))
to <- cumsum(nnodes)
ivec <- integer(to[l])
pvec <- c(0, to)
res <- vector("list", l)
k <- 1
for (i in 1:l) {
ppi <- prop.part(x[[i]])
if (!rooted) ppi <- SHORTwise(ppi)
indi <- sort(fmatch(ppi, pp))
ivec[from[i]:to[i]] <- indi
}
X <- sparseMatrix(i = ivec, p = pvec, dims = c(length(pp), l))
list(X = X, prop.part = pp)
}


moving_average <- function(obj, window = 50) {
fun <- function(x) {
cx <- c(0, cumsum(x))
(cx[(window + 1):length(cx)] - cx[1:(length(cx) - window)]) / (window)
}
res <- apply(obj$X, 1, fun)
rownames(res) <- c()
}


0 comments on commit 7f744f3

Please sign in to comment.