Write pseudobulk inputs for the scE2G enhancer-gene pipeline
write_sce2g_inputs.RdWrites the per-cluster fragment files, optional RNA matrices, and cluster table that
the scE2G Snakemake pipeline (https://github.com/EngreitzLab/scE2G) takes as
input. Each group in pb becomes one scE2G cell cluster.
Usage
write_sce2g_inputs(
pb,
dir,
rna = NULL,
model = NULL,
verbose = getOption("MarchR.verbose", FALSE)
)Arguments
- pb
(MarchRPseudobulk) Output of
pseudobulk_fragments(), built withblacklist = FALSE(see Details).- dir
(character) Output directory. Files land in
<dir>/fragments/,<dir>/rna/, and<dir>/config_cell_clusters.tsv.- rna
(IterableMatrix or NULL) Raw-count gene x cell matrix for multiome data, e.g.
proj[["RNA", by_dataset = FALSE]].NULLfor ATAC-only. DefaultNULL.- model
(character) scE2G model folder names under its
models/directory. Default"multiome_powerlaw_v3"whenrnais given, else"scATAC_powerlaw_v3".- verbose
(logical) Print progress messages. Default
getOption("MarchR.verbose", FALSE).
Value
pb with fragments_path (and rna_path when rna is given) added to its
manifest, and params$sce2g_config_path set to the cluster table.
Details
Requires the optional Rsamtools package.
Build pb with blacklist = FALSE; this warns otherwise. scE2G removes blocklisted
candidate regions itself and then adds gene promoters back, so fragments already
filtered by MarchR leave any promoter inside a blocklisted region with no signal.
scE2G's models are trained on human data. Its default references are hg38; hg19 data runs by pointing its config at the hg19 reference files in its ABC submodule.
References
Sheth MU, Qiu W-L, Ma XR, et al. (2026). Mapping enhancer-gene regulatory interactions from single-cell data. Nature Genetics 58(8), 1941-1952. doi:10.1038/s41588-026-02695-8
Examples
if (FALSE) { # \dontrun{
pb <- pseudobulk_fragments(proj, group_by = "clusters", blacklist = FALSE)
pb <- write_sce2g_inputs(pb, "sce2g_inputs")
# Multiome
pb <- write_sce2g_inputs(pb, "sce2g_inputs", rna = proj[["RNA", by_dataset = FALSE]])
} # }