Configuration skill for the immunopipe process
Purpose: Calculate module/pathway/gene signature scores per cell using Seurat's AddModuleScore or CellCycleScoring functions.
[ModuleScoreCalculator]
cache = true
[ModuleScoreCalculator.in]
# Input: Seurat object from SeuratClustering
srtobj = ["SeuratClustering"]
[ModuleScoreCalculator.envs]
# Default parameters inherited by all modules
defaults = { nbin = 24, ctrl = 100, seed = 8525, agg = "mean" }
# Module definitions (key = module name, value = gene set parameters)
modules = {}
# Post-scoring metadata transformations
post_mutaters = {}
| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| features | string/list | Required | Gene names or cc.genes/cc.genes.updated.2019 for cell cycle |
| nbin | int | 24 | Number of bins for aggregate expression levels of all analyzed features |
| ctrl | int | 100 | Number of control features selected from same bin per analyzed feature |
| k | boolean | false | Use feature clusters from DoKMeans instead of random selection |
| assay | string | NULL | The assay to use (defaults to active assay) |
| seed | int | 8525 | Random seed for reproducibility |
| search | boolean | false | Search for symbol synonyms if features don't match |
| keep | boolean | false | Keep individual feature scores (non-cell cycle only) |
| agg | string | "mean" | Aggregation function: mean, median, sum, max, min, var, sd |
Reference: https://satijalab.org/seurat/reference/addmodulescore
When using features = "cc.genes" or "cc.genes.updated.2019", adds:
S.Score - S phase score per cellG2M.Score - G2M phase score per cellPhase - Cell cycle phase assignment (G1, S, G2M)Reference: https://satijalab.org/seurat/reference/cellcyclescoring
{"DC": {"features": 2, "kind": "diffmap"}}
Adds first N diffusion components as metadata columns (DC_1, DC_2, ...).
Reference: https://www.rdocumentation.org/packages/destiny/versions/2.0.4/topics/DiffusionMap
[ModuleScoreCalculator]
[ModuleScoreCalculator.in]
srtobj = ["SeuratClustering"]
[ModuleScoreCalculator.envs.modules]
CellCycle = { features = "cc.genes.updated.2019" }
Output columns: S.Score, G2M.Score, Phase
[ModuleScoreCalculator.envs.modules.Exhaustion]
features = "HAVCR2,ENTPD1,LAYN,LAG3,TIGIT,PDCD1,TOX"
[ModuleScoreCalculator.envs.modules.Cytotoxicity]
features = "GZMB,PRF1,NKG7,GNLY,CTSW"
[ModuleScoreCalculator.envs.modules.Proliferation]
features = "MKI67,STMN1,TUBB,PCNA,TOP2A"
[ModuleScoreCalculator.envs.modules.Activation]
features = "IFNG,TNF,CD69,CD25"
[ModuleScoreCalculator.envs.modules]
[ModuleScoreCalculator.envs.modules.CellCycle]
features = "cc.genes.updated.2019"
[ModuleScoreCalculator.envs.modules.Exhaustion]
features = "HAVCR2,ENTPD1,LAYN,LAG3,TIGIT,PDCD1"
[ModuleScoreCalculator.envs.modules.Activation]
features = "IFNG,TNF,CD69,CD25"
[ModuleScoreCalculator.envs.modules.Proliferation]
features = "MKI67,STMN1,TUBB,PCNA"
[ModuleScoreCalculator.envs.modules]
DC = { features = 2, kind = "diffmap" }
Use with: env.dimplots in SeuratClusterStats with reduction = "DC"
[ModuleScoreCalculator.envs.post_mutaters]
# Calculate combined exhaustion-activation ratio
Exh_Act_Ratio = "Exhaustion1 / Activation1"
# Classify high vs low exhaustion
Exhaustion_Level = "ifelse(Exhaustion1 > median(Exhaustion1, na.rm = TRUE), 'High', 'Low')"
[ModuleScoreCalculator.envs.modules]
# Exhaustion markers (checkpoint genes)
Exhaustion = {
features = "HAVCR2,ENTPD1,LAYN,LAG3,TIGIT,PDCD1,TOX,CTLA4"
}
# Activation markers
Activation = {
features = "IFNG,TNF,CD69,CD25,IL2RA"
}
# Memory markers
Memory = {
features = "IL7R,CCR7,SELL,S100A4"
}
# Terminal differentiation
Terminal_Diff = {
features = "TIGIT,PDCD1,CD274,CD244,CD160"
}
[ModuleScoreCalculator.envs.modules]
# Cytotoxicity
Cytotoxicity = {
features = "GZMB,PRF1,NKG7,GNLY,CTSW"
}
# Activation
NK_Activation = {
features = "NCAM1,KLRD1,FCGR3A"
}
# Exhaustion
NK_Exhaustion = {
features = "HAVCR2,LAG3,PDCD1,TIGIT"
}
[ModuleScoreCalculator.envs.defaults]
nbin = 24
ctrl = 100
seed = 8525
[ModuleScoreCalculator.envs.modules]
CellCycle = {
features = "cc.genes.updated.2019"
}
[ModuleScoreCalculator.envs.modules]
# Glycolysis (Warburg effect)
Glycolysis = {
features = "HK2,PKM,LDHA,PFKL,ENO1"
}
# Oxidative phosphorylation
OXPHOS = {
features = "ND1,ND2,ND3,COX1,COX2,ATP5A1"
}
# Fatty acid oxidation
FAO = {
features = "CPT1A,ACOX1,HADHA"
}
[ModuleScoreCalculator.envs.modules]
# Plasma cell differentiation
Plasma = {
features = "MZB1,SSR4,SDC1,XBP1,PRDM1"
}
# Germinal center
Germinal_Center = {
features = "BCL6,AICDA,MEF2B"
}
# Naive vs memory
Naive = {
features = "IL7R,CCR7,IGHD"
}
Memory = {
features = "CD27,IGG1,IGHG1"
}
HALLMARK_INTERFERON_GAMMA_RESPONSEHALLMARK_TNFA_SIGNALING_VIA_NFKBHALLMARK_INFLAMMATORY_RESPONSEHALLMARK_HYPOXIAHALLMARK_APOPTOSIST Cell Exhaustion Markers:
HAVCR2 (TIM-3), PDCD1 (PD-1), LAG3, TIGIT, CTLA4TOX, NR4A1, EOMEST Cell Activation Markers:
IFNG, TNF, IL2CD69, CD25 (IL2RA), CD38Cytotoxicity Markers:
GZMB, GZMA, GZMHPRF1NKG7, GNLY, CTSWProliferation Markers:
MKI67STMN1, TUBBPCNA, TOP2ACell Cycle Genes (Seurat built-in):
cc.genes - Original Tirosh et al. 2016 gene setcc.genes.updated.2019 - Updated with 2019 gene symbolsSeuratClustering - Provides the Seurat objectTOrBCellSelection - If working with T/B cell subsetsSeuratClusterStats - Visualize module scores across clustersCellCellCommunication - Correlate scores with cell interactionsScFGSEA - Validate module activity with enrichment analysis"GENE1,GENE2,GENE3" ✓"cc.genes" or "cc.genes.updated.2019" ✓{"features": N, "kind": "diffmap"} ✓MKI67, IFNG) ✓Mki67, Ifng) ✓search = true to automatically find synonymskeep = true to retain unmatched featuresnbin: Typically 10-50 (default 24)ctrl: Typically 10-500 (default 100)Symptom: Warning "XX% of features not found in object"
Solutions:
search = true to find symbol synonymssearch = true + keep = true to debug missing genesSymptom: Module score is NA or unreliable
Solutions:
keep = true to see how many genes matchedSymptom: Most cells classified as G1 phase
Solutions:
cc.genes instead of cc.genes.updated.2019S.Score and G2M.Score values directlySymptom: No variation in scores across cells
Solutions:
nbin and ctrl parametersassay = "RNA" vs "SCT")Symptom: DC_1, DC_2 columns missing
Solutions:
destiny R package is installedSingleCellExperiment package is available{"DC": {"features": 2, "kind": "diffmap"}}SingleCellExperiment, destinyHAVCR2 + PDCD1 + LAG3)nbin = 24: Default works well for most datasetsctrl = 100: Increase if many genes have similar expression levelsseed = 8525: Keep fixed for reproducibility across runsagg = "mean": Use median for outlier-resistant aggregationSeuratClusterStats.envs.dimplots to visualize scoresSeuratClusterStats.envs.violins for distribution plotspost_mutaters for custom score transformations# Complete workflow with multiple scores
[ModuleScoreCalculator.envs.defaults]
nbin = 24
ctrl = 100
seed = 8525
[ModuleScoreCalculator.envs.modules]
# Cell cycle
CellCycle = { features = "cc.genes.updated.2019" }
# T cell function
Exhaustion = { features = "HAVCR2,ENTPD1,LAYN,LAG3,TIGIT,PDCD1,TOX,CTLA4" }
Activation = { features = "IFNG,TNF,CD69,CD25" }
Memory = { features = "IL7R,CCR7,SELL,S100A4" }
# Cytotoxicity
Cytotoxicity = { features = "GZMB,PRF1,NKG7,GNLY" }
# Metabolism
Glycolysis = { features = "HK2,PKM,LDHA,PFKL,ENO1" }
[ModuleScoreCalculator.envs.post_mutaters]
# Classify T cell states
Tcell_State = """
case_when(
Exhaustion1 > median(Exhaustion1, na.rm = TRUE) ~ 'Exhausted',
Activation1 > median(Activation1, na.rm = TRUE) ~ 'Activated',
Memory1 > median(Memory1, na.rm = TRUE) ~ 'Memory',
TRUE ~ 'Naive'
)
"""
# Combined functional score
Functionality = "(Activation1 + Cytotoxicity1) / (Exhaustion1 + 1)"
[ModuleScoreCalculator] section exists in configmodules dictionaryModuleName1, ModuleName2, etc.CellCycleScoring() which adds S.Score, G2M.Score, Phasepost_mutaters for custom metadata calculationsSeuratClusterStats for plottingGene Set Formats:
# Comma-separated
features = "GENE1,GENE2,GENE3"
# Cell cycle (built-in)
features = "cc.genes.updated.2019"
# Diffusion map (special)
features = 2
kind = "diffmap"
Common Gene Sets:
Exhaustion = "HAVCR2,PDCD1,LAG3,TIGIT,CTLA4,TOX"
Cytotoxicity = "GZMB,PRF1,NKG7,GNLY"
Proliferation = "MKI67,STMN1,PCNA,TOP2A"
Activation = "IFNG,TNF,CD69,CD25"
Memory = "IL7R,CCR7,SELL"
Process Location: /immunopipe/processes.py (line 455)
Documentation: /docs/processes/ModuleScoreCalculator.md
Function: Seurat::AddModuleScore(), Seurat::CellCycleScoring()
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer