Skip to content

Latest commit

 

History

History
98 lines (64 loc) · 4.27 KB

File metadata and controls

98 lines (64 loc) · 4.27 KB

plotmorph

Morph any metabolomics figure into any journal's house style.

plotmorph is an R package that adapts metabolomics and lipidomics figures to journal-specific publication requirements — fonts, colors, dimensions, line weights, caption format, MSI confidence reporting — via a parameterized style schema. Add a new journal by editing one YAML file.

Why

Adapting a figure to a journal's house style is one of the most-repeated tasks in scientific publishing. It is also one of the most often skipped: papers ship with mixed fonts across panels, red-green volcano plots that fail accessibility, missing MSI confidence levels in captions, and color schemes that drift between subfigures of the same composite. plotmorph exists to make journal-style compliance the default, not an afterthought.

Status

v0.1.0 — early release. Public-from-day-one. The internals will move quickly. The output contract (the JournalStyle schema) will evolve under additive rules — additions are safe, renames are deprecated through one release cycle.

What's in v0.1

  • Style schema (JournalStyle) — ~30 parameters that fully specify a journal's figure requirements.
  • One hand-encoded style — ACS family (covers Analytical Chemistry, Journal of Proteome Research, ACS Omega, Journal of the American Society for Mass Spectrometry in one spec).
  • Three primitive renderersrender_volcano(), render_heatmap(), render_bar().
  • A multi-panel composer (compose_panels()) — the signature feature. Builds composite figures from primitives while enforcing typography, palette, and panel-label consistency that is routinely broken in real publications.
  • A mechanical compliance checker (compliance_check()) — audits a rendered figure against its target journal's spec and returns a structured pass/fail report.
  • Export to PDF / EPS / PNG at journal-spec dimensions and DPI.

Roadmap

v0.2 — Nature, Springer, and MDPI journal families. Pathway diagrams, lipid-class chain plots, ChemRICH-style networks. URL-based style ingestion: paste a journal's Author Information page, get a draft template auto-extracted.

v0.3 — community-contributed templates accumulating in inst/styles/. Benchmark suite reproducing 20 published figures from primary data on MetaboLights / MassIVE.

Installation

# install.packages("remotes")
remotes::install_github("othmanalaa/plotmorph")

For the interactive demo (optional):

install.packages(c("shiny", "bslib", "DT"))

Try it live

plotmorph::run_app()

This opens a browser window where you can upload a CSV, see the default ggplot2 rendering side-by-side with the journal-styled rendering, customize the font / palette / size / thresholds live, run a mechanical compliance check, and export to PDF / PNG / EPS.

Don't have data to hand? Click Use example data in the sidebar.

Quick start

library(plotmorph)

# Synthetic volcano data (or load your own)
set.seed(42)
data <- data.frame(
  feature_id = paste0("L", seq_len(100)),
  log2FC     = c(rnorm(80, 0, 0.5), rnorm(20, 2, 0.5)),
  pvalue     = c(runif(80, 0.05, 1), runif(20, 0, 0.05))
)
data$padj <- p.adjust(data$pvalue, method = "BH")

# Load the ACS family style
style <- load_acs_style()

# Render
p <- render_volcano(data, style)

# Audit compliance
report <- compliance_check(p, style)
print(report)

# Export to journal spec
export_figure(p, style, path = "volcano.pdf", width_mode = "single")

Design principles

  1. One YAML per journal. The style spec is the contract. Adding journal #50 is the same effort as adding journal #1.
  2. Compliance is mechanical, not aspirational. compliance_check() returns structured pass/fail, not advice.
  3. Multi-panel consistency by construction. The composer applies one theme across all panels — the most common failure mode in real composites is impossible by design.
  4. Metabolomics-specific defaults. Colorblind-safe palettes, MSI confidence reporting in captions, log₂ fold-change axis labels with proper subscripts.

Acknowledgments

Developed with AI-assisted coding at FGCZ (Functional Genomics Center Zurich, ETH / UZH).

License

MIT. See LICENSE.md.

Citation

See CITATION.cff or run citation("plotmorph") after install.