getCorrMtx: Find Pearson's correlations between topics (cell-types) with...

View source: R/functions.R

getCorrMtxR Documentation

Find Pearson's correlations between topics (cell-types) with respect to their proportions across documents (pixels), i.e. thetas, or gene probabilities, i.e. betas.

Description

Find Pearson's correlations between topics (cell-types) with respect to their proportions across documents (pixels), i.e. thetas, or gene probabilities, i.e. betas.

Usage

getCorrMtx(m1, m2, type = c("t", "b"), thresh = NULL, verbose = TRUE)

Arguments

m1

first matrix

m2

second matrix

type

must be either "t" (theta; cell-type proportions across pixels) or "b" (beta; cell-type gene expression profiles)

thresh

if comparing betas, use to compare genes above this probability (e.g., expression level). NULL or 0 < numeric < 1.0 (default: NULL)

verbose

control the verbosity (default: TRUE)

Value

matrix of Pearson's correlations; m1 (rows) by m2 (cols)

Examples

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)
optLDA <- optimalModel(models = ldas, opt = 3)
results <- getBetaTheta(optLDA, perc.filt = 0.05, betaScale = 1000)
deconProp <- results$theta
corMtx <- getCorrMtx(m1 = as.matrix(deconProp), m2 = as.matrix(deconProp), type = "t")
rownames(corMtx) <- paste0("X", seq(nrow(corMtx)))
colnames(corMtx) <- paste0("X", seq(ncol(corMtx)))
head(corMtx)


JEFworks-Lab/STdeconvolve documentation built on July 17, 2024, 7:11 a.m.