Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
sagun98 committed Jul 31, 2024
1 parent ad592f9 commit de2df45
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 24 deletions.
11 changes: 0 additions & 11 deletions R/fit.R
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
#!/usr/bin/env Rscript
# Load Required Packages
for (lib in c(
'dplyr',
'pbapply',
'lmerTest',
'parallel',
'lme4',
'multcomp'
)) {
suppressPackageStartupMessages(require(lib, character.only = TRUE))
}

# Function to augment data for logistic fitting
augment_data <- function(formula, random_effects_formula, dat_sub){
Expand Down
14 changes: 6 additions & 8 deletions R/maaslin3.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,6 @@
# THE SOFTWARE.
###############################################################################

# load in the required libraries, report an error if they are not installed

for (lib in c('optparse', 'logging', 'data.table', 'dplyr')) {
suppressPackageStartupMessages(require(lib, character.only = TRUE))
}

###############################################################
# If running on the command line, load other Maaslin3 modules #
###############################################################
Expand All @@ -44,8 +38,12 @@ if (identical(environment(), globalenv()) &&
sub("--file=", "", script_options[grep("--file=", script_options)])
script_dir <- dirname(script_path)
script_name <- basename(script_path)

for (R_file in dir(script_dir, pattern = "*.R$"))
R_files <- c("fit.R", "utility_scripts.R", "vis.R")
# load in the required libraries, report an error if they are not installed
for (lib in c('optparse', 'logging', 'data.table', 'dplyr', 'pbapply','lmerTest','parallel','lme4','multcomp','ggplot2','viridis',"grid",'RColorBrewer','patchwork','scales')) {
suppressPackageStartupMessages(require(lib, character.only = TRUE))
}
for (R_file in R_files)
{
if (!(R_file == script_name))
source(file.path(script_dir, R_file))
Expand Down
5 changes: 0 additions & 5 deletions R/viz.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@
# THE SOFTWARE.
###############################################################################

# Load libararies
for (lib in c('dplyr', 'ggplot2', 'viridis', "grid", 'RColorBrewer', 'patchwork', 'scales')) {
suppressPackageStartupMessages(require(lib, character.only = TRUE))
}

# MaAsLin3 theme based on Nature journal requirements
nature_theme <- function(x_axis_labels, y_label) {
# set default text format based on categorical and length
Expand Down

0 comments on commit de2df45

Please sign in to comment.