||
DESeq是一个基于Reads count来进行差异分析的R包,具体安装与使用方法如下:
#Install DESeq package:
source("https://bioconductor.org/biocLite.R")
biocLite("DESeq")
#Load the DESeq package into the R environment:
library("DESeq")
#Use the read.delim function to read the count table into the R environment:
countTable <- read.delim("xxx.txt",row.names=1)
#Remove HTSeq-count special counters (last 5 rows of the count table):
##countTable <- countTable[-((dim(countTable)[1]-4):dim(countTable)[1]),] #Don't need(if the reads count is not from HTSeq result);
#Create a conditions factor variable, which indicates the treatment type for each sample:
conditions <- factor(c("CON","CON","CON","HFD","HFD","HFD"))
#Create a CountDataSet data structure, which stores all of the sample attributes that the DESeq package requires for computing differential expression:
cds <- newCountDataSet(countTable,conditions)
#Normalization is a critical step prior to testing for differential expression. DESeq contains the function, estimateSizeFactors, which uses the median count ratio method to compute scaling factors for each sample:
cds <- estimateSizeFactors(cds)
#Next, the variance for each gene needs to be estimated using the estimateDispersions function:
cds <- estimateDispersions(cds)
#Test for differential expression between "CON" and "HFD" samples using nbinomTest function:
res <- nbinomTest(cds,"CON","HFD")
#Export results to a table, which can be easily viewed as a spreadsheet:
write.csv(res,file="topTable.csv")
#Identify the gene IDs that correspond to differentially expressed genes (in this case we classify genes with an adjusted p--‐value < 0.05 as differentially expressed):
counts(cds,normalized=TRUE)[which(res$padj<0.05),]
#Close R using the following command:
q()
Archiver|手机版|科学网 ( 京ICP备07017567号-12 )
GMT+8, 2024-6-16 20:10
Powered by ScienceNet.cn
Copyright © 2007- 中国科学报社