Skip to content

Commit

Permalink
fix lintr and change test data files
Browse files Browse the repository at this point in the history
  • Loading branch information
DamienCode404 committed Nov 6, 2024
1 parent 6bb1b0a commit 245124e
Show file tree
Hide file tree
Showing 10 changed files with 1,687 additions and 2,248 deletions.
15 changes: 9 additions & 6 deletions tools/camera/CAMERA_findAdducts.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,17 @@ convertNullString <- function(x) {
return(x)
}

# Function to convert string to numeric lists or NA
convertStringToNumeric <- function(x) {
# Function to convert string to numeric lists
convert_psg_list <- function(x) {
# Check if x is NULL or has zero length before further processing
if (is.null(x) || length(x) == 0) {
return(NULL)
}

# Force conversion to character
x <- as.character(x)

if (x == "NA") {
return(NA)
} else if (grepl("^[0-9]+$", x)) {
if (grepl("^[0-9]+$", x)) {
# If the string represents a single numeric value
return(as.numeric(x))
} else {
Expand All @@ -55,7 +58,7 @@ for (arg in names(args)) {
}

# Convert only the 'psg_list' element in args
args$psg_list <- convertStringToNumeric(args$psg_list)
args$psg_list <- convert_psg_list(args$psg_list)

print("Argument types:")
print(sapply(args, class))
Expand Down
7 changes: 1 addition & 6 deletions tools/camera/CAMERA_groupFWHM.R
Original file line number Diff line number Diff line change
Expand Up @@ -87,16 +87,11 @@ if (!exists("xdata")) stop("\n\nERROR: The RData doesn't contain any object call
# Verification of a group step before doing the fillpeaks job.
if (!hasFeatures(xdata)) stop("You must always do a group step after a retcor. Otherwise it won't work for the groupFWHM step")

# sample = NA # Automatic selection, particularly useful if you have no specific preference
# sample = 3 # Single file selection
# sample = c(1, 2, 5) # Manual selection
# sample = 1:length(xs@filepaths) # Select all samples

# Convert the xset object to xsAnnotate using CAMERA
cat("Converting xset object to xsAnnotate...\n")
xsa <- xsAnnotate(xset, sample = args$sample, nSlaves = as.numeric(args$nSlaves), polarity = args$polarity)

print(paste0("All samples in xset object:", paste(1:length(xset@filepaths), collapse = ", ")))
print(paste0("All samples in xset object:", paste(seq_along(xset@filepaths), collapse = ", ")))
print(paste0("Selected samples:", paste(xsa@sample, collapse = ", ")))
print(paste0("Run in parallel mode (0 = disabled):", paste(xsa@runParallel)))
print(paste0("Polarity:", xsa@polarity))
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

This file was deleted.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

0 comments on commit 245124e

Please sign in to comment.