4 Slingshot: cell lineage and pseudotime inference

pancreas <- readRDS("data/pancreas_sub_sce.rds")

panc <- RunSlingshot(sce = pancreas, group = "SubCellType", reduction = "UMAP")

4.1 Lineage plot

p1 <- lineage_plot(panc, group = "SubCellType") + 
  sc_dim_geom_label(
    geom = shadowtext::geom_shadowtext,
    color='black', 
    bg.color='white'
  )


## displayed selected lineages
p2 <- lineage_plot(panc, group = "SubCellType", lineages = c("Lineage1", "Lineage2"))  + 
  sc_dim_geom_label(
    geom = shadowtext::geom_shadowtext,
    color='black', 
    bg.color='white'
  )

plot_list(`All Lineages` = p1, `Selected Lineages` = p2, ncol=1)

4.2 Pseudotime plot

pp1 <- pseudo_plot(panc, reduction = "UMAP", lineage = "Lineage1")
pp2 <- pseudo_plot(panc, reduction = "UMAP", lineage = "Lineage2")
pp_all <- pseudo_plot(panc, reduction = "UMAP")

plot_list(pp1, pp2, pp_all, design="AABB\nCCCC")

4.4 Heatmap

heatmap_genes <- head(unique(rownames(panc)), 10)

## 默认按照拟时间排序
hmp1 <- pseudo_heatmap(panc, features = heatmap_genes, lineage = "Lineage2")

## 可以手动对基因或细胞设置聚类(cluster = TRUE),此时会打乱pseudotime的排序
hmp2 <- pseudo_heatmap(panc, features = heatmap_genes, lineage = "Lineage2", cluster_columns = TRUE)

## 对基因聚类
hmp3 <- pseudo_heatmap(panc, features = heatmap_genes, lineage = "Lineage2", cluster_rows = TRUE, sort = FALSE)

## 默认排序
hmp4 <- pseudo_heatmap(panc, features = heatmap_genes, lineage = "Lineage2", cluster_rows = FALSE, sort = TRUE)

## 组合起来看就能看到两个参数的设定对行顺序的影响
aplot::plot_list(hmp1, hmp2, hmp3, hmp4, ncol=1)