Skip to content

Precursor

tdfpy.Precursor dataclass

Precursor(
    _timsdata: TimsData,
    precursor_id: int,
    largest_peak_mz: float,
    average_mz: float,
    monoisotopic_mz: float | None,
    charge: int | None,
    scan_number: float,
    intensity: float,
    parent_frame: int,
    pasef_frame_msms_infos: tuple[PasefFrameMsmsInfo, ...],
    rt: float,
)

Bases: _TdfData

A detected precursor ion from a DDA acquisition.

Combines data from the Precursors table with its associated PASEF MS/MS scan windows (PasefFrameMsmsInfo). Provides direct access to ion mobility, CCS, and fragmentation spectra.

Field Type Description
precursor_id int Unique precursor ID
largest_peak_mz float m/z of the most intense isotope peak
average_mz float Intensity-weighted average m/z
monoisotopic_mz float \| None Monoisotopic m/z (if determined)
charge int \| None Charge state (if determined)
scan_number float Fractional mobility scan coordinate
intensity float Summed precursor intensity
parent_frame int MS1 frame ID
pasef_frame_msms_infos tuple[PasefFrameMsmsInfo, ...] Associated PASEF MS/MS windows
rt float Retention time in seconds

peaks property

peaks: npt.NDArray[np.float64]

Centroided PASEF MS/MS peaks for this precursor.

Sums every PASEF subscan of this precursor — which may span several frames — collapses the mobility dimension, then centroids by greedy m/z merging. See :func:~tdfpy.centroiding.get_mobility_collapsed_spectrum.

Returns a single (N, 2) array of [m/z, intensity] (already centroided and 2-D), unlike Frame.peaks / DiaWindow.raw_peaks which return raw peaks as a list of per-scan arrays. Do not iterate this expecting one entry per scan.

tdfpy.PasefFrameMsmsInfo dataclass

PasefFrameMsmsInfo(
    _timsdata: TimsData,
    frame_id: int,
    scan_num_begin: int,
    scan_num_end: int,
    isolation_mz: float,
    isolation_width: float,
    collision_energy: float,
    precursor: int | None,
    rt: float,
    polarity: Polarity,
)

Bases: _TdfData

A single PASEF MS/MS isolation window within a parent frame.

Each instance corresponds to one row in the PasefFrameMsMsInfo table: a contiguous range of mobility scans acquired with a specific isolation window and collision energy, linked to a precursor ion.

Field Type Description
frame_id int Parent MS1 frame ID
scan_num_begin int First mobility scan (inclusive)
scan_num_end int Mobility scan range end (exclusive) — the range is [scan_num_begin, scan_num_end)
isolation_mz float Isolation window center m/z
isolation_width float Isolation window width in Th
collision_energy float Collision energy in eV
precursor int \| None Associated precursor ID
rt float Retention time in seconds (from parent frame)
polarity Polarity Ion polarity

peaks property

peaks: npt.NDArray[np.float64]

Centroided MS/MS peaks summed over this window's scan range.

The mobility dimension is summed away and the resulting profile is centroided by greedy m/z merging — see :func:~tdfpy.centroiding.get_mobility_collapsed_spectrum.

Returns a single (N, 2) array of [m/z, intensity] — note this is already centroided and 2-D, unlike Frame.peaks / DiaWindow.raw_peaks which return raw peaks as a list of per-scan arrays. Do not iterate this expecting one entry per scan.