Skip to content

Commit

Permalink
fix: psg_list (findAdducts) and sample (xsAnnotate)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
DamienCode404 committed Nov 5, 2024
1 parent b16ecf1 commit 43e7c4a
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 14 deletions.
14 changes: 14 additions & 0 deletions tools/camera/CAMERA_findAdducts.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down
17 changes: 9 additions & 8 deletions tools/camera/CAMERA_groupFWHM.R
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion tools/camera/findAdducts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
</conditional>
</when>
</conditional>
<param name="convertRTMinute" type="boolean" checked="true" truevalue="TRUE" falsevalue="FALSE" label="Convert seconds to minutes when exporting tsv" />
<param name="convertRTMinute" type="boolean" checked="false" truevalue="TRUE" falsevalue="FALSE" label="Convert seconds to minutes when exporting tsv" />
<param name="numDigitsMZ" type="integer" value="4" max="4" min="0" label="Number of digits for MZ values (namecustom)" />
<param name="numDigitsRT" type="integer" value="4" max="4" min="0" label="Number of digits for RT values (namecustom)" />
<expand macro="input_file_load"/>
Expand Down
2 changes: 1 addition & 1 deletion tools/camera/findIsotopes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
</param>
<param name="minfrac" type="float" value="0.5" max="1" min="0" label="The percentage number of samples, which must satisfy the C12/C13 rule for isotope annotation" />
<param name="filter" type="boolean" checked="false" truevalue="TRUE" falsevalue="FALSE" label="Should C12/C13 filter be applied" />
<param name="convertRTMinute" type="boolean" checked="true" truevalue="TRUE" falsevalue="FALSE" label="Convert seconds to minutes when exporting tsv" />
<param name="convertRTMinute" type="boolean" checked="false" truevalue="TRUE" falsevalue="FALSE" label="Convert seconds to minutes when exporting tsv" />
<param name="numDigitsMZ" type="integer" value="4" max="4" min="0" label="Number of digits for MZ values (namecustom)" />
<param name="numDigitsRT" type="integer" value="4" max="4" min="0" label="Number of digits for RT values (namecustom)" />
<expand macro="input_file_load"/>
Expand Down
2 changes: 1 addition & 1 deletion tools/camera/groupCorr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
<option value="maxf">maxf</option>
<option value="area">area</option> -->
</param>
<param name="convertRTMinute" type="boolean" checked="false" truevalue="TRUE" falsevalue="FALSE" label="Convert seconds to minutes when exporting tsv" />
<param name="numDigitsMZ" type="integer" value="4" max="4" min="0" label="Number of digits for MZ values (namecustom)" />
<param name="numDigitsRT" type="integer" value="4" max="4" min="0" label="Number of digits for RT values (namecustom)" />
<param name="convertRTMinute" type="boolean" checked="true" truevalue="TRUE" falsevalue="FALSE" label="Convert seconds to minutes when exporting tsv" />
<expand macro="input_file_load"/>
</inputs>
<outputs>
Expand Down
7 changes: 4 additions & 3 deletions tools/camera/groupFWHM.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
nSlaves 1
#else
sample $sample
nSlaves $nSlaves
nSlaves 1
#end if
@COMMAND_FILE_LOAD@
Expand Down Expand Up @@ -59,10 +59,11 @@
</when>
<when value="TRUE">
<param name="sample" type="text" value="NA" label="use all the samples (automatic selection)" optional="true" />
<param name="nSlaves" type="integer" value="1" max="3" min="1" label="for parallel mode set nSlaves higher than 1" optional="true" />
<!-- issue with findAdducts Use of 'xcmsClusterApply' is deprecated! Use 'BPPARAM' arguments instead. Need update of the package -->
<!-- <param name="nSlaves" type="integer" value="1" max="3" min="1" label="for parallel mode set nSlaves higher than 1" optional="true" /> -->
</when>
</conditional>
<param name="convertRTMinute" type="boolean" checked="true" truevalue="TRUE" falsevalue="FALSE" label="Convert seconds to minutes when exporting tsv" />
<param name="convertRTMinute" type="boolean" checked="false" truevalue="TRUE" falsevalue="FALSE" label="Convert seconds to minutes when exporting tsv" />
<param name="numDigitsMZ" type="integer" value="4" max="4" min="0" label="Number of digits for MZ values (namecustom)" />
<param name="numDigitsRT" type="integer" value="4" max="4" min="0" label="Number of digits for RT values (namecustom)" />
<expand macro="input_file_load"/>
Expand Down

0 comments on commit 43e7c4a

Please sign in to comment.