msdxr provides tools to read and parse GC-MS data stored in the proprietary
MSDX binary format used by Chromatec instruments.
The package implements a custom parser, developed via empirical (black-box) reconstruction of the file format, that allows users to:
- Import GC-MS data into R along with basic instrument metadata
- Access individual mass spectra
- Extract total ion (TIC) and extracted ion chromatograms (XIC)
This package is not affiliated with, endorsed by, or associated with Chromatec.
# Install 'msdxr' from GitHub:
remotes::install_github("andreysamokhin/msdxr")The package reference manual and vignette are available both locally (in the doc/ directory) and online. A separate workflow illustrating the screening of PCB-related signals in GC-MS data is available on OSF:
msdx_file <- system.file("extdata", "ketones.msdx", package = "msdxr")
gcms <- msdxr::ReadMsdx(msdx_file)ReadMsdx() returns a list of spectra (one per scan), with metadata stored as
the settings attribute. Each spectrum contains:
rt- retention time (seconds)scan_no- scan numbermz- mass-to-charge ratiosintst- ion intensitiestic- total ion current
tic <- msdxr::ExtractTic(gcms)
plot(
tic$rt,
tic$tic,
type = "l",
xlab = "Retention time (s)",
ylab = "Intensity",
main = "Total Ion Chromatogram"
)ms <- msdxr::ExtractSpectrum(gcms, rt = 423)
plot(
ms$mz,
100 * ms$intst / max(ms$intst),
xlim = c(10, 200),
type = "h",
xlab = "m/z",
ylab = "Intensity",
main = sprintf("rt = %.1f s; scan = %d", ms$rt, ms$scan_no)
)- Full support is currently limited to files containing a single segment and scan event.
- The MSDX format is proprietary and not publicly documented.