SpectrumMetaDataLookup#

class pyopenms.SpectrumMetaDataLookup#

Bases: SpectrumLookup

Helper class for looking up spectrum meta data.

Provides functions for extracting and looking up meta data of spectra, including retention time, precursor m/z, MS level, scan number, and native ID. Inherits lookup-by-RT, lookup-by-native-ID, and lookup-by-index from SpectrumLookup.

__init__() → None#

Methods

__init__()

addMissingIMToPeptideIDs(peptide_ids, exp)

Add missing ion mobility information to peptide identifications

addMissingRTsToPeptideIDs(peptides, exp)

Add missing RTs to peptide IDs

addMissingSpectrumReferences(peptides, filename)

Add missing spectrum references

addReferenceFormat(regexp)

Register a possible format for a spectrum reference.

empty()

Check if any spectra were set

extractScanNumber(native_id, scan_regexp, ...)

Overloaded function.

findByIndex(index[, count_from_one])

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

findByNativeID(native_id)

Look up spectrum by native ID.

findByRT(rt)

Look up spectrum by retention time (RT).

findByReference(spectrum_ref)

Look up spectrum by reference string.

findByScanNumber(scan_number)

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

getSpectrumMetaData(spectrum)

Extract meta data from a spectrum

readSpectra(spectra[, scan_regexp, ...])

Read spectra and store their meta data for later look-up.

setSpectraDataRef(spectra_data)

Set spectra data reference (filename)

Attributes

static addMissingIMToPeptideIDs(peptide_ids: pyopenms.PeptideIdentificationList, exp: pyopenms.MSExperiment) → bool#

Add missing ion mobility information to peptide identifications

static addMissingRTsToPeptideIDs(peptides: pyopenms.PeptideIdentificationList, exp: pyopenms.MSExperiment) → bool#

Add missing RTs to peptide IDs

static addMissingSpectrumReferences(peptides: pyopenms.PeptideIdentificationList, filename: str, stop_on_error: bool = False, override_spectra_data: bool = False, override_spectra_references: bool = False) → bool#

Add missing spectrum references

addReferenceFormat(regexp: str) → None#

Register a possible format for a spectrum reference.

Parameters:

regexp – Regular expression defining the format

empty() → bool#

Check if any spectra were set

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 scan number from a native ID using a regular expression

Parameters:
  • native_id – The native spectrum ID string

  • scan_regexp – Regular expression for extracting the scan number

  • no_error – If true, do not throw on failure

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

Extract scan number from a native ID using the accession type

Parameters:
  • native_id – The native spectrum ID string

  • native_id_type_accession – The native ID type accession

findByIndex(index: int, count_from_one: bool = False) → 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(native_id: str) → int#

Look up spectrum by native ID.

Parameters:

native_id – Native ID to look up

Returns:

Index of the spectrum that matched

findByRT(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(spectrum_ref: str) → int#

Look up spectrum by reference string.

Parameters:

spectrum_ref – Spectrum reference to parse

Returns:

Index of the spectrum that matched

findByScanNumber(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

static getSpectrumMetaData(spectrum: pyopenms.MSSpectrum) → pyopenms.SpectrumMetaData#

Extract meta data from a spectrum

readSpectra(spectra: pyopenms.MSExperiment, scan_regexp: str = '=(?<SCAN>\\d+)$', get_precursor_rt: bool = False) → None#

Read spectra and store their meta data for later look-up.

Parameters:
  • spectra – MSExperiment containing the spectra

  • scan_regexp – Regular expression for matching scan numbers in spectrum native IDs

  • get_precursor_rt – Assign precursor retention times?

property rt_tolerance: float#
setSpectraDataRef(spectra_data: str) → None#

Set spectra data reference (filename)