How pawelqs/cevomod works
Project Type and Purpose
• Project type: An R package (library) for modeling cancer evolution from NGS data.
• Purpose: Implement and expose statistical methods (power-law + binomial mixtures) for Variant Allele Frequency (VAF) analysis, provide helper data-wrangling, plotting, and two Shiny applications for interactive exploration.
File Structure
• Top-level:
– R/ : All core R functions (model fitting, data transformations, plotting, wrappers).
– man/ : Rd documentation for every exported function.
– data-raw/ → data/ : Raw sources (Excel, R scripts) that generate internal datasets (sysdata.rda, driver_genes.rda, etc.).
– inst/ : Shiny applications (cevoapp/app.R and cevobrowser/app.R) and a container definition (CliP.def).
– tests/ : Automated test suite (testthat) including snapshots of plots.
– vignettes/ : R Markdown tutorials (“Get started,” “Fitting models,” “Visualizations”).
– pkgdown/ + _pkgdown.yml : Website generation assets.
– .github/workflows : CI pipelines (R-CMD-check, pkgdown deploy, test coverage).
– DESCRIPTION, NAMESPACE, Makefile : Standard R package metadata and build scripts.
Extract Key Insights from README
• Core modeling workflow:
a. Input VAF or CCF data (possibly via readthis integration).
b. Fit power-law component(s) (fixed or optimized exponent).
c. Fit binomial mixture subclones (methods: mclust, BMix, CliP via Apptainer).
d. Provide plotting and summary functions.
• External dependencies/services:
– mclust R package (Gaussian mixtures)
– BMix R package (binomial mixtures)
– Apptainer container runtime for CliP
– pkgdown and GitHub Actions for site build & CI.
Main Components & Their Relationships
A. Core Modeling Engine (R/)
• Data input & validation → statistical fit functions → result objects (“cevomod” S3 classes).
B. Internal Data Pipeline
• data-raw/ scripts + Excel sources → sysdata.rda → data/ (packaged data).
C. Extension Points
• readthis integration (bulk data import)
• build_clip_container() → builds Apptainer image for CliP
D. Presentation Layers
• Plotting functions (R/plot_*.R) → static plots in R console & vignettes.
• Shiny apps (inst/cevoapp & inst/cevobrowser) → interactive exploration GUIs.
• pkgdown site (vignettes + function reference).
E. Quality & Deployment
• tests/ → unit & snapshot tests (testthat) → ensure correctness of core & plots.
• .github/workflows → on-push CI, coverage reports, pkgdown deploy.
• Makefile → local build/test/dev commands.
Architectural Patterns & Design Principles
• Modular single-package design (clear separation: data ingestion, computation, plotting, UI).
• S3 classes + generic methods (plot.cevomod, print.cevodata).
• CI/CD pipeline enforcing test coverage and documentation deployment.
• Data-raw → data → inst (container def) → pkg → pkgdown → GitHub Pages (fully automated).