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

Add presc.v

* R/mix.R(presc.v): New function. Vectorises presc.single.

* NAMESPACE: Update exports.

* man(presc.single.Rd,presc.v.Rd): Update docs.
parent ff55acb8
No related branches found
No related tags found
No related merge requests found
......@@ -3,4 +3,5 @@
export(mb.do)
export(mb.prep)
export(presc.single)
export(presc.v)
export(sw.do)
......@@ -146,7 +146,42 @@ gen_file_table <- function(fn_data,n_cmpd,wd) {
fn_table
}
##' Wrapper for a single prescreening call. Produces output in the
##' usual mix method places.
##'
##' @title Wrapper for RMB_EIC_Prescreen
##' @param fn_data The mzML filename.
##' @param stgs_alist Settings named list, or a settings filename.
##' @param wd Directory under which results are archived.
##' @param mode RMB mode.
##' @param fn_cmpd_l Filename of the compound list.
##' @param ppm_lim_fine The ppm_limit_fine argument to RMB_EIC_Prescreen
##' @param EIC_limit Passed down to RMB_EIC_Prescreen.
##' @return result of RMB_EIC_Prescreen
##' @author Todor Kondić
##' @export
presc.single <- function(fn_data,stgs_alist,wd,mode,fn_cmpd_l,ppm_lim_fine=10,EIC_limit=0.001) {
no_drama_mkdir(wd)
wd <- normalizePath(wd)
gen_stgs_and_load(fn_data,stgs_alist,wd)
## Generate and load the compound list.
x <- gen_cmpdl_and_load(fn_data,wd,fn_cmpd_l)
fn_comp <- x$fn_cmpdl
n_cmpd <- x$n
## Generate file table.
fn_table <- gen_file_table(fn_data,n_cmpd,wd)
#curd <- setwd(wd)
res <-RMB_EIC_prescreen_df(wd=wd,RMB_mode=mode, FileList=fn_table,
cmpd_list=fn_comp,
ppm_limit_fine=ppm_lim_fine,
EIC_limit=EIC_limit)
#setwd(curd)
res
}
##' Runs a compound mixture workflow on a single mzML file.
##'
......@@ -252,8 +287,24 @@ mb.single<-function(mb,infodir,fn_stgs) {
res
}
##' Vectorises presc.single.
##'
##' @title Vectorises presc.single
##' @param fn_data Sequence of mzML filenames.
##' @param fn_cmpd_l Compound list filename.
##' @param mode RMB mode.
##' @param ppm_lim_fine Prescreen fine limit (see ReSOLUTION prescreening function).
##' @param EIC_limit Prescreen EIC limit (see ReSOLUTION prescreening function).
##' @return Nothing useful.
##' @author Todor Kondić
##' @export
presc.v<-function(fn_data,fn_cmpd_l,mode,ppm_lim_fine=10,EIC_limit=0.001) {
idir<-function(n) file.path(".",stripext(n))
wd <- sapply(fn_data,idir)
stgs_alist <- sapply(wd,function(d) {paste(d,".ini",sep='')})
f<-Vectorize(presc.single,vectorize.args=c("fn_data","stgs_alist","wd"),SIMPLIFY=F)
f(fn_data,stgs_alist,wd,mode=mode,fn_cmpd_l=fn_cmpd_l,ppm_lim_fine=ppm_lim_fine,EIC_limit=EIC_limit)
}
##' Interface to vectorised spectral workflow.
......@@ -465,42 +516,7 @@ RMB_EIC_prescreen_df <- function (wd, RMB_mode, FileList, cmpd_list,
##' Wrapper for a single prescreening call. Produces output in the
##' usual mix method places.
##'
##' @title Wrapper for RMB_EIC_Prescreen
##' @param fn_data The mzML filename.
##' @param stgs_alist Settings named list, or a settings filename.
##' @param wd Directory under which results are archived.
##' @param mode RMB mode.
##' @param fn_cmpd_l Filename of the compound list.
##' @param ppm_lim_fine The ppm_limit_fine argument to RMB_EIC_Prescreen
##' @param EIC_limit Passed down to RMB_EIC_Prescreen.
##' @param nm_arch Archive prefix.
##' @return result of RMB_EIC_Prescreen
##' @author Todor Kondić
##' @export
presc.single <- function(fn_data,stgs_alist,wd,mode,fn_cmpd_l,ppm_lim_fine=10,EIC_limit=0.001,nm_arch="archive") {
wd <- normalizePath(wd)
gen_stgs_and_load(fn_data,stgs_alist,wd)
## Generate and load the compound list.
x <- gen_cmpdl_and_load(fn_data,wd,fn_cmpd_l)
fn_comp <- x$fn_cmpdl
n_cmpd <- x$n
## Generate file table.
fn_table <- gen_file_table(fn_data,n_cmpd,wd)
#curd <- setwd(wd)
res <-RMB_EIC_prescreen_df(wd=wd,RMB_mode=mode, FileList=fn_table,
cmpd_list=fn_comp,
ppm_limit_fine=ppm_lim_fine,
EIC_limit=EIC_limit)
#setwd(curd)
res
}
......
......@@ -5,7 +5,7 @@
\title{Wrapper for RMB_EIC_Prescreen}
\usage{
presc.single(fn_data, stgs_alist, wd, mode, fn_cmpd_l, ppm_lim_fine = 10,
EIC_limit = 0.001, nm_arch = "archive")
EIC_limit = 0.001)
}
\arguments{
\item{fn_data}{The mzML filename.}
......@@ -21,8 +21,6 @@ presc.single(fn_data, stgs_alist, wd, mode, fn_cmpd_l, ppm_lim_fine = 10,
\item{ppm_lim_fine}{The ppm_limit_fine argument to RMB_EIC_Prescreen}
\item{EIC_limit}{Passed down to RMB_EIC_Prescreen.}
\item{nm_arch}{Archive prefix.}
}
\value{
result of RMB_EIC_Prescreen
......
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/mix.R
\name{presc.v}
\alias{presc.v}
\title{Vectorises presc.single}
\usage{
presc.v(fn_data, fn_cmpd_l, mode, ppm_lim_fine = 10, EIC_limit = 0.001)
}
\arguments{
\item{fn_data}{Sequence of mzML filenames.}
\item{fn_cmpd_l}{Compound list filename.}
\item{mode}{RMB mode.}
\item{ppm_lim_fine}{Prescreen fine limit (see ReSOLUTION prescreening function).}
\item{EIC_limit}{Prescreen EIC limit (see ReSOLUTION prescreening function).}
}
\value{
Nothing useful.
}
\description{
Vectorises presc.single.
}
\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