MSSpectrum#
- class pyopenms.MSSpectrum(*args, **kwargs)#
Bases:
MSSpectrum
- __init__(*args, **kwargs)#
Overload:
- __init__(self) None
Overload:
- __init__(self, in_0: MSSpectrum) None
Methods
__init__
(*args, **kwargs)Overload:
calculateTIC
(self)Returns the total ion current (=sum) of peak intensities in the spectrum
clear
(self, clear_meta_data)Clears all data (and meta data if clear_meta_data is true)
clearMetaInfo
(self)Removes all meta values
clearRanges
(self)Resets all range dimensions as empty
containsIMData
(self)findHighestInWindow
(self, mz, ...)Returns the index of the highest peak in the provided abs.
Overload:
getAcquisitionInfo
(self)Returns a const reference to the acquisition info
getComment
(self)Returns the free-text comment
getDataProcessing
(self)getDriftTime
(self)Returns the drift time (-1 if not set)
getDriftTimeUnit
(self)getDriftTimeUnitAsString
(self)getFloatDataArrays
(self)Returns the additional float data arrays to store e.g.
getInstrumentSettings
(self)Returns a const reference to the instrument settings of the current spectrum
getIntegerDataArrays
(self)Returns the additional int data arrays to store e.g.
getKeys
(self, keys)Fills the given vector with a list of all keys for which a value is set
getMSLevel
(self)Returns the MS level
getMaxIntensity
(self)Returns the maximum intensity
getMaxMZ
(self)Returns the maximum m/z
getMetaValue
(self, in_0)Returns the value corresponding to a string, or
getMinIntensity
(self)Returns the minimum intensity
getMinMZ
(self)Returns the minimum m/z
getName
(self)getNativeID
(self)Returns the native identifier for the spectrum, used by the acquisition software
Returns a const reference to the PeptideIdentification vector
getPrecursors
(self)Returns a const reference to the precursors
getProducts
(self)Returns a const reference to the products
getRT
(self)Returns the absolute retention time (in seconds)
getSourceFile
(self)Returns a const reference to the source file
getStringDataArrays
(self)Returns the additional string data arrays to store e.g.
getType
(self)Returns the spectrum type (centroided (PEAKS) or profile data (RAW))
get_df
([export_meta_values])Returns a DataFrame representation of the MSSpectrum.
Cython signature: numpy_vector, numpy_vector get_peaks()
isMetaEmpty
(self)Returns if the MetaInfo is empty
isSorted
(self)Returns true if the spectrum is sorte by m/z
metaRegistry
(self)Returns a reference to the MetaInfoRegistry
metaValueExists
(self, in_0)Returns whether an entry with the given name exists
push_back
(self, in_0)Append a peak
removeMetaValue
(self, in_0)Removes the DataValue corresponding to name if it exists
reserve
(self, n)resize
(self, n)Resize the peak array
select
(self, indices)Subset the spectrum by indices.
setAcquisitionInfo
(self, in_0)Sets the acquisition info
setComment
(self, in_0)Sets the free-text comment
setDataProcessing
(self, in_0)setDriftTime
(self, in_0)Sets the drift time (-1 if not set)
setDriftTimeUnit
(self, dt)setFloatDataArrays
(self, fda)Sets the additional float data arrays to store e.g.
setInstrumentSettings
(self, in_0)Sets the instrument settings of the current spectrum
setIntegerDataArrays
(self, ida)Sets the additional int data arrays to store e.g.
setMSLevel
(self, in_0)Sets the MS level
setMetaValue
(self, in_0, in_1)Sets the DataValue corresponding to a name
setName
(self, in_0)setNativeID
(self, in_0)Sets the native identifier for the spectrum, used by the acquisition software
setPeptideIdentifications
(self, in_0)Sets the PeptideIdentification vector
setPrecursors
(self, in_0)Sets the precursors
setProducts
(self, in_0)Sets the products
setRT
(self, in_0)Sets the absolute retention time (in seconds)
setSourceFile
(self, in_0)Sets the source file
setStringDataArrays
(self, sda)Sets the additional string data arrays to store e.g.
setType
(self, in_0)Sets the spectrum type
Cython signature: set_peaks((numpy_vector, numpy_vector))
size
(self)Returns the number of peaks in the spectrum
sortByIntensity
(self, reverse)sortByPosition
(self)unify
(self, in_0)updateRanges
(self)- calculateTIC(self) float #
Returns the total ion current (=sum) of peak intensities in the spectrum
- clear(self, clear_meta_data: bool) None #
Clears all data (and meta data if clear_meta_data is true)
- clearMetaInfo(self) None #
Removes all meta values
- clearRanges(self) None #
Resets all range dimensions as empty
- containsIMData(self) bool #
- findHighestInWindow(self, mz: float, tolerance_left: float, tolerance_right: float) int #
Returns the index of the highest peak in the provided abs. m/z tolerance window to the left and right (-1 if none match)
- findNearest()#
Overload:
- findNearest(self, mz: float) int
Returns the index of the closest peak in m/z
Overload:
- findNearest(self, mz: float, tolerance: float) int
Returns the index of the closest peak in the provided +/- m/z tolerance window (-1 if none match)
Overload:
- findNearest(self, mz: float, tolerance_left: float, tolerance_right: float) int
Returns the index of the closest peak in the provided abs. m/z tolerance window to the left and right (-1 if none match)
- getAcquisitionInfo(self) AcquisitionInfo #
Returns a const reference to the acquisition info
- getDataProcessing(self) List[DataProcessing] #
- getDriftTime(self) float #
Returns the drift time (-1 if not set)
- getDriftTimeUnit(self) int #
- getFloatDataArrays(self) List[FloatDataArray] #
Returns the additional float data arrays to store e.g. meta data
- getIMData()#
- getInstrumentSettings(self) InstrumentSettings #
Returns a const reference to the instrument settings of the current spectrum
- getIntegerDataArrays(self) List[IntegerDataArray] #
Returns the additional int data arrays to store e.g. meta data
- getKeys(self, keys: List[bytes]) None #
Fills the given vector with a list of all keys for which a value is set
- getMSLevel(self) int #
Returns the MS level
- getMaxIntensity(self) float #
Returns the maximum intensity
- getMaxMZ(self) float #
Returns the maximum m/z
- getMetaValue(self, in_0: bytes | str | String) int | float | bytes | str | List[int] | List[float] | List[bytes] #
Returns the value corresponding to a string, or
- getMinIntensity(self) float #
Returns the minimum intensity
- getMinMZ(self) float #
Returns the minimum m/z
- getNativeID(self) bytes | str | String #
Returns the native identifier for the spectrum, used by the acquisition software
- getPeptideIdentifications(self) List[PeptideIdentification] #
Returns a const reference to the PeptideIdentification vector
- getRT(self) float #
Returns the absolute retention time (in seconds)
- getSourceFile(self) SourceFile #
Returns a const reference to the source file
- getStringDataArrays(self) List[StringDataArray] #
Returns the additional string data arrays to store e.g. meta data
- getType(self) int #
Returns the spectrum type (centroided (PEAKS) or profile data (RAW))
- get_df(export_meta_values: bool = True) DataFrame #
Returns a DataFrame representation of the MSSpectrum.
- Args:
export_meta_values (bool): Whether to export meta values.
- Returns:
pd.DataFrame: DataFrame representation of the MSSpectrum.
- get_peaks()#
Cython signature: numpy_vector, numpy_vector get_peaks()
Will return a tuple of two numpy arrays (m/z, intensity) corresponding to the peaks in the MSSpectrum. Provides fast access to peaks.
- intensityInRange()#
- isMetaEmpty(self) bool #
Returns if the MetaInfo is empty
- isSorted(self) bool #
Returns true if the spectrum is sorte by m/z
- metaRegistry(self) MetaInfoRegistry #
Returns a reference to the MetaInfoRegistry
- metaValueExists(self, in_0: bytes | str | String) bool #
Returns whether an entry with the given name exists
- removeMetaValue(self, in_0: bytes | str | String) None #
Removes the DataValue corresponding to name if it exists
- reserve(self, n: int) None #
- resize(self, n: int) None #
Resize the peak array
- select(self, indices: List[int]) MSSpectrum #
Subset the spectrum by indices. Also applies to associated data arrays if present.
- setAcquisitionInfo(self, in_0: AcquisitionInfo) None #
Sets the acquisition info
- setDataProcessing(self, in_0: List[DataProcessing]) None #
- setDriftTime(self, in_0: float) None #
Sets the drift time (-1 if not set)
- setDriftTimeUnit(self, dt: int) None #
- setFloatDataArrays(self, fda: List[FloatDataArray]) None #
Sets the additional float data arrays to store e.g. meta data
- setInstrumentSettings(self, in_0: InstrumentSettings) None #
Sets the instrument settings of the current spectrum
- setIntegerDataArrays(self, ida: List[IntegerDataArray]) None #
Sets the additional int data arrays to store e.g. meta data
- setMSLevel(self, in_0: int) None #
Sets the MS level
- setMetaValue(self, in_0: bytes | str | String, in_1: int | float | bytes | str | List[int] | List[float] | List[bytes]) None #
Sets the DataValue corresponding to a name
- setNativeID(self, in_0: bytes | str | String) None #
Sets the native identifier for the spectrum, used by the acquisition software
- setPeptideIdentifications(self, in_0: List[PeptideIdentification]) None #
Sets the PeptideIdentification vector
- setRT(self, in_0: float) None #
Sets the absolute retention time (in seconds)
- setSourceFile(self, in_0: SourceFile) None #
Sets the source file
- setStringDataArrays(self, sda: List[StringDataArray]) None #
Sets the additional string data arrays to store e.g. meta data
- setType(self, in_0: int) None #
Sets the spectrum type
- set_peaks()#
Cython signature: set_peaks((numpy_vector, numpy_vector))
Takes a tuple or list of two arrays (m/z, intensity) and populates the MSSpectrum. The arrays can be numpy arrays (faster).
- size(self) int #
Returns the number of peaks in the spectrum
- sortByIntensity(self, reverse: bool) None #
- sortByPosition(self) None #
- unify(self, in_0: SpectrumSettings) None #
- updateRanges(self) None #