
Split cells into expression groups per cell type
SplitByGene.RdAdds a metadata column labeling each cell as "high" / "low" (or
"expressed" / "zero") for a given gene. The split is computed
independently within each cell type. The column can be passed directly as
condition.by in RunGSEA_pseudobulk() or used with Seurat::FindMarkers.
Arguments
- seurat_object
A Seurat object.
- gene
Character. Gene to split on.
- group.by
Character. Cell-type identity column.
- split
Character.
"zero_vs_expressed"(default),"quantile", or"expressed_quantile".- quantile_range
Numeric length-2. Quantile bounds for the two threshold modes. Default
c(0.25, 0.75).- assay
Character or
NULL. Assay to use.- layer
Character. Layer/slot. Default
"data".- col_name
Character or
NULL. New metadata column name. Defaults to"<gene>_split".
Details
Split modes
"zero_vs_expressed"GOI = 0 →
"zero"; GOI > 0 →"expressed". Cleanest for pseudobulk: maps to donor-level proportion."quantile"Bottom
quantile_range[1]→"low"; top1 - quantile_range[2]→"high"; middle →NA(excluded)."expressed_quantile"Same as
"quantile"but among GOI > 0 cells only. Zeros →NA. Avoids dropout in the low group but can confound with library size - regress outnCount_RNAdownstream.