15.4 Column mapping, mutation, and filters
Use command-line mapping for a quick run or [data] keys for a durable analysis. For example:
nlmx nca pk.csv --id-col USUBJID --time-col ACTTIME `
--dv-col CONC --amt-col DOSE --evid-col EVID --mdv-col MDV
The corresponding file keys are id, time, dv, amt, evid, and mdv; optional mappings include cmt, rate, addl, ii, ss, blq, and group columns.
Mutations run first
--mutate or [data] mutate applies sequential R-style assignments to a copy before filters:
--mutate "DV = DV / 1000; ANALYTE_PK = DVID == 1"
Later assignments can use earlier derived columns. The changed dataset is written into the output directory, preserving the analysed representation. Mutation is useful for explicit conversions or flags, but source data should remain immutable and every conversion should be dimensionally reviewed.
Two filters with different effects
--filter/[data] filter tests every row. A dose that fails is removed along with its ability to start a profile. --obs-filter/[data] obs_filter applies to observation records while doses are retained. For a multi-analyte file, an observation filter such as DVID == 1 is often safer than a row filter that accidentally removes dose records lacking DVID.
Conditions support comparisons, Boolean operations, and membership expressions used elsewhere in nlmx. Quote text values and remember that blank cells compare as empty text. Test record counts before and after filtering.
Processing order
The operational order is mutation, row filtering/observation filtering during data reading, record classification, profile construction, BLQ treatment, and NCA. A derived flag therefore can control a filter, but a filter cannot refer to a parameter calculated later.
Grouping is not filtering. --group TRT,STUDY retains rows and creates combined labels for summaries, plots, and comparisons. In crossover data, place the applicable treatment value on each dose record.
Common mistakes
- Using
--filter "DVID == 1"when dose rows have blank DVID. - Converting concentration in both the dataset and mutation.
- Expecting mutation to alter the source file.
- Treating group columns as subject-constant in crossover data.
Checklist
- Map every nonstandard column explicitly.
- Write down mutation/filter order.
- Compare dose and observation counts before and after filters.
- Inspect the written mutated dataset.
- Verify group labels at dose records.
Further reading
See record roles, units and dose factors, and profile audit tables.