Browse Source

added verbose output

master
junikimm717 3 years ago
parent
commit
f24f59c93c
  1. 7
      README.md
  2. 33
      src/script.def.R

7
README.md

@ -7,12 +7,17 @@ choosing (preferably halogenated compounds).
## Installation
The script has the following dependencies:
- latest version of the [Nontarget R Package](https://github.com/blosloos/nontarget) (This should be installed through the devtools package)
- latest version of the [Nontarget R Package](https://github.com/blosloos/nontarget)
(This should be installed
through the devtools package)
- [purrr](https://www.rdocumentation.org/packages/purrr/versions/0.2.5)
- [enviPat](https://rdocumentation.org/packages/enviPat/versions/2.2)
- [stringr](https://www.rdocumentation.org/packages/stringr/versions/1.4.0)
- [parallel](https://www.rdocumentation.org/packages/parallel/versions/3.6.2)
Before running/configuring the script, call `make` while in the `/src`
directory or copy `script.def.R` to `script.R`.
## Additional Notes
In order to make the search run in linear time, as of right now, the entire

33
src/script.def.R

@ -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)
##############################################################################
Loading…
Cancel
Save