All R packages are now pre-installed in the Docker image, eliminating runtime installations that were causing slowdowns and redundant package installs during API calls.
Instead of manually specifying exact versions for every package, we're using BiocManager as the package manager, which provides several key benefits:
- Automatic Compatibility: By setting Bioconductor version 3.21, BiocManager automatically ensures all Bioconductor packages are compatible with each other
- Dependency Resolution: BiocManager handles CRAN packages and resolves dependencies that work well with the Bioconductor ecosystem
- Less Version Conflicts: No need to manually track and update dozens of specific version numbers
- Easier Maintenance: Future updates are simpler - just update the Bioconductor version and rebuild
- Used
remotes::install_version()for specific versions of each package - Required manual version management for 20+ packages
- Prone to version conflicts between CRAN and Bioconductor packages
- More complex and harder to maintain
# Set Bioconductor version 3.21 - this manages compatibility
BiocManager::install(version = '3.21', ask = FALSE, update = TRUE)
# Install Bioconductor packages - version managed by BiocManager
BiocManager::install(c('WGCNA', 'DESeq2', 'limma', 'biomaRt', 'sva',
'STRINGdb', 'apeglm', 'impute'), ask = FALSE)
# Install CRAN packages - BiocManager ensures Bioconductor compatibility
BiocManager::install(c('tidyverse', 'Rtsne', 'umap', 'ggplot2', 'readr',
'ape', 'mice', 'dplyr', 'gplots', 'ggVennDiagram',
'pheatmap', 'RColorBrewer', 'stringr', 'here', 'lme4'),
ask = FALSE)All runtime package installation code has been removed from the following files:
api/code/req_packages.R- Now just loads pre-installed packagesapi/code/micro_functions.R- Replacedinstall_and_load()with directlibrary()callsapi/code/Microarray_Updated_Workflow.R- Simplified package loading
api/code/1_init_venn_m.R- Removed installation functionapi/code/3_plot_venn_m.R- Removed installation functionapi/code/4_wide_frame_venn_m.R- Removed installation checks
api/code/5_Up_Down_m.R- Removed ggplot2 installation checkapi/code/2_plot_heatmap.R- Removed pheatmap/RColorBrewer installationapi/code/1_Biomart_init_m.R- Removed biomaRt installation function
api/string/1_setup_string_env.R- Removedinstall_and_load()function
api/code/.Rprofile- Added safeguards to prevent runtime installations
- Performance: No more waiting for package installations during API calls
- Reliability: Packages are tested and verified during Docker build, not at runtime
- Reproducibility: Docker image contains exact package versions
- Version Compatibility: BiocManager ensures all packages work together
- Simpler Maintenance: Easier to update packages in the future
When using Bioconductor 3.21 with R 4.4+, you'll get approximately:
- WGCNA: ~1.73
- DESeq2: ~1.44.0
- limma: ~3.60.0+
- biomaRt: ~2.60.0+
- sva: ~3.52.0
- STRINGdb: ~2.16.0+
- tidyverse: ~2.0.0
- And compatible versions of all other packages
Note: Exact versions may vary slightly but BiocManager ensures compatibility
To rebuild the Docker image with the new package setup:
docker build -t plagl1-server .
docker run --name plgl-server -p 8000:8000 -d plagl1-server:latestOr use the command from the Dockerfile:
docker rm -f plgl-server && docker build -t wonderful_rubin . && docker run --name plgl-server -p 8000:8000 -d wonderful_rubin:latestAfter building the new Docker image, test that all packages load correctly:
# In R console within container
library(WGCNA)
library(DESeq2)
library(limma)
library(biomaRt)
library(sva)
library(STRINGdb)
library(tidyverse)
# ... etcAll packages should load without any installation prompts or errors.
To update R packages in the future:
- Change the Bioconductor version in Dockerfile (e.g., from
'3.21'to'3.22') - Rebuild the Docker image
- Test the application
BiocManager will automatically pull compatible versions of all packages.