Skip to content
Snippets Groups Projects
Commit 6db17d2f authored by Todor Kondic's avatar Todor Kondic
Browse files

Add many things

parent 416151a0
No related branches found
No related tags found
No related merge requests found
......@@ -21,4 +21,5 @@ Collate:
'run.R'
Imports:
RMassBank,
parallel
parallel,
yaml
......@@ -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)
......
......@@ -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.
......
% 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ć
}
......@@ -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.
......
% 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ć
}
......@@ -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ć
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment