SpectrumLookup#
- class pyopenms.SpectrumLookup#
Bases:
objectHelper class for looking up spectra based on different attributes
- __init__() None#
Methods
__init__()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
findByScanNumber(scan_number)Look up spectrum by scan number (extracted from the native ID)
readSpectra(spectra[, scan_regexp])Read and index spectra for later look-up
Attributes
- 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.
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
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
- 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
- readSpectra(spectra: pyopenms.MSExperiment, scan_regexp: str = '=(?<SCAN>\\d+)$') None#
Read and index spectra for later look-up
- property rt_tolerance: float#