转录组scRNA

10X单细胞转录组下游流程-3-亚群注释

2019-12-22  本文已影响0人  大吉岭猹

1. 读取数据

rm(list = ls())
options(warn=-1)
suppressMessages(library(Seurat))

#读取上一次保存的seurat对象PBMC
start_time <- Sys.time()
load('./patient1.PBMC.output.Rdata')
end_time <- Sys.time()
end_time - start_time
# Time difference of 5.142311 secs

colP<-c('green4',
        'pink',
        '#FF7F00',
        'orchid',
        '#99c9fb',
        'dodgerblue2',
        'grey30',
        'yellow',
        'grey60',
        'grey',
        'red',
        '#FB9A99',
        'black',
        'blue'
)

2. 按时间点分组画图

DimPlot(PBMC, group.by = "TimePoints")

3. 标识感兴趣的基因

allGenes = rownames(raw_dataPBMC)
# 基因列表来自原文
markerGenes <- c(
  "CD3D",
  "CD3E",
  "TRAC",
  "IL7R",
  "GZMA",
  "FCGR3A",
  "CD14",
  "MS4A1",
  "FCER1A"
)
markerGenes %in% allGenes
FeaturePlot(object = PBMC,
            features = markerGenes,
            cols = c("grey", "blue"),
            reduction = "tsne")

4. 亚群注释

# 文件来自参考的笔记,最终来源于原文
n=read.table('celltype-patient1-PBMC.txt',sep = '\t')
n
new.cluster.ids <- as.character(n[,2])
names(new.cluster.ids) <- levels(PBMC)
PBMC <- RenameIdents(PBMC, new.cluster.ids)
DimPlot(PBMC, reduction = "tsne", label = TRUE, pt.size = 0.5, cols = colP) + NoLegend()

5. 不同时间点分开画图

TimePoints = PBMC@meta.data$TimePoints
table(TimePoints)

# 以PBMC_Pre为例
PBMC_Pre  = SubsetData(PBMC, TimePoints =='PBMC_Pre')
DimPlot(PBMC_Pre, reduction = "tsne",
        cols = colP,
        do.label = F)
上一篇下一篇

猜你喜欢

热点阅读