Lookup
mzmlpy.lookup.SpectrumLookup
SpectrumLookup(
file_object: FileInterface,
count: int | None = None,
id_regex: str | None = None,
)
Bases: BaseLookup[Spectrum]
Lookup interface for spectra.
Source code in src/mzmlpy/lookup.py
15 16 17 18 19 | |
count
property
count: int | None
Get count of items.
filter
filter(
*,
ms_level: int | None = None,
retention_time: (
tuple[float | None, float | None] | None
) = None,
polarity: Literal["positive", "negative"] | None = None,
precursor_mz: (
tuple[float | None, float | None] | None
) = None,
spectrum_type: (
Literal["centroid", "profile"] | None
) = None,
mobility_type: (
Literal["inverse_reduced", "drift_time"] | None
) = None,
ion_mobility: (
tuple[float | None, float | None] | None
) = None,
faims_voltage: (
tuple[float | None, float | None] | None
) = None
) -> Iterator[Spectrum]
Lazily select spectra by metadata, using inclusive time bounds in seconds.
Criteria are combined with AND. Retention time matches any scan. Precursor m/z matches overlapping isolation windows, with selected ions as a fallback. Missing metadata does not match a requested criterion. Keep the reader open while iterating.
Source code in src/mzmlpy/lookup.py
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | |
get_by_index
get_by_index(index: int | str) -> T
Get item by index. Negative indices count from the end, like a list.
Source code in src/mzmlpy/lookup.py
40 41 42 43 44 45 46 47 48 49 50 51 | |
get_by_id
get_by_id(identifier: str) -> T
Get item by ID.
Source code in src/mzmlpy/lookup.py
53 54 55 | |
get_by_slice
get_by_slice(slice_obj: slice) -> list[T]
Get items by slice notation.
Source code in src/mzmlpy/lookup.py
57 58 59 60 61 62 63 64 65 | |
next
next() -> T
Advance a persistent cursor and return the next item.
The cursor is created on first call and advances on each subsequent call, raising
StopIteration once every item has been returned. Call :meth:reset to start over.
Source code in src/mzmlpy/lookup.py
92 93 94 95 96 97 98 99 100 | |
reset
reset() -> None
Reset the cursor used by :meth:next so the next call starts from the first item.
Source code in src/mzmlpy/lookup.py
102 103 104 | |
mzmlpy.lookup.ChromatogramLookup
ChromatogramLookup(
file_object: FileInterface,
count: int | None = None,
id_regex: str | None = None,
)
Bases: BaseLookup[Chromatogram]
Lookup interface for chromatograms.
Source code in src/mzmlpy/lookup.py
15 16 17 18 19 | |
count
property
count: int | None
Get count of items.
get_by_index
get_by_index(index: int | str) -> T
Get item by index. Negative indices count from the end, like a list.
Source code in src/mzmlpy/lookup.py
40 41 42 43 44 45 46 47 48 49 50 51 | |
get_by_id
get_by_id(identifier: str) -> T
Get item by ID.
Source code in src/mzmlpy/lookup.py
53 54 55 | |
get_by_slice
get_by_slice(slice_obj: slice) -> list[T]
Get items by slice notation.
Source code in src/mzmlpy/lookup.py
57 58 59 60 61 62 63 64 65 | |
next
next() -> T
Advance a persistent cursor and return the next item.
The cursor is created on first call and advances on each subsequent call, raising
StopIteration once every item has been returned. Call :meth:reset to start over.
Source code in src/mzmlpy/lookup.py
92 93 94 95 96 97 98 99 100 | |
reset
reset() -> None
Reset the cursor used by :meth:next so the next call starts from the first item.
Source code in src/mzmlpy/lookup.py
102 103 104 | |