Split a Seurat object into per-batch layers and prepare it for integration.
split_layers_by_batch.RdDrops the scaled data, reductions, graphs, and clustering columns, then
splits the assay layers by a metadata column — splitting the layers rather
than the object is what the Seurat 5 IntegrateLayers() workflow expects.
Usage
split_layers_by_batch(
x,
batch_var = "orig.ident",
assay = "RNA",
num_variable_genes = 3000,
num_dim = 50,
log_file = NULL
)Details
Everything after the split runs through the same verbs as the single-sample
path (normalize_counts(), run_pca()), so the two workflows cannot drift
apart on parameters. integrate_layers() then consumes the resulting "pca"
reduction.