rainbow.read
- read(path, display_precision='auto', hrms=False, requested_files=None, telemetry=False, centroid=False, format=None, bin_width=None, peaks=False, _labels_only=False, **removed)[source]
Reads a chromatogram data directory. Main method of the package.
MS m/z resolution is controlled by
bin_width(the lossy step that sums intensities into a shared grid), not bydisplay_precision(which only rounds the displayed labels). A finerbin_widthmay drastically increase memory usage for larger files. The finest m/z grid the binary can record is 0.05 Da for Agilent quadrupole MS and about 0.03 Da for Waters, and a given run is often coarser (Agilent quadrupole runs usually step 0.1); the Agilent HRMS profile is far finer (seemz_resolution()to inspect a file).Agilent HRMS parsing may be slow. Set the flag to enable it.
For Agilent .dx archives, instrument telemetry traces (e.g. pressure, temperature) are skipped unless the telemetry flag is set.
The vendor is normally detected from the path: a .D/.dx path is read as Agilent and a .raw path as Waters. A directory whose name lacks that suffix is identified from its contents instead. Pass
format(‘agilent’ or ‘waters’) to override detection entirely.- Parameters:
path (str) – Path of the directory.
display_precision (int or 'auto', optional) – Decimals for the displayed m/z (and other ylabel) labels. Cosmetic: it rounds the labels and never merges data. Where a coarse value would round neighbouring bins onto one label, it is raised to what the grid needs, so the labels name the columns one to one for any bin_width a float64 m/z can distinguish. It does not apply to a per-scan channel at all (an HRMS profile or a centroid), whose labels are its data. The default
'auto'chooses per file: 4 for the high-resolution Agilent HRMS profile and TOF centroids, and 0 (whole numbers) for unit-resolution data (UV, GC/quadrupole MS, Waters).hrms (bool, optional) – Flag for Agilent HRMS (MSProfile.bin) parsing.
requested_files (list, optional) – List of filenames to parse.
telemetry (bool, optional) – Flag for Agilent .dx telemetry traces.
centroid (bool, optional) – Flag for Agilent MassHunter centroid (MSPeak.bin) parsing.
format (str, optional) – Force the vendor parser (‘agilent’ or ‘waters’), bypassing extension/content detection.
bin_width (float, optional) – Width in daltons of each m/z bin: the lossy binning control that sums intensities into a shared grid. It applies to MS channels only, never to a UV or wavelength axis. For regular MS the default is nominal mass (1 Da); pass a finer width down to the vendor’s m/z grid for more resolution (a width below it only warns and inserts empty bins, and one small enough to overflow the bin index is refused). For the Agilent HRMS profile, omit it (the default) to keep the per-scan representation, or pass a width to project the scans onto one shared m/z grid (see HRMS Profile Data: Why Each Scan Has Its Own m/z).
peaks (bool, optional) – Flag for reading the run’s integrated peaks into
DataDirectory.peaks, asread_sequence()does for a whole sequence. For Agilent they come from the result document of the sequence the run sits in (sequence.acamlbeside it), or else from the run’s own (sequence.acam_inside it); a run with neither has none. Waters results and a .dx archive’s are not read; asking for them warns.
- Returns:
DataDirectory representing the directory.