mscompress (top-level)¶
The entry-point module. Re-exports everything from
mscompress._core, mscompress.mszx,
mscompress.metadata, and
mscompress.annotations.
read
¶
read(
path: Union[str, PathLike, bytes],
*,
cache=None,
cache_spectra: int = CACHE_SPECTRA_AUTO,
) -> Union[MZMLFile, MSZFile, MSZXFile]
Read and parse mzML, MSZ, or MSZX files.
Both cache and cache_spectra are exposed only here; the file
constructors deliberately don't expose them. read() is the single
entry point for both knobs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Union[str, PathLike, bytes]
|
Path to the file to read. |
required |
cache
|
Optional[Union[BlockCache, int]]
|
Shared decompressed-block
cache for MSZ/MSZX files. |
None
|
cache_spectra
|
int
|
Per-file LRU cap for cached |
CACHE_SPECTRA_AUTO
|
Returns:
| Type | Description |
|---|---|
Union[MZMLFile, MSZFile, MSZXFile]
|
Union[MZMLFile, MSZFile, MSZXFile]: Parsed file object. A v2 (batch) |
Union[MZMLFile, MSZFile, MSZXFile]
|
|
Utility functions¶
A versatile compression tool for efficient management of mass-spectrometry data.
get_num_threads
¶
Get the number of available threads on the system.
Returns:
| Type | Description |
|---|---|
int
|
Number of usable threads. |
get_filesize
¶
Get the size of a file in bytes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
Union[str, bytes]
|
Path to file (string or bytes). |
required |
Returns:
| Type | Description |
|---|---|
int
|
Size of the file in bytes. |
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If file does not exist. |
list_algorithms
¶
list_algorithms() -> list[AlgorithmInfo]
Return a list of available lossy algorithm descriptors from the C registry.
Top-level types¶
AlgorithmInfo
¶
Bases: TypedDict
Descriptor for a lossy transformation algorithm.
SpectrumDict
¶
Bases: TypedDict
Dictionary representing a spectrum's binary data arrays.
SpectrumTransform
¶
Bases: Protocol
Protocol for spectrum transform callables.
A transform receives a SpectrumDict and returns a SpectrumDict. Both input and output must contain 'mz' and 'intensity' keys with NumPy arrays of equal length.