View source: R/find_marker_in_bulk.R
| find_markers_in_bulk | R Documentation |
Identifies informative marker features across groups from bulk gene expression or signature score matrices using Seurat workflows. Performs feature selection, scaling, PCA, clustering, and marker discovery.
find_markers_in_bulk(
pdata,
eset,
group,
id_pdata = "ID",
nfeatures = 2000,
top_n = 20,
thresh.use = 0.25,
only.pos = TRUE,
min.pct = 0.25,
npcs = 30
)
pdata |
Data frame. Sample metadata. |
eset |
Matrix. Gene expression or signature score matrix. |
group |
Character. Column name in pdata specifying grouping variable. |
id_pdata |
Character. Column name for sample IDs. Default is "ID". |
nfeatures |
Integer. Number of top variable features to select. Default is 2000. |
top_n |
Integer. Number of top markers to retain per cluster. Default is 20. |
thresh.use |
Numeric. Threshold for marker selection. Default is 0.25. |
only.pos |
Logical. Whether to retain only positive markers. Default is TRUE. |
min.pct |
Numeric. Minimum expression percentage threshold. Default is 0.25. |
npcs |
Integer. Number of principal components to use. Default is 30. |
List with components: 'sce' (Seurat object), 'markers' (all markers), 'top_markers' (top markers per group).
if (requireNamespace("Seurat", quietly = TRUE) && requireNamespace("Matrix", quietly = TRUE)) {
# Simulate data
set.seed(123)
sim_eset <- matrix(abs(rnorm(100 * 30)), 100, 30)
rownames(sim_eset) <- paste0("Gene", 1:100)
colnames(sim_eset) <- paste0("Sample", 1:30)
sim_pdata <- data.frame(
ID = paste0("Sample", 1:30),
TMEcluster = rep(c("A", "B", "C"), each = 10)
)
res <- find_markers_in_bulk(
pdata = sim_pdata, eset = sim_eset,
group = "TMEcluster", npcs = 5
)
if (!is.null(res)) head(res$top_markers)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.