Readers¶
High-level entry points for opening timsTOF .d acquisitions.
tdfpy.get_acquisition_type
¶
Determine the acquisition type (DDA, DIA, or PRM) of a .d folder by examining the MsMsType values in the Frames table.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
analysis_dir
|
str | Path
|
Path to the .d folder |
required |
Returns:
| Type | Description |
|---|---|
AcquisitionType
|
|
AcquisitionType
|
type found (checked in that order), or |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If analysis.tdf does not exist |
Source code in src/tdfpy/reader.py
tdfpy.DDA
¶
Bases: _DFolder
Open a DDA (Data-Dependent Acquisition) .d folder.
Use as a context manager so the TimsData connection is closed when done.
Exposes MS1 frames via ms1 and precursors via precursors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
analysis_dir
|
str | Path
|
Path to the |
required |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the |
AcquisitionTypeError
|
If the folder holds a DIA or PRM acquisition. |
TdfpyError
|
If a frame has an MsMsType other than MS1 or DDA MS/MS. |
Note
PasefFrameMsMsInfo rows with a NULL Precursor are tolerated: the
PasefFrameMsmsInfo element is built with precursor_id=None and
logged, rather than failing the whole file. Such rows are not
reachable from any Precursor.
Source code in src/tdfpy/reader.py
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 | |
timsdata
property
¶
timsdata: TimsData
The open :class:TimsData handle on analysis.tdf_bin.
Raises:
| Type | Description |
|---|---|
ReaderClosedError
|
If the reader was closed. |
pandas_tdf
property
¶
pandas_tdf: PandasTdf
A :class:PandasTdf view of analysis.tdf.
Raises:
| Type | Description |
|---|---|
ReaderClosedError
|
If the reader was closed. |
metadata
property
¶
metadata: MetaData
Global metadata about the acquisition.
Raises:
| Type | Description |
|---|---|
ReaderClosedError
|
If the reader was closed. |
calibration
property
¶
calibration: Calibration
ms1
property
¶
ms1: Ms1FrameLookup[DDAMs1Frame]
Lookup for MS1 frames. Supports indexing by frame ID.
precursors
property
¶
precursors: PrecursorLookup
Lookup for all precursors. Supports indexing by precursor ID and .query().
close
¶
tdfpy.DIA
¶
Bases: _DFolder
Open a DIA (Data-Independent Acquisition) .d folder.
Use as a context manager so the TimsData connection is closed when done.
Exposes MS1 frames via ms1, per-frame windows via windows, and the
window definitions via window_groups.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
analysis_dir
|
str | Path
|
Path to the |
required |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the |
AcquisitionTypeError
|
If the folder holds a DDA or PRM acquisition. |
TdfpyError
|
If a frame has an MsMsType other than MS1 or DIA MS/MS. |
Example
Source code in src/tdfpy/reader.py
timsdata
property
¶
timsdata: TimsData
The open :class:TimsData handle on analysis.tdf_bin.
Raises:
| Type | Description |
|---|---|
ReaderClosedError
|
If the reader was closed. |
pandas_tdf
property
¶
pandas_tdf: PandasTdf
A :class:PandasTdf view of analysis.tdf.
Raises:
| Type | Description |
|---|---|
ReaderClosedError
|
If the reader was closed. |
metadata
property
¶
metadata: MetaData
Global metadata about the acquisition.
Raises:
| Type | Description |
|---|---|
ReaderClosedError
|
If the reader was closed. |
calibration
property
¶
calibration: Calibration
ms1
property
¶
ms1: Ms1FrameLookup[DIAMs1Frame]
Lookup for MS1 frames. Supports indexing by frame ID.
windows
property
¶
windows: DiaWindowLookup
Lookup for all per-frame DIA windows. Indexed by window group ID; supports .query().
window_groups
property
¶
window_groups: tuple[DiaWindowGroup, ...]
Every window definition (DiaFrameMsMsWindows row), grouped by window group ID.
close
¶
tdfpy.PRM
¶
Bases: _DFolder
Open a PRM (Parallel Reaction Monitoring) .d folder.
Use as a context manager so the TimsData connection is closed when done.
Exposes MS1 frames via ms1, PRM targets via targets, and individual
transitions via transitions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
analysis_dir
|
str | Path
|
Path to the |
required |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the |
AcquisitionTypeError
|
If the folder holds a DDA or DIA acquisition. |
TdfpyError
|
If a frame has an MsMsType other than MS1 or PRM MS/MS. |
Example
Source code in src/tdfpy/reader.py
timsdata
property
¶
timsdata: TimsData
The open :class:TimsData handle on analysis.tdf_bin.
Raises:
| Type | Description |
|---|---|
ReaderClosedError
|
If the reader was closed. |
pandas_tdf
property
¶
pandas_tdf: PandasTdf
A :class:PandasTdf view of analysis.tdf.
Raises:
| Type | Description |
|---|---|
ReaderClosedError
|
If the reader was closed. |
metadata
property
¶
metadata: MetaData
Global metadata about the acquisition.
Raises:
| Type | Description |
|---|---|
ReaderClosedError
|
If the reader was closed. |
calibration
property
¶
calibration: Calibration
ms1
property
¶
ms1: Ms1FrameLookup[PRMMs1Frame]
Lookup for MS1 frames. Supports indexing by frame ID.
targets
property
¶
targets: PrmTargetLookup
Lookup for all PRM targets. Supports indexing by target ID and .query().
transitions
property
¶
transitions: PrmTransitionLookup
Lookup for all PRM transitions. Supports indexing by target ID and .query().