RunPAGA: Run PAGA analysis

View source: R/SCP-analysis.R

RunPAGAR Documentation

Run PAGA analysis

Description

PAGA is a graph-based method used to infer cellular trajectories. This function runs the PAGA analysis on a Seurat object.

Usage

RunPAGA(
  srt = NULL,
  assay_X = "RNA",
  slot_X = "counts",
  assay_layers = c("spliced", "unspliced"),
  slot_layers = "counts",
  adata = NULL,
  group_by = NULL,
  linear_reduction = NULL,
  nonlinear_reduction = NULL,
  basis = NULL,
  n_pcs = 30,
  n_neighbors = 30,
  use_rna_velocity = FALSE,
  vkey = "stochastic",
  embedded_with_PAGA = FALSE,
  paga_layout = "fr",
  threshold = 0.1,
  point_size = 20,
  infer_pseudotime = FALSE,
  root_group = NULL,
  root_cell = NULL,
  n_dcs = 10,
  n_branchings = 0,
  min_group_size = 0.01,
  palette = "Paired",
  palcolor = NULL,
  show_plot = TRUE,
  save = FALSE,
  dpi = 300,
  dirpath = "./",
  fileprefix = "",
  return_seurat = !is.null(srt)
)

Arguments

srt

A Seurat object.

assay_X

Assay to convert as the main data matrix (X) in the anndata object.

slot_X

Slot name for assay_X in the Seurat object.

assay_layers

Assays to convert as layers in the anndata object.

slot_layers

Slot names for the assay_layers in the Seurat object.

adata

An anndata object.

group_by

Variable to use for grouping cells in the Seurat object.

linear_reduction

Linear reduction method to use, e.g., "PCA".

nonlinear_reduction

Non-linear reduction method to use, e.g., "UMAP".

basis

The basis to use for reduction, e.g., "UMAP".

n_pcs

Number of principal components to use for linear reduction. Default is 30.

n_neighbors

Number of neighbors to use for constructing the KNN graph. Default is 30.

use_rna_velocity

Whether to use RNA velocity for PAGA analysis. Default is FALSE.

vkey

The name of the RNA velocity data to use if use_rna_velocity is TRUE. Default is "stochastic".

embedded_with_PAGA

Whether to embed data using PAGA layout. Default is FALSE.

paga_layout

The layout for plotting PAGA graph. See See layout param in scanpy.pl.paga function.

threshold

The threshold for plotting PAGA graph. Edges for weights below this threshold will not draw.

point_size

The point size for plotting.

infer_pseudotime

Whether to infer pseudotime.

root_group

The group to use as the root for pseudotime inference.

root_cell

The cell to use as the root for pseudotime inference.

n_dcs

TThe number of diffusion components to use for pseudotime inference.

n_branchings

Number of branchings to detect.

min_group_size

The minimum size of a group (as a fraction of the total number of cells) to consider it as a potential branching point.

palette

The palette to use for coloring cells.

palcolor

A vector of colors to use as the palette.

show_plot

Whether to show the PAGA plot.

save

Whether to save the PAGA plots.

dpi

The DPI (dots per inch) for saving the PAGA plot.

dirpath

The directory to save the PAGA plots.

fileprefix

The file prefix to use for the PAGA plots.

return_seurat

Whether to return a Seurat object instead of an anndata object. Default is TRUE.

See Also

srt_to_adata PAGAPlot CellDimPlot RunSCVELO

Examples

data("pancreas_sub")
pancreas_sub <- RunPAGA(srt = pancreas_sub, assay_X = "RNA", group_by = "SubCellType", linear_reduction = "PCA", nonlinear_reduction = "UMAP")
CellDimPlot(pancreas_sub, group.by = "SubCellType", reduction = "draw_graph_fr")
PAGAPlot(pancreas_sub, reduction = "UMAP")
CellDimPlot(pancreas_sub, group.by = "SubCellType", reduction = "UMAP", paga = pancreas_sub@misc$paga)

pancreas_sub <- RunPAGA(
  srt = pancreas_sub, group_by = "SubCellType", linear_reduction = "PCA", nonlinear_reduction = "UMAP",
  embedded_with_PAGA = TRUE, infer_pseudotime = TRUE, root_group = "Ductal"
)
head(pancreas_sub[[]])
names(pancreas_sub@reductions)
FeatureDimPlot(pancreas_sub, features = "dpt_pseudotime", reduction = "PAGAUMAP2D")
PAGAPlot(pancreas_sub, reduction = "PAGAUMAP2D")
CellDimPlot(pancreas_sub, group.by = "SubCellType", reduction = "PAGAUMAP2D", paga = pancreas_sub@misc$paga)


zh542370159/SCP documentation built on Nov. 22, 2023, 2:34 a.m.