CLI Reference#

MaldiAMRKit ships a command-line interface built on Typer. Three subcommands cover the most common batch-processing workflows: preprocessing spectra into feature matrices, generating quality reports, and building standardised dataset directories.

Command Reference#

Usage Examples#

Preprocess#

Build a CSV feature matrix from a directory of .txt spectra:

maldiamrkit preprocess -i data/ -o features.csv -b 3

Save individual preprocessed spectra alongside the feature matrix:

maldiamrkit preprocess -i data/ -o features.csv --save-spectra-dir processed/

Use a custom preprocessing pipeline defined in YAML:

maldiamrkit preprocess -i data/ -o features.csv -p config.yaml

Quality#

Generate a per-spectrum quality report (SNR, TIC, peak count, etc.):

maldiamrkit quality -i data/ -o quality_report.csv

Build#

Build a DRIAMS-like dataset directory from flat .txt spectra (default layout):

maldiamrkit build -s data/ -m meta.csv -o output/

Build from a Bruker binary tree:

maldiamrkit build -s data/ -m meta.csv -o output/ -l bruker

Customise Bruker-specific column names:

maldiamrkit build -s data/ -m meta.csv -o output/ -l bruker \
  --path-column SpectrumPath --target-position-column Position

Organise output into year-based subfolders:

maldiamrkit build -s data/ -m meta.csv -o output/ --year-column acquisition_date

Add extra processing handlers from a YAML config:

maldiamrkit build -s data/ -m meta.csv -o output/ --extra-handlers handlers.yaml

Pipeline Configuration#

The --pipeline option accepts a JSON or YAML file describing the preprocessing steps. When omitted, the default pipeline is used (see default()).

steps:
  - name: clip
  - name: sqrt
  - name: savgol
    params: {window_length: 11, polyorder: 3}
  - name: snip
    params: {n_iters: 20}
  - name: trim
    params: {mz_min: 2000, mz_max: 20000}
  - name: tic

See the Quickstart Guide for a full walkthrough of building and customising preprocessing pipelines.