How nvelden/geneviewer works
Project type & purpose
• It’s an R library/package (not a standalone web app).
• Bundles documentation (man pages, vignettes), example HTML widgets, and a pkgdown website.
Topology of components
A. User Layer (rectangle, light green)
• R console / RStudio / Shiny app
• Calls geneviewer API (e.g. GC_chart, GC_labels)
B. Core R Engine (rectangle, light blue)
• R/ folder: data‐import, normalization, alignment wrappers, plotting functions
• data/ & inst/extdata/: sample datasets & user‐provided files
• tests/ and vignettes/: validation and examples
C. External Tools (rectangle, orange)
• BLAST (BlastP)
• MUMmer
• Invoked by R wrappers (system calls)
D. Interactive Front‑end (rectangle, purple)
• htmlwidgets bridge:
– inst/htmlwidgets/geneviewerwidget.js + geneviewer.yaml
– lib dependencies: D3, FileSaver, html2canvas, geneviewer JS and Themes
• Produces interactive SVG/Canvas plots embedded in HTML
E. Static Plotting (rectangle, blue)
• Pure R graphics output (e.g. grid, ggplot) for PDF/PNG
F. Documentation Site (rectangle, gray)
• pkgdown generates docs/ HTML from man/, vignettes/, README.md
• Includes reference and articles generated under docs/articles
G. CI/CD & Distribution (rectangle, yellow)
• GitHub Actions (R‑CMD‑check)
• CRAN/GitHub releases
Relationships & data flow
• User → Core R Engine: calls API functions
• Core R Engine → External Tools: system calls for alignment
• Core R Engine → Static Plotting: draws gene maps
• Core R Engine → Interactive Front‑end: invokes htmlwidgets to wrap JS libs
• Interactive Front‑end → Browser: renders interactive plots
• Core R Engine + pkgdown → Documentation Site
• CI/CD → builds & tests Core R Engine and publishes package to CRAN/GitHub
Architectural patterns & design principles
• Layered separation:
– Data ingestion & transformation (R/data.R, read_*.R)
– Analysis (alignment, normalization)
– Visualization (static vs. interactive)
• Extensibility hooks: custom themes, labels, tooltips
• Standard R package layout: DESCRIPTION, NAMESPACE, R/, man/, inst/, tests/, vignettes/
• Decoupling of R logic from JS visualization via htmlwidgets
Essential elements
• Annotations for key technologies (D3, htmlwidgets, pkgdown, GitHub Actions)
• Boundaries for “User space” vs. “Package internals” vs. “External dependencies”