
Generate meta cells based on SEACells and return a MetaCells object
generate_seacells_sc.RdThis function implements the meta cell aggregation from Persad et al., and returns the resulting SEACells. Compared to other algorithms, a kernel archetype analysis is used to identify the metacells. For details, please refer to the publication.
Usage
generate_seacells_sc(
object,
seacell_params = params_sc_seacells(),
embd_to_use = "pca",
no_embd_to_use = NULL,
cells_to_use = NULL,
regenerate_knn = FALSE,
target_size = 1e+05,
seed = 42L,
.verbose = TRUE
)Arguments
- object
SingleCellsorSingleCellsSubsetclass.- seacell_params
List. Output of
params_sc_seacells(). A list with the following items:n_sea_cells - Number of SEA cells to detect.
max_fw_iters - Maximum iterations for the Franke-Wolfe algorithm per matrix update.
convergence_epsilon - Convergence threshold. Algorithm stops when RSS change < epsilon * RSS(0).
max_iter - Maximum iterations to run SEACells for.
min_iter - Minimum iterations to run SEACells for.
greedy_threshold - Maximum number of cells before defaulting to rapid random selection of archetypes.
graph_building - Graph building method.
pruning - Boolean. Shall small values be pruned during the Franke- Wolfe iterations.
pruning_threshold - The threshold below which pruning shall be applied during Franke-Wolfe iterations.
knn - List of kNN parameters. See
params_knn_defaults()for available parameters and their defaults.
- embd_to_use
String. The embedding to use. Atm, the only option is
"pca". Only relevant if you set regenerate_knn toTRUE.- no_embd_to_use
Optional integer. Number of embedding dimensions to use. If
NULLall will be used. Only relevant if you set regenerate_knn toTRUE.- cells_to_use
Optional string. Names of the cells to use for the generation of the SEACells.
- regenerate_knn
Boolean. Shall a kNN graph be regenerated. If not, the internal one will be used.
- target_size
Numeric. The library target size to normalise the meta cells to.
- seed
Integer. Seed for reproducibility.
- .verbose
Boolean or integer. Controls verbosity and returns run times.
FALSE-> quiet,TRUEor1L-> normal verbosity,2L-> detailed verbosity.
Value
A MetaCells() with the data generated by this meta cell
aggregation method.
Examples
# archetypal analysis based meta cells
sc <- demo_single_cells()
mc <- generate_seacells_sc(
sc,
seacell_params = params_sc_seacells(
n_sea_cells = 50L,
min_iter = 5L,
knn = list(k = 10L)
),
.verbose = FALSE
)
mc
#> Single cell experiment (Meta Cells).
#> Meta cell method: seacell
#> Merged: FALSE
#> No meta cells: 50
#> No genes: 50
#> No cells aggregated: 500
#> 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)