Use scanpy.tl.paga() to produce a partition-based graph abstraction for a Seurat object and use that to initialize a UMAP. Additionally, runs cluster determination via the 'leiden' or 'louvain' algorithms.
If dimensional reduction has already been performed (PCA, ICA, or harmony), that is used to find neighbors, otherwise PCA is run.
Parameters are prefixed by the step to which they correspond (i.e. "neighbors_" are passed to scanpy.pp.neighbors())
Heavily based on the fantastic walk through found at https://romanhaa.github.io/blog/paga_to_r/
PAGA(
object,
assay = "RNA",
slim = FALSE,
seurat_grouping = NULL,
set_ident = TRUE,
clustering_algorithm = "leiden",
reduction_name = "umap",
reduction_key = "umap_",
edge_filter_weight = 0.1,
neighbors_n_neighbors = 15,
neighbors_n_pcs = NULL,
neighbors_use_rep = "pca",
neighbors_knn = TRUE,
neighbors_random_state = 0,
neighbors_method = "umap",
neighbors_metric = "euclidean",
clustering_resolution = 1,
clustering_restrict_to = NULL,
clustering_random_state = 0,
clustering_key_added = NULL,
clustering_adjacency = NULL,
clustering_directed = TRUE,
clustering_use_weights = TRUE,
clustering_n_iterations = -1,
clustering_partition_type = NULL,
paga_show = FALSE,
paga_plot = FALSE,
paga_add_pos = TRUE,
paga_threshold = 0.01,
paga_layout = NULL,
paga_init_pos = NULL,
paga_root = 0,
paga_single_component = NULL,
paga_random_state = 0,
umap_min_dist = 0.5,
umap_spread = 1,
umap_n_components = 3,
umap_alpha = 1,
umap_gamma = 1,
umap_negative_sample_rate = 5,
umap_init_pos = "spectral"
)
Seurat object assay to use when converting to Scanpy object
Temporarily discard all unnecessary data from the Seurat object (i.e. keep only the normalized data for the assay and reduction used for neighborhood calculation). May help when performing PAGA on large objects. (Default: FALSE)
Force PAGA to use this metadata grouping variable. (Default: NULL)
Set the cluster identity for each cell when returning the object? (Default: TRUE)
Whether to use the "louvain" or "leiden" algorithms (Default: "leiden")
dimensional reduction name, `umap` by default
dimensional reduction key, specifies the string before the number for the dimension names. `umap` by default
Set edges with a weight below this threshold to NA (Default: 0.1)
Resolution to pass to the clustering algorith (Default: 1.0)