Skip to content

Commit

Permalink
improve plot_ma to display correct units depending on which_var o…
Browse files Browse the repository at this point in the history
…f the selected model
  • Loading branch information
warrenmcg committed Nov 17, 2017
1 parent fb3ecdc commit 5d09823
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion R/plots.R
Original file line number Diff line number Diff line change
Expand Up @@ -611,14 +611,20 @@ plot_ma <- function(obj, test, test_type = 'wt', which_model = 'full',
' Suggestions? Email us.')
}

which_var <- obj$fits[[which_model]]$which_var
if (which_var == "obs_counts") {
x_label <- "counts"
} else {
x_label <- "tpms"
}
res <- sleuth_results(obj, test, test_type, which_model, rename_cols = FALSE,
show_all = FALSE)
res <- dplyr::mutate(res, significant = qval < sig_level)

p <- ggplot(res, aes(mean_obs, b))
p <- p + geom_point(aes(colour = significant), alpha = point_alpha)
p <- p + scale_colour_manual(values = c('black', sig_color))
p <- p + xlab('mean( log( counts + 0.5 ) )')
p <- p + xlab(paste('mean( log(', x_label, '+ 0.5 ) )'))
p <- p + ylab(paste0('beta: ', test))

if (!is.null(highlight)) {
Expand Down

0 comments on commit 5d09823

Please sign in to comment.