Commit 6648430e authored by daniel.eilertz's avatar daniel.eilertz
Browse files

Removed server stuff from process_batch (git describe and sample_postprocessing.py)

parent 3aad83f1
......@@ -10,7 +10,7 @@
#' @return msd list metabolites of samples with processed data
#'
#' @export
process_batch <- function(nowfolder = "", parameters = list()) {
process_batch <- function(nowfolder = "", parameters = list(), return_msd=FALSE) {
# Initialize analysis ------------------------------
ptm <- proc.time()
......@@ -78,31 +78,31 @@ process_batch <- function(nowfolder = "", parameters = list()) {
}
# Log git info ------------------------------
tryCatch({
cat(paste(timestamp(), '\n Now running process_batch.R',
'\n\n Current user: ', Sys.info()[["user"]], '\n \n'), file=prm$log_con)
scriptgithash <- automrmgithash <- helperfilesgithash <- ''
if (dir.exists('~/data/helperfiles')) {
helperfilesgithash <- system(paste0("git --git-dir=", prm$pathprefix, "data/helperfiles/.git/ describe --always"), intern=TRUE)
cat(paste('\n\n Gitlab repository for helperfiles: https://gitlab.gwdg.de/joerg.buescher/helperfiles
Commit hash: ', helperfilesgithash), file=prm$log_con)
}
if (dir.exists('~/data/automRm')) {
automrmgithash <- system(paste0("git --git-dir=", prm$pathprefix, "data/automRm/.git/ describe --always"), intern=TRUE)
cat(paste('\n\n Gitlab repository for automRm: https://gitlab.gwdg.de/joerg.buescher/automrm
Commit hash: ', automrmgithash,
), file=prm$log_con)
}
if (dir.exists('~/code/R_analysis')) {
scriptgithash <- system(paste0("git --git-dir=", prm$pathprefix, "code/R_analysis/.git/ describe --always"), intern=TRUE)
cat(paste('\n\n Gitlab repository for processing script: https://gitlab.gwdg.de/daniel.eilertz/ms-web
Commit hash: ', scriptgithash), file=prm$log_con)
}
rm('helperfilesgithash', 'scriptgithash', 'automrmgithash')
}, error = function(err) {
# not in docker container used for development, do nothing
})
# tryCatch({
# cat(paste(timestamp(), '\n Now running process_batch.R',
# '\n\n Current user: ', Sys.info()[["user"]], '\n \n'), file=prm$log_con)
# scriptgithash <- automrmgithash <- helperfilesgithash <- ''
#
# if (dir.exists('~/data/helperfiles')) {
# helperfilesgithash <- system(paste0("git --git-dir=", prm$pathprefix, "data/helperfiles/.git describe --always"), intern=TRUE)
# cat(paste('\n\n Gitlab repository for helperfiles: https://gitlab.gwdg.de/joerg.buescher/helperfiles
# Commit hash: ', helperfilesgithash), file=prm$log_con)
# }
# if (dir.exists('~/data/automRm')) {
# automrmgithash <- system(paste0("git --git-dir=", prm$pathprefix, "data/automRm/.git describe --always"), intern=TRUE)
# cat(paste('\n\n Gitlab repository for automRm: https://gitlab.gwdg.de/joerg.buescher/automrm
# Commit hash: ', automrmgithash,
# ), file=prm$log_con)
# }
# if (dir.exists('~/code/R_analysis')) {
# scriptgithash <- system(paste0("git --git-dir=", prm$pathprefix, "code/R_analysis/.git describe --always"), intern=TRUE)
# cat(paste('\n\n Gitlab repository for processing script: https://gitlab.gwdg.de/daniel.eilertz/ms-web
# Commit hash: ', scriptgithash), file=prm$log_con)
# }
# rm('helperfilesgithash', 'scriptgithash', 'automrmgithash')
# }, error = function(err) {
# # not in docker container used for development, do nothing
# })
# 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'))) {
......@@ -197,28 +197,38 @@ process_batch <- function(nowfolder = "", parameters = list()) {
# for documentation purposes append session info to log. do this at the end because it's a messy read.
cat(as.character(sessionInfo()), file=prm$log_con)
cat('qqq_auto_integrate complete.')
tryCatch({
# Call sample postprocessing if in pipeline mode
if (!(as.character(Sys.info()[["user"]]) == 'rstudio') && !prm$runninglocal ){
rm(list = ls()) # empty workspace to avoid out of memory options
gc()
# system("chmod 777 overviewheatmap.pdf", intern=FALSE, wait=FALSE)
system("python3 /code/msweb/metabolomics/help/sample_postprocessing.py", intern=FALSE, wait=FALSE)
}
# cat('\nSettings overview: \n')
# cat(as.character(prm),file=prm$log_con)
print ('qqq_auto_integrate complete.')
# Reset par to default
par(pardefault)
# tidy up
# setwd(originalwd)
par(pardefault)
# Return msd object if argument is set
if(return_msd){
msd
}
}, error = function(err) {
# if tidying up doesn't work, well too bad.
})
msd
# tryCatch({
# # Call sample postprocessing if in pipeline mode
# if (!(as.character(Sys.info()[["user"]]) == 'rstudio') && !prm$runninglocal ){
# rm(list = ls()) # empty workspace to avoid out of memory options
# gc()
# # system("chmod 777 overviewheatmap.pdf", intern=FALSE, wait=FALSE)
# system("python3 /code/msweb/metabolomics/help/sample_postprocessing.py", intern=FALSE, wait=FALSE)
# }
# # cat('\nSettings overview: \n')
# # cat(as.character(prm),file=prm$log_con)
# print ('qqq_auto_integrate complete.')
#
# # tidy up
# # setwd(originalwd)
# par(pardefault)
#
# }, error = function(err) {
# # if tidying up doesn't work, well too bad.
# })
#
# msd
} # endfunction
......
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