coherentFraction: Calculate coherent fraction for feature expression program.

View source: R/annotation_functions.R

coherentFractionR Documentation

Calculate coherent fraction for feature expression program.

Description

Calculate fraction of genes that are correlated with feature expression program. Performed on a per-cluster basis ("seurat_clusters" in 'object' meta data).

Usage

coherentFraction(
  object,
  score.matrix,
  genelist,
  method = c("pearson", "spearman"),
  assay = DefaultAssay(object),
  slot = "data",
  subsample.cluster.n = 500,
  nworkers = 1,
  verbose = T
)

Arguments

object

Seurat Object.

score.matrix

matrix of feature expression program. Can be computed using 'AddModuleScores', 'AddSModuleScores', 'mikoScore', among others.

method

Correlation method: "pearson" or "spearman". Default is "pearson".

assay

Name of assay to use.

slot

Use expression data from this slot in 'object'.

subsample.cluster.n

number of cells to subsample within each cluster ("seurat_clusters" in 'object' meta data). Default is 500.

nworkers

Number of workers for parallel implementation. Default is 1.

verbose

Print progress. Default is TRUE.

geneset

gene set list used for obtaining 'score.matrix' (e.g., gene set provided as input into 'mikoScore' or 'AddSModuleScores').

Value

data.frame containing cluster-level coherent fractions.

Author(s)

Nicholas Mikolajewicz

See Also

AddSModuleScore for standardized module scoring, mikoScore for miko scoring

Examples


so.query <-  AddSModuleScore(object = so.query, features = gene.list)

raw.mat <- so.query@misc[["raw_score"]]
colnames(raw.mat) <- gsub("raw_", "", colnames(raw.mat))
df.cscore <- coherentFraction(object = so.query, score.matrix =raw.mat, nworkers = 20,
                              genelist = gene.list, assay = DefaultAssay(so.query), slot = "data", subsample.cluster.n = 500)



NMikolajewicz/scMiko documentation built on June 28, 2023, 1:41 p.m.