コード例 #1
0
def get_maxima_list(ic: IonChromatogram, points: List = 3) -> int:
    """
    List of retention time and intensity of local maxima for ion

    :param ic: An :class:`~pyms.IonChromatogram.IonChromatogram` object
    :type ic: ~pyms.IonChromatogram.IonChromatogram
    :param points: Number of scans over which to consider a maxima to be a peak. Default ``3``
    :type points: int

    :return: A list of retention time and intensity of local maxima for ion
    :rtype: list

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

    if not isinstance(ic, IonChromatogram):
        raise TypeError("'ic' must be an IonChromatogram object")

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

    peak_point = get_maxima_indices(ic.intensity_array, points)
    mlist = []

    for index in range(len(peak_point)):
        rt = ic.get_time_at_index(peak_point[index])
        intensity = ic.get_intensity_at_index(peak_point[index])
        mlist.append([rt, intensity])

    return mlist
コード例 #2
0
def get_maxima_list_reduced(ic: IonChromatogram,
                            mp_rt: float,
                            points: int = 13,
                            window: int = 3) -> List:
    """
    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.

    :param ic: An :class:`~pyms.IonChromatogram.IonChromatogram` object
    :type ic: ~pyms.IonChromatogram.IonChromatogram
    :param mp_rt: The retention time of the missing peak
    :type mp_rt: float
    :param points: Number of scans over which to consider a maxima to be a peak. Default ``13``
    :type points: int, optional
    :param window: The window around the ``mp_rt`` where peaks should be recorded. Default ``3``
    :type window: int, optional

    :return: A list of retention time and intensity of local maxima for ion
    :rtype: list

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

    if not isinstance(ic, IonChromatogram):
        raise TypeError("'ic' must be an IonChromatogram object")

    if not isinstance(mp_rt, Number):
        raise TypeError("'mp_rt' must be an integer")

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

    peak_point = get_maxima_indices(ic.intensity_array, points)
    maxima_list = []

    for index in range(len(peak_point)):
        rt = ic.get_time_at_index(peak_point[index])

        if (rt > float(mp_rt) - window) and (rt < float(mp_rt) + window):
            intensity = ic.get_intensity_at_index(peak_point[index])
            maxima_list.append([rt, intensity])
        else:
            pass

    return maxima_list
コード例 #3
0
def get_maxima_list_reduced(
    ic: IonChromatogram,
    mp_rt: float,
    points: int = 13,
    window: int = 3,
) -> List[Tuple[float, float]]:
    """
	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.

	:param ic:
	:param mp_rt: The retention time of the missing peak
	:param points: Number of scans over which to consider a maxima to be a peak.
	:param window: The window around ``mp_rt`` where peaks should be recorded.

	:return: 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)
	"""

    if not isinstance(ic, IonChromatogram):
        raise TypeError("'ic' must be an IonChromatogram object")

    if not is_number(mp_rt):
        raise TypeError("'mp_rt' must be a number")

    peak_point = get_maxima_indices(ic.intensity_array, points)
    maxima_list = []

    for index in range(len(peak_point)):
        rt = ic.get_time_at_index(peak_point[index])

        if (rt > float(mp_rt) - window) and (rt < float(mp_rt) + window):
            intensity = ic.get_intensity_at_index(peak_point[index])
            maxima_list.append((rt, intensity))

    return maxima_list