Run Palantir analysis
Usage
RunPalantir(
  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,
  dm_n_components = 10,
  dm_alpha = 0,
  dm_n_eigs = NULL,
  early_group = NULL,
  early_cell = NULL,
  terminal_cells = NULL,
  terminal_groups = NULL,
  num_waypoints = 1200,
  scale_components = TRUE,
  use_early_cell_as_start = TRUE,
  adjust_early_cell = FALSE,
  adjust_terminal_cells = FALSE,
  max_iterations = 25,
  n_jobs = 8,
  point_size = 20,
  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. 
- dm_n_components
- The number of diffusion components to calculate. 
- dm_alpha
- Normalization parameter for the diffusion operator. 
- dm_n_eigs
- Number of eigen vectors to use. 
- early_group
- Name of the group to start Palantir analysis from. 
- early_cell
- Name of the cell to start Palantir analysis from. 
- terminal_cells
- Character vector specifying terminal cells for Palantir analysis. 
- terminal_groups
- Character vector specifying terminal groups for Palantir analysis. 
- num_waypoints
- Number of waypoints to be included. 
- scale_components
- Should the cell fate probabilities be scaled for each component independently? 
- use_early_cell_as_start
- Should the starting cell for each terminal group be set as early_cell? 
- adjust_early_cell
- Whether to adjust the early cell to the cell with the minimum pseudotime value. 
- adjust_terminal_cells
- hether to adjust the terminal cells to the cells with the maximum pseudotime value for each terminal group. 
- max_iterations
- Maximum number of iterations for pseudotime convergence. 
- n_jobs
- The number of parallel jobs to run. 
- point_size
- The point size for plotting. 
- 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. 
Examples
data("pancreas_sub")
pancreas_sub <- RunPalantir(
  srt = pancreas_sub, group_by = "SubCellType", linear_reduction = "PCA", nonlinear_reduction = "UMAP",
  early_group = "Ductal", use_early_cell_as_start = TRUE,
  terminal_groups = c("Alpha", "Beta", "Delta", "Epsilon")
)
#> Error in check_Python("palantir"): could not find function "check_Python"
head(pancreas_sub[[]])
#>                     orig.ident nCount_RNA nFeature_RNA     S_score   G2M_score nCount_spliced nFeature_spliced
#> CAGCCGAAGCGATATA SeuratProject      10653         3295  0.33188155  0.54532743          10653             3295
#> AGTGTCATCGCCGTGA SeuratProject       4596         2053 -0.07156909 -0.08865353           4596             2053
#> GATGAAAAGTTGTAGA SeuratProject      14091         3864  0.08940628  0.77610326          14091             3864
#> CACAGTACATCCGTGG SeuratProject       5484         2510 -0.25927997 -0.25941831           5484             2510
#> CGGAGCTCATTGGGCC SeuratProject       7357         2674 -0.11764368  0.46237856           7357             2674
#> AGAGCTTGTGTGACCC SeuratProject       6498         2516 -0.11406432 -0.17830831           6498             2516
#>                  nCount_unspliced nFeature_unspliced      CellType   SubCellType Phase
#> CAGCCGAAGCGATATA             1587               1063        Ductal        Ductal   G2M
#> AGTGTCATCGCCGTGA             1199                803 Pre-endocrine Pre-endocrine    G1
#> GATGAAAAGTTGTAGA             2166               1379   Ngn3 low EP   Ngn3 low EP   G2M
#> CACAGTACATCCGTGG             1339                859     Endocrine          Beta    G1
#> CGGAGCTCATTGGGCC              976                745        Ductal        Ductal   G2M
#> AGAGCTTGTGTGACCC              822                591        Ductal        Ductal    G1
FeatureDimPlot(pancreas_sub, c("palantir_pseudotime", "palantir_diff_potential"))
#> Warning: palantir_pseudotime,palantir_diff_potential are not in the features of srt.
#> Error in FeatureDimPlot(pancreas_sub, c("palantir_pseudotime", "palantir_diff_potential")): There are no valid features present.
FeatureDimPlot(pancreas_sub, paste0(c("Alpha", "Beta", "Delta", "Epsilon"), "_diff_potential"))
#> Warning: Alpha_diff_potential,Beta_diff_potential,Delta_diff_potential,Epsilon_diff_potential are not in the features of srt.
#> Error in FeatureDimPlot(pancreas_sub, paste0(c("Alpha", "Beta", "Delta",     "Epsilon"), "_diff_potential")): There are no valid features present.