ococrook / bandle

An R package for Bayesian analysis of differential localisation experiments
https://ococrook.github.io/bandle/
5 stars 1 forks source link

Option for fcol is missing in some functions #16

Closed lmsimp closed 2 years ago

lmsimp commented 2 years ago

e.g. in prior_pred_dir there are several functions which assume fcol = "markers" such as getMarkerClasses and unknownMSnSet

prior_pred_dir
function (object, iter = 5000, dirPrior = NULL, q = 15) 
{
    K <- length(getMarkerClasses(object))
    if (is.null(dirPrior)) {
        dirPrior <- diag(rep(1, K)) + matrix(0.05, nrow = K, 
            ncol = K)
    }
    priornotAlloc <- vector(length = iter)
    nkknown <- table(getMarkers(object, verbose = FALSE))[getMarkerClasses(object)]
    for (i in seq.int(iter)) {
        concentration <- diag(nkknown) + dirPrior
        currentweights <- t(sampleDirichlet(K^2, c(concentration)))
        priornotAlloc[i] <- sum(currentweights[1, -c((K + 1) * 
            seq.int(1:(K)) - K)])
    }
    meannotAlloc <- mean(priornotAlloc) * nrow(unknownMSnSet(object))
    tailnotAlloc <- sum((priornotAlloc * nrow(unknownMSnSet(object))) > 
        q)/iter
    return(list(priornotAlloc = priornotAlloc, meannotAlloc = meannotAlloc, 
        tailnotAlloc = tailnotAlloc))
}
ococrook commented 2 years ago

This has been fixed in the latest pull request