Skip to content

Commit

Permalink
source_from_here DEV_MODE
Browse files Browse the repository at this point in the history
  • Loading branch information
Ameen Eetemadi committed Jul 9, 2021
1 parent 8a9f216 commit 651cf4a
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 13 deletions.
10 changes: 7 additions & 3 deletions R/convert_to_friendlyname_OMMs.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@ get_args <- function() {

# source the filename from this script's directory
source_from_here <- function(filename) {
initial.options <- commandArgs(trailingOnly = FALSE)
script.name <- sub("--file=", "", initial.options[grep("--file=", initial.options)])
source(file.path(dirname(script.name), filename))
if (DEV_MODE){
source(file.path("R", filename))
} else {
initial.options <- commandArgs(trailingOnly = FALSE)
script.name <- sub("--file=", "", initial.options[grep("--file=", initial.options)])
source(file.path(dirname(script.name), filename))
}
}
source_from_here("common_OMMs.R")

Expand Down
10 changes: 7 additions & 3 deletions R/generate_OMMs.R
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,13 @@ get_proportions <- function(df_food_glycans, target_glycans){

# source the filename from this script's directory
source_from_here <- function(filename) {
initial.options <- commandArgs(trailingOnly = FALSE)
script.name <- sub("--file=", "", initial.options[grep("--file=", initial.options)])
source(file.path(dirname(script.name), filename))
if (DEV_MODE){
source(file.path("R", filename))
} else {
initial.options <- commandArgs(trailingOnly = FALSE)
script.name <- sub("--file=", "", initial.options[grep("--file=", initial.options)])
source(file.path(dirname(script.name), filename))
}
}
source_from_here("common_OMMs.R")

Expand Down
12 changes: 8 additions & 4 deletions R/select_OMMs.R
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,13 @@ get_args <- function() {

# source the filename from this script's directory
source_from_here <- function(filename) {
initial.options <- commandArgs(trailingOnly = FALSE)
script.name <- sub("--file=", "", initial.options[grep("--file=", initial.options)])
source(file.path(dirname(script.name), filename))
if (DEV_MODE){
source(file.path("R", filename))
} else {
initial.options <- commandArgs(trailingOnly = FALSE)
script.name <- sub("--file=", "", initial.options[grep("--file=", initial.options)])
source(file.path(dirname(script.name), filename))
}
}
source_from_here("common_OMMs.R")
source_from_here("theme_util_OMMs.R")
Expand Down Expand Up @@ -94,4 +98,4 @@ selected_MMs <- cand_MMs[idx_selected_meals,]

# 6) Save the selected mixed meals
save_MMs(selected_MMs, args$output)
print("Completed Successfully!")
print("Completed Successfully!")
10 changes: 7 additions & 3 deletions R/visualize_OMMs.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,13 @@ get_args <- function() {

# source the filename from this script's directory
source_from_here <- function(filename) {
initial.options <- commandArgs(trailingOnly = FALSE)
script.name <- sub("--file=", "", initial.options[grep("--file=", initial.options)])
source(file.path(dirname(script.name), filename))
if (DEV_MODE){
source(file.path("R", filename))
} else {
initial.options <- commandArgs(trailingOnly = FALSE)
script.name <- sub("--file=", "", initial.options[grep("--file=", initial.options)])
source(file.path(dirname(script.name), filename))
}
}
source_from_here("common_OMMs.R")
source_from_here("theme_util_OMMs.R")
Expand Down

0 comments on commit 651cf4a

Please sign in to comment.