diff --git a/DESCRIPTION b/DESCRIPTION index c7911e7a766ad8cd89c3a45252f9215f6b1dcc62..1587c58952347cecead9e7b8e439f8ce4577806e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -21,4 +21,5 @@ Collate: 'run.R' Imports: RMassBank, - parallel + parallel, + yaml diff --git a/R/mix.R b/R/mix.R index ac505dd05e23b62535b9df1c98c7d63d8e46cf1e..8594f4df21033e73bb7ca06b7786c2dc2ce1d36f 100644 --- a/R/mix.R +++ b/R/mix.R @@ -26,19 +26,38 @@ no_drama_mkdir<-function(path) { ##' @param file The name of the YAML specification that will be merged ##' with the template Rmb settings file. ##' @return NULL -##' @author Todor Kondić mk_sett_file<-function(sett_alist,file) { - require(yaml) tmp<-tempfile() RMassBank::RmbSettingsTemplate(tmp) - sett<-yaml.load_file(tmp) + sett<-yaml::yaml.load_file(tmp) for (nm in names(sett_alist)) { sett[[nm]]<-sett_alist[[nm]] } - write_yaml(x=sett,file=file) + yaml::write_yaml(x=sett,file=file) NULL } +##' Combine RMB settings with different collisional energies into one +##' settings file with multiple collisional energy entries. +##' +##' .. content for \details{} .. +##' @title Combine RMB Settings With Different Collisional Energies +##' @param sett_fns A list of settings files. +##' @param fname The name of the combined file. +##' @return fname +##' @author Todor Kondić +mk_combine_file<-function(sett_fns,fname) { + all_settings <- lapply(sett_fns,yaml::yaml.load_file) + comb_settings <- all_settings[[1]] + + for (n in 1:length(all_settings)) { + comb_settings$spectraList[[n]] <- all_settings[[n]]$spectraList[[1]] + } + + yaml::write_yaml(x=comb_settings,fname) + fname +} + ##' Generate the RMassBank compound list from the input compound list ##' in CSV file src_fn. The input compound list format is either a ##' Chemical Dashboard csv file with, at least, PREFERRED_ SMILES @@ -90,11 +109,8 @@ gen_comp_list<-function(src_fn,dest_fn) { ##' @return MsmsWorkspace object. ##' @author Todor Kondić single.sw<-function(fn_data,stgs_alist,wd,fn_cmpd_list,mode,readMethod="mzR",archdir="archive",lastStep=8) { - - require(RMassBank) - require(yaml) ## Generate settings file and load. - stgs_alist<-if (is.character(stgs_alist)) yaml.load_file(stgs_alist) else stgs_alist + stgs_alist<-if (is.character(stgs_alist)) yaml::yaml.load_file(stgs_alist) else stgs_alist sfn<-file.path(wd,paste(fn_data,".ini",sep='')) mk_sett_file(stgs_alist,sfn) RMassBank::loadRmbSettings(sfn) diff --git a/man/mb.do.Rd b/man/mb.do.Rd index a1e5883389d7f43e491d38f49a75cf8e425e097e..73e319d502ee46098ba30753221dca5eded59767 100644 --- a/man/mb.do.Rd +++ b/man/mb.do.Rd @@ -4,12 +4,15 @@ \alias{mb.do} \title{Perform the Mass Bank workflow} \usage{ -mb.do(mb, rdir = ".") +mb.do(mb, rdir = ".", proc = F) } \arguments{ \item{mb}{The list of prepared mbWorkspace objects.} \item{rdir}{Root data dir.} + +\item{proc}{Split work between this amount of processes. If FALSE +(or, 1), run sequential.} } \value{ The named list of processed mbWorkspace objects. diff --git a/man/mb.p.Rd b/man/mb.p.Rd new file mode 100644 index 0000000000000000000000000000000000000000..e68fff8d257a944e8f25ee646f858a4c61101b98 --- /dev/null +++ b/man/mb.p.Rd @@ -0,0 +1,27 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/mix.R +\name{mb.p} +\alias{mb.p} +\title{Parallel Mass Bank Workflow} +\usage{ +mb.p(mb, infodir, fn_stgs, cl = F) +} +\arguments{ +\item{mb}{List of mass bank workflow objects} + +\item{infodir}{List of subdirs containing info lists.} + +\item{fn_stgs}{List of settings files.} + +\item{cl}{Cluster.} +} +\value{ +A named list of mbWorkspace objects. The names are derived +from the input mb sequence. +} +\description{ +Interface to parallelised Mass Bank workflow. +} +\author{ +Todor Kondić +} diff --git a/man/mb.prep.Rd b/man/mb.prep.Rd index 3d179361decd1b5460983ef3c3572f1d953fde28..43fdac85f45a3111b019bf504123fda8c389ed39 100644 --- a/man/mb.prep.Rd +++ b/man/mb.prep.Rd @@ -10,6 +10,8 @@ mb.prep(w, rdir = ".") \item{w}{A list of spectral workspace inputs.} \item{rdir}{Data root.} + +\item{proc}{Split work between this amount of processes. If FALSE} } \value{ Named list of prepared mbWorkspace objects. diff --git a/man/mk_combine_file.Rd b/man/mk_combine_file.Rd new file mode 100644 index 0000000000000000000000000000000000000000..32740c25d42c55c469612a06a873a6701837fa49 --- /dev/null +++ b/man/mk_combine_file.Rd @@ -0,0 +1,26 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/mix.R +\name{mk_combine_file} +\alias{mk_combine_file} +\title{Combine RMB Settings With Different Collisional Energies} +\usage{ +mk_combine_file(sett_fns, fname) +} +\arguments{ +\item{sett_fns}{A list of settings files.} + +\item{fname}{The name of the combined file.} +} +\value{ +fname +} +\description{ +Combine RMB settings with different collisional energies into one +settings file with multiple collisional energy entries. +} +\details{ +.. content for \details{} .. +} +\author{ +Todor Kondić +} diff --git a/man/mk_sett_file.Rd b/man/mk_sett_file.Rd index 3298e34be93ae18616fed2b207218b926501eef1..cbf885acf6429be534d34326454305720c5054e4 100644 --- a/man/mk_sett_file.Rd +++ b/man/mk_sett_file.Rd @@ -20,6 +20,3 @@ Produce the Rmb Settings file Produce the Rmb Settings file based on the customisation file in YAML format. } -\author{ -Todor Kondić -}