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

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.

See also

AddSModuleScore for standardized module scoring, mikoScore for miko scoring

Author

Nicholas Mikolajewicz

Examples


so.query <-  AddSModuleScore(object = so.query, features = gene.list)
#> Loading required package: parallel
#> Error in AddSModuleScore(object = so.query, features = gene.list): object 'gene.list' not found

raw.mat <- so.query@misc[["raw_score"]]
#> Error in eval(expr, envir, enclos): object 'so.query' not found
colnames(raw.mat) <- gsub("raw_", "", colnames(raw.mat))
#> Error in is.data.frame(x): object 'raw.mat' not found
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)
#> Error in "Seurat" %in% class(object): object 'so.query' not found