MNE — Make NONMEM Easier
A local-first VS Code workbench for NONMEM, PsN, and pharmacometrics modeling.
MNE helps pharmacometricians create, run, compare, and evaluate NONMEM models without leaving VS Code. NONMEM, PsN, and R are external requirements and are not bundled.
Core workflows include:
- NONMEM model creation and duplication
- PsN execution and safe
update_inits
- Modeling Overview with model lineage and fit statistics
- code and normalized result comparison
- GOF, individual-fit, and editable parameter reports
- VPC and pcVPC workflows
- PsN bootstrap with an editable English Word report
- NONMEM syntax highlighting
Current release status: MNE v0.1.0 is macOS-first and has been tested primarily on macOS. The architecture is intended to remain portable, but Windows and Linux are not verified for this release.
What is MNE?
MNE is an independent open-source/community tool for local NONMEM model development. It provides a VS Code interface around existing local tools and the repository's established R analysis backends.
MNE is not an official NONMEM or PsN product. NONMEM and PsN are external software and are not distributed with this extension.
Features
- Create the next numbered
.mod or .ctl model from a minimal template.
- Duplicate a model exactly or create a new model using final estimates through PsN
update_inits.
- Run a model with PsN
execute, with isolated retry directories and explicit failure states.
- Import an existing successful NONMEM/PsN result without rerunning NONMEM.
- Review model lineage, description, dataset, ID/observation counts, OFV, dOFV, AIC, BIC, and run status in Modeling Overview.
- Compare two model files with the native VS Code diff.
- Compare two normalized RunSummary results without parsing NONMEM output in the UI.
- Generate GOF images, a multipage individual-fit PDF, and an editable Word parameter table.
- Generate and replot VPC/pcVPC results with shared bins, units, facets, and CMT-level filtering.
- Run PsN bootstrap, parse section-based
bootstrap_results.csv, and generate an editable English Word report.
- Highlight NONMEM control streams in
.mod and .ctl files.
Typical Workflow
Create run1
→ Run with PsN
→ Duplicate to run2
→ Update initial estimates
→ Compare models/results
→ Review Modeling Overview and GOF
→ Run VPC or pcVPC
→ Run Bootstrap
Requirements
- Visual Studio Code 1.85 or newer.
- A licensed and working local NONMEM installation.
- A local PsN installation providing the commands used by your workflows:
execute
update_inits
bootstrap
- R and
Rscript.
- R packages used by the selected workflow.
The v0.1.0 release environment used R 4.5.3 and PsN 5.7.0. These are verified environment versions, not declared minimum versions.
Python is not required for MNE v0.1.0.
R packages
MNE can check, but never automatically installs, its R dependencies. Run:
MNE: Check R Dependencies
The packaged R backends currently use:
- Core contracts and adapters:
jsonlite
- GOF:
ggplot2, ggpubr, scales
- Individual-fit PDF:
lattice
- Word reports:
officer, flextable
- VPC/pcVPC:
dplyr, tidyvpc
Install only the packages required for the workflows you intend to use, for example:
install.packages(c(
"jsonlite", "ggplot2", "ggpubr", "scales", "lattice",
"officer", "flextable", "dplyr", "tidyvpc"
))
Installation
MNE v0.1.0 is currently prepared as a VSIX release candidate. It has not been published to the Visual Studio Marketplace yet.
To install a reviewed VSIX:
- Open VS Code.
- Open the Extensions view.
- Choose Install from VSIX… from the Extensions menu.
- Select
mne-0.1.0.vsix.
- Open a folder containing NONMEM models.
For source development:
cd apps/vscode-extension
npm ci
npm test
Press F5 in VS Code to start an Extension Development Host.
Environment Setup
Run:
MNE: Check Environment
MNE resolves tools from the following settings first and then from PATH:
{
"nonmemWorkbench.psnExecutable": "",
"nonmemWorkbench.updateInitsExecutable": "",
"nonmemWorkbench.bootstrapExecutable": "",
"nonmemWorkbench.bootstrapThreads": 4,
"nonmemWorkbench.rscriptExecutable": ""
}
The existing nonmemWorkbench.* setting and command identifiers are intentionally retained for compatibility; user-visible labels use MNE.
Missing optional workflow tools do not prevent syntax highlighting, native code comparison, or read-only result access.
Workspace Trust
MNE declares limited support for untrusted workspaces.
In an untrusted workspace, syntax highlighting, native code comparison, and read-only artifact access remain available. Operations that execute local NONMEM, PsN, or R processes are blocked until the workspace is trusted.
Model Development
Use the Explorer context menu or Command Palette:
- MNE: New NONMEM Model
- MNE: Duplicate Model
- MNE: Update Initial Estimates
- MNE: Run with PsN
- MNE: Import Existing Run
New and duplicate model names use the next available runN number. Operations using final estimates delegate to PsN update_inits; TypeScript does not parse or rewrite THETA, OMEGA, or SIGMA estimates.
Modeling Overview
The MNE Activity Bar view shows one compact row per model, including explicit reference lineage, description, method, dataset, ID/observation counts, OFV, dOFV, AIC, BIC, minimization/covariance status, significant digits, notes, and actions.
dOFV is calculated only against the explicitly selected reference model. MNE does not infer lineage from row order.
Compare Models and Results
Compare Models offers:
- Compare Code — native VS Code side-by-side diff; no external process is run.
- Compare Results — comparison of normalized RunSummary contracts using the packaged R adapter.
Two selected .lst files or two selected .ext files can also invoke Compare Results from the Explorer context menu.
GOF and Parameter Reports
After successful execution or existing-run import, MNE writes standardized artifacts under .nmw/runs/<runId>/, including:
summary.json — versioned RunSummary backend contract
- GOF overview image
- individual-fit PDF
- editable Word parameter report
- normalized parameter CSV
The UI consumes RunSummary rather than parsing NONMEM result formats directly.
VPC / pcVPC
MNE: Run VPC creates an isolated job under:
.nmw/vpc/<sourceRun>/vpc_00N/
The generated simulation model is derived from a job-local copy. MNE applies final estimates with update_inits, localizes relative data dependencies, and does not overwrite the structural source model.
The plotting wizard supports:
- VPC or pcVPC
- automatic, equal-frequency, or explicit global bins
- axis-unit labels
- up to two facet variables
- CMT-level selection, including explicit dose-only metadata
- linear and semilog output
Open Latest VPC → Replot VPC reuses the existing simulation table and does not rerun NONMEM.
Bootstrap
MNE: Run Bootstrap creates an isolated job under:
.nmw/bootstrap/<sourceRun>/bootstrap_00N/
The generated model:
- receives final estimates through PsN
update_inits
- retains
$ESTIMATION
- removes
$COV/$COVARIANCE
- removes all
$TABLE records
- leaves the source model unchanged
MNE invokes PsN 5.7-compatible syntax:
bootstrap -samples=<N> -threads=<N> <generated-model>
The parser locates section anchors instead of fixed row numbers. Minimization success is read from diagnostic.means/minimization.successful; medians come from medians; 95% intervals come only from the 2.5% and 97.5% rows of percentile.confidence.intervals.
The report is written as:
reports/<runId>_bootstrap_results.docx
It contains English headings, the minimization-success rate, final model estimates, Bootstrap medians, percentile intervals, and population/IIV/residual groups. Regenerate Bootstrap Report reuses the existing CSV and does not rerun Bootstrap.
NONMEM Syntax Highlighting
MNE includes an independently authored TextMate grammar for NONMEM control streams. It recognizes records, comments, strings, indexed parameters, routines, keywords, numbers, and operators.
The grammar was written independently. An older open repository was reviewed only as a design reference; provenance details are recorded in NOTICE.md.
Output Files and .nmw
.nmw/ is MNE's workspace-local metadata and artifact directory. It may contain:
.nmw/
├── runs/
├── comparisons/
├── vpc/
├── bootstrap/
├── history/
└── model-metadata.json
It does not replace source NONMEM models. MNE-generated VPC and Bootstrap models are job-local derivatives and do not overwrite their source models.
The repository .gitignore excludes .nmw/ by default. Teams that intentionally audit selected manifests can adopt their own version-control policy.
Privacy and Local-first Design
MNE's core v0.1.0 workflows run through local VS Code, NONMEM, PsN, and R installations. MNE v0.1.0 does not require an LLM or cloud service for its core modeling workflow.
The VSIX does not include NONMEM, PsN, clinical/study datasets, gold runs, test fixtures, or user-generated .nmw artifacts.
Known Limitations
- v0.1.0 is primarily tested on macOS; Windows and Linux are not verified.
- NONMEM, PsN, and R must be installed and configured separately.
- Result import and reporting depend on expected NONMEM/PsN output structures.
- VPC/pcVPC requires
tidyvpc and its R dependencies.
- MNE has no independent QC or regulatory-validation engine.
- MNE assists workflow automation; it does not replace pharmacometric review, model qualification, or regulatory validation.
Troubleshooting
PsN command not found
Run MNE: Check Environment. Configure the corresponding nonmemWorkbench.*Executable setting or add the command to PATH.
Rscript not found
Configure nonmemWorkbench.rscriptExecutable or add Rscript to PATH.
Missing R package
Run MNE: Check R Dependencies. Install the listed packages in the R library used by the configured Rscript.
update_inits unavailable
Install/configure PsN and verify update_inits from the same environment in which VS Code is launched.
bootstrap_results.csv not found
Inspect the MNE Output channel and the job manifest under .nmw/bootstrap/<run>/<job>/manifest.json. PsN may have exited without producing a complete Bootstrap result.
External execution is blocked
Trust the workspace before running NONMEM, PsN, R reporting, VPC, pcVPC, or Bootstrap. Read-only workflows remain available without trust.
License
MNE is released under the MIT License. See LICENSE.
Third-party Attribution
NONMEM and PsN are separate external products and are not bundled with MNE.
The syntax grammar provenance statement is available in NOTICE.md. Runtime npm development tooling and user-installed R packages retain their respective licenses and are not vendored as application source.
Project Links