From ac642dd0d5b0301c0a5fc9910a77248730ac34c3 Mon Sep 17 00:00:00 2001 From: Damien RAT Date: Wed, 23 Oct 2024 10:03:24 +0200 Subject: [PATCH] Add "singlefile_galaxyPath" and "singlefile_sampleName" arguments --- tools/camera/CAMERA_findAdducts.R | 44 +++++++++++++----------------- tools/camera/CAMERA_findIsotopes.R | 22 ++++++++------- tools/camera/CAMERA_groupCorr.R | 26 ++++++++++-------- tools/camera/CAMERA_groupFWHM.R | 14 ++++++---- 4 files changed, 53 insertions(+), 53 deletions(-) diff --git a/tools/camera/CAMERA_findAdducts.R b/tools/camera/CAMERA_findAdducts.R index 6e8adc0b3..771e480fb 100755 --- a/tools/camera/CAMERA_findAdducts.R +++ b/tools/camera/CAMERA_findAdducts.R @@ -10,37 +10,31 @@ args_vec <- commandArgs(trailingOnly = TRUE) print("Arguments retrieved from the command line:") print(args_vec) -# # Function to convert "NULL" strings to actual NULL values -# convertNullString <- function(x) { -# if (x == "NULL") { -# return(NULL) -# } -# return(x) -# } - args <- list( - image = args_vec[1], # the xsAnnotate object - ppm = as.numeric(args_vec[2]), # ppm error for the search - mzabs = as.numeric(args_vec[3]), # allowed variance for the search - multiplier = as.numeric(args_vec[4]), # highest number(n) of allowed clusterion [nM+ion] - polarity = args_vec[5], # Which polarity mode was used for measuring of the MS sample - rules = args_vec[6], # custom ruleset or NULL for default ruleset - max_peaks = as.numeric(args_vec[7]), # If run in parallel mode, this number defines how many peaks will be calculated in each thread - psg_list = args_vec[8], # Vector of pseudospectra indices; correlation analysis will only be done for those groups - intval = args_vec[9], # choose intensity values. Allowed values are "into", "maxo", "intb" (string) + image = args_vec[1], # the xsAnnotate object + ppm = as.numeric(args_vec[2]), # ppm error for the search + mzabs = as.numeric(args_vec[3]), # allowed variance for the search + multiplier = as.numeric(args_vec[4]), # highest number(n) of allowed clusterion [nM+ion] + polarity = args_vec[5], # Which polarity mode was used for measuring of the MS sample + rules = args_vec[6], # custom ruleset or NULL for default ruleset + max_peaks = as.numeric(args_vec[7]), # If run in parallel mode, this number defines how many peaks will be calculated in each thread + psg_list = args_vec[8], # Vector of pseudospectra indices; correlation analysis will only be done for those groups + intval = args_vec[9], # choose intensity values. Allowed values are "into", "maxo", "intb" (string) convertRTMinute = as.logical(args_vec[10]), # TRUE - FALSE - numDigitsMZ = as.numeric(args_vec[11]), # Number of digits MZ - numDigitsRT = as.numeric(args_vec[12]) # Number of digits RT + numDigitsMZ = as.numeric(args_vec[11]), # Number of digits MZ + numDigitsRT = as.numeric(args_vec[12]), # Number of digits RT + singlefile_galaxyPath = args_vec[13], # @COMMAND_FILE_LOAD@ + singlefile_sampleName = args_vec[14] # @COMMAND_FILE_LOAD@ ) # Check if the 'rules' argument in 'args' is NULL if (is.null(args$rules)) { # If 'args$rules' is NULL, set 'rulset' to NULL - args$rulset <- NULL + args$rulset <- NULL } else { # Try to read the rules file with different delimiters - delimiters <- c(";", "\t", ",") # List of possible delimiters - success <- FALSE # Flag to check if reading was successful + delimiters <- c(";", "\t", ",") # List of possible delimiters + success <- FALSE # Flag to check if reading was successful for (sep in delimiters) { # Attempt to read the rules file with the current separator @@ -48,8 +42,8 @@ if (is.null(args$rules)) { # Check if the number of columns is at least 4 if (ncol(args$rulset) >= 4) { - success <- TRUE # Mark success if the format is correct - break # Exit the loop if the file was read successfully + success <- TRUE # Mark success if the format is correct + break # Exit the loop if the file was read successfully } } @@ -58,7 +52,7 @@ if (is.null(args$rules)) { # Display an error message if the file is not well formatted error_message <- "The rules file appears to be improperly formatted. Accepted column separators are ;, tab, and ,." print(error_message) - stop(error_message) # Stop execution with an error + stop(error_message) # Stop execution with an error } } diff --git a/tools/camera/CAMERA_findIsotopes.R b/tools/camera/CAMERA_findIsotopes.R index 1b769f3e7..791dc5ba9 100755 --- a/tools/camera/CAMERA_findIsotopes.R +++ b/tools/camera/CAMERA_findIsotopes.R @@ -11,17 +11,19 @@ print("Arguments retrieved from command line:") print(args_vec) args <- list( - image = args_vec[1], # the xsAnnotate object - maxcharge = as.numeric(args_vec[2]), # max. number of the isotope charge - maxiso = as.numeric(args_vec[3]), # max. number of the isotope peaks - ppm = as.numeric(args_vec[4]), # ppm error for the search - mzabs = as.numeric(args_vec[5]), # allowed variance for the search - intval = args_vec[6], # Intensity parameter ("into", "maxo", "intb") - minfrac = as.numeric(args_vec[7]), # In case of multiple samples, percentage value of samples, which must contain the correct C12/C13 ratio and are not NA - filter = as.logical(args_vec[8]), # Should C12/C13 filter be applied? + image = args_vec[1], # the xsAnnotate object + maxcharge = as.numeric(args_vec[2]), # max. number of the isotope charge + maxiso = as.numeric(args_vec[3]), # max. number of the isotope peaks + ppm = as.numeric(args_vec[4]), # ppm error for the search + mzabs = as.numeric(args_vec[5]), # allowed variance for the search + intval = args_vec[6], # Intensity parameter ("into", "maxo", "intb") + minfrac = as.numeric(args_vec[7]), # In case of multiple samples, percentage value of samples, which must contain the correct C12/C13 ratio and are not NA + filter = as.logical(args_vec[8]), # Should C12/C13 filter be applied? convertRTMinute = as.logical(args_vec[9]), # TRUE - FALSE - numDigitsMZ = as.numeric(args_vec[10]), # Number of digits MZ - numDigitsRT = as.numeric(args_vec[11]) # Number of digits RT + numDigitsMZ = as.numeric(args_vec[10]), # Number of digits MZ + numDigitsRT = as.numeric(args_vec[11]), # Number of digits RT + singlefile_galaxyPath = args_vec[12], # @COMMAND_FILE_LOAD@ + singlefile_sampleName = args_vec[13] # @COMMAND_FILE_LOAD@ ) print("Converted arguments:") diff --git a/tools/camera/CAMERA_groupCorr.R b/tools/camera/CAMERA_groupCorr.R index 5832b71a0..72bbd4ca8 100755 --- a/tools/camera/CAMERA_groupCorr.R +++ b/tools/camera/CAMERA_groupCorr.R @@ -11,18 +11,20 @@ print("Command-line arguments retrieved:") print(args_vec) args <- list( - image = args_vec[1], # the xsAnnotate object - cor_eic_th = as.numeric(args_vec[2]), # Correlation threshold for EIC correlation - pval = as.numeric(args_vec[3]), # p-value threshold for testing correlation significance - graphMethod = args_vec[4], # Clustering method for resulting correlation graph. See calcPC for more details. - calcIso = as.logical(args_vec[5]), # Include isotope detection information for graph clustering - calcCiS = as.logical(args_vec[6]), # Calculate correlation inside samples - calcCaS = as.logical(args_vec[7]), # Calculate correlation across samples - cor_exp_th = as.numeric(args_vec[8]), # Threshold for intensity correlations across samples - intval = args_vec[9], # Selection of the intensity values (such as "into") used in the correlation analysis. See getPeaklist for all allowed values. - numDigitsMZ = as.numeric(args_vec[10]), # Digits for MZ "customname" - numDigitsRT = as.numeric(args_vec[11]), # Digits for RT "customname" - convertRTMinute = as.logical(args_vec[12]) # TRUE - FALSE + image = args_vec[1], # the xsAnnotate object + cor_eic_th = as.numeric(args_vec[2]), # Correlation threshold for EIC correlation + pval = as.numeric(args_vec[3]), # p-value threshold for testing correlation significance + graphMethod = args_vec[4], # Clustering method for resulting correlation graph. See calcPC for more details. + calcIso = as.logical(args_vec[5]), # Include isotope detection information for graph clustering + calcCiS = as.logical(args_vec[6]), # Calculate correlation inside samples + calcCaS = as.logical(args_vec[7]), # Calculate correlation across samples + cor_exp_th = as.numeric(args_vec[8]), # Threshold for intensity correlations across samples + intval = args_vec[9], # Selection of the intensity values (such as "into") used in the correlation analysis. See getPeaklist for all allowed values. + numDigitsMZ = as.numeric(args_vec[10]), # Digits for MZ "customname" + numDigitsRT = as.numeric(args_vec[11]), # Digits for RT "customname" + convertRTMinute = as.logical(args_vec[12]), # TRUE - FALSE + singlefile_galaxyPath = args_vec[13], # @COMMAND_FILE_LOAD@ + singlefile_sampleName = args_vec[14] # @COMMAND_FILE_LOAD@ ) print("Converted arguments:") diff --git a/tools/camera/CAMERA_groupFWHM.R b/tools/camera/CAMERA_groupFWHM.R index d7416da87..e57be0468 100755 --- a/tools/camera/CAMERA_groupFWHM.R +++ b/tools/camera/CAMERA_groupFWHM.R @@ -12,13 +12,15 @@ print(args_vec) # Convert arguments to appropriate types args <- list( - image = args_vec[1], # RData input file - sigma = as.numeric(args_vec[2]), # Convert sigma to numeric - perfwhm = as.numeric(args_vec[3]), # Convert perfwhm to numeric - intval = args_vec[4], # intval parameter ("into", "maxo", "intb") + image = args_vec[1], # RData input file + sigma = as.numeric(args_vec[2]), # Convert sigma to numeric + perfwhm = as.numeric(args_vec[3]), # Convert perfwhm to numeric + intval = args_vec[4], # intval parameter ("into", "maxo", "intb") convertRTMinute = as.logical(args_vec[5]), # TRUE - FALSE - numDigitsMZ = as.numeric(args_vec[6]), # Number of digits MZ - numDigitsRT = as.numeric(args_vec[7]) # Number of digits RT + numDigitsMZ = as.numeric(args_vec[6]), # Number of digits MZ + numDigitsRT = as.numeric(args_vec[7]), # Number of digits RT + singlefile_galaxyPath = args_vec[8], # @COMMAND_FILE_LOAD@ + singlefile_sampleName = args_vec[9] # @COMMAND_FILE_LOAD@ ) print("Converted arguments:")