# Counts矩阵的标准化方法：TMM和VST、RLOG

- TMM：The Trimmed Mean of M value by edgeR
- VST：The variance stabilizing transformation by DESeq2
- RLOG：The regularized-logarithm transformation by DESeq2

Counts矩阵来源于STAR匹配得到的结果：`df <- read.csv('GSE123379.csv', row.names = 1)`

## 安装补充包

- conda activate tcga
- conda install -c bioconda bioconductor-edger -y

## TMM方法

    1
    2
    3
    4
    5
    6
    7
    8
    9

    f_counts2TMM <- function(countsMatrix){
        require(edgeR)
        TMM <- DGEList(counts = countsMatrix)
        TMM <- calcNormFactors(TMM, method = 'TMM')
        cpm(TMM, normalized.lib.sizes = TRUE, log=F)
    }
    countsMatrix <- df[-(1:3)]
    TMM <- f_counts2TMM(countsMatrix)
    TMM

## VST方法

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13

    f_counts2VST <- function(countsMatrix){
        require(DESeq2)
        conditions <- factor(rep("Control",ncol(countsMatrix)))
        colData_b <- data.frame(row.names = colnames(countsMatrix), conditions)
        dds <- DESeqDataSetFromMatrix(countData = countsMatrix,
                                  colData = colData_b,
                                  design = ~ 1)
        vsd <- vst(object=dds, blind=T)
        assay(vsd)
    }
    countsMatrix <- df[-(1:3)]
    VST <- f_counts2VST(countsMatrix)
    VST

## RLOG方法

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13

    f_counts2RLOG <- function(countsMatrix){
        require(DESeq2)
        conditions <- factor(rep("Control",ncol(countsMatrix)))
        colData_b <- data.frame(row.names = colnames(countsMatrix), conditions)
        dds <- DESeqDataSetFromMatrix(countData = countsMatrix,
                                  colData = colData_b,
                                  design = ~ 1)
        rld  <- rlog(object=dds, blind=T)
        assay(rld)
    }
    countsMatrix <- df[-(1:3)]
    RLOG <- f_counts2RLOG(countsMatrix)
    RLOG

数据清洗
Counts矩阵的标准化方法：TMM和VST、RLOG
https://occdn.limour.top/2159.html
Author
Limour
Posted on
July 27, 2022
Licensed under
菜鸟博主对神经网络的简单理解（一） Previous
使用IQR方法进行重复值的选择 Next

#### Search

Keyword