MSExperimentDF

class pyopenms.dataframes.MSExperimentDF(*args, **kwargs)

Bases: pyopenms.pyopenms_2.MSExperiment

__init__(*args, **kwargs)
  • Cython signature: void MSExperiment()

  • Cython signature: void MSExperiment(MSExperiment &)

Methods

__init__(*args, **kwargs)

  • Cython signature: void MSExperiment()

addChromatogram

Cython signature: void addChromatogram(MSChromatogram chromatogram)

addSpectrum

Cython signature: void addSpectrum(MSSpectrum spec)

calculateTIC

Cython signature: MSChromatogram calculateTIC() Returns the total ion chromatogram

clear

Cython signature: void clear(bool clear_meta_data) Clear all spectra data and meta data (if called with True)

clearMetaDataArrays

Cython signature: bool clearMetaDataArrays()

clearMetaInfo

Cython signature: void clearMetaInfo() Removes all meta values

clearRanges

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

empty

Cython signature: bool empty()

get2DPeakDataLong

Cython signature: tuple[np.array[float] rt, np.array[float] mz, np.array[float] inty] get2DPeakDataLong(float min_rt, float max_rt, float min_mz, float max_mz)

getChromatogram

Cython signature: MSChromatogram getChromatogram(size_t id_)

getChromatograms

Cython signature: libcpp_vector[MSChromatogram] getChromatograms()

getComment

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

getContacts

Cython signature: libcpp_vector[ContactPerson] getContacts() Returns a reference to the list of contact persons

getDateTime

Cython signature: DateTime getDateTime() Returns the date the experiment was performed

getExperimentalSettings

Cython signature: ExperimentalSettings getExperimentalSettings()

getFractionIdentifier

Cython signature: String getFractionIdentifier() Returns fraction identifier

getHPLC

Cython signature: HPLC getHPLC() Returns a reference to the description of the HPLC run

getIdentifier

Cython signature: String getIdentifier() Retrieve document identifier (e.g.

getInstrument

Cython signature: Instrument getInstrument() Returns a reference to the MS instrument description

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

getLoadedFilePath

Cython signature: String getLoadedFilePath() Returns the file_name which is the absolute path to the file loaded

getLoadedFileType

Cython signature: int getLoadedFileType() Returns the file_type (e.g.

getMSLevels

Cython signature: list[int] getMSLevels()

getMaxIntensity

Cython signature: double getMaxIntensity() Returns the maximum intensity

getMaxMZ

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

getMaxRT

Cython signature: double getMaxRT() Returns the maximum RT

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

getMinRT

Cython signature: double getMinRT() Returns the minimum RT

getNrChromatograms

Cython signature: size_t getNrChromatograms() Returns the number of chromatograms

getNrSpectra

Cython signature: size_t getNrSpectra() Returns the number of MS spectra

getPrecursorSpectrum

Cython signature: int getPrecursorSpectrum(int zero_based_index) Returns the index of the precursor spectrum for spectrum at index @p zero_based_index

getPrimaryMSRunPath

Cython signature: void getPrimaryMSRunPath(StringList & toFill) References to the first MS file(s) after conversions.

getProteinIdentifications

Cython signature: libcpp_vector[ProteinIdentification] getProteinIdentifications() Returns a reference to the protein ProteinIdentification vector

getSample

Cython signature: Sample getSample() Returns a reference to the sample description

getSize

Cython signature: uint64_t getSize() Returns the total number of peaks

getSourceFiles

Cython signature: libcpp_vector[SourceFile] getSourceFiles() Returns a reference to the source data file

getSpectra

Cython signature: libcpp_vector[MSSpectrum] getSpectra()

getSpectrum

Cython signature: MSSpectrum getSpectrum(size_t id_)

get_df([long])

Generates a pandas DataFrame with all peaks in the MSExperiment

get_massql_df()

Exports data from MSExperiment to pandas DataFrames to be used with MassQL.

isMetaEmpty

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

isSorted

  • Cython signature: bool isSorted(bool check_mz)

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

removeMetaValue

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

reserve

Cython signature: void reserve(size_t s)

reserveSpaceChromatograms

Cython signature: void reserveSpaceChromatograms(size_t s)

reserveSpaceSpectra

Cython signature: void reserveSpaceSpectra(size_t s)

reset

Cython signature: void reset()

resize

Cython signature: void resize(size_t s)

setChromatograms

Cython signature: void setChromatograms(libcpp_vector[MSChromatogram] chromatograms)

setComment

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

setContacts

Cython signature: void setContacts(libcpp_vector[ContactPerson] contacts) Sets the list of contact persons

setDateTime

Cython signature: void setDateTime(DateTime date_time) Sets the date the experiment was performed

setFractionIdentifier

Cython signature: void setFractionIdentifier(String fraction_identifier) Sets the fraction identifier

setHPLC

Cython signature: void setHPLC(HPLC hplc) Sets the description of the HPLC run

setIdentifier

Cython signature: void setIdentifier(String id) Sets document identifier (e.g.

setInstrument

Cython signature: void setInstrument(Instrument instrument) Sets the MS instrument description

setLoadedFilePath

Cython signature: void setLoadedFilePath(String file_name) Sets the file_name according to absolute path of the file loaded, preferably done whilst loading

setLoadedFileType

Cython signature: void setLoadedFileType(String file_name) Sets the file_type according to the type of the file loaded from, preferably done whilst loading

setMetaValue

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

setProteinIdentifications

Cython signature: void setProteinIdentifications(libcpp_vector[ProteinIdentification] protein_identifications) Sets the protein ProteinIdentification vector

setSample

Cython signature: void setSample(Sample sample) Sets the sample description

setSourceFiles

Cython signature: void setSourceFiles(libcpp_vector[SourceFile] source_files) Sets the source data file

setSpectra

Cython signature: void setSpectra(libcpp_vector[MSSpectrum] & spectra)

size

Cython signature: int size()

sortChromatograms

  • Cython signature: void sortChromatograms(bool sort_rt)

sortSpectra

  • Cython signature: void sortSpectra(bool sort_mz)

swap

Cython signature: void swap(MSExperiment)

updateRanges

  • Cython signature: void updateRanges()

addChromatogram()

Cython signature: void addChromatogram(MSChromatogram chromatogram)

addSpectrum()

Cython signature: void addSpectrum(MSSpectrum spec)

calculateTIC()

Cython signature: MSChromatogram calculateTIC() Returns the total ion chromatogram

clear()

Cython signature: void clear(bool clear_meta_data) Clear all spectra data and meta data (if called with True)

clearMetaDataArrays()

Cython signature: bool clearMetaDataArrays()

clearMetaInfo()

Cython signature: void clearMetaInfo() Removes all meta values

clearRanges()

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

empty()

Cython signature: bool empty()

get2DPeakDataLong()

Cython signature: tuple[np.array[float] rt, np.array[float] mz, np.array[float] inty] get2DPeakDataLong(float min_rt, float max_rt, float min_mz, float max_mz)

getChromatogram()

Cython signature: MSChromatogram getChromatogram(size_t id_)

getChromatograms()

Cython signature: libcpp_vector[MSChromatogram] getChromatograms()

getComment()

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

getContacts()

Cython signature: libcpp_vector[ContactPerson] getContacts() Returns a reference to the list of contact persons

getDateTime()

Cython signature: DateTime getDateTime() Returns the date the experiment was performed

getExperimentalSettings()

Cython signature: ExperimentalSettings getExperimentalSettings()

getFractionIdentifier()

Cython signature: String getFractionIdentifier() Returns fraction identifier

getHPLC()

Cython signature: HPLC getHPLC() Returns a reference to the description of the HPLC run

getIdentifier()

Cython signature: String getIdentifier() Retrieve document identifier (e.g. an LSID)

getInstrument()

Cython signature: Instrument getInstrument() Returns a reference to the MS instrument description

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

getLoadedFilePath()

Cython signature: String getLoadedFilePath() Returns the file_name which is the absolute path to the file loaded

getLoadedFileType()

Cython signature: int getLoadedFileType() Returns the file_type (e.g. featureXML, consensusXML, mzData, mzXML, mzML, …) of the file loaded

getMSLevels()

Cython signature: list[int] getMSLevels()

getMaxIntensity()

Cython signature: double getMaxIntensity() Returns the maximum intensity

getMaxMZ()

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

getMaxRT()

Cython signature: double getMaxRT() Returns the maximum RT

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

getMinRT()

Cython signature: double getMinRT() Returns the minimum RT

getNrChromatograms()

Cython signature: size_t getNrChromatograms() Returns the number of chromatograms

getNrSpectra()

Cython signature: size_t getNrSpectra() Returns the number of MS spectra

getPrecursorSpectrum()

Cython signature: int getPrecursorSpectrum(int zero_based_index) Returns the index of the precursor spectrum for spectrum at index @p zero_based_index

getPrimaryMSRunPath()

Cython signature: void getPrimaryMSRunPath(StringList & toFill) References to the first MS file(s) after conversions. Used to trace results back to original data.

getProteinIdentifications()

Cython signature: libcpp_vector[ProteinIdentification] getProteinIdentifications() Returns a reference to the protein ProteinIdentification vector

getSample()

Cython signature: Sample getSample() Returns a reference to the sample description

getSize()

Cython signature: uint64_t getSize() Returns the total number of peaks

getSourceFiles()

Cython signature: libcpp_vector[SourceFile] getSourceFiles() Returns a reference to the source data file

getSpectra()

Cython signature: libcpp_vector[MSSpectrum] getSpectra()

getSpectrum()

Cython signature: MSSpectrum getSpectrum(size_t id_)

get_df(long: bool = False)

Generates a pandas DataFrame with all peaks in the MSExperiment

Parameters: long: set to True if you want to have a long/expanded/melted dataframe with one row per peak. Faster but

replicated RT information. If False, returns rows in the style: rt, np.array(mz), np.array(int)

Returns: pandas.DataFrame: feature information stored in a DataFrame

get_massql_df()

Exports data from MSExperiment to pandas DataFrames to be used with MassQL.

The Python module massql allows queries in mass spectrometry data (MS1 and MS2 data frames) in a SQL like fashion (https://github.com/mwang87/MassQueryLanguage).

Both dataframes contain the columns: ‘i’: intensity of a peak ‘i_norm’: intensity normalized by the maximun intensity in the spectrum ‘i_tic_norm’: intensity normalized by the sum of intensities (TIC) in the spectrum ‘mz’: mass to charge of a peak ‘scan’: number of the spectrum ‘rt’: retention time of the spectrum ‘polarity’: ion mode of the spectrum as integer value (positive: 1, negative: 2)

The MS2 dataframe contains additional columns: ‘precmz’: mass to charge of the precursor ion ‘ms1scan’: number of the corresponding MS1 spectrum ‘charge’: charge of the precursor ion

Returns: ms1_df (pandas.DataFrame): peak data of MS1 spectra ms2_df (pandas.DataFrame): peak data of MS2 spectra with precursor information

isMetaEmpty()

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

isSorted()
  • Cython signature: bool isSorted(bool check_mz) Checks if all spectra are sorted with respect to ascending RT

  • Cython signature: bool isSorted()

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

removeMetaValue()

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

reserve()

Cython signature: void reserve(size_t s)

reserveSpaceChromatograms()

Cython signature: void reserveSpaceChromatograms(size_t s)

reserveSpaceSpectra()

Cython signature: void reserveSpaceSpectra(size_t s)

reset()

Cython signature: void reset()

resize()

Cython signature: void resize(size_t s)

setChromatograms()

Cython signature: void setChromatograms(libcpp_vector[MSChromatogram] chromatograms)

setComment()

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

setContacts()

Cython signature: void setContacts(libcpp_vector[ContactPerson] contacts) Sets the list of contact persons

setDateTime()

Cython signature: void setDateTime(DateTime date_time) Sets the date the experiment was performed

setFractionIdentifier()

Cython signature: void setFractionIdentifier(String fraction_identifier) Sets the fraction identifier

setHPLC()

Cython signature: void setHPLC(HPLC hplc) Sets the description of the HPLC run

setIdentifier()

Cython signature: void setIdentifier(String id) Sets document identifier (e.g. an LSID)

setInstrument()

Cython signature: void setInstrument(Instrument instrument) Sets the MS instrument description

setLoadedFilePath()

Cython signature: void setLoadedFilePath(String file_name) Sets the file_name according to absolute path of the file loaded, preferably done whilst loading

setLoadedFileType()

Cython signature: void setLoadedFileType(String file_name) Sets the file_type according to the type of the file loaded from, preferably done whilst loading

setMetaValue()

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

setProteinIdentifications()

Cython signature: void setProteinIdentifications(libcpp_vector[ProteinIdentification] protein_identifications) Sets the protein ProteinIdentification vector

setSample()

Cython signature: void setSample(Sample sample) Sets the sample description

setSourceFiles()

Cython signature: void setSourceFiles(libcpp_vector[SourceFile] source_files) Sets the source data file

setSpectra()

Cython signature: void setSpectra(libcpp_vector[MSSpectrum] & spectra)

size()

Cython signature: int size()

sortChromatograms()
  • Cython signature: void sortChromatograms(bool sort_rt) Sorts chromatograms by m/z. If sort_rt=True also sort each chromatogram RT

  • Cython signature: void sortChromatograms()

sortSpectra()
  • Cython signature: void sortSpectra(bool sort_mz) Sorts spectra by RT. If sort_mz=True also sort each peak in a spectrum by m/z

  • Cython signature: void sortSpectra()

swap()

Cython signature: void swap(MSExperiment)

updateRanges()
  • Cython signature: void updateRanges() Recalculate global RT and m/z ranges after changes to the data has been made.

  • Cython signature: void updateRanges(int msLevel) Recalculate RT and m/z ranges for a specific MS level