Skip to contents

Read chromatogram data streams from 'Shimadzu' .gcd files.

Usage

read_shimadzu_gcd(
  path,
  what = "chroms",
  format_out = c("matrix", "data.frame", "data.table"),
  data_format = c("wide", "long"),
  read_metadata = TRUE,
  metadata_format = c("chromconverter", "raw"),
  collapse = TRUE
)

Arguments

path

Path to 'Shimadzu' .gcd file.

what

What stream to get: current options are chromatograms (chroms) and/or peak lists (peak_table). If a stream is not specified, the function will default to chroms.

format_out

Class of output. Either matrix, data.frame, or data.table.

data_format

Whether to return data in wide (default) or long format.

read_metadata

Logical. Whether to attach metadata. Defaults to TRUE.

metadata_format

Format to output metadata. Either chromconverter or raw.

collapse

Logical. Whether to collapse lists that only contain a single element. Defaults to TRUE.

Value

A 2D chromatogram in the format specified by data_format and format_out. If data_format is wide, the chromatogram will be returned with retention times as rows and a single column for the intensity. If long format is requested, two columns will be returned: one for the retention time and one for the intensity. The format_out argument determines whether the chromatogram is returned as a matrix, data.frame, or data.table. Metadata can be attached to the chromatogram as attributes if read_metadata is TRUE.

Details

A parser to read chromatogram data streams from 'Shimadzu' .gcd files. GCD files are encoded as 'Microsoft' OLE documents. The parser relies on the olefile package in Python to unpack the files. The PDA data is encoded in a stream called PDA 3D Raw Data:3D Raw Data. The GCD data stream contains a segment for each retention time, beginning with a 24-byte header.

The 24 byte header consists of the following fields:

  • 4 bytes: segment label (17234).

  • 4 bytes: Little-endian integer specifying the sampling interval in milliseconds.

  • 4 bytes: Little-endian integer specifying the number of values in the file.

  • 4 bytes: Little-endian integer specifying the total number of bytes in the file (However, this seems to be off by a few bytes?).

  • 8 bytes of 00s

After the header, the data are simply encoded as 64-bit (little-endian) floating-point numbers. The retention times can be (approximately?) derived from the number of values and the sampling interval encoded in the header.

Note

This parser is experimental and may still need some work. It is not yet able to interpret much metadata from the files.

Author

Ethan Bass