Switch from theme_gray() to theme_foundation()
This commit is contained in:
@@ -76,15 +76,15 @@ args <- parse_arguments()
|
||||
# dir.create(file.path(args$out_dir, "zscores", "qc"), showWarnings = FALSE)
|
||||
|
||||
# Define themes and scales
|
||||
library(ggthemes)
|
||||
|
||||
theme_publication <- function(base_size = 14, base_family = "sans", legend_position = "bottom") {
|
||||
theme_foundation <- ggplot2::theme_grey(base_size = base_size, base_family = base_family)
|
||||
theme_foundation <- ggthemes::theme_foundation(base_size = base_size, base_family = base_family)
|
||||
|
||||
theme_foundation %+replace%
|
||||
theme(
|
||||
plot.title = element_text(face = "bold", size = rel(1.2), hjust = 0.5),
|
||||
text = element_text(),
|
||||
panel.background = element_rect(colour = NA),
|
||||
plot.background = element_rect(colour = NA),
|
||||
panel.border = element_rect(colour = NA),
|
||||
axis.title = element_text(face = "bold", size = rel(1)),
|
||||
axis.title.y = element_text(angle = 90, vjust = 2, size = 18),
|
||||
@@ -1119,7 +1119,7 @@ main <- function() {
|
||||
x_var = "delta_bg",
|
||||
y_var = NULL,
|
||||
plot_type = "density",
|
||||
title = "Plate analysis by Drug Conc for Delta Background before quality control",
|
||||
title = "Density plot for Delta Background by Conc All Data",
|
||||
color_var = "conc_num_factor",
|
||||
x_label = "Delta Background",
|
||||
y_label = "Density",
|
||||
@@ -1130,7 +1130,7 @@ main <- function() {
|
||||
x_var = "delta_bg",
|
||||
y_var = NULL,
|
||||
plot_type = "bar",
|
||||
title = "Plate analysis by Drug Conc for Delta Background before quality control",
|
||||
title = "Bar plot for Delta Background by Conc All Data",
|
||||
color_var = "conc_num_factor",
|
||||
x_label = "Delta Background",
|
||||
y_label = "Count",
|
||||
@@ -1215,9 +1215,7 @@ main <- function() {
|
||||
)
|
||||
)
|
||||
|
||||
message("Generating quality control plots")
|
||||
|
||||
# TODO trying out some parallelization
|
||||
message("Generating quality control plots in parallel")
|
||||
# future::plan(future::multicore, workers = parallel::detectCores())
|
||||
future::plan(future::multisession, workers = 3) # generate 3 plots in parallel
|
||||
|
||||
@@ -1368,7 +1366,7 @@ main <- function() {
|
||||
file = file.path(out_dir, "zscore_interaction_deletion_enhancers_and_suppressors_K.csv"), row.names = FALSE)
|
||||
|
||||
# Handle linear model based enhancers and suppressors
|
||||
lm_threshold <- 2
|
||||
lm_threshold <- 2 # TODO add to study config?
|
||||
enhancers_lm_L <- zscore_interactions[zscore_interactions$Z_lm_L >= lm_threshold, ]
|
||||
suppressors_lm_L <- zscore_interactions[zscore_interactions$Z_lm_L <= -lm_threshold, ]
|
||||
enhancers_lm_K <- zscore_interactions[zscore_interactions$Z_lm_K >= lm_threshold, ]
|
||||
@@ -1406,19 +1404,20 @@ main <- function() {
|
||||
plot_configs = rank_lm_plot_configs, grid_layout = list(ncol = 3, nrow = 2))
|
||||
|
||||
message("Filtering and reranking plots")
|
||||
interaction_threshold <- 2 # TODO add to study config?
|
||||
# Formerly X_NArm
|
||||
zscore_interactions_filtered <- zscore_interactions_joined %>%
|
||||
filter(!is.na(Z_lm_L) & !is.na(Avg_Zscore_L)) %>%
|
||||
mutate(
|
||||
Overlap = case_when(
|
||||
Z_lm_L >= 2 & Avg_Zscore_L >= 2 ~ "Deletion Enhancer Both",
|
||||
Z_lm_L <= -2 & Avg_Zscore_L <= -2 ~ "Deletion Suppressor Both",
|
||||
Z_lm_L >= 2 & Avg_Zscore_L <= 2 ~ "Deletion Enhancer lm only",
|
||||
Z_lm_L <= 2 & Avg_Zscore_L >= 2 ~ "Deletion Enhancer Avg Zscore only",
|
||||
Z_lm_L <= -2 & Avg_Zscore_L >= -2 ~ "Deletion Suppressor lm only",
|
||||
Z_lm_L >= -2 & Avg_Zscore_L <= -2 ~ "Deletion Suppressor Avg Zscore only",
|
||||
Z_lm_L >= 2 & Avg_Zscore_L <= -2 ~ "Deletion Enhancer lm, Deletion Suppressor Avg Z score",
|
||||
Z_lm_L <= -2 & Avg_Zscore_L >= 2 ~ "Deletion Suppressor lm, Deletion Enhancer Avg Z score",
|
||||
Z_lm_L >= interaction_threshold & Avg_Zscore_L >= interaction_threshold ~ "Deletion Enhancer Both",
|
||||
Z_lm_L <= -interaction_threshold & Avg_Zscore_L <= -interaction_threshold ~ "Deletion Suppressor Both",
|
||||
Z_lm_L >= interaction_threshold & Avg_Zscore_L <= interaction_threshold ~ "Deletion Enhancer lm only",
|
||||
Z_lm_L <= interaction_threshold & Avg_Zscore_L >= interaction_threshold ~ "Deletion Enhancer Avg Zscore only",
|
||||
Z_lm_L <= -interaction_threshold & Avg_Zscore_L >= -interaction_threshold ~ "Deletion Suppressor lm only",
|
||||
Z_lm_L >= -interaction_threshold & Avg_Zscore_L <= -interaction_threshold ~ "Deletion Suppressor Avg Zscore only",
|
||||
Z_lm_L >= interaction_threshold & Avg_Zscore_L <= -interaction_threshold ~ "Deletion Enhancer lm, Deletion Suppressor Avg Z score",
|
||||
Z_lm_L <= -interaction_threshold & Avg_Zscore_L >= interaction_threshold ~ "Deletion Suppressor lm, Deletion Enhancer Avg Z score",
|
||||
TRUE ~ "No Effect"
|
||||
),
|
||||
lm_R_squared_L = summary(lm(Z_lm_L ~ Avg_Zscore_L))$r.squared,
|
||||
|
||||
@@ -1430,6 +1430,11 @@ wrapper calculate_interaction_zscores
|
||||
# TODO
|
||||
#
|
||||
# * More variables can be read in from the config file to allow more configuration
|
||||
# * sd thresholds
|
||||
# * lm thresholds
|
||||
# * interaction thresholds
|
||||
# * reference gene(s)
|
||||
# * background genes
|
||||
# * Add gene names, other threshold values, etc.
|
||||
# * Dataframe columns and output file columns should be standardized in calculate_interactions()
|
||||
# * Need to decide if conc_num_factor is numeric or factor
|
||||
|
||||
Reference in New Issue
Block a user