4.1 Projects, run families and stems
Most commands of nlmx read a dataset or a control stream that you name. Four commands (cov, inspect, validate
and posterior, with resume and simulate-study around them) read the results of a NONMEM-style run: several files
that belong together. This section explains how nlmx recognises such a set, and why it stops when it cannot.
4.1.1 A project and its folders
A project in nlmx is nothing more than a folder layout that you keep: the program has no project file and no
registry. The layout that generate writes (Section 3.1) and that this book uses is
demo/
data/analysis.csv the dataset
models/run101.ctl the control stream, and beside it the results of its fit
nlmx.covar, nlmx.vpc … settings files, one per command
out_*/ the output folders you asked for
Nothing forces this layout. The program takes every path you give it, relative to where you run the command, and a
control stream's $DATA is resolved relative to the control stream, as NONMEM does (the logs say so: reading dataset models/../data/analysis.csv).
4.1.2 A run family: the files that share a stem
NONMEM names the results of a run after its control stream. If the control stream is run101.ctl, the run stem is
run101 and the run family is every file with that stem:
Table 4.3. The file extensions of a run family, and the settings extensions of the commands.
| Extension | What it is | Written by |
|---|---|---|
.ctl or .mod |
the control stream | you |
.ext |
final and iteration estimates | fit, NONMEM |
.cov |
covariance matrix of the estimates | fit, NONMEM |
.cor |
correlation matrix of the estimates | fit, NONMEM |
.coi |
inverse of the covariance matrix | fit, NONMEM |
.phi |
individual estimates (ETAs) and objective | fit, NONMEM |
.lst |
NONMEM's listing | NONMEM |
.tab |
a NONMEM table | NONMEM |
Chapter 5 says what each file contains and which commands read it.
The settings files are a second family of extensions. Every command has its own, and the content is always TOML:
| Settings extension | Command | Settings extension | Command | |
|---|---|---|---|---|
.covar |
cov, fit, inspect, validate, posterior, resume, simulate-study |
.vpc |
vpc |
|
.qcd |
qc-data |
.forest |
forest |
|
.qcn |
qc-nm |
.sims |
sims |
|
.eda |
eda |
.er |
er |
|
.nca |
nca |
.power |
power |
|
.init |
autoinit |
.gen |
generate |
|
.screen |
screen |
.ask |
ask |
A file with the wrong extension is refused, and the message names the one it should have (Section 4.4). The extensions are distinct from those of NONMEM, so a settings file can never be mistaken for a result.
4.1.3 How nlmx finds the family
You can tell the covariate engine where the run is in four ways:
- a folder:
--model-dir models. nlmx lists the control streams in it; with exactly one, that is the run, and the other files with the same stem are the family. - a stem inside a folder:
--model-dir models --run-stem run101, which is the way to choose when the folder holds more than one run. - explicit files:
--ctl models/run101.ctl --ext … --cov … --data …, one option per file (--cor,--lst,--phi,--tabletoo). Any file you name overrides the one that would be discovered. - a manifest:
--files manifest.txt, a small TOML file with a[files]table whose keys arecontrol_stream,ext,cov,cor,data,lst,phiandtable. Paths in it are relative to the manifest.
In a settings file the same choices are the keys [input] model_dir, run_stem and the [input.files] table. With
--recursive, the folder is searched below as well.
For the commands that take a control stream as their main argument (fit, vpc, forest, sims, power, qc-nm) none
of this is needed: you name the control stream, and the estimates are looked for beside it (vpc, for example, takes the estimates from --ext, then --results-dir, then beside the control stream, then from
<stem>_fit/).
4.1.4 Why nlmx refuses an ambiguous folder
Two runs in one folder are the ordinary state of a project: run101 and run102 in models/. If you name the folder
without a stem, nlmx has no way to know which you mean, and it does not guess:
$ nlmx inspect --model-dir models --covariates CL=WT -o o_amb2
0.00s info input mode: directory `models`
0.00s error FAILED during stage `discovering NONMEM artifacts`: ambiguous run family in `models`
0.00s error exit code 3 (file discovery or I/O failure)
0.00s error hint: candidates: run101, run102; disambiguate with --run-stem or `input.run_stem`
The reason is the cost of a wrong guess: a covariate analysis of run101 that reads the .ext of run102 gives numbers
that look right. So the rule is the same in every case of doubt: list the candidates and stop. The same rule makes
nlmx refuse a stem that has both a .ctl and a .mod, or the same control stream in two subfolders, and a stem with no
control stream (the message then lists the control streams that are present). Adding --run-stem run101 resolves the
first case, and the log says so: run stem resolved to run101.
Discovery is followed by checks that the files fit together (exit code 6, "inconsistent NONMEM artifacts", when they do
not). nlmx inspect does the discovery and these checks and fits nothing, which makes it the first command to run on a
run you have not seen.
4.1.5 Where the files of a run family come from in this book
The family run101.ctl, .ext, .cov, .cor, .coi, .phi is what nlmx fit writes to its output folder. In the tour,
the covariate analysis read the family that generate wrote into models/ (the project was generated with a fitted base
model), and the confirmatory run, run102, was fitted by fit into out_fit102, from where forest and vpc read it
with --results-dir out_fit102. A run fitted by NONMEM itself is read in exactly the same way: nlmx reads and writes the
NONMEM formats, and that is what lets it work beside NONMEM (Section 1.4).
Common mistakes
- Naming a folder that holds several runs. Add
--run-stem. - Leaving results from an old run beside the control stream. An
.extthat predates the last edit of the control stream is read without complaint if its parameters still match; remove or move old results. - Using a settings file with the wrong extension.
nlmx vpc -c study.txtis refused: rename itstudy.vpc.
Checklist
- Each run in its own stem,
.ctland results side by side (or named with--ext,--cov). - With more than one run in a folder,
--run-stemorinput.run_stemis given. -
nlmx inspectreports the stem and the files you expect before you run a long analysis.
Further reading
Section 4.5 (the option grammar), Section 4.4 (exit codes 3 and 6), Chapter 25 for inspect and validate.