Commit 46e73aab authored by joerg.buescher's avatar joerg.buescher
Browse files

Merge branch 'dev' into 'master'

bugfix enable running outside of developement environment

See merge request !3
parents 77d50e18 dc6f0f7e
......@@ -4,7 +4,7 @@
#' using metabolite definitions and sample information provided in the same folder.
#'
#' @param nowfolder folder that contains .mzML files, sample.info and optionally update_prm.R. Default is current working directory
#' @param ml_type options are "mlpred" for prediction, "mltrain_initial" for training of peak recognition model and "mltrain_pcand" for training of quality scoring model. Default is "mlpred"
#' @param parameters list of parameters that overwrites defaults defined in initialize_prm()
#'
#' @export
qqq_auto_integrate <- function(nowfolder = "", parameters = list()) {
......@@ -13,11 +13,10 @@ qqq_auto_integrate <- function(nowfolder = "", parameters = list()) {
ptm <- proc.time()
pardefault <- par(no.readonly = TRUE)
options("scipen"=100, "digits"=4)
originalwd <- getwd()
# Set working directory (in Testmode)
if (nowfolder == '') {
setwd(".")
nowfolder <- getwd()
}else{
if(dir.exists(nowfolder)){
......@@ -33,7 +32,6 @@ qqq_auto_integrate <- function(nowfolder = "", parameters = list()) {
system("rm R_messages.log")
# Initialize prm (global settings)
# source('~/code/R_analysis/R_functions/qqq/initialize_prm.R')
prm <- initialize_prm()
# update prm from local settings in mzML folder
......@@ -75,24 +73,13 @@ qqq_auto_integrate <- function(nowfolder = "", parameters = list()) {
Commit hash: ', automrmgithash,
'\n\n Current user: ', Sys.info()[["user"]], '\n \n'), file=prm$log_con)
rm('helperfilesgithash', 'scriptgithash', 'automrmgithash')
}, error = function(err) {
# not in docker container used for development, do nothing
})
# Reset working directory
setwd(nowfolder)
# # Load functions and rf models ------------------------------
# load_functions <- function(){
# func_path <- paste0(prm$pathprefix,'code/R_analysis/R_functions/')
# for(func_path in paste0(func_path,c("qqq/","misc/"))){
# r_functions <- list.files(func_path, pattern = "[.]R$", recursive = FALSE)
# r_functions <- r_functions[which(r_functions !="initialize_prm.R")] # don't source initialize_prm.R (would overwrite prm settings)
# lapply(paste0(func_path,r_functions), source)
# }
# rm('func_path')
# }
# load_functions()
# load random forest models and add to parameter list
if (prm$ml_type %in% c('mlprod', 'mltrain_pcand') ) { #(!(prm$ml_train && (prm$ml_type == 'initial'))) {
load(file = prm$model_rf_path) # 1. model to detect best peak in MRM
......@@ -198,6 +185,10 @@ qqq_auto_integrate <- function(nowfolder = "", parameters = list()) {
# cat(as.character(prm),file=prm$log_con)
print ('qqq_auto_integrate complete.')
# tidy up
setwd(originalwd)
par(pardefault)
} # endfunction
......
......@@ -9,7 +9,7 @@ qqq_auto_integrate(nowfolder = "", parameters = list())
\arguments{
\item{nowfolder}{folder that contains .mzML files, sample.info and optionally update_prm.R. Default is current working directory}
\item{ml_type}{options are "mlpred" for prediction, "mltrain_initial" for training of peak recognition model and "mltrain_pcand" for training of quality scoring model. Default is "mlpred"}
\item{parameters}{list of parameters that overwrites defaults defined in initialize_prm()}
}
\description{
This function processes all .mzML files in nowfolder (current folder if empty)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment