Mercurial > repos > mingchen0919 > rmarkdown_deseq2
annotate DESeq_results.Rmd @ 6:2f8ddef8d545 draft
update deseq2
author | mingchen0919 |
---|---|
date | Tue, 07 Nov 2017 13:50:32 -0500 |
parents | 7231d7e8d3ed |
children |
rev | line source |
---|---|
0
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
1 --- |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
2 title: 'DESeq2: Results' |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
3 output: |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
4 html_document: |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
5 number_sections: true |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
6 toc: true |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
7 theme: cosmo |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
8 highlight: tango |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
9 --- |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
10 |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
11 ```{r setup, include=FALSE, warning=FALSE, message=FALSE} |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
12 knitr::opts_chunk$set( |
6 | 13 echo = ECHO, |
14 error = TRUE | |
0
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
15 ) |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
16 ``` |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
17 |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
18 |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
19 ```{r eval=TRUE} |
6 | 20 # Import workspace |
0
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
21 fcp = file.copy("DESEQ_WORKSPACE", "deseq.RData") |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
22 load("deseq.RData") |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
23 ``` |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
24 |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
25 # Results {.tabset} |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
26 |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
27 ## Result table |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
28 |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
29 ```{r} |
6 | 30 cat('--- View the top 100 rows of the result table ---') |
31 res <- results(dds, contrast = c('CONTRAST_FACTOR', 'TREATMENT_LEVEL', 'CONDITION_LEVEL')) | |
32 write.csv(as.data.frame(res), file = 'deseq_results.csv') | |
33 res_df = as.data.frame(res)[1:100, ] | |
34 datatable(res_df, style="bootstrap", filter = 'top', | |
0
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
35 class="table-condensed", options = list(dom = 'tp', scrollX = TRUE)) |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
36 ``` |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
37 |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
38 ## Result summary |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
39 |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
40 ```{r} |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
41 summary(res) |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
42 ``` |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
43 |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
44 |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
45 # MA-plot {.tabset} |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
46 |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
47 |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
48 |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
49 ```{r} |
6 | 50 cat('--- Shrinked with Bayesian procedure ---') |
0
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
51 plotMA(res) |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
52 ``` |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
53 |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
54 |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
55 # Histogram of p values |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
56 |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
57 ```{r} |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
58 hist(res$pvalue[res$baseMean > 1], breaks = 0:20/20, |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
59 col = "grey50", border = "white", main = "", |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
60 xlab = "Mean normalized count larger than 1") |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
61 ``` |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
62 |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
63 |
6 | 64 # Visualization {.tabset} |
65 ## Gene clustering | |
0
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
66 |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
67 ```{r} |
6 | 68 clustering_groups = strsplit("CLUSTERING_FACTORS", ',')[[1]] |
0
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
69 |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
70 topVarGenes <- head(order(rowVars(assay(rld)), decreasing = TRUE), 20) |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
71 mat <- assay(rld)[ topVarGenes, ] |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
72 mat <- mat - rowMeans(mat) |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
73 annotation_col <- as.data.frame(colData(rld)[, clustering_groups]) |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
74 colnames(annotation_col) = clustering_groups |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
75 rownames(annotation_col) = colnames(mat) |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
76 pheatmap(mat, annotation_col = annotation_col) |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
77 ``` |
7231d7e8d3ed
planemo upload for repository https://github.com/statonlab/docker-GRReport/tree/master/my_tools/rmarkdown_deseq2 commit 9285c2b8ad41a486dde2a87600a6b8267841c8b5-dirty
mingchen0919
parents:
diff
changeset
|
78 |
6 | 79 ## Sample-to-sample distance |
80 | |
81 ```{r} | |
82 sampleDistMatrix <- as.matrix( sampleDists ) | |
83 colors <- colorRampPalette( rev(brewer.pal(9, "Blues")) )(255) | |
84 pheatmap(sampleDistMatrix, | |
85 clustering_distance_cols = sampleDists, | |
86 col = colors) | |
87 ``` | |
88 | |
89 ## PCA plot | |
90 | |
91 ```{r} | |
92 plotPCA(rld, intgroup = clustering_groups) | |
93 ``` | |
94 | |
95 ## MDS plot {.tabset} | |
96 | |
97 ### Data table | |
98 ```{r} | |
99 mds <- as.data.frame(colData(rld)) %>% | |
100 cbind(cmdscale(sampleDistMatrix)) | |
101 knitr::kable(mds) | |
102 ``` | |
103 | |
104 ### Plot | |
105 ```{r} | |
106 ggplot(mds, aes(x = `1`, y = `2`, col = time)) + | |
107 geom_point(size = 3) + coord_fixed() | |
108 ``` | |
109 |