|
|
@ -31,8 +31,9 @@ columns.spectra <- "Spectra_Number" |
|
|
|
output.intensities <- 5 |
|
|
|
|
|
|
|
# Verbose output |
|
|
|
verbose.enable <- TRUE |
|
|
|
verbose.outputdir <- "/output/dir" |
|
|
|
verbose.enable <- FALSE |
|
|
|
# output directory must already exist. |
|
|
|
verbose.outputdir <- "/path/to/directory" |
|
|
|
|
|
|
|
|
|
|
|
# Script ##################################################################### |
|
|
@ -150,6 +151,14 @@ derive.frame <- function(result) { |
|
|
|
return(res) |
|
|
|
} |
|
|
|
|
|
|
|
verbose.dump <- function(result) { |
|
|
|
path <- file.path(verbose.outputdir, paste(derive.fragment(result), ".txt", |
|
|
|
sep="")) |
|
|
|
sink(path) |
|
|
|
dput(result) |
|
|
|
sink() |
|
|
|
} |
|
|
|
|
|
|
|
# Execution ################################################################## |
|
|
|
|
|
|
|
## Set all of the intervals ################################################## |
|
|
@ -177,14 +186,28 @@ results <- mclapply(use, diagnostics, mc.cores=use_cores) |
|
|
|
|
|
|
|
results.positive <- Filter(function(x) positive(x), results) |
|
|
|
|
|
|
|
# print to files if verbose output requested |
|
|
|
|
|
|
|
if (verbose.enable) { |
|
|
|
if (!dir.exists(verbose.outputdir)) { |
|
|
|
stop(str_interp("Directory $[s]{dir} does not exist", |
|
|
|
list(dir=verbose.outputdir))) |
|
|
|
} |
|
|
|
res <- readline(prompt=paste("Are you sure you want to overwrite files in ", |
|
|
|
verbose.outputdir, "? [y/N] ")) |
|
|
|
if (res != "y") { |
|
|
|
stop("Process aborted.") |
|
|
|
} |
|
|
|
print(paste("printing output to ", verbose.outputdir)) |
|
|
|
mapply(verbose.dump, results.positive) |
|
|
|
} |
|
|
|
|
|
|
|
result.frame <- mapply(derive.frame, results.positive) |
|
|
|
result.fragment <- mapply(derive.fragment, results.positive) |
|
|
|
result.iso <- mapply(derive.iso, results.positive) |
|
|
|
result.intensity <- mapply(derive.intensity, results.positive) |
|
|
|
result.average <- mapply(derive.average, results.positive) |
|
|
|
|
|
|
|
for (x in result.frame) { |
|
|
|
print(x) |
|
|
|
} |
|
|
|
print(result.fragment) |
|
|
|
|
|
|
|
############################################################################## |