mscompress-test / README.md
chrisagrams's picture
Upload README.md with huggingface_hub
ab93432 verified
metadata
license: unknown
task_categories:
  - other
tags:
  - mass-spectrometry
  - proteomics
  - metabolomics
  - mscompress
size_categories:
  - n<1K

My MSZ Dataset

A dataset containing mass spectrometry data in MSZ format.

Dataset Information

  • Format: MSZ (compressed mass spectrometry)
  • Number of files: 1
  • Granularity: spectrum-level
  • Filter: All MS levels

Files

  • test.msz

Usage

This dataset requires the mscompress library to load the MSZ files.

Installation

pip install mscompress

Loading the Dataset

from datasets import load_dataset

# Load the dataset
dataset = load_dataset("my-msz-dataset")

# Access spectra
for example in dataset["train"]:
    mz = example["mz"]
    intensity = example["intensity"]
    print(f"Spectrum {example['scan_number']}: {len(mz)} peaks")

Direct MSZ File Access

For more control, you can download and read the MSZ files directly:

import mscompress
from huggingface_hub import hf_hub_download

# Download an MSZ file
msz_path = hf_hub_download(
    repo_id="<repo_id>",
    filename="data/test.msz",
    repo_type="dataset"
)

# Read with mscompress
msz = mscompress.read(msz_path)

# Access spectra with random access
spectrum = msz.spectra[0]
print(f"m/z: {spectrum.mz}")
print(f"Intensity: {spectrum.intensity}")

Dataset Structure

Spectrum-level Features

  • source_file: Name of the source MSZ file
  • spectrum_index: Index of the spectrum in the file
  • scan_number: Scan number from the instrument
  • ms_level: MS level (1 for MS1, 2 for MS2/MS3, etc.)
  • retention_time: Retention time in seconds
  • num_peaks: Number of m/z-intensity pairs
  • mz: Array of m/z values
  • intensity: Array of intensity values

Citation

If you use this dataset, please cite the mscompress library:

@software{mscompress,
  title = {mscompress: High-performance compression for mass spectrometry data},
  url = {https://github.com/chrisagrams/mscompress}
}

License

Please check with the dataset creator for license information.