OmicsClaw R Enhanced plotting requires specific R packages to generate
publication-quality figures via ggplot2 and ComplexHeatmap. The
OMICSCLAW_R_LIBS environment variable points to a dedicated library
directory (under $CONDA_PREFIX/lib/R/omicsclaw-library) that is
searched first, allowing version pinning that shadows conda-managed R
packages.
- R must be installed (4.x). Check:
Rscript --version - Active conda environment:
conda activate <your_env> OMICSCLAW_R_LIBSis set automatically byRScriptRunnerwhen conda is active
# Run in R or Rscript -e "..."
r_libs <- Sys.getenv("OMICSCLAW_R_LIBS")
if (nchar(r_libs) == 0) stop("OMICSCLAW_R_LIBS not set -- activate conda env first")
# ggplot2 MUST be pinned to 3.5.2 -- 4.0.2 breaks the + operator (S7 migration)
# Do NOT use install.packages("ggplot2") -- that installs 4.0.x
install.packages(
"https://cran.r-project.org/src/contrib/Archive/ggplot2/ggplot2_3.5.2.tar.gz",
repos = NULL, type = "source", lib = r_libs
)
# Other core dependencies
install.packages(c("scales", "RColorBrewer", "viridis", "ggrepel"), lib = r_libs)
# Verify pin worked:
# Rscript -e '.libPaths(c(Sys.getenv("OMICSCLAW_R_LIBS"), .libPaths())); packageVersion("ggplot2")'
# Must print: [1] '3.5.2' -- NOT 4.0.xr_libs <- Sys.getenv("OMICSCLAW_R_LIBS")
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager", lib = r_libs)
BiocManager::install("ComplexHeatmap", lib = r_libs, update = FALSE, ask = FALSE)magick requires system library libmagick++-dev. If you see linker errors:
# Ubuntu/Debian
sudo apt-get install -y libmagick++-dev
# Then install from source with the linker flag:
LIBRARY_PATH=/usr/lib/x86_64-linux-gnu Rscript -e 'install.packages("magick", lib=Sys.getenv("OMICSCLAW_R_LIBS"), type="source")'If system install is not possible, magick-dependent renderers will warn and skip -- other renderers continue normally.
monocle3 is on GitHub (not CRAN). Required for LineagePlot/DynamicPlot renderers.
r_libs <- Sys.getenv("OMICSCLAW_R_LIBS")
# Dependencies
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager", lib = r_libs)
BiocManager::install(c("BiocGenerics", "DelayedArray", "DelayedMatrixStats",
"limma", "lme4", "S4Vectors", "SingleCellExperiment",
"SummarizedExperiment", "batchelor", "HDF5Array",
"terra", "ggrastr"), lib = r_libs, update = FALSE, ask = FALSE)
# leidenbase from CRAN
install.packages("leidenbase", lib = r_libs)
# monocle3 from GitHub
if (!requireNamespace("remotes", quietly = TRUE))
install.packages("remotes", lib = r_libs)
remotes::install_github("cole-trapnell-lab/monocle3", lib = r_libs)r_libs <- Sys.getenv("OMICSCLAW_R_LIBS")
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager", lib = r_libs)
BiocManager::install("GSVA", lib = r_libs, update = FALSE, ask = FALSE)Already installed as part of Phase 15. Verify:
Rscript -e 'library(clusterProfiler); library(fgsea); cat("OK\n")'If missing:
r_libs <- Sys.getenv("OMICSCLAW_R_LIBS")
BiocManager::install(c("clusterProfiler", "fgsea"), lib = r_libs, update = FALSE, ask = FALSE)Cause: ggplot2 4.0.x S7 migration broke ggproto + operator.
Fix: Pin 3.5.2 per Section 3 above.
Verify: packageVersion("ggplot2") must return 3.5.2.
Cause: OMICSCLAW_R_LIBS not in .libPaths() when R script runs.
Fix: Ensure conda env is active. RScriptRunner sets R_LIBS_USER automatically.
Manual check: Rscript -e 'cat(.libPaths(), sep="\n")' -- first entry should be omicsclaw-library.
Expected for skills that do not export embedding CSVs to figure_data/. The R renderer gracefully warns and skips -- Python figures are unaffected.
Use ask = FALSE, force = TRUE in BiocManager::install() to allow updates.
# One-liner for CI or fresh machines:
Rscript -e '
r_libs <- Sys.getenv("OMICSCLAW_R_LIBS")
if (nchar(r_libs) == 0) stop("Set OMICSCLAW_R_LIBS or activate conda env")
install.packages("https://cran.r-project.org/src/contrib/Archive/ggplot2/ggplot2_3.5.2.tar.gz",
repos=NULL, type="source", lib=r_libs)
install.packages(c("scales","RColorBrewer","viridis","ggrepel"), lib=r_libs)
if (!requireNamespace("BiocManager",quietly=TRUE)) install.packages("BiocManager",lib=r_libs)
BiocManager::install("ComplexHeatmap", lib=r_libs, update=FALSE, ask=FALSE)
cat("Core R Enhanced packages installed\n")
'Last updated: Phase 18 (2026-04-11). Based on real install experience from Phases 13-17.