feature_correlation: Get features whose expression is correlated or...

View source: R/feature_correlation.R

feature_correlationR Documentation

Get features whose expression is correlated or anti-correlated across all cells or groups of cells

Description

Find out the expression of which features is correlated or anti-correlated using simple correlation metrics like pearson or spearman. The analysis may be applied to a subset of cells or subset of features (see arguments). Due to dropouts in some scRNAseq technologies this analysis is not super-clean but may still provide a valid, relative, comparison of feature correlations. Other methods considering the dropout-effect exist: COTAN.

Usage

feature_correlation(
  SO,
  features,
  assay = c("RNA", "SCT"),
  method = c("pearson", "spearman", "kendall"),
  cells = NULL,
  min.pct = 0.1,
  limit_p = 1e-303,
  bar.fill = c("correlation_sign", "ref_feature_pct", "none"),
  theme = ggplot2::theme_bw(),
  split.by = NULL,
  min.group.size = 20,
  topn = c(10, 10),
  ...
)

Arguments

SO

Seurat object

features

which features to calculate correlations for (must be rownames in the selected assay)

assay

which assay to obtain expression values from; the data slot will be used in any case

method

which metric of correlation to calculate

cells

vector of cell names to consider for correlation anaylsis; if NULL (default) all cells are used

min.pct

minimum percentage of expressing cells (> 0 UMIs) to include a feature in correlation analysis

limit_p

p-value which p-values of 0 will be set to; this avoids obtaining INF when deriving -log10(p-val)

bar.fill

which bar fill to apply

theme

which ggplot theme to set as basis

split.by

groups for correlation analysis; must be a categorical column in meta.data of SO

min.group.size

required number of cell in one group to be considered in analysis

topn

numeric vector of length two; number of top anti-correlated and correlated features, respectively

...

additional arguments to psych::corr.test and to ggplot2::theme

Value

a default plot (ggplot2 object) and the underlying data frame with correlation values


Close-your-eyes/scexpr documentation built on April 21, 2023, 10:27 a.m.