
Pipeline step: generate meta cells
step_metacells_sc.RdWraps the meta cell generators as an ScStep. Unlike the other steps this
one changes the class of the object: it takes a SingleCells or
SingleCellsSubset and returns a MetaCells(). Steps that follow
it need MetaCells methods, which validate_pipeline() checks up front.
Combined with apply_pipeline_per_group() this gives you per-group
pre-processing (HVG, PCA, batch correction within a patient, kNN) followed by
source-pure meta cells, which you then hand to merge_meta_cells().
Usage
step_metacells_sc(method = c("bootstrapped", "seacells", "supercells"), ...)Examples
# per group pre-processing that ends on source-pure meta cells
sc <- demo_single_cells(prepped = FALSE)
pipeline <- step_hvg_sc(hvg_no = 30L, .verbose = FALSE) %>>%
step_pca_sc(no_pcs = 10L, .verbose = FALSE) %>>%
step_neighbours_sc(.verbose = FALSE) %>>%
step_metacells_sc(
"bootstrapped",
sc_meta_cell_params = params_sc_bt_metacells(target_no_metacells = 10L),
.verbose = FALSE
)
per_group <- apply_pipeline_per_group(pipeline, sc, group_col = "cell_grp")
merge_meta_cells(per_group, .verbose = FALSE)
#> Single cell experiment (Meta Cells).
#> Meta cell method: meta_cells_hdwgcna
#> Merged: TRUE
#> No meta cells: 30
#> No genes: 50
#> No cells aggregated: 297
#> No obs rows in source: 500
#> HVG calculated: FALSE
#> PCA calculated: FALSE
#> Other embeddings: none
#> KNN generated: FALSE
#> SNN generated: FALSE
#> Stale artefacts: none
unlink(sc@dir_data, recursive = TRUE, force = TRUE)