DESeq2包:差異表達分析


 1 Usage: Rcript *.R  input output
 2 
 3 library(DESeq2)
 4 
 5 count <- read.table(input, header=T, sep="\t", row.names=1, comment.char="", check.names=F)
 6 countData <- count[apply(count, 1, sum) > 0 , ] ##過濾表達量
 7 colData   <- data.frame(row.names = colnames(countData), 
 8                       condition = factor(c(1, 2, 3)) ##condition分組       
 9                       )
10 
11 dds <- DESeqDataSetFromMatrix(countData = countData, colData = colData, design = ~ condition)
12 
13 dds <- DESeq(dds,betaPrior=FALSE,test="LRT", reduced=~1) ##差異表達量計算
14 cnt <- as.data.frame(counts(dds, normalized=TRUE)) ##表達量歸一化
15 16  
17 
18 res <- as.data.frame(results(dds)) ##其它值pvalue等
19 res <- cbind(cnt, res)
20 res$type <- "Not DEG"  ##添加type列
21 res$type[res$pvalue < 0.05 & res$log2FoldChange >= 1 ] <- "Up"
22 res$type[res$pvalue < 0.05 & res$log2FoldChange <= -1] <- "Down"
23 
24 diff_file <- paste(output, "/diff.xls", sep="")
25 write.table(res, diff_file, sep="\t", quote=F,  col.names = NA)

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM