样本量比较大的时候推荐使用百分位数进行细胞过滤
#百分位数法:
ncount_q <- quantile(sample.tmp.seurat@meta.data$nCount_RNA,c(0.025,0.975))
nfeature_q <- quantile(sample.tmp.seurat@meta.data$nFeature_RNA,c(0.025,0.975))
mt_q <- quantile(sample.tmp.seurat@meta.data$percent.mt,c(0.025,0.8))
可视化
pdf(paste(output,"Quality_Control_Count_Feature.pdf",sep="_"), width=8, height=6)
p3 <- plot(sample.tmp.seurat@meta.data$nCount_RNA,sample.tmp.seurat@meta.data$nFeature_RNA,pch=16,cex=0.7,bty="n")
p3 <- p3 + abline(h=c(as.numeric(nfeature_q)[1],as.numeric(nfeature_q)[2]),v=c(as.numeric(ncount_q)[1],as.numeric(ncount_q)[2]),lty=2,lwd=2,col="red")
print(p3)
dev.off()
可视化后,可以看这个标准过大概过滤掉了多少细胞
创建过滤后的子集
sample.tmp.seurat <-subset(sample.tmp.seurat,subset=
nFeature_RNA>as.numeric(nfeature_q)[1] &
nFeature_RNA<as.numeric(nfeature_q)[2]&
nCount_RNA>as.numeric(ncount_q)[1]&
nCount_RNA<as.numeric(ncount_q)[2]&percent.mt<10)