Spectrum

Overview

class modifinder.classes.Spectrum(incoming_data=None, normalize_peaks=True, **kwargs)[source]

A class to represent a spectrum.

Parameters:
  • mz (list) – A list of m/z values.

  • intensity (list) – A list of intensity values.

  • precursor_mz (float) – The precursor m/z value.

  • precursor_charge (int) – The precursor charge.

  • adduct (str) – The adduct.

  • ms_level (int) – The ms level, default is 2.

  • instrument (str, optional) – The instrument used.

  • ms_mass_analyzer (str, optional) – The mass analyzer used.

  • ms_dissociation_method (str, optional) – The dissociation method used.

  • spectrum_id (str, optional) – The spectrum id.

Examples

__init__(incoming_data=None, normalize_peaks=True, **kwargs)[source]

Constructor for the Spectrum class.

the spectrum class can be initialized with a dictionary of data or with the individual values.

Parameters:
  • incoming_data (Input data (optional, default is None).) – The data to initialize the Spectrum object. The data can be a dictionary, a usi, or a Spectrum object.

  • normalize_peaks (bool, default is True.) – If True, the intensity of the peaks will be normalized at initialization.

Methods

update([peaks, peaks_json, mz, intensity, ...])

Update the Spectrum object with the given values.

clear()

Clear the Spectrum object.

normalize_peaks([change_self])

l2 Normalize the intensity of the Spectrum object.

remove_small_peaks([ratio_to_base_peak, ...])

Remove peaks with intensity lower than a given ratio to the base peak.

keep_top_k([k, change_self])

Keep only the top k peaks in the Spectrum object.