Replace sgd_genes function with vectorized approach

This commit is contained in:
2024-09-01 03:34:22 -04:00
parent 00984b5060
commit 9e2a2d16c5

View File

@@ -99,15 +99,6 @@ scale_colour_publication <- function(...) {
)), ...) )), ...)
} }
# Load SGD gene list
sgd_genes <- function(sgd_gene_list) {
read.delim(file = sgd_gene_list, quote = "", header = FALSE,
colClasses = c(rep("NULL", 3), rep("character", 2), rep("NULL", 11))) %>%
dplyr::rename(ORF = V4, GeneName = V5)
}
genes <- sgd_genes(args$sgd_gene_list)
# Load the initial dataframe from the easy_results_file # Load the initial dataframe from the easy_results_file
load_and_process_data <- function(easy_results_file, sd = 3) { load_and_process_data <- function(easy_results_file, sd = 3) {
df <- read.delim(easy_results_file, skip = 2, as.is = TRUE, row.names = 1, strip.white = TRUE) df <- read.delim(easy_results_file, skip = 2, as.is = TRUE, row.names = 1, strip.white = TRUE)
@@ -299,7 +290,6 @@ process_strains <- function(df, l_within_2sd_k, strain, output_dir) {
return(df_strains) return(df_strains)
} }
calculate_interaction_scores <- function(df, df_stats_by_l, df_stats_by_k, calculate_interaction_scores <- function(df, df_stats_by_l, df_stats_by_k,
df_stats_by_r, df_stats_by_auc, background_means, max_conc, variables, group_vars = c("OrfRep", "Gene", "num")) { df_stats_by_r, df_stats_by_auc, background_means, max_conc, variables, group_vars = c("OrfRep", "Gene", "num")) {
@@ -437,7 +427,6 @@ generate_cpp_correlation_plots <- function(df_na_rm, lm_list, output_dir) {
save_plots("Correlation_CPPs", plot_list, output_dir) save_plots("Correlation_CPPs", plot_list, output_dir)
} }
# Adjust missing values and calculate ranks # Adjust missing values and calculate ranks
adjust_missing_and_rank <- function(df) { adjust_missing_and_rank <- function(df) {
df <- df %>% df <- df %>%
@@ -511,7 +500,6 @@ create_ranked_plots <- function(df, output_dir) {
generate_and_save_ranked_plots(df_adjusted, output_dir, "RankPlots_lm_naRM") generate_and_save_ranked_plots(df_adjusted, output_dir, "RankPlots_lm_naRM")
} }
main <- function() { main <- function() {
# Applying to all experiments # Applying to all experiments
lapply(names(args$experiments), function(exp_name) { lapply(names(args$experiments), function(exp_name) {