view 02_ma_plot.Rmd @ 2:ab8d558ea6e6 draft default tip

planemo upload commit 841d8b22bf9f1aaed6bfe8344b60617f45b275b2-dirty
author mingchen0919
date Sun, 30 Dec 2018 13:57:07 -0500
parents 32210899a3dd
children
line wrap: on
line source

---
title: 'MA-plot'
output:
    html_document:
      highlight: pygments
---

```{r setup, include=FALSE, warning=FALSE, message=FALSE}
knitr::opts_chunk$set(error = TRUE, echo = FALSE)
```


```{r warning=FALSE}
log_fold_change = res$log2FoldChange
base_mean = res$baseMean
significant = res$padj
significant[significant < 0.1] = 'yes'
significant[significant != 'yes'] = 'no'

maplot_df = data.frame(log_fold_change, base_mean, significant)
maplot_df = maplot_df[!is.na(maplot_df$significant), ]
p = ggplot(data = maplot_df) +
  geom_point(mapping = aes(log(base_mean), log_fold_change, color = significant),
             size = 0.5) +
  scale_color_manual(name = 'Significant',
                     values = c('no' = 'black', 'yes' = 'red'),
                     labels = c('No', 'Yes')) +
  xlab('Log base mean') +
  ylab('Log fold change') +
  theme_classic()

plotly::ggplotly(p)
```