plot_sa {baldur}  R Documentation 
plot_sa
returns a ggplot
with a graphical representation between the log
foldchange and sigma.
plot_sa(results, alpha = 0.05, lfc = NULL)
results 
Output generated by

alpha 
Significance cutoff; used to draw a line indicating where significance starts 
lfc 
LFC cutoff; used to draw lines for 
plot_sa
returns a ggplot
object
# Setup model matrix
design < model.matrix(~ 0 + factor(rep(1:2, each = 3)))
colnames(design) < paste0("ng", c(50, 100))
yeast_norm < yeast %>%
# Remove missing data
tidyr::drop_na() %>%
# Normalize data
psrn('identifier') %>%
# Add meanvariance trends
calculate_mean_sd_trends(design)
# Fit the gamma regression
gam < fit_gamma_regression(yeast_norm, sd ~ mean)
# Estimate each data point's uncertainty
unc < estimate_uncertainty(gam, yeast_norm, "identifier", design)
yeast_norm < gam %>%
# Add hyperpriors for sigma
estimate_gamma_hyperparameters(yeast_norm)
# Setup contrast matrix
contrast < matrix(c(1, 1), 2)
results < yeast_norm %>%
head() %>% # Just run a few for the example
infer_data_and_decision_model(
'identifier',
design,
contrast,
unc,
clusters = 1 # I highly recommend increasing the number of parallel workers/clusters
# this will greatly reduce the speed of running baldur
)
# Plot with alpha = 0.05
plot_sa(results, alpha = 0.05)
# Plot with alpha = 0.01 and show LFC = 1
plot_sa(results, alpha = 0.01, 1)