getBetaTheta | R Documentation |
Pull out cell-type proportions across pixels (theta) and cell-type gene probabilities (beta) matrices from fitted LDA models from fitLDA
getBetaTheta(
lda,
corpus = NULL,
perc.filt = 0.05,
betaScale = 1,
verbose = TRUE
)
lda |
an LDA model from "topicmodels" R package. From list of models returned by fitLDA |
corpus |
If corpus is NULL, then it will use the original corpus that the model was fitted to. Otherwise, compute deconvolved topics from this new corpus. Needs to be pixels x genes and nonnegative integer counts. Each row needs at least 1 nonzero entry (default: NULL) |
perc.filt |
proportion threshold to remove cell-types in pixels (default: 0.05) |
betaScale |
factor to scale the predicted cell-type gene expression profiles (default: 1) |
verbose |
Boolean for verbosity (default: TRUE) |
A list that contains
beta: cell-type (rows) by gene (columns) distribution matrix. Each row is a probability distribution of a cell-type expressing each gene in the corpus
theta: pixel (rows) by cell-types (columns) distribution matrix. Each row is the cell-type composition for a given pixel
data(mOB)
pos <- mOB$pos
cd <- mOB$counts
counts <- cleanCounts(cd, min.lib.size = 100)
corpus <- restrictCorpus(counts, removeAbove=1.0, removeBelow = 0.05)
ldas <- fitLDA(t(as.matrix(corpus)), Ks = 3, ncores=2)
optLDA <- optimalModel(models = ldas, opt = 3)
results <- getBetaTheta(optLDA, perc.filt = 0.05, betaScale = 1000)
head(results$theta)
head(results$beta)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.