get_coexpression_stat: get_coexpression_stat

View source: R/get_coexpression_stat.R

get_coexpression_statR Documentation

get_coexpression_stat

Description

For each gene of interest, returns top co-expressed genes from the sce counts matrix (either filtered by number of co-expressed genes or correlation)

Usage

get_coexpression_stat(
  sce,
  genes,
  n = 10,
  corr.thresh = 0.5,
  method = "spearman",
  verbose = TRUE
)

Arguments

sce

SingleCellExperiment object containing gene counts matrix (stored in 'logcounts' assay).

genes

Charcter vector specifying genes to which co-expression stat should be returned.

n

Scalar (or NULL) specifying number of top HVGs to be return. Default n=10. If NULL, returns all genes with correlation higher than threshold.

corr.thresh

Scalar (float) specifying threshold for correlation to use. Default corr.thresh=0.5.

method

Character specifying method for correlation. Availbale options are c("spearman", "pearson", "kendall"). Default method="spearman".

verbose

Boolean identifying whether intermediate print outputs should be returned. Default verbose=TRUE.

Value

List, each element corresponds to a gene in genes. Each element is data.frame with co-expressed genes.

Examples

require(SingleCellExperiment)
n_row = 500
n_col = 100
sce = SingleCellExperiment(assays = list(logcounts = matrix(rnorm(n_row*n_col), ncol=n_col)))
rownames(sce) = as.factor(1:n_row)
colnames(sce) = c(1:n_col)
sce$cell = colnames(sce)
out = get_coexpression_stat(sce, c("1","2"))


MarioniLab/geneBasisR documentation built on June 30, 2023, 2:04 p.m.