comparison DESeq.Rmd @ 6:2f8ddef8d545 draft

update deseq2
author mingchen0919
date Tue, 07 Nov 2017 13:50:32 -0500
parents 312e9bcc02f1
children
comparison
equal deleted inserted replaced
5:fd3514267506 6:2f8ddef8d545
8 highlight: tango 8 highlight: tango
9 --- 9 ---
10 10
11 ```{r setup, include=FALSE, warning=FALSE, message=FALSE} 11 ```{r setup, include=FALSE, warning=FALSE, message=FALSE}
12 knitr::opts_chunk$set( 12 knitr::opts_chunk$set(
13 echo = ECHO 13 echo = ECHO,
14 error = TRUE
14 ) 15 )
15
16 library(stringi)
17 library(DESeq2)
18 library(pheatmap)
19 # library(PoiClaClu)
20 library(RColorBrewer)
21 ``` 16 ```
22 17
23 # `DESeqDataSet` object 18 # `DESeqDataSet` object
24 19
25 ```{r} 20 ```{r 'DESeqDataSet object'}
26 count_files = strsplit(opt$count_files, ',')[[1]] 21 count_file_paths = strsplit(opt$count_file_paths, ',')[[1]]
22 count_file_names = strsplit(opt$count_file_names, ',')[[1]]
27 sample_table = read.table(opt$sample_table, header = TRUE) 23 sample_table = read.table(opt$sample_table, header = TRUE)
24 row.names(sample_table) = sample_table[,2]
25 sample_table = sample_table[count_file_names, ]
28 26
29 ## copy count files into working directory 27 ## copy count files into working directory
30 file_copy = file.copy(count_files, sample_table$fileName, overwrite = TRUE) 28 file_copy = file.copy(count_file_paths, count_file_names, overwrite = TRUE)
31 29
32 ## DESeqDataSet object 30 ## DESeqDataSet object
33 dds = DESeqDataSetFromHTSeqCount(sampleTable = sample_table, 31 dds = DESeqDataSetFromHTSeqCount(sampleTable = sample_table,
34 directory = './', 32 directory = './',
35 design = DESIGN_FORMULA) 33 design = DESIGN_FORMULA)
53 51
54 # Peek at data {.tabset} 52 # Peek at data {.tabset}
55 53
56 ## Count Data 54 ## Count Data
57 55
58 ```{r} 56 ```{r 'count data'}
59 datatable(head(counts(dds), 100), style="bootstrap", 57 datatable(head(counts(dds), 100), style="bootstrap",
60 class="table-condensed", options = list(dom = 'tp', scrollX = TRUE)) 58 class="table-condensed", options = list(dom = 'tp', scrollX = TRUE))
61 ``` 59 ```
62 60
63 ## Sample Table 61 ## Sample Table
64 62
65 ```{r} 63 ```{r 'sample table'}
66 datatable(sample_table, style="bootstrap", 64 datatable(sample_table, style="bootstrap",
67 class="table-condensed", options = list(dom = 'tp', scrollX = TRUE)) 65 class="table-condensed", options = list(dom = 'tp', scrollX = TRUE))
68 ``` 66 ```
69 67
70 # Sample distance on variance stabilized data {.tabset} 68 # Sample distance on variance stabilized data {.tabset}