單細(xì)胞前期工作重要的是如何將測序得到的多樣本整合同步分析:
library(Seurat)
folders=list.files('./') #列出文件夾
folders=folders[-7] #刪除第七個代碼文件
sceList = lapply(folders,function(folder){ CreateSeuratObject(counts = Read10X(folder), project = folder )})#讀取文件生成列表
sce.merge <- merge(sceList[[1]], y = c(sceList[[2]],sceList[[3]],sceList[[4]],sceList[[5]], sceList[[6]],sceList[[7]],sceList[[8]],sceList[[9]],sceList[[10]]), add.cell.ids = folders, project = "PBMC")#整合列表對象星立,sce.merge就是整合后的單細(xì)胞合并文件了
sce.merge
sce.subset <- subset(sce.merge, subset = nFeature_RNA > 500 & percent.mt < 5) #對細(xì)胞進(jìn)行過濾钝凶,若需要對基因進(jìn)行整體過濾归苍,可以在保存完文件后讀入的時候設(shè)置參數(shù)
write.table(sce.subset@assays$RNA@counts,"filter.txt",sep="\t")