changeset 8:32ed0a8df05c draft

update
author mingchen0919
date Fri, 09 Mar 2018 01:22:06 -0500
parents cadfcfb4036d
children f8c7138cfc35
files deseq2.Rmd deseq2_render.R
diffstat 2 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/deseq2.Rmd	Fri Mar 09 00:02:09 2018 -0500
+++ b/deseq2.Rmd	Fri Mar 09 01:22:06 2018 -0500
@@ -49,15 +49,17 @@
                 mean = res$baseMean,
                 lfc = res$log2FoldChange,
                 padj = res$padj,
-                col = ifelse(res$padj < opt$X_I, 
-                             paste0("padj < ", opt$X_I), 
-                             paste0("padj >= ", opt$X_I)),
                 stringsAsFactors = FALSE)
+cols = vector(mode='character', length = nrow(res))
+cols[(res$padj < opt$X_I) & !is.na(res$padj)] = paste0('< ', opt$X_I)
+cols[(res$padj >= opt$X_I) & !is.na(res$padj)] = paste0('>= ', opt$X_I)
+cols[cols == ''] = 'NA'
+df$col = cols
 p = ggplot(data = df) +
-  geom_point(mapping = aes(x = log(mean), y = lfc, col = col, key = ID)) +
+  geom_point(mapping = aes(x = log(mean), y = lfc, col = cols, key = ID)) +
   scale_x_continuous(name = 'Log(mean)') +
   scale_y_continuous(name = 'Log fold change') +
-  scale_color_manual(name = 'Significance')+
+  scale_color_discrete(name = 'Adjusted P')+
   theme_classic()
 ggplotly(p)
 ```
--- a/deseq2_render.R	Fri Mar 09 00:02:09 2018 -0500
+++ b/deseq2_render.R	Fri Mar 09 01:22:06 2018 -0500
@@ -36,7 +36,7 @@
          data_type_flags = c("character", "character", "character", "character",
                              "character", "character", "character", "character",
                              "character", "character", "character", "character",
-                             "character", "character", "character")
+                             "character", "double", "character")
   )
 )
 opt = getopt(spec_matrix)