SpectrumLookup#

class pyopenms.SpectrumLookup#

Bases: object

Cython implementation of _SpectrumLookup

Original C++ documentation is available here

__init__(self) None#

Methods

__init__(self)

addReferenceFormat(self, regexp)

Register a possible format for a spectrum reference

empty(self)

Check if any spectra were set

extractScanNumber(self, native_id, ...)

findByIndex(self, index, count_from_one)

Look up spectrum by index (position in the vector of spectra)

findByNativeID(self, native_id)

Look up spectrum by native ID

findByRT(self, rt)

Look up spectrum by retention time (RT)

findByReference(self, spectrum_ref)

Look up spectrum by reference

findByScanNumber(self, scan_number)

Look up spectrum by scan number (extracted from the native ID)

readSpectra(self, spectra, scan_regexp)

Read and index spectra for later look-up

Attributes

rt_tolerance

addReferenceFormat(self, regexp: bytes | str | String) None#

Register a possible format for a spectrum reference

Parameters:

regexp – Regular expression defining the format

empty(self) bool#

Check if any spectra were set

extractScanNumber(self, native_id: bytes | str | String, native_id_type_accession: bytes | str | String) int#
findByIndex(self, index: int, count_from_one: bool) int#

Look up spectrum by index (position in the vector of spectra)

Parameters:
  • index – Index to look up

  • count_from_one – Do indexes start counting at one (default zero)?

Returns:

Index of the spectrum that matched

findByNativeID(self, native_id: bytes | str | String) int#

Look up spectrum by native ID

Parameters:

native_id – Native ID to look up

Returns:

Index of the spectrum that matched

findByRT(self, rt: float) int#

Look up spectrum by retention time (RT)

Parameters:

rt – Retention time to look up

Returns:

Index of the spectrum that matched

findByReference(self, spectrum_ref: bytes | str | String) int#

Look up spectrum by reference

Parameters:

spectrum_ref – Spectrum reference to parse

Returns:

Index of the spectrum that matched

findByScanNumber(self, scan_number: int) int#

Look up spectrum by scan number (extracted from the native ID)

Parameters:

scan_number – Scan number to look up

Returns:

Index of the spectrum that matched

readSpectra(self, spectra: MSExperiment, scan_regexp: bytes | str | String) None#

Read and index spectra for later look-up

Parameters:
  • spectra – Container of spectra

  • scan_regexp – Regular expression for matching scan numbers in spectrum native IDs (must contain the named group “?<SCAN>”. For example, “scan=(?<SCAN>d+)”).

rt_tolerance#