Bläddra i källkod

Sort experiments for analysis

Bryan Roessler 6 månader sedan
förälder
incheckning
4cab528772
1 ändrade filer med 12 tillägg och 4 borttagningar
  1. 12 4
      qhtcp-workflow/apps/r/calculate_interaction_zscores.R

+ 12 - 4
qhtcp-workflow/apps/r/calculate_interaction_zscores.R

@@ -52,6 +52,7 @@ parse_arguments <- function() {
     stop("Experiment arguments should be in groups of 3: path, name, sd.")
   }
 
+  # Extract the experiments into a list
   experiments <- list()
   for (i in seq(1, length(exp_args), by = 3)) {
     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(
     out_dir = out_dir,
     sgd_gene_list = sgd_gene_list,
     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", "qc"), showWarnings = FALSE)
 
-# Define themes and scales
-library(ggthemes)
-
 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)