pyms.BillerBiemann

Functions to perform Biller and Biemann deconvolution.

Functions:

BillerBiemann(im[, points, scans])

Deconvolution based on the algorithm of Biller and Biemann (1974).

get_maxima_indices(ion_intensities[, points])

Returns the scan indices for the apexes of the ion.

get_maxima_list(ic[, points])

List of retention time and intensity of local maxima for ion.

get_maxima_list_reduced(ic, mp_rt[, points, …])

List of retention time and intensity of local maxima for ion.

get_maxima_matrix(im[, points, scans])

Constructs a matrix containing only data for scans in which particular ions apexed.

num_ions_threshold(pl, n, cutoff[, copy_peaks])

Remove Peaks where there are fewer than n ions with intensities above the given threshold.

rel_threshold(pl[, percent, copy_peaks])

Remove ions with relative intensities less than the given relative percentage of the maximum intensity.

sum_maxima(im[, points, scans])

Reconstruct the TIC as sum of maxima.

BillerBiemann(im, points=3, scans=1)[source]

Deconvolution based on the algorithm of Biller and Biemann (1974).

Parameters
  • im (BaseIntensityMatrix)

  • points (int) – Number of scans over which to consider a maxima to be a peak. Default 3.

  • scans (int) – Number of scans to combine peaks from to compensate for spectra skewing. Default 1.

Return type

List[Peak]

Returns

List of detected peaks

Authors

Andrew Isaac, Dominic Davis-Foster (type assertions)

get_maxima_indices(ion_intensities, points=3)[source]

Returns the scan indices for the apexes of the ion.

Parameters
  • ion_intensities (Union[Sequence, ndarray]) – A list of intensities for a single ion.

  • points (int) – Number of scans over which to consider a maxima to be a peak. Default 3.

Author

Andrew Isaac, Dominic Davis-Foster (type assertions)

Example:

>>> # A trivial set of data with two clear peaks
>>> data = [1, 2, 3, 4, 5, 4, 3, 2, 1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1]
>>> get_maxima_indices(data)
[4, 13]
>>> # Wider window (more points)
>>> get_maxima_indices(data, points=10)
[13]
Return type

List[int]

get_maxima_list(ic, points=3)[source]

List of retention time and intensity of local maxima for ion.

Parameters
  • ic (IonChromatogram)

  • points (int) – Number of scans over which to consider a maxima to be a peak. Default 3.

Return type

List[List[float]]

Returns

A list of retention time and intensity of local maxima for ion.

Author

Andrew Isaac, Dominic Davis-Foster (type assertions)

get_maxima_list_reduced(ic, mp_rt, points=13, window=3)[source]

List of retention time and intensity of local maxima for ion.

Only peaks around a specific retention time are recorded.
Created for use with gap filling algorithm.
Parameters
  • ic (IonChromatogram)

  • mp_rt (float) – The retention time of the missing peak

  • points (int) – Number of scans over which to consider a maxima to be a peak. Default 13.

  • window (int) – The window around mp_rt where peaks should be recorded. Default 3.

Return type

List[Tuple[float, float]]

Returns

A list of 2-element tuple containing the retention time and intensity of local maxima for each ion.

Author

Andrew Isaac, Dominic Davis-Foster (type assertions)

get_maxima_matrix(im, points=3, scans=1)[source]

Constructs a matrix containing only data for scans in which particular ions apexed.

The data can be optionally consolidated into the scan within a range with the highest total intensity by adjusting the scans parameter. By default this is 1, which does not consolidate the data.

The columns are ion masses and the rows are scans. Get matrix of local maxima for each ion.

Parameters
  • im (BaseIntensityMatrix)

  • points (int) – Number of scans over which to consider a maxima to be a peak. Default 3.

  • scans (int) – Number of scans to combine peaks from to compensate for spectra skewing. Default 1.

Return type

ndarray

Returns

A matrix of giving the intensities of ion masses (columns) and for each scan (rows).

Author

Andrew Isaac, Dominic Davis-Foster (type assertions)

num_ions_threshold(pl, n, cutoff, copy_peaks=True)[source]

Remove Peaks where there are fewer than n ions with intensities above the given threshold.

Parameters
  • pl (Sequence[Peak])

  • n (int) – Minimum number of ions that must have intensities above the cutoff.

  • cutoff (float) – The minimum intensity threshold.

  • copy_peaks (bool) – Whether the returned peak list should contain copies of the peaks. Default True.

Return type

List[Peak]

Returns

A new list of Peak objects.

Author

Andrew Isaac, Dominic Davis-Foster (type assertions)

rel_threshold(pl, percent=2, copy_peaks=True)[source]

Remove ions with relative intensities less than the given relative percentage of the maximum intensity.

Parameters
  • pl (Sequence[Peak])

  • percent (float) – Threshold for relative percentage of intensity. Default 2%.

  • copy_peaks (bool) – Whether the returned peak list should contain copies of the peaks. Default True.

Return type

List[Peak]

Returns

A new list of Peak objects with threshold ions.

Author

Andrew Isaac, Dominic Davis-Foster (type assertions)

sum_maxima(im, points=3, scans=1)[source]

Reconstruct the TIC as sum of maxima.

Parameters
  • im (BaseIntensityMatrix)

  • points (int) – Peak if maxima over ‘points’ number of scans. Default 3.

  • scans (int) – Number of scans to combine peaks from to compensate for spectra skewing. Default 1.

Return type

IonChromatogram

Returns

The reconstructed TIC.

Author

Andrew Isaac, Dominic Davis-Foster (type assertions)