This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
iDEP (Integrated Differential Expression & Pathway analysis) is a bioinformatics platform for analyzing gene expression data from RNA-Seq, microarray, proteomics, and other methods. It's built as an R package using the Golem framework for Shiny applications.
- Start development server: Run
source("dev/run_dev.R")from R console (re-documents and reloads package automatically) - Run app in production mode:
idepGolem::run_app()from R console - Run tests:
testthat::test_dir("tests/")ordevtools::test()or for one specific test onlydevtools::test(filter = "deg_full_rank") - Document and reload:
golem::document_and_reload()(used in dev workflow) - Lint: uses
.lintrconfig enforcingsnake_caseobject names
- Install from GitHub:
devtools::install_github("https://github.com/gexijin/idepGolem", upgrade = "never") - Install dependencies: Run the above command first (355 dependencies)
- Run with Docker:
docker run --pull always -d --name idep -p 3838:3838 gexijin/idep:latest - Access:
http://localhost:3838
- Main entry point:
R/run_app.R— loadsidep_datadatabase once at startup and passes it to every module - UI:
R/app_ui.R— defines the navbar-based interface structure - Server:
R/app_server.R— coordinates all modules, manages tab visibility, and passes reactive data downstream - Configuration:
inst/golem-config.ymlmanages environment settings
The app has 14 analysis modules (numbered by tab order):
mod_01_load_data— Data loading and validationmod_02_pre_process— Data preprocessing and filteringmod_03_clustering— Hierarchical clustering analysismod_04_pca— Principal component analysismod_05_deg— Differential expression analysis (has 2 UI components)mod_06_pathway— Pathway enrichment analysismod_07_genome— Genome-wide analysismod_08_bicluster— Biclustering analysismod_09_network— Gene network analysismod_10_doc— Documentation and helpmod_11_enrichment— Gene set enrichmentmod_12_heatmap— Heatmap visualizationmod_13_gene_plot— Individual gene expression plotsmod_14_survey— User survey
Each module follows the pattern: mod_XX_name_ui() and mod_XX_name_server()
The pipeline is hierarchical and one-directional:
load_data → pre_process → [clustering, pca, deg, pathway, genome, bicluster, network, heatmap, ...]
- Each module returns a named list of reactive expressions (not just side effects). Downstream modules receive this list and call its elements as functions.
- The global
idep_dataobject (species/pathway databases) is loaded once inrun_app()and passed as an argument to every module — not reloaded per session. - A
tab <- reactive(input$navbar)is passed to modules so they can defer expensive computations until the user visits their tab. app_server.Rcontains two largeobserve()blocks controlling tab visibility based on data file format (1=counts, 2=normalized, 3=fold-change+p, 4=fold-change only) and species selection.
fct_XX_*.Rfiles contain pure functions with no Shiny dependencies — they take data as arguments and return data. These are unit-testable without a reactive context.mod_XX_*.Rfiles contain UI + reactive orchestration — they callfct_functions insidereactive()oreventReactive()blocks.- Tests should call
fct_functions directly (seetests/testthat/for examples).
- Data processing:
R/fct_01_load_data.RthroughR/fct_13_gene_plot.R - Database utilities:
R/fct_database.R - UI utilities:
R/utils_ui.R - Color palettes:
R/aaa_palette_utils.R(prefixedaaa_to ensure early loading) - KEGG pathway rendering:
R/utils_kegg_pathview.R— internal replacements for the pathview Bioconductor package (removed as a dependency). Entry point ismypathview(), called fromfct_06_pathway.R. Species validation usesKEGGREST::keggInfo()instead of pathview's statickorgdata.
run_app.R initializes these globals once via Shiny's onStart (shared across all user sessions):
db_ver— database version string (e.g."data113")DATAPATH— resolved path to the database directoryorg_info_file— path toorgInfo.dbidep_data— species/demo data loaded byget_idep_data()
The app handles 4 input data types (set in load_data module), which drive tab visibility in app_server.R:
- Raw read counts — all tabs visible
- Normalized expression — all tabs visible
- Fold-change + FDR — hides Prep, Cluster, PCA, Bicluster, Network for single-comparison; hides PCA, Bicluster, Network for multi-comparison
- Fold-change only (no FDR) — same as type 3 but also hides Volcano Plot
RMarkdown templates in inst/app/www/RMD/ generate downloadable HTML workflow reports (pre-process, clustering, PCA, DEG, pathway). The Prep tab bundles parameters into an .RData file so reports can be regenerated locally.
- Uses environment variable
IDEP_DATABASEor falls back to../../datarelative path, then./data113 - Database version controlled via
db_vervariable (currently "data113") - Species and pathway data loaded via
get_idep_data()function
- Test data lives in
tests/testthat/testdata/(synthetic count matrices and design files) - Tests reference GitHub issues in comments to document the bug being tested (e.g., issue #831, #856)
testthatedition 3 (specified in DESCRIPTION)
- GitHub Actions workflows in
.github/workflows/build Electron desktop apps for Windows, Mac, and Linux - Electron builds bundle a full R runtime + all dependencies (~1 hour build time)
- Workflows are manually triggered (workflow_dispatch)
The app requires 355 R packages including major bioinformatics libraries:
- Bioconductor packages: DESeq2, limma, GSVA, ReactomePA, KEGGREST, KEGGgraph
- Shiny ecosystem: shiny, plotly, DT, visNetwork
- Analysis packages: WGCNA, PCAtools, fgsea, gage