
Calculate diffusion coordinates
calc_diffusion_coordinates.RdTo leverage the quality metrics from Persad, et al., we need the diffusion coordinates to then calculate if a cell is a dense or sparse region of the manifold, its compactness and separation to other meta cells. To do so, generate a diffusion map on the original data based on the approach of SEACells and add the data to the object, see Persad, et al.
Usage
calc_diffusion_coordinates(
object,
knn_data,
n_dcs = 10L,
k_density = 150L,
seed = 42L,
.verbose = TRUE
)Arguments
- object
MetaCellsclass.- knn_data
SingleCellNearestNeighbourclass. Contains the kNN graph from the original cells.- n_dcs
Integer. Number of diffusion coordinates to use. Defaults to
10L.- k_density
Integer. The k-th neighbour to use for the density region estimation. Defaults to
150L.- seed
Integer. Seed for reproducibility
- .verbose
Boolean or integer. Controls verbosity and returns run times.
FALSE-> quiet,TRUEor1L-> normal verbosity,2L-> detailed verbosity.
Examples
# diffusion map off the source kNN graph, giving each meta cell a region
sc <- demo_single_cells()
mc <- generate_bt_meta_cells_sc(
sc,
sc_meta_cell_params = params_sc_bt_metacells(target_no_metacells = 50L),
.verbose = FALSE
)
mc <- calc_diffusion_coordinates(
mc,
knn_data = get_knn_obj(sc),
.verbose = FALSE
)
table(mc[["density_region"]]$density_region)
#>
#> high low mid
#> 12 11 27
unlink(sc@dir_data, recursive = TRUE, force = TRUE)