From 43e7c4a0606f3c0f9c5009a8f0ace8b0f423db96 Mon Sep 17 00:00:00 2001 From: Damien RAT Date: Tue, 5 Nov 2024 15:38:27 +0100 Subject: [PATCH] fix: psg_list (findAdducts) and sample (xsAnnotate) nSlaves issue with findAdducts. Use of 'xcmsClusterApply' is deprecated! Use 'BPPARAM' arguments instead. Need update of the package CAMERA to parallelize. nSlaves is set by default to 1. --- tools/camera/CAMERA_findAdducts.R | 14 ++++++++++++++ tools/camera/CAMERA_groupFWHM.R | 17 +++++++++-------- tools/camera/findAdducts.xml | 2 +- tools/camera/findIsotopes.xml | 2 +- tools/camera/groupCorr.xml | 2 +- tools/camera/groupFWHM.xml | 7 ++++--- 6 files changed, 30 insertions(+), 14 deletions(-) diff --git a/tools/camera/CAMERA_findAdducts.R b/tools/camera/CAMERA_findAdducts.R index 8dc3999df..470516103 100755 --- a/tools/camera/CAMERA_findAdducts.R +++ b/tools/camera/CAMERA_findAdducts.R @@ -37,6 +37,20 @@ for (arg in names(args)) { args[[arg]] <- convertNullString(args[[arg]]) } +# Function to convert string to numeric lists +convertStringToNumeric <- function(x) { + if (x == NULL) { + return(x) + } else { + # Convert string representation of a list to a numeric vector + # Use a regular expression to split by common separators + return(as.numeric(unlist(strsplit(x, "[,;\\s]+")))) + } +} + +# Convert only the 'psg_list' element in args +args$psg_list <- convertStringToNumeric(args$psg_list) + print("Argument types:") print(sapply(args, class)) diff --git a/tools/camera/CAMERA_groupFWHM.R b/tools/camera/CAMERA_groupFWHM.R index 4fecaa106..a02b90689 100755 --- a/tools/camera/CAMERA_groupFWHM.R +++ b/tools/camera/CAMERA_groupFWHM.R @@ -25,18 +25,19 @@ cat("\n\n") print("Arguments retrieved from the command line:") print(args) -# Function to convert "NA" strings to actual NA values -convertNAString <- function(x) { - if (is.vector(x)) { - x[x == "NA"] <- NA - } else if (x == "NA") { - x <- NA +# Function to convert "NA" strings to actual NA values and string to numeric lists +convertStringToNumeric <- function(x) { + if (x == "NA") { + return(NA) + } else { + # Convert string representation of a list to a numeric vector + # Use a regular expression to split by common separators + return(as.numeric(unlist(strsplit(x, "[,;\\s]+")))) } - return(x) } # Convert only the 'sample' element in args -args$sample <- convertNAString(args$sample) +args$sample <- convertStringToNumeric(args$sample) print("Argument types:") print(sapply(args, class)) diff --git a/tools/camera/findAdducts.xml b/tools/camera/findAdducts.xml index 4c07e0efe..b115e4457 100755 --- a/tools/camera/findAdducts.xml +++ b/tools/camera/findAdducts.xml @@ -103,7 +103,7 @@ - + diff --git a/tools/camera/findIsotopes.xml b/tools/camera/findIsotopes.xml index f58cc514b..08e28fe5b 100755 --- a/tools/camera/findIsotopes.xml +++ b/tools/camera/findIsotopes.xml @@ -43,7 +43,7 @@ - + diff --git a/tools/camera/groupCorr.xml b/tools/camera/groupCorr.xml index 24e6a90ba..991a749d8 100755 --- a/tools/camera/groupCorr.xml +++ b/tools/camera/groupCorr.xml @@ -51,9 +51,9 @@ --> + - diff --git a/tools/camera/groupFWHM.xml b/tools/camera/groupFWHM.xml index 41e35ee6f..1b255304a 100755 --- a/tools/camera/groupFWHM.xml +++ b/tools/camera/groupFWHM.xml @@ -28,7 +28,7 @@ nSlaves 1 #else sample $sample - nSlaves $nSlaves + nSlaves 1 #end if @COMMAND_FILE_LOAD@ @@ -59,10 +59,11 @@ - + + - +