API Reference¶
Auto-generated reference for leech's Python API. For command-line usage, see the CLI Reference.
Modules¶
Data handling¶
- Data Preparation -- BAM/POD5 reading, chunk extraction, splitting
- Features -- Move table parsing, dwell time and signal feature computation
- Dataset -- PyTorch Dataset classes for training
Models and training¶
- Models -- Neural network architectures (ConvLSTMDwell, TransformerDwell, etc.)
- CRF -- CTC-CRF sequence models: encoder, loss, and Viterbi decode
- Training -- Trainer class and training loop
- Evaluation -- Model evaluation and metrics
- Inference -- Inference engine and bundle inference
- Grid Search -- Hyperparameter optimization
Utilities¶
- Utilities -- Model loading, checkpoint handling, bundle creation
Quick examples¶
Extract dwell times from a BAM record¶
from leech.features import extract_move_table, compute_dwell_times
move_table = extract_move_table(alignment)
dwell_times = compute_dwell_times(move_table)
Load and run a model¶
from leech.model_loading import load_model_from_checkpoint
model, config = load_model_from_checkpoint("model_best.pt", device="cuda")