Learn R Programming

chromConverter (version 0.12.0)

read_sz_qtof_calibration: Read TOF calibration coefficients from a 'Shimadzu' QTOF file

Description

Fits the flight-time-to-m/z coefficients A and B from the calibration points stored in the file.

Usage

read_sz_qtof_calibration(
  path,
  drop_rep = 2L,
  correct = TRUE,
  polarity = read_qtof_polarity(path)
)

Value

Named numeric vector with elements A and B.

Arguments

path

Path to 'Shimadzu' .lcd file.

drop_rep

Which of the three replicate sets to exclude from the fit. Defaults to 2, the factory default set described above. Ignored when the cached correction is used, since that identifies a single set on its own.

correct

Logical. Whether to fold in the mass correction 'LabSolutions' applied to the run, where the file carries one. Defaults to TRUE; the result then reproduces the vendor's mass axis, and carries a corrected attribute to say so. FALSE returns the tuning calibration alone, which is a few ppm out but is what the correction is expressed against.

polarity

Ion polarity, either positive or negative, selecting which of the two top-level entries to fit. Defaults to the polarity recorded in the file.

Details

The TOF Calibration Table stream holds the calibration points themselves: pairs of a known m/z and the flight time at which the instrument actually observed it. It is encoded as a protocol buffer, a binary format in which every value is tagged with a number rather than a name, so the fields are referred to below by those numbers. The top-level ones are:

  • 10 -- positive mode (Na(NaI)n calibrants)

  • 20 -- negative mode (I(NaI)n calibrants)

Both polarities are written to every file, so the table is the same in a positive and a negative run on the same instrument.

Within each entry are the theoretical m/z scaled by 1e9 (.10), the measured flight time in the same units as the Centroid Data stream (.20) and a label (.30). Five calibrants are stored per polarity, in three replicate sets. The second is a factory default rather than a measurement --- its flight times are byte-identical across different instruments --- and including it inflates the error by two orders of magnitude.

'LabSolutions' fits one of the remaining sets rather than their average, and which one varies between files. The mass correction the file caches for the run (see read_sz_qtof_mass_correction) says which, because its offset is tied to that set's intercept by $$offset = B(1 - scale) + shift \times A$$ Solving that for B reproduces one set's own intercept to ~1e-7 and no other's to better than 1e-4. That set is fitted and the correction folded in, as \(A/scale\) and \(B - shift \times A/scale\), which reproduces the m/z 'LabSolutions' reports to the four decimal places it writes them with, leaving 0.03 to 0.1 ppm (median) over three files from two instruments.

Failing that --- no cached correction, or an offset that fits no set --- the sets named by drop_rep are dropped and the rest fitted together, which lands within about 5 ppm. read_sz_qtof then refines that fit against the reference ions it finds in the data.