数据标准化-单细胞转录组分析的数据标准化预处理scRNA-seq

2023-09-05  本文已影响0人  一车小面包人

背景:单细胞转录组常规分析流程的数据标准化(归一化)预处理。

两种方法:
1.log
2.sct
其实这两种标准化方法与批次校正的两种方法息息相关,是多批次数据集校正批次的基础。

library(Seurat)
library(ggplot2)
library(dplyr)
sc<-readRDS("./sc_qc.rds") #'读取质控后的rds
j=as.data.frame(colSums(sc))
colnames(j)=("V1")
h=ggplot(j)+
        geom_histogram(aes(x=V1))+
        xlab(label = "UMI count per cell")
        #ggsave(h, file="hist.pdf", width=12, height=6)
        ggsave(h, file="hist_before.png", width=12, height=6)
norm_before.png
sc_1<-sc%>%NormalizeData()%>%FindVariableFeatures(nfeatures=2000) %>%
      ScaleData(features=rownames(sc)) #'log标准化
j=as.data.frame(colSums(sc_1))
colnames(j)=("V1")
h=ggplot(j)+
        geom_histogram(aes(x=V1))+
        xlab(label = "UMI count per cell")
        #ggsave(h, file="hist.pdf", width=12, height=6)
        ggsave(h, file="log.png", width=12, height=6)
log.png
sc_2<- SCTransform(sc,assay = Assays(sc)[1])
j=as.data.frame(colSums(sc_2))
colnames(j)=("V1")
h=ggplot(j)+
        geom_histogram(aes(x=V1))+
        xlab(label = "UMI count per cell")
        #ggsave(h, file="hist.pdf", width=12, height=6)
        ggsave(h, file="sct.png", width=12, height=6)
sct.png

总结:sct标准化一步(一行代码)就做了log标准化的三步骤:标准化、寻找高变基因、scale。

上一篇下一篇

猜你喜欢

热点阅读