PScore#

class pyopenms.PScore#

Bases: object

Cython implementation of _PScore

Original C++ documentation is available here

__init__()#

Overload:

__init__(self) None

Overload:

__init__(self, in_0: PScore) None

Methods

__init__

Overload:

calculateIntensityRankInMZWindow(self, mz, ...)

Calculate local (windowed) peak ranks

calculatePeakLevelSpectra(self, spec, ranks, ...)

Calculates spectra for peak level between min_level to max_level and stores them in the map

calculateRankMap(self, peak_map, mz_window)

Precalculated, windowed peak ranks for a whole experiment

computePScore

Overload:

calculateIntensityRankInMZWindow(self, mz: List[float], intensities: List[float], mz_window: float) List[int]#

Calculate local (windowed) peak ranks

The peak rank is defined as the number of neighboring peaks in +/- (mz_window/2) that have higher intensity The result can be used to efficiently filter spectra for top 1..n peaks in mass windows

Parameters:
  • mz – The m/z positions of the peaks

  • intensities – The intensities of the peaks

  • mz_window – The window in Thomson centered at each peak

calculatePeakLevelSpectra(self, spec: MSSpectrum, ranks: List[int], min_level: int, max_level: int) Dict[int, MSSpectrum]#

Calculates spectra for peak level between min_level to max_level and stores them in the map

A spectrum of peak level n retains the (n+1) top intensity peaks in a sliding mz_window centered at each peak

calculateRankMap(self, peak_map: MSExperiment, mz_window: float) List[List[int]]#

Precalculated, windowed peak ranks for a whole experiment

The peak rank is defined as the number of neighboring peaks in +/- (mz_window/2) that have higher intensity

Parameters:
  • peak_map – Fragment spectra used for rank calculation. Typically a peak map after removal of all MS1 spectra

  • mz_window – Window in Thomson centered at each peak

computePScore()#

Overload:

computePScore(self, fragment_mass_tolerance: float, fragment_mass_tolerance_unit_ppm: bool, peak_level_spectra: Dict[int, MSSpectrum], theo_spectra: List[MSSpectrum], mz_window: float) float

Computes the PScore for a vector of theoretical spectra

Similar to Andromeda, a vector of theoretical spectra can be provided that e.g. contain loss spectra or higher charge spectra depending on the sequence. The best score obtained by scoring all those theoretical spectra against the experimental ones is returned

Parameters:
  • fragment_mass_tolerance – Mass tolerance for matching peaks

  • fragment_mass_tolerance_unit_ppm – Whether Thomson or ppm is used

  • peak_level_spectra – Spectra for different peak levels (=filtered by maximum rank).

  • theo_spectra – Theoretical spectra as obtained e.g. from TheoreticalSpectrumGenerator

  • mz_window – Window in Thomson centered at each peak

Overload:

computePScore(self, fragment_mass_tolerance: float, fragment_mass_tolerance_unit_ppm: bool, peak_level_spectra: Dict[int, MSSpectrum], theo_spectrum: MSSpectrum, mz_window: float) float

Computes the PScore for a single theoretical spectrum

Parameters:
  • fragment_mass_tolerance – Mass tolerance for matching peaks

  • fragment_mass_tolerance_unit_ppm – Whether Thomson or ppm is used

  • peak_level_spectra – Spectra for different peak levels (=filtered by maximum rank)

  • theo_spectra – Theoretical spectra as obtained e.g. from TheoreticalSpectrumGenerator

  • mz_window – Window in Thomson centered at each peak