RunDynamicFeatures: RunDynamicFeatures

View source: R/SCP-analysis.R

RunDynamicFeaturesR Documentation

RunDynamicFeatures

Description

Calculates dynamic features for lineages in a single-cell RNA-seq dataset.

Usage

RunDynamicFeatures(
  srt,
  lineages,
  features = NULL,
  suffix = lineages,
  n_candidates = 1000,
  minfreq = 5,
  family = NULL,
  slot = "counts",
  assay = NULL,
  libsize = NULL,
  BPPARAM = BiocParallel::bpparam(),
  seed = 11
)

Arguments

srt

A Seurat object.

lineages

A character vector specifying the lineage names for which dynamic features should be calculated.

features

A character vector specifying the features (genes or metadata variables) for which dynamic features should be calculated. If NULL, n_candidates must be provided.

suffix

A character vector specifying the suffix to append to the output slot names for each lineage. Defaults to the lineage names.

n_candidates

An integer specifying the number of candidate features to select when features is NULL. Defaults to 1000.

minfreq

An integer specifying the minimum frequency threshold for candidate features. Features with a frequency less than minfreq will be excluded. Defaults to 5.

family

A character or character vector specifying the family of distributions to use for the generalized additive models (GAMs). If family is set to NULL, the appropriate family will be automatically determined based on the data. If length(family) is 1, the same family will be used for all features. Otherwise, family must have the same length as features.

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.

libsize

A numeric or numeric vector specifying the library size correction factors for each cell. If NULL, the library size correction factors will be calculated based on the expression matrix. If length(libsize) is 1, the same value will be used for all cells. Otherwise, libsize must have the same length as the number of cells in srt. Defaults to NULL.

BPPARAM

A BiocParallelParam object specifying the parallelization parameters for computing dynamic features. Defaults to BiocParallel::bpparam().

seed

An integer specifying the seed for random number generation. Defaults to 11.

Value

Returns the modified Seurat object with the calculated dynamic features stored in the tools slot.

See Also

DynamicHeatmap DynamicPlot RunDynamicEnrichment

Examples

data("pancreas_sub")
pancreas_sub <- RunSlingshot(pancreas_sub, group.by = "SubCellType", reduction = "UMAP")
pancreas_sub <- RunDynamicFeatures(pancreas_sub, lineages = c("Lineage1", "Lineage2"), n_candidates = 200)
names(pancreas_sub@tools$DynamicFeatures_Lineage1)
head(pancreas_sub@tools$DynamicFeatures_Lineage1$DynamicFeatures)
ht <- DynamicHeatmap(
  srt = pancreas_sub,
  lineages = c("Lineage1", "Lineage2"),
  cell_annotation = "SubCellType",
  n_split = 6, reverse_ht = "Lineage1"
)
ht$plot

DynamicPlot(
  srt = pancreas_sub,
  lineages = c("Lineage1", "Lineage2"),
  features = c("Nnat", "Irx1"),
  group.by = "SubCellType",
  compare_lineages = TRUE,
  compare_features = FALSE
)

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