A cross-platform, browser-based GUI for NONMEM population PK/PD modeling.
NMGUI runs NONMEM models via Perl-speaks-NONMEM (PsN), parses results, and provides interactive diagnostics — all from your browser. No Electron, no Java, no cloud. Just Python and a browser.
Works on macOS, Linux, and Windows.
Vibe coded by Rob ter Heine with some help of Claude Opus.
Model management — Scan a project directory for .mod/.ctl files. View OFV, parameter estimates, minimization status, covariance diagnostics, condition number, shrinkage, and ETABAR at a glance. Estimation method auto-detected (FOCE, FOCE-I, SAEM, IMP, BAYES, NUTS).
Integrated editor — CodeMirror 5 editor with NONMEM syntax highlighting. Save, duplicate with optional final estimate injection and jitter (±N% perturbation, bounds-aware).
Run execution — Launch PsN tools (execute, vpc, bootstrap, scm, sse) with live console streaming. Start and stop runs from the interface.
Model evaluation — Publication-ready 2×2 GOF figure (DV vs PRED, DV vs IPRED, CWRES vs PRED, CWRES vs TIME). Individual fit plots with pagination. Residual distribution with normal overlay. OFV convergence from .ext files. MDV=1 auto-excluded. Custom column filters for compartment, study, or BLQ selection.
VPC — Dedicated tab for Visual Predictive Checks. Three R backends: vpc (Ron Keizer), xpose (UUPharmacometrics), xpose4. Configurable binning, prediction correction, LLOQ, stratification. Editable R script with one-click regeneration.
Run report — One-click HTML report with parameter tables (THETA/OMEGA/SIGMA with names, units, FIX tags, SE, RSE%, CV%), correlation matrix, ETABAR test, shrinkage summary. Opens in a new tab, print-ready.
Data viewer — Paginated table with Excel-style column filters. Scatter plots with LOESS smoother, GOF presets, ETA-vs-covariate plots, QQ plots. Custom filters (column + operator + value).
Model workflow — Star/flag models. Model ancestry tracking (based_on) with "↳ from parent" display. Ancestry tree visualization (🌳). Stale run detection when .mod or data changes after last run. Model comments. All metadata persists across sessions.
Fully offline — All assets (Plotly.js, CodeMirror) bundled locally. No internet required after installation.
Prerequisites: Python 3.8+, NONMEM, PsN. Optional: R, RStudio, vpc/xpose packages.
git clone https://github.com/Robterheine/NMGUI.git
cd NMGUI
pip install flask
python3 run.py
Your browser opens to http://localhost:5151. Point it at a folder with your .mod files.
See INSTALL.txt for detailed per-platform setup instructions.
Coming soon.
NMGUI is a single-page web application served by a lightweight Flask backend. The entire codebase is about 8,000 lines across six files:
| File | Purpose |
|---|---|
run.py |
Launch script |
app.py |
Flask backend, all API routes |
parser.py |
NONMEM .lst/.ext file parser |
templates/index.html |
Single-page HTML application |
static/js/app.js |
Frontend logic (vanilla JS) |
static/css/style.css |
Dark theme |
No build step. No node_modules. No bundler. No framework beyond Flask.
Configuration stored in ~/.nmgui/ (settings, bookmarks, model comments).
NMGUI ships with two automated test suites (272 tests total):
python3 test_parser.py # 96 tests — parser accuracy across all estimation methods
python3 test_validation.py # 176 tests — API integrity, error handling, UI consistency
Parser tested against FOCE, FOCE-I, SAEM, SAEM→IMP, BAYES, all-FIX, OMEGA BLOCK, COV failures, mixed FIX/estimated parameters, and edge cases (empty files, binary garbage, truncated output, extreme numbers).
| Component | Required | Purpose |
|---|---|---|
| Python 3.8+ | Yes | Runs the NMGUI server |
| Flask | Yes | Web framework (only Python dependency) |
| NONMEM 7.4+ | Yes | Population PK/PD modeling |
| PsN 5.x | Yes | Model execution, VPC simulation, bootstrap |
| gfortran | Yes | Fortran compiler for NONMEM |
| R 4.0+ | No | VPC plotting (vpc, xpose, xpose4 packages) |
| RStudio | No | Launched from NMGUI for custom R scripting |
MIT. NONMEM requires a separate license from ICON plc.
Issues and pull requests welcome. NMGUI is a research tool built for pharmacometricians — feedback from the community shapes its development.