RunDynamicEnrichment: RunDynamicEnrichment

View source: R/SCP-analysis.R

RunDynamicEnrichmentR Documentation

RunDynamicEnrichment

Description

This function calculates gene-set scores from the specified database (db) for each lineage using the specified scoring method (score_method). It then treats these scores as expression values and uses them as input to the RunDynamicFeatures function to identify dynamically enriched terms along the lineage.

Usage

RunDynamicEnrichment(
  srt,
  lineages,
  score_method = "AUCell",
  slot = "data",
  assay = NULL,
  min_expcells = 20,
  r.sq = 0.2,
  dev.expl = 0.2,
  padjust = 0.05,
  IDtype = "symbol",
  species = "Homo_sapiens",
  db = "GO_BP",
  db_update = FALSE,
  db_version = "latest",
  convert_species = TRUE,
  Ensembl_version = 103,
  mirror = NULL,
  TERM2GENE = NULL,
  TERM2NAME = NULL,
  minGSSize = 10,
  maxGSSize = 500,
  BPPARAM = BiocParallel::bpparam(),
  seed = 11
)

Arguments

srt

A Seurat object containing the results of differential expression analysis (RunDEtest). If specified, the genes and groups will be extracted from the Seurat object automatically. If not specified, the geneID and geneID_groups arguments must be provided.

lineages

A character vector specifying the lineages to plot.

score_method

The method to use for scoring. Can be "Seurat", "AUCell", or "UCell". Defaults to "Seurat".

slot

A character vector specifying the slot in the Seurat object to use. Default is "counts".

assay

A character vector specifying the assay in the Seurat object to use. Default is NULL.

min_expcells

A numeric value specifying the minimum number of expected cells. Default is 20.

r.sq

A numeric value specifying the R-squared threshold. Default is 0.2.

dev.expl

A numeric value specifying the deviance explained threshold. Default is 0.2.

padjust

A numeric value specifying the p-value adjustment threshold. Default is 0.05.

IDtype

A character vector specifying the type of gene IDs in the srt object or geneID argument. This argument is used to convert the gene IDs to a different type if IDtype is different from result_IDtype.

species

A character vector specifying the species for which the analysis is performed.

db

A character vector specifying the name of the database to be used for enrichment analysis.

db_update

A logical value indicating whether the gene annotation databases should be forcefully updated. If set to FALSE, the function will attempt to load the cached databases instead. Default is FALSE.

db_version

A character vector specifying the version of the database to be used. This argument is ignored if db_update is TRUE. Default is "latest".

convert_species

A logical value indicating whether to use a species-converted database when the annotation is missing for the specified species. The default value is TRUE.

Ensembl_version

Ensembl database version. If NULL, use the current release version.

mirror

Specify an Ensembl mirror to connect to. The valid options here are 'www', 'uswest', 'useast', 'asia'.

TERM2GENE

A data frame specifying the gene-term mapping for a custom database. The first column should contain the term IDs, and the second column should contain the gene IDs.

TERM2NAME

A data frame specifying the term-name mapping for a custom database. The first column should contain the term IDs, and the second column should contain the corresponding term names.

minGSSize

A numeric value specifying the minimum size of a gene set to be considered in the enrichment analysis.

maxGSSize

A numeric value specifying the maximum size of a gene set to be considered in the enrichment analysis.

BPPARAM

A BiocParallelParam object specifying the parallel back-end to be used for parallel computation. Defaults to BiocParallel::bpparam().

seed

The random seed for reproducibility. Defaults to 11.

See Also

RunDynamicFeatures DynamicHeatmap

Examples

data("pancreas_sub")
pancreas_sub <- RunSlingshot(pancreas_sub, group.by = "SubCellType", reduction = "UMAP")
pancreas_sub <- RunDynamicFeatures(pancreas_sub, lineages = "Lineage1", n_candidates = 200)
ht1 <- DynamicHeatmap(
  srt = pancreas_sub,
  lineages = "Lineage1",
  cell_annotation = "SubCellType",
  n_split = 4
)
ht1$plot

pancreas_sub <- RunDynamicEnrichment(
  srt = pancreas_sub,
  lineages = "Lineage1",
  score_method = "AUCell",
  db = "GO_BP",
  species = "Mus_musculus"
)
ht2 <- DynamicHeatmap(
  srt = pancreas_sub,
  assay = "GO_BP",
  lineages = "Lineage1_GO_BP",
  cell_annotation = "SubCellType",
  n_split = 4,
  split_method = "kmeans-peaktime"
)
ht2$plot

zh542370159/SCP documentation built on Nov. 22, 2023, 2:34 a.m.