Flexible marker-finding process that wraps Seurat's FindMarkers function to support custom group comparisons beyond simple cluster-vs-all analysis. Unlike ClusterMarkers (all-vs-all cluster comparisons), MarkersFinder enables targeted differential expression analyses between specific groups, conditions within cell types, or any custom comparison defined by metadata columns. It automatically performs pathway enrichment analysis on significant markers and generates comprehensive visualizations.
Flexible marker finding process that wraps Seurat's FindMarkers function for custom group comparisons beyond simple cluster-vs-all analysis. Unlike ClusterMarkers (all-vs-all cluster comparisons), MarkersFinder enables targeted differential expression analysis between specific groups, conditions within cell types, or any custom comparison defined by metadata columns. Automatically performs pathway enrichment analysis on significant markers and generates comprehensive visualizations.
Note: Use ClusterMarkers for standard all-vs-all cluster analysis. Use MarkersFinder for custom comparisons.
[MarkersFinder]
cache = true
[MarkersFinder.in]
srtobj = ["SeuratClustering"]
[MarkersFinder.envs]
group_by = "seurat_clusters" # Column in metadata to group cells
ident_1 = "" # First group (ident.1); if empty, all groups vs rest
ident_2 = "" # Second group (ident.2); if empty, ident_1 vs rest
each = "" # Column to create separate cases for each unique value
[MarkersFinder.envs]
test.use = "wilcox" # Options: wilcox, MAST, DESeq2, roc, t, tobit, bimod, poisson, negbinom, LR
logfc.threshold = 0.25 # Minimum log2 fold change
min.pct = 0.1 # Minimum percentage of cells expressing gene
min.diff.pct = -Inf # Minimum difference in detection
only.pos = false # Only positive markers
min.cells.group = 3 # Minimum cells per group
min.cells.feature = 3 # Minimum cells expressing gene
[MarkersFinder.envs]
sigmarkers = "p_val_adj < 0.05" # Filter for enrichment (vars: p_val, avg_log2FC, pct.1, pct.2, p_val_adj)
dbs = ["KEGG_2021_Human", "MSigDB_Hallmark_2020"] # Pathway databases
enrich_style = "enrichr" # Options: enrichr, clusterprofiler
[MarkersFinder.envs.cases."T_vs_B"]
group_by = "celltype"
ident_1 = "T cells"
ident_2 = "B cells"
[MarkersFinder.envs.cases."Treatment_vs_Control"]
group_by = "condition"
ident_1 = "treatment"
ident_2 = "control"
subset = "celltype == 'T cells'"
https://satijalab.org/seurat/reference/findmarkers
Key Parameters:
ident.1, ident.2: Groups to comparetest.use: Statistical test (wilcox, MAST, DESeq2, roc, etc.)logfc.threshold: Minimum fold change (log2 scale)min.pct: Minimum percentage of cells expressing genemin.diff.pct: Minimum difference in detection between groupsonly.pos: Return only positive markers (higher in ident.1)"KEGG_2021_Human", "KEGG": KEGG pathways"MSigDB_Hallmark_2020", "Hallmark": MSigDB Hallmark"GO_Biological_Process_2025": GO Biological Process"Reactome_Pathways_2024", "Reactome": Reactome"WikiPathways_2024_Human", "WikiPathways": WikiPathwaysFull list: https://maayanlab.cloud/Enrichr/#libraries
[MarkersFinder]
[MarkersFinder.in]
srtobj = ["SeuratClustering"]
[MarkersFinder.envs]
group_by = "seurat_clusters"
[MarkersFinder.envs]
group_by = "seurat_clusters"
ident_1 = "c1"
ident_2 = "c3"
logfc.threshold = 0.25
sigmarkers = "p_val_adj < 0.05 & avg_log2FC > 0"
[MarkersFinder.envs]
group_by = "condition"
ident_1 = "treatment"
ident_2 = "control"
subset = "celltype == 'T cells'"
test.use = "MAST"
[MarkersFinder.envs.cases."T_vs_B"]
group_by = "celltype"
ident_1 = "T cells"
ident_2 = "B cells"
[MarkersFinder.envs.cases."CD4_vs_CD8"]
group_by = "subtype"
ident_1 = "CD4+ T"
ident_2 = "CD8+ T"
subset = "celltype == 'T cells'"
each)[MarkersFinder.envs]
group_by = "seurat_clusters"
ident_1 = "c1"
ident_2 = "c2"
each = "Sample"
[MarkersFinder.envs]
group_by = "seurat_clusters"
ident_1 = "c1"
ident_2 = "c3"
logfc.threshold = 0.25
sigmarkers = "p_val_adj < 0.05 & avg_log2FC > 0"
[MarkersFinder.envs.cases."Treatment_Tcells"]
group_by = "condition"
ident_1 = "treatment"
ident_2 = "control"
subset = "celltype == 'T cells'"
[MarkersFinder.envs.cases."Treatment_Bcells"]
group_by = "condition"
ident_1 = "treatment"
ident_2 = "control"
subset = "celltype == 'B cells'"
[MarkersFinder.envs.cases."T_vs_B"]
group_by = "celltype"
ident_1 = "T cells"
ident_2 = "B cells"
[MarkersFinder.envs.cases."CD4_vs_CD8"]
group_by = "subtype"
ident_1 = "CD4+ T"
ident_2 = "CD8+ T"
subset = "celltype == 'T cells'"
[MarkersFinder.envs]
group_by = "seurat_clusters"
each[MarkersFinder.envs]
group_by = "seurat_clusters"
ident_1 = "c1"
ident_2 = "c2"
each = "Batch"
overlaps = {"Batch_Overlap": {plot_type = "venn"}}
| Feature | ClusterMarkers | MarkersFinder | |---------|---------------|---------------| | Default behavior | All clusters vs all other clusters | Customizable comparisons | | Group specification | Fixed to seurat_clusters | Any metadata column | | Comparisons | All-vs-all matrix | Targeted pairs or groups vs rest | | Multiple cases | Single comparison set | Multiple custom cases | | Use case | Cluster annotation | Targeted differential expression |
When to use which:
SeuratClustering (provides cluster assignments and metadata)ClusterMarkers (simpler all-vs-all), PseudoBulkDEG (bulk-like DE)group_by must be valid column in Seurat object metadataident_1 and ident_2 must exist in group_by column if specifiedmin.cells.group cells (default: 3)min.cells.feature cells (default: 3)each: creates separate case for each unique value in columnsigmarkers must be valid R/dplyr expression with available variables: p_val, avg_log2FC, pct.1, pct.2, p_val_adjSymptoms: Error "ident.1 not found"
Solution: Verify group_by column name and ident_1/ident_2 values match Seurat object metadata exactly (case-sensitive)
Symptoms: No markers found or cell count error
Solution: Reduce min.cells.group and min.cells.feature to 1, or combine similar groups via mutaters
Symptoms: Empty marker tables
Solution: Loosen thresholds: logfc.threshold = 0.1, min.pct = 0.05, sigmarkers = "p_val_adj < 0.1 & avg_log2FC > 0"
Symptoms: Thousands of markers, computationally expensive
Solution: Tighten thresholds: logfc.threshold = 0.58 (1.5-fold), min.pct = 0.25, sigmarkers = "p_val_adj < 0.01 & avg_log2FC > 1"
Symptoms: Empty enrichment tables
Solution: Loosen sigmarkers filter and add more databases: dbs = ["KEGG_2021_Human", "MSigDB_Hallmark_2020", "Reactome_Pathways_2024"]
npx skills add pwwang/标记基因发现器下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Category:science-education