monocle3单细胞测序scRNA-seq

单细胞之轨迹分析-6:velocyto.R+Seurat

2022-04-04  本文已影响0人  Hayley笔记

轨迹分析系列:


1. 载入数据集,转换成Seurat对象

练习数据下载:SCG71.loom

library(Seurat)
library(velocyto.R)
library(SeuratWrappers)
ldat <- ReadVelocity(file = "SCG71.loom")
bm <- as.Seurat(x = ldat)
View(bm)
2. 整合降维聚类
bm <-SCTransform(object = bm, assay = "spliced") %>% RunPCA(verbose = FALSE) %>% 
  FindNeighbors(dims = 1:20) %>% FindClusters() %>% RunUMAP(dims = 1:20)
# 降维聚类分群都是基于"spliced"这个assay做的
DimPlot(bm)
3. 速率分析及可视化
bm <- RunVelocity(object = bm, deltaT = 1, kCells = 25, fit.quantile = 0.02)

这一步的结果存在bm@tools

ident.colors <- (scales::hue_pal())(n = length(x = levels(x = bm)))
names(x = ident.colors) <- levels(x = bm)
cell.colors <- ident.colors[Idents(object = bm)]
names(x = cell.colors) <- colnames(x = bm)
show.velocity.on.embedding.cor(emb = Embeddings(object = bm, reduction = "umap"), vel = Tool(object = bm, 
    slot = "RunVelocity"), n = 200, scale = "sqrt", cell.colors = ac(x = cell.colors, alpha = 0.5), 
    cex = 0.8, arrow.scale = 3, show.grid.flow = TRUE, min.grid.cell.mass = 0.5, grid.n = 40, arrow.lwd = 1, 
    do.par = FALSE, cell.border.alpha = 0.1)
上一篇下一篇

猜你喜欢

热点阅读