Lookups
Lookup classes provide iteration, index access, and query methods over collections of frames, precursors, or DIA windows.
tdfpy.Ms1FrameLookup
Ms1FrameLookup(frames: dict[int, T])
Bases: Generic[T]
A class to perform lookups on MS1 frames. Can be iterated over to yield all frames. Can be indexed by frame ID.
Source code in src/tdfpy/lookup.py
16 17 | |
get
get(frame_id: int, default=None)
Return the frame with the given ID, or default if not found.
Source code in src/tdfpy/lookup.py
32 33 34 | |
tdfpy.PrecursorLookup
PrecursorLookup(precursors: dict[int, Precursor])
A class to perform lookups on precursors. Can be iterated over to yield all precursors. Can be indexed by precursor ID. Provides methods to query by m/z and retention time.
Source code in src/tdfpy/lookup.py
129 130 | |
get
get(precursor_id: int, default=None)
Return the precursor with the given ID, or default if not found.
Source code in src/tdfpy/lookup.py
145 146 147 | |
query_range
query_range(
mz_range: tuple[float, float] | None = None,
rt_range: tuple[float, float] | None = None,
) -> Iterator[Precursor]
Query precursors by m/z and/or retention time ranges.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mz_range
|
tuple[float, float] | None
|
Tuple of (min_mz, max_mz). If None, m/z filtering is skipped. |
None
|
rt_range
|
tuple[float, float] | None
|
Tuple of (min_rt, max_rt) in seconds. If None, RT filtering is skipped. |
None
|
Yields: Precursor objects matching the criteria.
Source code in src/tdfpy/lookup.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 | |
query
query(
mz: float | None = None,
rt: float | None = None,
mz_tolerance: float = 20.0,
mz_tolerance_type: Literal["ppm", "da"] = "ppm",
rt_tolerance: float = 30.0,
) -> Iterator[Precursor]
Query precursors by m/z and/or retention time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mz
|
float | None
|
Target m/z value. If None, m/z filtering is skipped. |
None
|
rt
|
float | None
|
Target retention time (in seconds). If None, RT filtering is skipped. |
None
|
mz_tolerance
|
float
|
Tolerance for m/z matching. |
20.0
|
mz_tolerance_type
|
Literal['ppm', 'da']
|
Unit for m/z tolerance ("ppm" or "da"). Default is "ppm". |
'ppm'
|
rt_tolerance
|
float
|
Tolerance for retention time matching (in seconds). Default is 20s. |
30.0
|
Yields:
| Type | Description |
|---|---|
Precursor
|
Precursor objects matching the criteria. |
Note
Uses monoisotopic_mz if available, otherwise largest_peak_mz.
Source code in src/tdfpy/lookup.py
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 | |
tdfpy.DiaWindowLookup
DiaWindowLookup(windows: list[DiaWindow])
A class to perform lookups on DIA windows. Can be iterated over to yield all windows. Can be indexed by window ID (which is equivalent to window_group).
Source code in src/tdfpy/lookup.py
44 45 46 47 48 49 50 51 | |
get
get(window_group_id: int, default=None)
Return windows for the given window group ID, or default if not found.
Source code in src/tdfpy/lookup.py
66 67 68 | |
query_range
query_range(
window_group_index: int | DiaWindowGroup | None = None,
rt_range: tuple[float, float] | None = None,
) -> Iterator[DiaWindow]
Query windows by window group and/or retention time range.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
window_group_index
|
int | DiaWindowGroup | None
|
Window group index or |
None
|
rt_range
|
tuple[float, float] | None
|
Tuple of (min_rt, max_rt) in seconds. If None, RT filtering is skipped. |
None
|
Yields:
| Type | Description |
|---|---|
DiaWindow
|
DiaWindow objects matching the criteria. |
Source code in src/tdfpy/lookup.py
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | |
query
query(
window_group_index: int | DiaWindowGroup | None = None,
rt: float | None = None,
rt_tolerance: float = 30.0,
) -> Iterator[DiaWindow]
Query windows by retention time.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rt
|
float | None
|
Target retention time (in seconds). If None, RT filtering is skipped. |
None
|
rt_tolerance
|
float
|
Tolerance for retention time matching (in seconds). Default is 30s. |
30.0
|
Yields: DiaWindow objects matching the criteria.
Source code in src/tdfpy/lookup.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 | |