Input/Output

Text

Module for importing MS data from delimited text files.

dget.io.text.delimiters = [';', ',', '\t', ' ']

text delimiters

Type:

List[str]

dget.io.text.guess_loadtxt_kws(file: str | Path | TextIO, loadtxt_kws: dict | None = None) dict

Attempt to guess the loadtxt_kws for a file.

These keywords are passed to np.loadtxt during initilisation of a dget.DGet class. Guessed values are ‘delimiter’, ‘usecols’ and ‘skiprows’.

Parameters:
  • file – str, path or file pointer to MS text file

  • loadtxt_kws – current keywords, values may be overwritten

Returns:

loadtxt_kws updated with guessed values

dget.io.text.mass_hints = ['mass', 'm/z', 'thompson']

strings used guess m/z column from header

Type:

List[str]

dget.io.text.signal_hints = ['signal', 'intensity', 'count', 'cps']

strings used guess signal intensity column from header

Type:

List[str]

Shimadzu

Module for importing Shimadzu HRMS exports from LabSolutions.

dget.io.shimadzu.get_loadtxt_kws(file: str | Path | TextIO) dict

Read the loadtxt_kws from the Shimadzu file.

Shimadzu MS exports may contain more than just the MS profile data, so we must find the ‘Profile Data’ header and skip to that. The delimiter can be inferred and the usecols should always be (0, 1).

Parameters:

file – string, Path or file pointer to file

Returns:

dict of all keywords required for np.loadtxt

dget.io.shimadzu.is_shimadzu_file(file: str | Path | TextIO) bool

Check if the file is a Shimdazu spectra export.

Extracts the header and calls is_shimadzu_header.

Parameters:

file – string, Path or file pointer

Returns:

True if a Shimadzu header

dget.io.shimadzu.is_shimadzu_header(header: List[str]) bool

Check if the header is a Shimdazu spectra export.

Parameters:

header – list of header strings, at least 2 lines

Returns:

True if a Shimadzu header