Write the targeted LC-HRMS quantitation program of a hospital metabolomics core (eleven tryptophan-pathway metabolites with isotope-labelled internal standards from raw Q-TOF scans, calibration, carryover, dilution and specimen factors) within a 60-minute session; it is run on further batches from the same instrument with known concentrations.
harbor run -t reactive-labs/lcms-targeted-quantharbor download reactive-labs/lcms-targeted-quantYou are Tobias Engvall, staff scientist in the Metabolomics and Bioanalysis Core (MBC) of Linnehavn University
Hospital. The core measures the KT-PANEL, eleven tryptophan-pathway metabolites with isotope-labelled internal
standards, on its Kestrel 6500 Q-TOF for the KYNO-ICU sepsis study. Today is Monday 16 November 2026. Maren
Kolstad, head of the core, wrote this morning (the mail is in /app/inputs/docs/mail/):
Since Arvid left nobody owns the KT-PANEL evaluation, and Lars will not accept results from kt_quant_v2.py for the DSMB package. Please write the evaluation as one program that takes a batch folder as KestrelAcq exports it and writes the results, to SOP-MBC-031 rev 4 and the validation report as they stand. Lars will run it on the remaining KYNO-ICU batches: the processing PC launches it once per batch and stops it after 8 seconds, so it has to be quick. Send me the results for the four batches on the share as well.
You have 60 minutes. Whatever is in /app/output when the time is up is graded, so keep a working program saved
as you go.
In /app/inputs:
batches/: the four KYNO-ICU batches on the share, B26-0914, B26-1005, B26-1022 and B26-1104. Each folder
holds <batch>_sequence.xlsx (sheet Sequence, the sample list; sheet Calibration, the nominal values and
stock lots) and raw/, one .npz scan file and one .json run sidecar per injection. The .npz holds the
centroided MS1 scans (scan_rt, scan_index, mz, intensity; the centroids of scan i are
scan_index[i]:scan_index[i+1]) and the LockSpray function (lock_rt, lock_index, lock_mz,
lock_intensity).docs/: SOP-MBC-031 rev 4, validation report VR-MBC-031-02, the instrument logbook, the stock preparation
records and certificates of analysis, and mails.method/: the KestrelQuant target list.legacy/: the previous analyst's script and handover note./app/output/quant.py, run as
python3 /app/output/quant.py <batch_dir> <out.json>
It reads one batch folder in the format of the four in hand and writes one JSON object:
{"batch": "B26-0914",
"samples": {"KI-0301-D1-P": {"QA": 512.3, "NA": 21.07, "PA": 38.9, "3HK": 44.1, "5HT": "<LLOQ",
"Kyn": 3.112, "5HIAA": 61.4, "Trp": 41.27, "XA": 9.8, "KynA": 52.6, "AA": 19.3},
"...": {}}}
| Key | Content |
|---|---|
batch |
the batch folder name (not scored) |
samples |
one entry per study specimen of the batch (sample type SMP), keyed by its Sample ID; re-injections of a specimen do not get their own entry |
| analyte keys | QA, NA, PA, 3HK, 5HT, Kyn, 5HIAA, Trp, XA, KynA, AA (the codes of SOP-MBC-031 section 3) |
| values | the concentration in the specimen as received (urine as voided), in umol/L for Trp and Kyn and nmol/L for all others; or the string "<LLOQ" |
The program runs with Python 3.12, numpy, scipy, pandas and openpyxl, on one CPU core with 2 GB of memory and
no network, and must finish a batch (up to 140 injections) within 8 seconds of wall time. It is run as
another user from a copy of /app/output: it may load helper files that you put in /app/output (found
relative to __file__), but /app/inputs is not there when it runs.
/app/output/results/<batch>.json for each of the four batches in hand (for example
/app/output/results/B26-0914.json): the program's output for that batch.
Lars runs your program on 24 further KYNO-ICU batches acquired on the same instrument between 7 September and 13 November 2026 and exported the same way, from specimens whose concentrations are known: plasma, urine and CSF batches in the layouts and sizes SOP-MBC-031 allows. Some hold later study days of the subjects in the four batches in hand. The four batches in hand have reference values too, and your result files are compared in the same way.
For each specimen and analyte, with c the reference concentration and L the specimen's LLOQ (the L1 nominal value times the specimen's pre-analytical factors, without D10), both in nmol/L:
"<LLOQ" earns full credit if c is below 1.25 L and nothing otherwise.| Analyte | QA | NA | PA | 3HK | 5HT | Kyn | 5HIAA | Trp | XA | KynA | AA |
|---|---|---|---|---|---|---|---|---|---|---|---|
| r | 0.044 | 0.078 | 0.046 | 0.04 | 0.044 | 0.037 | 0.047 | 0.036 | 0.043 | 0.042 | 0.036 |
| q | 0.22 | 0.28 | 0.23 | 0.24 | 0.3 | 0.11 | 0.23 | 0.17 | 0.26 | 0.17 | 0.19 |
For NA in urine r is 0.25.
A missing analyte, a missing specimen or a value that is neither a finite number nor "<LLOQ" earns nothing.
A specimen scores the mean over the eleven analytes, a batch the mean over its specimens, divided by what the
core's own reference evaluation scores on the same batch (capped at 1). A batch on which the program fails, runs
out of time or writes no readable JSON scores zero. The final score is 80 % the mean over the
24 further batches and 20 % the mean over the four result files.