Exemplo n.º 1
0
def BillerBiemann(im: IntensityMatrix,
                  points: int = 3,
                  scans: int = 1) -> List[Peak]:
    """
    Deconvolution based on the algorithm of Biller and Biemann (1974)

    :param im: An :class:`~pyms.IntensityMatrix.IntensityMatrix` object
    :type im: ~pyms.IntensityMatrix.IntensityMatrix
    :param points: Number of scans over which to consider a maxima to be a peak. Default ``3``
    :type points: int, optional
    :param scans: Number of scans to combine peaks from to compensate for spectra skewing. Default ``1``
    :type scans: int, optional

    :return: List of detected peaks
    :rtype: List[:class:`pyms.Peak.Class.Peak`]

    :authors: Andrew Isaac, Dominic Davis-Foster (type assertions)
    """

    if not isinstance(im, IntensityMatrix):
        raise TypeError("'im' must be an IntensityMatrix object")

    if not isinstance(points, int):
        raise TypeError("'points' must be an integer")

    if not isinstance(scans, int):
        raise TypeError("'scans' must be an integer")

    rt_list = im.time_list
    mass_list = im.mass_list
    peak_list = []
    maxima_im = get_maxima_matrix(im, points, scans)
    numrows = len(maxima_im)

    for row in range(numrows):
        if sum(maxima_im[row]) > 0:
            rt = rt_list[row]
            ms = MassSpectrum(mass_list, maxima_im[row])
            peak = Peak(rt, ms)
            peak.bounds = [0, row, 0]  # store IM index for convenience
            peak_list.append(peak)

    return peak_list
Exemplo n.º 2
0
def BillerBiemann(im: BaseIntensityMatrix,
                  points: int = 3,
                  scans: int = 1) -> List[Peak]:
    """
	Deconvolution based on the algorithm of Biller and Biemann (1974).

	:param im:
	:param points: Number of scans over which to consider a maxima to be a peak.
	:param scans: Number of scans to combine peaks from to compensate for spectra skewing.

	:return: List of detected peaks

	:authors: Andrew Isaac, Dominic Davis-Foster (type assertions)
	"""

    if not isinstance(im, BaseIntensityMatrix):
        raise TypeError("'im' must be an IntensityMatrix object")

    if not isinstance(points, int):
        raise TypeError("'points' must be an integer")

    if not isinstance(scans, int):
        raise TypeError("'scans' must be an integer")

    rt_list = im.time_list
    mass_list = im.mass_list
    peak_list = []
    maxima_im = get_maxima_matrix(im, points, scans)

    for row_idx, row in enumerate(maxima_im):
        if sum(row) > 0:
            rt = rt_list[row_idx]
            ms = MassSpectrum(mass_list, row)
            peak = Peak(rt, ms)
            peak.bounds = (0, row_idx, 0)  # store IM index for convenience
            # TODO: can the bounds be determined from the intensity matrix?
            peak_list.append(peak)

    return peak_list