
Run PAGA graph abstraction
run_paga_sc.RdPAGA abstracts the single cell kNN graph into a cluster-level graph, where the edge weight between two clusters measures how much more connected they are than expected under a random null model. It also returns the maximum spanning forest of that graph, which is the backbone typically plotted. For details, please refer to Wolf, et al.
Only the kNN indices are used, no distances and no expression data, so the
method is safe on any of the available graphs, including the WNN one. Run
find_neighbours_sc() and a clustering first.
Usage
run_paga_sc(
object,
cluster_col,
modality = c("rna", "adt", "wnn"),
.verbose = TRUE
)Arguments
- object
One of
SingleCells,SingleCellsSubset,MetaCellsorSingleCellsMultiModal.- cluster_col
String. The obs column holding the cluster assignments. Empty factor levels are retained.
- modality
String. One of
c("rna", "adt", "wnn"). Which kNN graph to run over. Anything but"rna"requires aSingleCellsMultiModalobject.- .verbose
Boolean or integer. Controls verbosity and returns run times.
FALSE-> quiet,TRUEor1L-> normal verbosity,2L-> detailed verbosity.
Value
A PagaRes S3 object with:
connectivities - Symmetric sparse matrix of clusters x clusters with a zero diagonal. Values lie in
(0, 1].connectivities_tree - Maximum spanning forest of
connectivities, carrying the original connectivity values on the retained edges.sizes - data.table with
clusterandn_cells.params - List with
cluster_colandmodality.
Examples
# cluster level graph abstraction of the Leiden clusters
sc <- demo_single_cells()
sc <- find_clusters_sc(sc, res = 1.0)
res <- run_paga_sc(sc, cluster_col = "leiden_clustering", .verbose = FALSE)
res$sizes
#> cluster n_cells
#> <char> <int>
#> 1: 0 169
#> 2: 1 166
#> 3: 2 165
unlink(sc@dir_data, recursive = TRUE, force = TRUE)