不积小流 , 无以成江海 !分享 http://blog.sciencenet.cn/u/xiongchaoliang

博文

DESeq的安装与使用

已有 22386 次阅读 2015-9-20 10:04 |个人分类:【技术-软件】|系统分类:科研笔记

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()


DESeq.txt




https://blog.sciencenet.cn/blog-1509670-922044.html

上一篇:Google和Google学术可用链接汇总
下一篇:生物医学研究领域的实验protocols
收藏 IP: 159.226.43.*| 热度|

0

该博文允许注册用户评论 请点击登录 评论 (0 个评论)

数据加载中...

Archiver|手机版|科学网 ( 京ICP备07017567号-12 )

GMT+8, 2024-6-16 20:10

Powered by ScienceNet.cn

Copyright © 2007- 中国科学报社

返回顶部