MSSpectrum

class pyopenms.Plotting.MSSpectrum

Bases: object

Cython implementation of _MSSpectrum

Documentation is available at http://www.openms.de/current_doxygen/html/classOpenMS_1_1MSSpectrum.html

– Inherits from [‘SpectrumSettings’, ‘RangeManagerMzInt’]

The representation of a 1D spectrum. Raw data access is proved by get_peaks and set_peaks, which yields numpy arrays Iterations yields access to underlying peak objects but is slower Extra data arrays can be accessed through getFloatDataArrays / getIntegerDataArrays / getStringDataArrays See help(SpectrumSettings) for information about meta-information —– Usage:

ms_level = spectrum.getMSLevel() rt = spectrum.getRT() mz, intensities = spectrum.get_peaks()

__init__()
  • Cython signature: void MSSpectrum()

  • Cython signature: void MSSpectrum(MSSpectrum &)

Methods

__init__

  • Cython signature: void MSSpectrum()

calculateTIC

Cython signature: double calculateTIC() Returns the total ion current (=sum) of peak intensities in the spectrum

clear

Cython signature: void clear(bool clear_meta_data) Clears all data (and meta data if clear_meta_data is true)

clearMetaInfo

Cython signature: void clearMetaInfo() Removes all meta values

clearRanges

Cython signature: void clearRanges() Resets all range dimensions as empty

containsIMData

Cython signature: bool containsIMData()

findHighestInWindow

Cython signature: int findHighestInWindow(double mz, double tolerance_left, double tolerance_right) Returns the index of the highest peak in the provided abs.

findNearest

  • Cython signature: int findNearest(double mz)

getAcquisitionInfo

Cython signature: AcquisitionInfo getAcquisitionInfo() Returns a const reference to the acquisition info

getComment

Cython signature: String getComment() Returns the free-text comment

getDataProcessing

Cython signature: libcpp_vector[shared_ptr[DataProcessing]] getDataProcessing()

getDriftTime

Cython signature: double getDriftTime() Returns the drift time (-1 if not set)

getDriftTimeUnit

Cython signature: DriftTimeUnit getDriftTimeUnit()

getDriftTimeUnitAsString

Cython signature: String getDriftTimeUnitAsString()

getFloatDataArrays

Cython signature: libcpp_vector[FloatDataArray] getFloatDataArrays() Returns the additional float data arrays to store e.g.

getIMData

getInstrumentSettings

Cython signature: InstrumentSettings getInstrumentSettings() Returns a const reference to the instrument settings of the current spectrum

getIntegerDataArrays

Cython signature: libcpp_vector[IntegerDataArray] getIntegerDataArrays() Returns the additional int data arrays to store e.g.

getKeys

Cython signature: void getKeys(libcpp_vector[String] & keys) Fills the given vector with a list of all keys for which a value is set

getMSLevel

Cython signature: unsigned int getMSLevel() Returns the MS level

getMaxIntensity

Cython signature: double getMaxIntensity() Returns the maximum intensity

getMaxMZ

Cython signature: double getMaxMZ() Returns the maximum m/z

getMetaValue

Cython signature: DataValue getMetaValue(String) Returns the value corresponding to a string, or

getMinIntensity

Cython signature: double getMinIntensity() Returns the minimum intensity

getMinMZ

Cython signature: double getMinMZ() Returns the minimum m/z

getName

Cython signature: String getName()

getNativeID

Cython signature: String getNativeID() Returns the native identifier for the spectrum, used by the acquisition software

getPeptideIdentifications

Cython signature: libcpp_vector[PeptideIdentification] getPeptideIdentifications() Returns a const reference to the PeptideIdentification vector

getPrecursors

Cython signature: libcpp_vector[Precursor] getPrecursors() Returns a const reference to the precursors

getProducts

Cython signature: libcpp_vector[Product] getProducts() Returns a const reference to the products

getRT

Cython signature: double getRT() Returns the absolute retention time (in seconds)

getSourceFile

Cython signature: SourceFile getSourceFile() Returns a const reference to the source file

getStringDataArrays

Cython signature: libcpp_vector[StringDataArray] getStringDataArrays() Returns the additional string data arrays to store e.g.

getType

Cython signature: int getType() Returns the spectrum type (centroided (PEAKS) or profile data (RAW))

get_peaks

Cython signature: numpy_vector, numpy_vector get_peaks()

intensityInRange

isMetaEmpty

Cython signature: bool isMetaEmpty() Returns if the MetaInfo is empty

isSorted

Cython signature: bool isSorted() Returns true if the spectrum is sorte by m/z

metaRegistry

Cython signature: MetaInfoRegistry metaRegistry() Returns a reference to the MetaInfoRegistry

metaValueExists

Cython signature: bool metaValueExists(String) Returns whether an entry with the given name exists

push_back

Cython signature: void push_back(Peak1D) Append a peak

removeMetaValue

Cython signature: void removeMetaValue(String) Removes the DataValue corresponding to name if it exists

reserve

Cython signature: void reserve(size_t n)

resize

Cython signature: void resize(size_t n) Resize the peak array

select

Cython signature: MSSpectrum select(libcpp_vector[size_t] & indices) Subset the spectrum by indices.

setAcquisitionInfo

Cython signature: void setAcquisitionInfo(AcquisitionInfo) Sets the acquisition info

setComment

Cython signature: void setComment(String) Sets the free-text comment

setDataProcessing

Cython signature: void setDataProcessing(libcpp_vector[shared_ptr[DataProcessing]])

setDriftTime

Cython signature: void setDriftTime(double) Sets the drift time (-1 if not set)

setDriftTimeUnit

Cython signature: void setDriftTimeUnit(DriftTimeUnit dt)

setFloatDataArrays

Cython signature: void setFloatDataArrays(libcpp_vector[FloatDataArray] fda) Sets the additional float data arrays to store e.g.

setInstrumentSettings

Cython signature: void setInstrumentSettings(InstrumentSettings) Sets the instrument settings of the current spectrum

setIntegerDataArrays

Cython signature: void setIntegerDataArrays(libcpp_vector[IntegerDataArray] ida) Sets the additional int data arrays to store e.g.

setMSLevel

Cython signature: void setMSLevel(unsigned int) Sets the MS level

setMetaValue

Cython signature: void setMetaValue(String, DataValue) Sets the DataValue corresponding to a name

setName

Cython signature: void setName(String)

setNativeID

Cython signature: void setNativeID(String) Sets the native identifier for the spectrum, used by the acquisition software

setPeptideIdentifications

Cython signature: void setPeptideIdentifications(libcpp_vector[PeptideIdentification]) Sets the PeptideIdentification vector

setPrecursors

Cython signature: void setPrecursors(libcpp_vector[Precursor]) Sets the precursors

setProducts

Cython signature: void setProducts(libcpp_vector[Product]) Sets the products

setRT

Cython signature: void setRT(double) Sets the absolute retention time (in seconds)

setSourceFile

Cython signature: void setSourceFile(SourceFile) Sets the source file

setStringDataArrays

Cython signature: void setStringDataArrays(libcpp_vector[StringDataArray] sda) Sets the additional string data arrays to store e.g.

setType

Cython signature: void setType(SpectrumType) Sets the spectrum type

set_peaks

Cython signature: set_peaks((numpy_vector, numpy_vector))

size

Cython signature: size_t size() Returns the number of peaks in the spectrum

sortByIntensity

Cython signature: void sortByIntensity(bool reverse)

sortByPosition

Cython signature: void sortByPosition()

unify

Cython signature: void unify(SpectrumSettings)

updateRanges

Cython signature: void updateRanges()

calculateTIC()

Cython signature: double calculateTIC() Returns the total ion current (=sum) of peak intensities in the spectrum

clear()

Cython signature: void clear(bool clear_meta_data) Clears all data (and meta data if clear_meta_data is true)

clearMetaInfo()

Cython signature: void clearMetaInfo() Removes all meta values

clearRanges()

Cython signature: void clearRanges() Resets all range dimensions as empty

containsIMData()

Cython signature: bool containsIMData()

findHighestInWindow()

Cython signature: int findHighestInWindow(double mz, double tolerance_left, double tolerance_right) 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()
  • Cython signature: int findNearest(double mz) Returns the index of the closest peak in m/z

  • Cython signature: int findNearest(double mz, double tolerance) Returns the index of the closest peak in the provided +/- m/z tolerance window (-1 if none match)

  • Cython signature: int findNearest(double mz, double tolerance_left, double tolerance_right) 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()

Cython signature: AcquisitionInfo getAcquisitionInfo() Returns a const reference to the acquisition info

getComment()

Cython signature: String getComment() Returns the free-text comment

getDataProcessing()

Cython signature: libcpp_vector[shared_ptr[DataProcessing]] getDataProcessing()

getDriftTime()

Cython signature: double getDriftTime() Returns the drift time (-1 if not set)

getDriftTimeUnit()

Cython signature: DriftTimeUnit getDriftTimeUnit()

getDriftTimeUnitAsString()

Cython signature: String getDriftTimeUnitAsString()

getFloatDataArrays()

Cython signature: libcpp_vector[FloatDataArray] getFloatDataArrays() Returns the additional float data arrays to store e.g. meta data

getIMData()
getInstrumentSettings()

Cython signature: InstrumentSettings getInstrumentSettings() Returns a const reference to the instrument settings of the current spectrum

getIntegerDataArrays()

Cython signature: libcpp_vector[IntegerDataArray] getIntegerDataArrays() Returns the additional int data arrays to store e.g. meta data

getKeys()

Cython signature: void getKeys(libcpp_vector[String] & keys) Fills the given vector with a list of all keys for which a value is set

getMSLevel()

Cython signature: unsigned int getMSLevel() Returns the MS level

getMaxIntensity()

Cython signature: double getMaxIntensity() Returns the maximum intensity

getMaxMZ()

Cython signature: double getMaxMZ() Returns the maximum m/z

getMetaValue()

Cython signature: DataValue getMetaValue(String) Returns the value corresponding to a string, or

getMinIntensity()

Cython signature: double getMinIntensity() Returns the minimum intensity

getMinMZ()

Cython signature: double getMinMZ() Returns the minimum m/z

getName()

Cython signature: String getName()

getNativeID()

Cython signature: String getNativeID() Returns the native identifier for the spectrum, used by the acquisition software

getPeptideIdentifications()

Cython signature: libcpp_vector[PeptideIdentification] getPeptideIdentifications() Returns a const reference to the PeptideIdentification vector

getPrecursors()

Cython signature: libcpp_vector[Precursor] getPrecursors() Returns a const reference to the precursors

getProducts()

Cython signature: libcpp_vector[Product] getProducts() Returns a const reference to the products

getRT()

Cython signature: double getRT() Returns the absolute retention time (in seconds)

getSourceFile()

Cython signature: SourceFile getSourceFile() Returns a const reference to the source file

getStringDataArrays()

Cython signature: libcpp_vector[StringDataArray] getStringDataArrays() Returns the additional string data arrays to store e.g. meta data

getType()

Cython signature: int getType() Returns the spectrum type (centroided (PEAKS) or profile data (RAW))

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

Cython signature: bool isMetaEmpty() Returns if the MetaInfo is empty

isSorted()

Cython signature: bool isSorted() Returns true if the spectrum is sorte by m/z

metaRegistry()

Cython signature: MetaInfoRegistry metaRegistry() Returns a reference to the MetaInfoRegistry

metaValueExists()

Cython signature: bool metaValueExists(String) Returns whether an entry with the given name exists

push_back()

Cython signature: void push_back(Peak1D) Append a peak

removeMetaValue()

Cython signature: void removeMetaValue(String) Removes the DataValue corresponding to name if it exists

reserve()

Cython signature: void reserve(size_t n)

resize()

Cython signature: void resize(size_t n) Resize the peak array

select()

Cython signature: MSSpectrum select(libcpp_vector[size_t] & indices) Subset the spectrum by indices. Also applies to associated data arrays if present.

setAcquisitionInfo()

Cython signature: void setAcquisitionInfo(AcquisitionInfo) Sets the acquisition info

setComment()

Cython signature: void setComment(String) Sets the free-text comment

setDataProcessing()

Cython signature: void setDataProcessing(libcpp_vector[shared_ptr[DataProcessing]])

setDriftTime()

Cython signature: void setDriftTime(double) Sets the drift time (-1 if not set)

setDriftTimeUnit()

Cython signature: void setDriftTimeUnit(DriftTimeUnit dt)

setFloatDataArrays()

Cython signature: void setFloatDataArrays(libcpp_vector[FloatDataArray] fda) Sets the additional float data arrays to store e.g. meta data

setInstrumentSettings()

Cython signature: void setInstrumentSettings(InstrumentSettings) Sets the instrument settings of the current spectrum

setIntegerDataArrays()

Cython signature: void setIntegerDataArrays(libcpp_vector[IntegerDataArray] ida) Sets the additional int data arrays to store e.g. meta data

setMSLevel()

Cython signature: void setMSLevel(unsigned int) Sets the MS level

setMetaValue()

Cython signature: void setMetaValue(String, DataValue) Sets the DataValue corresponding to a name

setName()

Cython signature: void setName(String)

setNativeID()

Cython signature: void setNativeID(String) Sets the native identifier for the spectrum, used by the acquisition software

setPeptideIdentifications()

Cython signature: void setPeptideIdentifications(libcpp_vector[PeptideIdentification]) Sets the PeptideIdentification vector

setPrecursors()

Cython signature: void setPrecursors(libcpp_vector[Precursor]) Sets the precursors

setProducts()

Cython signature: void setProducts(libcpp_vector[Product]) Sets the products

setRT()

Cython signature: void setRT(double) Sets the absolute retention time (in seconds)

setSourceFile()

Cython signature: void setSourceFile(SourceFile) Sets the source file

setStringDataArrays()

Cython signature: void setStringDataArrays(libcpp_vector[StringDataArray] sda) Sets the additional string data arrays to store e.g. meta data

setType()

Cython signature: void setType(SpectrumType) 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()

Cython signature: size_t size() Returns the number of peaks in the spectrum

sortByIntensity()

Cython signature: void sortByIntensity(bool reverse)

sortByPosition()

Cython signature: void sortByPosition()

unify()

Cython signature: void unify(SpectrumSettings)

updateRanges()

Cython signature: void updateRanges()