Sort experiments for analysis

This commit is contained in:
2024-09-25 18:48:56 -04:00
parent 302110bb9b
commit 4cab528772

View File

@@ -52,6 +52,7 @@ parse_arguments <- function() {
stop("Experiment arguments should be in groups of 3: path, name, sd.") stop("Experiment arguments should be in groups of 3: path, name, sd.")
} }
# Extract the experiments into a list
experiments <- list() experiments <- list()
for (i in seq(1, length(exp_args), by = 3)) { for (i in seq(1, length(exp_args), by = 3)) {
exp_name <- exp_args[i + 1] exp_name <- exp_args[i + 1]
@@ -61,11 +62,21 @@ parse_arguments <- function() {
) )
} }
# Extract the trailing number from each path
trailing_numbers <- sapply(experiments, function(x) {
path <- x$path
nums <- gsub("[^0-9]", "", basename(path))
as.integer(nums)
})
# Sort the experiments based on the trailing numbers
sorted_experiments <- experiments[order(trailing_numbers)]
list( list(
out_dir = out_dir, out_dir = out_dir,
sgd_gene_list = sgd_gene_list, sgd_gene_list = sgd_gene_list,
easy_results_file = easy_results_file, easy_results_file = easy_results_file,
experiments = experiments experiments = sorted_experiments
) )
} }
@@ -75,9 +86,6 @@ args <- parse_arguments()
# dir.create(file.path(args$out_dir, "zscores"), showWarnings = FALSE) # dir.create(file.path(args$out_dir, "zscores"), showWarnings = FALSE)
# dir.create(file.path(args$out_dir, "zscores", "qc"), showWarnings = FALSE) # 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_publication <- function(base_size = 14, base_family = "sans", legend_position = "bottom") {
theme_foundation <- ggthemes::theme_foundation(base_size = base_size, base_family = base_family) theme_foundation <- ggthemes::theme_foundation(base_size = base_size, base_family = base_family)