API Reference#
Complete reference for all public classes and functions in MaldiBatchKit, organised by module.
Correctors#
Every corrector exposes the scikit-learn fit / transform /
fit_transform API, accepts batch and covariates at construction
time, and aligns them to X.index at each call - so the same object
is safe inside Pipeline and cross_val_score without leakage.
Base Class#
Base class for batch correctors that store |
Subclass this to ship a custom corrector. See Extending MaldiBatchKit for a walkthrough.
ComBat Family#
Pipeline-friendly wrapper around ComBatModel. |
|
ComBat-Fortin preset with species as a protected biological covariate. |
|
Weighted empirical-Bayes extension of Johnson-ComBat. |
Linear / Non-Parametric#
Linear-model batch subtraction following |
Single-Cell-Style Integration#
Sklearn-compatible Harmony with a closed-form |
Simple Baselines#
Subtract per-batch medians from each feature. |
|
Per-batch z-score normalisation. |
|
Rescale each batch so its per-feature mean matches a reference batch. |
MALDI-Specific Corrections#
Per-batch m/z warping to a single global reference. |
Diagnostics#
Generic Batch-Mixing Metrics#
Silhouette coefficient using batch labels as clusters. |
|
k-nearest-neighbours Batch Effect Test (kBET; Büttner et al. 2019). |
|
Local Inverse Simpson's Index for batch mixing. |
MALDI-Specific Metrics#
Per-batch peak-position drift relative to a global reference. |
|
Per-batch coefficient of variation of the Total Ion Count. |
|
Return the number of spectra per batch as a sorted Series. |
Combined Report#
Run every diagnostic on a (before, after) pair. |
Benchmark#
Diagnostic comparison of multiple batch correctors. |
Metrics#
Batch-aware downstream classifier metrics for model selection that generalises across sites. See Metrics Module for the full reference.
Per-batch Metric Functions#
|
Per-batch AUROC, aggregated with |
|
Per-batch average precision (PR-AUC), aggregated with |
|
Per-batch balanced accuracy, aggregated with |
|
Per-batch Matthews correlation coefficient, aggregated with |
|
Per-batch F1 score, aggregated with |
|
Per-batch precision, aggregated with |
|
Per-batch recall, aggregated with |
Scorer Factory#
|
Return a sklearn-compatible |
Visualization#
Plot UMAP embeddings of |
|
Overlay per-batch median spectra against a reference spectrum. |
|
Plot before/after diagnostic values, one subplot per metric. |
Integrations#
Bridge |