# HG changeset patch # User mingchen0919 # Date 1502143842 14400 # Node ID cf601273873710cf6aca86ea774a98e2a6fbe943 # Parent b1ad9a9985737491880ae1df2e7533b641af4c46 Uploaded diff -r b1ad9a998573 -r cf6012738737 DESeq_results.Rmd --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/DESeq_results.Rmd Mon Aug 07 18:10:42 2017 -0400 @@ -0,0 +1,85 @@ +--- +title: 'DESeq2: Results' +output: + html_document: + number_sections: true + toc: true + theme: cosmo + highlight: tango +--- + +```{r setup, include=FALSE, warning=FALSE, message=FALSE} +knitr::opts_chunk$set( + echo = ECHO +) + +library(DESeq2) +library(pheatmap) +library(genefilter) +``` + +# Import workspace + +```{r eval=TRUE} +fcp = file.copy("DESEQ_WORKSPACE", "deseq.RData") +load("deseq.RData") +``` + +# Results {.tabset} + +## Result table + +```{r} +group = colnames(sample_table)[CONTRAST_GROUP] +res <- results(dds, contrast = c(group, 'TREATMENT_LEVEL', 'CONDITION_LEVEL')) +datatable(as.data.frame(res), style="bootstrap", filter = 'top', + class="table-condensed", options = list(dom = 'tp', scrollX = TRUE)) +``` + +## Result summary + +```{r} +summary(res) +``` + + +# MA-plot {.tabset} + +## Shrinked with `lfcShrink()` function + +```{r eval=FALSE} +shrink_res = DESeq2::lfcShrink(dds, contrast = c(group, 'TREATMENT_LEVEL', 'CONDITION_LEVEL'), res=res) +plotMA(shrink_res) +``` + +## Shrinked with Bayesian procedure + +```{r} +plotMA(res) +``` + + +# Histogram of p values + +```{r} +hist(res$pvalue[res$baseMean > 1], breaks = 0:20/20, + col = "grey50", border = "white", main = "", + xlab = "Mean normalized count larger than 1") +``` + + +# Gene clustering + +```{r} +group_index = as.numeric(strsplit("CLUSTERING_GROUPS", ',')[[1]]) +clustering_groups = colnames(sample_table)[group_index] + +topVarGenes <- head(order(rowVars(assay(rld)), decreasing = TRUE), 20) +mat <- assay(rld)[ topVarGenes, ] +mat <- mat - rowMeans(mat) +annotation_col <- as.data.frame(colData(rld)[, clustering_groups]) +colnames(annotation_col) = clustering_groups +rownames(annotation_col) = colnames(mat) +pheatmap(mat, annotation_col = annotation_col) +``` +