comparison DESeq_results_04.Rmd @ 0:6f94b4b9de44 draft

planemo upload
author mingchen0919
date Tue, 27 Feb 2018 23:57:53 -0500
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:6f94b4b9de44
1 ---
2 output: html_document
3 ---
4
5 ```{r setup, include=FALSE, warning=FALSE, message=FALSE}
6 knitr::opts_chunk$set(
7 echo = as.logical(opt$X_e),
8 error = TRUE
9 )
10 ```
11
12
13 # Visualization {.tabset}
14 ## Gene clustering
15
16 ```{r}
17 clustering_groups = strsplit(opt$X_M, ',')[[1]]
18
19 topVarGenes <- head(order(rowVars(assay(rld)), decreasing = TRUE), 20)
20 mat <- assay(rld)[ topVarGenes, ]
21 mat <- mat - rowMeans(mat)
22 annotation_col <- as.data.frame(colData(rld)[, clustering_groups])
23 colnames(annotation_col) = clustering_groups
24 rownames(annotation_col) = colnames(mat)
25 pheatmap(mat, annotation_col = annotation_col)
26 ```
27
28 ## Sample-to-sample distance
29
30 ```{r}
31 sampleDistMatrix <- as.matrix( sampleDists )
32 colors <- colorRampPalette( rev(brewer.pal(9, "Blues")) )(255)
33 pheatmap(sampleDistMatrix,
34 clustering_distance_cols = sampleDists,
35 col = colors)
36 ```
37
38 ## PCA plot
39
40 ```{r}
41 plotPCA(rld, intgroup = clustering_groups)
42 ```
43
44 ## MDS plot {.tabset}
45
46 ### Data table
47 ```{r}
48 mds <- as.data.frame(colData(rld)) %>%
49 cbind(cmdscale(sampleDistMatrix))
50 knitr::kable(mds)
51 ```
52
53 ### Plot
54 ```{r}
55 ggplot(mds, aes(x = `1`, y = `2`, col = time)) +
56 geom_point(size = 3) + coord_fixed()
57 ```