Skip to contents

Add a command to a Seurat object @commands slot

Usage

AddSeuratCommand(
  object,
  name,
  call.string = paste0(name, "(object, ...)"),
  params = list(),
  assay.used = NULL
)

Arguments

object

Seurat object

name

Name of the command

call.string

Call string of the command

params

Parameters of the command

assay.used

Assay used in the command

Value

The Seurat object with the command added

Examples

object <- SeuratObject::pbmc_small
names(object@commands)
#>  [1] "NormalizeData.RNA"        "ScaleData.RNA"           
#>  [3] "RunPCA.RNA"               "BuildSNN.RNA.pca"        
#>  [5] "FindClusters"             "RunTSNE.pca"             
#>  [7] "JackStraw.RNA.pca"        "ScoreJackStraw.pca"      
#>  [9] "ProjectDim.RNA.pca"       "FindVariableFeatures.RNA"

object <- AddSeuratCommand(object, "RunSeuratDEAnalysis",
 "RunSeuratDEAnalysis(object, group.by = 'groups', ident.1 = 'g1', ident.2 = 'g2')",
 list(group.by = 'groups', ident.1 = 'g1', ident.2 = 'g2'))
object@commands$RunSeuratDEAnalysis
#> Command: RunSeuratDEAnalysis(object, group.by = 'groups', ident.1 = 'g1', ident.2 = 'g2')
#> Time: 2025-01-03 21:07:37.594081
#> group.by : groups 
#> ident.1 : g1 
#> ident.2 : g2