Skip to content

Commit

Permalink
Delete outdated test files + try to fix singlefile problem
Browse files Browse the repository at this point in the history
  • Loading branch information
DamienCode404 committed Oct 22, 2024
1 parent 67ef11c commit c890131
Show file tree
Hide file tree
Showing 15 changed files with 89 additions and 1,268 deletions.
50 changes: 33 additions & 17 deletions tools/camera/CAMERA_findAdducts.R
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ 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)
}
# # 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
Expand All @@ -26,23 +26,39 @@ args <- list(
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 = convertNullString(args_vec[8]), # Vector of pseudospectra indices; correlation analysis will only be done for those groups
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
)
# Convert "NULL" to actual NULL or convert to data frame
if (args$rules == "NULL") {
args$rulset <- convertNullString(args$rules) # Return NULL

# 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
} else {
args$rulset <- read.table(args$rules, h = TRUE, sep = ",")
if (ncol(args$rulset) < 4) rulset <- read.table(args$rules, h = TRUE, sep = "\t")
if (ncol(args$rulset) < 4) rulset <- read.table(args$rules, h = TRUE, sep = ",")
if (ncol(args$rulset) < 4) {
error_message <- "Your ruleset file seems not well formatted. The column separators accepted are ; , and tabulation"
# 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

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

# If reading the rules file failed for all delimiters
if (!success) {
# 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(error_message) # Stop execution with an error
}
}

Expand Down
3 changes: 3 additions & 0 deletions tools/camera/CAMERA_groupFWHM.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ args <- list(
numDigitsRT = as.numeric(args_vec[7]) # Number of digits RT
)

print("Converted arguments:")
print(args)

# Check if the image file exists
if (!file.exists(args$image)) {
stop("The RData file does not exist: ", args$image)
Expand Down
43 changes: 32 additions & 11 deletions tools/camera/findAdducts.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,39 @@
<expand macro="requirements"/>

<command detect_errors="exit_code"><![CDATA[
@COMMAND_RSCRIPT@/CAMERA_findAdducts.R
@COMMAND_RSCRIPT@CAMERA_findAdducts.R
'$image'
$ppm
$mzabs
$multiplier
$polarity
$rules
$max_peaks
$psg_list
#if $rules_select == "FALSE":
$rules NULL
#else
$rules
#end if
#if $advanced_select == "FALSE":
$multiplier 3
$max_peaks 100
$psg_list NULL
#else
$multiplier
$max_peaks
#if $psg_list_block == "FALSE":
$psg_list = NULL
#else
$psg_list
#end if
#end if
$intval
$convertRTMinute
$numDigitsMZ
$numDigitsRT
@COMMAND_FILE_LOAD@
]]>
</command>
<inputs>
Expand All @@ -39,7 +59,7 @@
<option value="FALSE" selected="true">FALSE</option>
</param>
<when value="FALSE">
<param name="rules" type="text" value="NULL" label="No personal ruleset file (using default ruleset)" optional="true" />
<!--<param name="rules" type="text" value="NULL" label="No personal ruleset file (using default ruleset)" optional="true" />-->
</when>
<when value="TRUE">
<param name="rules" type="data" format="csv" label="User defined ruleset" />
Expand All @@ -58,9 +78,9 @@
<option value="FALSE" selected="true">FALSE</option>
</param>
<when value="FALSE">
<param name="multiplier" type="integer" value="3" label="Highest number(n) of allowed clusterion [nM+ion]" optional="true" />
<!--<param name="multiplier" type="integer" value="3" label="Highest number(n) of allowed clusterion [nM+ion]" optional="true" />
<param name="max_peaks" type="integer" value="100" label="How many peaks will be calculated in every thread (parallel mode)" optional="true" />
<param name="psg_list" type="text" value="NULL" label="No psg_list" optional="true" />
<param name="psg_list" type="text" value="NULL" label="No psg_list" optional="true" />-->
</when>
<when value="TRUE">
<param name="multiplier" type="integer" value="3" label="Highest number(n) of allowed clusterion [nM+ion]" />
Expand All @@ -72,7 +92,7 @@
<option value="FALSE" selected="true">FALSE</option>
</param>
<when value="FALSE">
<param name="psg_list" type="text" value="NULL" label="No psg_list" optional="true" />
<!--<param name="psg_list" type="text" value="NULL" label="No psg_list" optional="true" />-->
</when>
<when value="TRUE">
<param name="psg_list" type="text" optional="true" label="Pseudospectra indices (optional)" help="Provide a comma-separated list of pseudospectra indices (e.g. 1,2,3)." />
Expand All @@ -83,6 +103,7 @@
<param name="convertRTMinute" type="boolean" checked="true" 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"/>
</inputs>
<outputs>
<data name="variableMetadata" format="tabular" label="${image.name[:-6]}.findAdducts.variableMetadata.tsv" from_work_dir="variableMetadata.tsv" />
Expand All @@ -91,15 +112,15 @@
<tests>
<test>
<param name="image" value="xset.merged.groupChromPeaks.fillChromPeaks.fwhm.groupCorr.findIsotopes.RData" />
<param name="ppm" value="5" />
<!--<param name="ppm" value="5" />
<param name="mzabs" value="0.015" />
<param name="polarity" value="positive" />
<param name="rules" value="NULL" />
<param name="intval" value="into" />
<param name="multiplier" value="3" />
<param name="max_peaks" value="100" />
<param name="psg_list" value="NULL" />

<param name="psg_list" value="NULL" />-->
<expand macro="test_file_load_single"/>
<output name="variableMetadata" file="xset.merged.groupChromPeaks.fillChromPeaks.fwhm.groupCorr.findIsotopes.findAdducts.variableMetadata.tsv" />
<output name="camera_findAdducts_rdata" file="xset.merged.groupChromPeaks.fillChromPeaks.fwhm.groupCorr.findIsotopes.findAdducts.RData" />
</test>
Expand Down
11 changes: 7 additions & 4 deletions tools/camera/findIsotopes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<expand macro="requirements"/>

<command detect_errors="exit_code"><![CDATA[
@COMMAND_RSCRIPT@/CAMERA_findIsotopes.R
@COMMAND_RSCRIPT@CAMERA_findIsotopes.R
'$image'
$maxcharge
$maxiso
Expand All @@ -21,6 +21,8 @@
$convertRTMinute
$numDigitsMZ
$numDigitsRTF
@COMMAND_FILE_LOAD@
]]>
</command>

Expand All @@ -40,6 +42,7 @@
<param name="convertRTMinute" type="boolean" checked="true" 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"/>
</inputs>
<outputs>
<data name="variableMetadata" format="tabular" label="${image.name[:-6]}.findIsotopes.variableMetadata.tsv" from_work_dir="variableMetadata.tsv" />
Expand All @@ -48,14 +51,14 @@
<tests>
<test>
<param name="image" value="xset.merged.groupChromPeaks.fillChromPeaks.fwhm.groupCorr.RData" />
<param name="maxcharge" value="3" />
<!--<param name="maxcharge" value="3" />
<param name="maxiso" value="4" />
<param name="ppm" value="5" />
<param name="mzabs" value="0.01" />
<param name="intval" value="into" />
<param name="minfrac" value="0.5" />
<param name="filter" value="FALSE" />

<param name="filter" value="FALSE" />-->
<expand macro="test_file_load_single"/>
<output name="variableMetadata" file="xset.merged.groupChromPeaks.fillChromPeaks.fwhm.groupCorr.findIsotopes.variableMetadata.tsv" />
<output name="camera_findIsotopes_rdata" file="xset.merged.groupChromPeaks.fillChromPeaks.fwhm.groupCorr.findIsotopes.RData" />
</test>
Expand Down
11 changes: 7 additions & 4 deletions tools/camera/groupCorr.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<expand macro="requirements"/>

<command detect_errors="exit_code"><![CDATA[
@COMMAND_RSCRIPT@/CAMERA_groupCorr.R
@COMMAND_RSCRIPT@CAMERA_groupCorr.R
'$image'
$cor_eic_th
$pval
Expand All @@ -22,6 +22,8 @@
$numDigitsMZ
$numDigitsRT
$convertRTMinute
@COMMAND_FILE_LOAD@
]]>
</command>

Expand All @@ -48,6 +50,7 @@
<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>
<data name="variableMetadata" format="tabular" label="${image.name[:-6]}.groupCorr.variableMetadata.tsv" from_work_dir="variableMetadata.tsv" />
Expand All @@ -56,15 +59,15 @@
<tests>
<test>
<param name="image" value="xset.merged.groupChromPeaks.fillChromPeaks.fwhm.RData" />
<param name="cor_eic_th" value="0.75" />
<!--<param name="cor_eic_th" value="0.75" />
<param name="pval" value="0.05" />
<param name="graphMethod" value="hcs" />
<param name="calcIso" value="FALSE" />
<param name="calcCiS" value="TRUE" />
<param name="calcCaS" value="FALSE" />
<param name="cor_exp_th" value="0.75" />
<param name="intval" value="into" />

<param name="intval" value="into" />-->
<expand macro="test_file_load_single"/>
<output name="variableMetadata" file="xset.merged.groupChromPeaks.fillChromPeaks.fwhm.groupCorr.variableMetadata.tsv" />
<output name="camera_groupCorr_rdata" file="xset.merged.groupChromPeaks.fillChromPeaks.fwhm.groupCorr.RData" />
</test>
Expand Down
11 changes: 7 additions & 4 deletions tools/camera/groupFWHM.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,16 @@
<expand macro="requirements"/>

<command detect_errors="exit_code"><![CDATA[
@COMMAND_RSCRIPT@/CAMERA_groupFWHM.R
@COMMAND_RSCRIPT@CAMERA_groupFWHM.R
'$image'
$sigma
$perfwhm
$intval
$convertRTMinute
$numDigitsMZ
$numDigitsRT
@COMMAND_FILE_LOAD@
]]>
</command>

Expand All @@ -31,6 +33,7 @@
<param name="convertRTMinute" type="boolean" checked="true" 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"/>
</inputs>

<outputs>
Expand All @@ -41,10 +44,10 @@
<tests>
<test>
<param name="image" value="xset.merged.groupChromPeaks.fillChromPeaks.RData" />
<param name="sigma" value="6" />
<!--<param name="sigma" value="6" />
<param name="perfwhm" value="0.6" />
<param name="intval" value="into" />

<param name="intval" value="into" />-->
<expand macro="test_file_load_single"/>
<output name="variableMetadata" file="xset.merged.groupChromPeaks.fillChromPeaks.fwhm.variableMetadata.tsv" />
<output name="camera_fwhm" file="xset.merged.groupChromPeaks.fillChromPeaks.fwhm.rdata" />
</test>
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit c890131

Please sign in to comment.