Skip to content

Commit

Permalink
Add "singlefile_galaxyPath" and "singlefile_sampleName" arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
DamienCode404 committed Oct 23, 2024
1 parent c890131 commit ac642dd
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 53 deletions.
44 changes: 19 additions & 25 deletions tools/camera/CAMERA_findAdducts.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,46 +10,40 @@ 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
args$rulset <- read.table(args$rules, header = TRUE, sep = sep)

# 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
}
}

Expand All @@ -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
}
}

Expand Down
22 changes: 12 additions & 10 deletions tools/camera/CAMERA_findIsotopes.R
Original file line number Diff line number Diff line change
Expand Up @@ -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:")
Expand Down
26 changes: 14 additions & 12 deletions tools/camera/CAMERA_groupCorr.R
Original file line number Diff line number Diff line change
Expand Up @@ -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:")
Expand Down
14 changes: 8 additions & 6 deletions tools/camera/CAMERA_groupFWHM.R
Original file line number Diff line number Diff line change
Expand Up @@ -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:")
Expand Down

0 comments on commit ac642dd

Please sign in to comment.