Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/satijalab/seurat-wrappers/llms.txt

Use this file to discover all available pages before exploring further.

RunCoGAPS() runs the CoGAPS (Coordinated Gene Activity in Pattern Sets) algorithm on a Seurat object. It decomposes the expression matrix into latent patterns via sparse Bayesian NMF, storing results as a DimReduc object.

Syntax

RunCoGAPS(
  object,
  assay = NULL,
  slot = "counts",
  params = NULL,
  temp.file = NULL,
  reduction.name = "CoGAPS",
  reduction.key = "CoGAPS_",
  ...
)

Parameters

object
Seurat
required
A Seurat object.
assay
character
default:"NULL"
Assay to pull expression data from. Defaults to the active default assay.
slot
character
default:"counts"
Slot within the assay to use. Data is log2-transformed (log2(x + 1)) internally before being passed to CoGAPS.
params
CogapsParams
default:"NULL"
A CogapsParams object specifying CoGAPS settings such as nPatterns, nIterations, singleCell, sparseOptimization, and distributed mode. If NULL, CoGAPS runs with default parameters.
temp.file
character or logical
default:"NULL"
If TRUE, creates a temporary .mtx file for the data matrix (required for distributed CoGAPS). If a string, uses that path as the temporary file. Leave NULL for in-memory execution.
reduction.name
character
default:"CoGAPS"
Name for the resulting DimReduc object stored in the Seurat object.
reduction.key
character
default:"CoGAPS_"
Column name prefix for the CoGAPS embedding dimensions.
...
any
Additional parameters passed to CoGAPS::CoGAPS().

Returns

A Seurat object with a new DimReduc object stored under reduction.name. Cell embeddings correspond to sampleFactors and feature loadings correspond to featureLoadings from the CoGAPS result.

Examples

library(SeuratWrappers)
BiocManager::install("CoGAPS")

# Basic run with default parameters
object <- RunCoGAPS(object = seurat_obj)

# Specify number of patterns and iterations
params <- CoGAPS::CogapsParams()
params <- CoGAPS::setParam(params, "nPatterns", 8)
params <- CoGAPS::setParam(params, "nIterations", 50000)
object <- RunCoGAPS(object = seurat_obj, params = params)

# Visualize patterns
VlnPlot(object, features = paste0("CoGAPS_", 1:8), group.by = "seurat_clusters")

See Also

Build docs developers (and LLMs) love