前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >在原有的UMAP上标注RNA velocity

在原有的UMAP上标注RNA velocity

作者头像
生信编程日常
发布2020-04-24 15:53:36
2.5K0
发布2020-04-24 15:53:36
举报
文章被收录于专栏:生物信息学、python、R、linux
1.读入RNA velocity的loom文件,并提取spliced文件和unspliced文件
代码语言:javascript
复制
ldat <- ReadVelocity(file = test.loom")
emat <- ldat$spliced
nmat <- ldat$unspliced
2.提取原有的用seurat做的UMAP的图。
代码语言:javascript
复制
emb <- seurat.object@reductions$umap@cell.embeddings
# Estimate the cell-cell distances 
cell.dist <- as.dist(1-armaCor(t(seurat.object@reductions$umap@cell.embeddings)))
3.将RNA velocity的细胞的名字改成原有的seurat用到的细胞名字
代码语言:javascript
复制
colnames(emat) <- paste(substring(colnames(emat),6,21),"_1",sep="")
colnames(nmat) <- paste(substring(colnames(nmat),6,21),"_1",sep="")
4.对velocity进行计算
代码语言:javascript
复制
# I'm not sure what this parameter does to be honest. 0.02 default
# perform gamma fit on a top/bottom quantiles of expression magnitudes
fit.quantile <- 0.02
# Main velocity estimation
rvel.cd <- gene.relative.velocity.estimates(emat,nmat,deltaT=2,
                                            kCells=10,
                                            cell.dist=cell.dist,
                                            fit.quantile=fit.quantile,
                                            n.cores=24)
5.提取原seurat对象的UMAP图的细胞颜色
代码语言:javascript
复制
# This section gets the colors out of the seurat tSNE object so that my seurat and velocyto plots use the same color scheme.
gg <- UMAPPlot(seurat.object)
ggplot_build(gg)$data
colors <- as.list(ggplot_build(gg)$data[[1]]$colour)
names(colors) <- rownames(emb)
6.将velocity画在原有的seurat的UMAP上
代码语言:javascript
复制
 p1 <- show.velocity.on.embedding.cor(emb,rvel.cd,n=30,scale='sqrt',
                                      cell.colors=ac(colors,alpha=0.5),
                                      cex=0.8,arrow.scale=2,show.grid.flow=T,
                                      min.grid.cell.mass=1.0,grid.n=50,arrow.lwd=1,
                                      do.par=F,cell.border.alpha = 0.1,
                                      n.cores=24,main="Day1 Cell Velocity")

参考: https://github.com/velocyto-team/velocyto.R/issues/16

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 1.读入RNA velocity的loom文件,并提取spliced文件和unspliced文件
  • 2.提取原有的用seurat做的UMAP的图。
  • 3.将RNA velocity的细胞的名字改成原有的seurat用到的细胞名字
  • 4.对velocity进行计算
  • 5.提取原seurat对象的UMAP图的细胞颜色
  • 6.将velocity画在原有的seurat的UMAP上
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档