SpectrumNativeIDParser#

class pyopenms.SpectrumNativeIDParser#

Bases: object

OpenMS class SpectrumNativeIDParser

__init__(*args, **kwargs)#

Methods

__init__(*args, **kwargs)

extractScanNumber(native_id, scan_regexp, ...)

Overloaded function.

getRegExFromNativeID(native_id)

Determine the regular expression that extracts the scan or index number from a native ID

isNativeID(id)

Check whether a spectrum identifier is a native ID from a vendor file

static extractScanNumber(native_id: str, scan_regexp: str, no_error: bool) → int#
static extractScanNumber(native_id: str, native_id_type_accession: str) → int

Overloaded function.

  1. extractScanNumber(native_id: str, scan_regexp: str, no_error: bool) -> int

Extract the scan number from a native ID using a regular expression

Parameters:
  • native_id – The native spectrum ID string

  • scan_regexp – Regular expression whose first capture group matches the scan number, e.g. scan=(?<SCAN>\d+) (naming the group is optional); if it matches several times, the last match is used

  • no_error – If true, return -1 on failure instead of raising an exception

Returns:

Scan number of the spectrum, or -1 on failure

  1. extractScanNumber(native_id: str, native_id_type_accession: str) -> int

Extract the scan number from a native ID using the CV accession of its format

Parameters:
  • native_id – The native spectrum ID string

  • native_id_type_accession – CV accession of the native ID format (e.g. “MS:1000768” for Thermo, “MS:1000770” for WIFF)

Returns:

Scan number of the spectrum, or -1 on failure (WIFF IDs yield cycle * 1000 + experiment; index-based IDs yield index + 1)

static getRegExFromNativeID(native_id: str) → str#

Determine the regular expression that extracts the scan or index number from a native ID

Parameters:

native_id – A native ID string to analyze (its prefix, e.g. “scan=” or “index=”, selects the pattern)

Returns:

Regular expression string whose named group GROUP matches the scan or index number

static isNativeID(id: str) → bool#

Check whether a spectrum identifier is a native ID from a vendor file

Parameters:

id – Spectrum identifier string to check

Returns:

True if the string starts with a known native ID prefix (scan=, scanId=, scanID=, controllerType=, function=, sample=, index=, spectrum=, file=, frame=)