Dear Gitlab users, due to maintenance reasons, Gitlab will not be available on Thursday 30.09.2021 from 5:00 pm to approximately 5:30 pm.

Commit 3ce7e864 authored by joerg.buescher's avatar joerg.buescher
Browse files

replacing update_prm.xlsx with update_prm.tsv

parent 7ed27775
......@@ -38,10 +38,13 @@ process_batch <- function(nowfolder = "", parameters = list(), return_msd=FALSE)
# update prm from local settings in mzML folder
update_prm_path <- file.path(nowfolder,"update_prm.xlsx")
update_prm_path <- file.path(nowfolder,"update_prm.tsv")
if (file.exists(update_prm_path)){
updatedata <- openxlsx::read.xlsx(update_prm_path)
if (('Variable.in.prm' %in% colnames(updatedata)) && ('Value' %in% colnames(updatedata)) ) {
updatedata <- read.table(update_prm_path, sep = '\t', stringsAsFactors = FALSE)
colnames(updatedata) <- updatedata[1, ]
updatedata <- updatedata[-1, ]
if (('Variable in prm' %in% colnames(updatedata)) && ('Value' %in% colnames(updatedata)) ) {
for (iv in 1:nrow(updatedata)) {
nowvalue <- updatedata[iv,'Value']
if (nowvalue %in% c("TRUE", "FALSE")) {
......@@ -49,7 +52,7 @@ process_batch <- function(nowfolder = "", parameters = list(), return_msd=FALSE)
} else if ( !is.na(as.numeric(nowvalue)) ) {
nowvalue <- as.numeric(nowvalue)
}
prm[[updatedata[iv,'Variable.in.prm']]] <- nowvalue
prm[[updatedata[iv,'Variable in prm']]] <- nowvalue
}
} else {
print('Error in update_prm.xlsx, cannot find required columns "Variabel in prm" and "Value".')
......@@ -128,12 +131,11 @@ process_batch <- function(nowfolder = "", parameters = list(), return_msd=FALSE)
save(metab, smpl, msd, prm, file = file.path(prm$batchdir, 'troubleshoot.RData') )
}
# must continue in order to generate manual_peakcheck_template and peakoverview.pdf required to prepare second training
# # do not proceed in case of initial training
# if(prm$ml_type == 'mltrain_initial'){
# print ('qqq_auto_integrate complete.')
# return(NULL)
# }
# do not proceed in case of initial training
if(prm$ml_type == 'mltrain_initial'){
print ('qqq_auto_integrate complete.')
return(NULL)
}
# subset peakdata (only non NA metabolites are returned)
......
......@@ -151,7 +151,7 @@ train_model <- function(model_type,base_folder,data_sets,model_file_name){
)
model_rf = caret::train(y ~ .,
data=train_data,#[,3:ncol(train_data)],
data=train_data,
method='rf',
tuneLength=10,
metric="ROC",
......@@ -269,4 +269,17 @@ train_model <- function(model_type,base_folder,data_sets,model_file_name){
print(fiplot)
dev.off()
# after initial training prepare manual_peakcheck_template.xlsx and plotoverview.pdf
# to enable second round of training
if (model_type=='pcand') {
prm$ml_type <- "mltrain_pcand"
prm$model_rf_path <- paste0(base_folder, model_file_name_prefix, ".Rdata")
for (data in 1:length(data_sets)) {
cat(paste0("\nCurrent dataset: ",data_sets[data]))
nowfolder <- paste0(base_folder, data_sets[data])
process_batch(nowfolder, parameters = prm)
}
}
}
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