comparison 01_deseq2_analysis.Rmd @ 1:32210899a3dd draft

planemo upload commit 841d8b22bf9f1aaed6bfe8344b60617f45b275b2-dirty
author mingchen0919
date Sun, 30 Dec 2018 12:45:56 -0500
parents
children
comparison
equal deleted inserted replaced
0:6f94b4b9de44 1:32210899a3dd
1 ---
2 title: 'DESeq2 analysis'
3 output:
4 html_document:
5 highlight: pygments
6 ---
7
8 ```{r setup, include=FALSE, warning=FALSE, message=FALSE}
9 knitr::opts_chunk$set(error = TRUE, echo = FALSE)
10 ```
11
12
13 ```{r echo=FALSE}
14 # import count data
15 count_data = read.csv(opt$X_A, row.names = 1, header = TRUE)
16 # import column data
17 coldata = read.csv(opt$X_B, row.names = 1, header = TRUE)[colnames(count_data),,drop=FALSE]
18 ```
19
20 ```{r echo=FALSE}
21 dds = DESeqDataSetFromMatrix(countData = count_data,
22 colData = coldata,
23 design = formula(opt$X_C))
24 dds = DESeq(dds, test = opt$X_G, fitType = opt$X_H)
25 ## Differential expression test results
26 res = results(dds, contrast = c(opt$X_D, opt$X_E, opt$X_F), alpha = opt$X_I)
27 res
28 ```
29
30
31 ```{r echo=FALSE}
32 # save all padj sorted res to tool output directory
33 padj_sorted_res = res[order(res$padj), ]
34 write.table(padj_sorted_res,
35 file = paste0(opt$X_d, '/padj-sorted-genes.txt'),
36 quote = FALSE)
37
38 # save significant genes to a file in tool output directory
39 sig_res = res[(res$padj < opt$X_I) & !is.na(res$padj), ]
40 sig_res_sorted = sig_res[order(sig_res$padj), ]
41 write.table(sig_res_sorted,
42 file = paste0(opt$X_d, '/padj-sorted-significant-genes.txt'),
43 quote = FALSE)
44 ```