This function processes a Seurat object through various steps including normalization, PCA, and clustering based on specified parameters. It allows for conditional execution of each step based on prior executions and parameter changes.

RunBasicSeurat(
  seu,
  spe = NULL,
  nFeature_RNA.min = 500,
  nFeature_RNA.max = Inf,
  percent.mt.max = 20,
  dims = 1:10,
  resolution = 0.5,
  reduction = NULL,
  harmony.by = NULL,
  force.Normalize = FALSE,
  force.RunPCA = FALSE,
  vars.to.regress = NULL,
  force.RunHarmony = FALSE,
  force.FindNeighbors = FALSE,
  force.FindClusters = FALSE,
  force.RunUMAP = FALSE
)

Arguments

seu

A Seurat object that will be processed.

spe

Either "human" or "mouse", used in calculating percent.mt. Default: NULL.

nFeature_RNA.min

The minimum number of RNA features to include in the subset. Default: 500.

nFeature_RNA.max

The maximum number of RNA features to include in the subset. Default: Inf.

percent.mt.max

The maximum percentage of mitochondrial content allowed for cells in the subset. Default: 20.

dims

The dimensions to be used in RunPCA and FindNeighbors. Default: 1:10.

resolution

The resolution parameter for the clustering algorithm. Default: 0.5.

reduction

The dimensional reduction technique to be used ('pca' or 'harmony'). If NULL, the method is determined based on available data in the Seurat object. Default: NULL.

harmony.by

A string representing a metadata column in the Seurat object that categorizes data, which might need transformation for numeric-only issues before running Harmony. Default: NULL.

force.Normalize

Forces the normalization step regardless of previous command history. Default: FALSE.

force.RunPCA

Forces the PCA step regardless of previous command history. Default: FALSE.

vars.to.regress

Variables to regress out during scaling. Default: NULL.

force.RunHarmony

Forces the Harmony integration step regardless of previous command history or detection. Default: FALSE.

force.FindNeighbors

Forces the neighbor finding step regardless of previous command history. Default: FALSE.

force.FindClusters

Forces the clustering step regardless of previous command history. Default: FALSE.

force.RunUMAP

Forces the UMAP step regardless of previous command history. Default: FALSE.

Value

Returns the modified Seurat object after performing the requested operations and updates.

Details

This function provides flexible and conditional execution of various data processing steps in a Seurat pipeline. Depending on the parameters set, the function intelligently determines whether to rerun specific steps based on changes in parameters or previous runs recorded in the Seurat object's command history. This allows for efficient reuse of existing results while ensuring updates are applied when necessary.

Examples

library(SeuratExtend)
pbmc <- RunBasicSeurat(pbmc, force.Normalize = TRUE)
DimPlot2(pbmc, group.by = "cluster")