Leech¶
Alpha quality — under active development
leech is alpha software. APIs, CLI flags, and output formats may change without notice, and bugs are expected. Validate results before relying on it for anything important.
Learning Enhanced Electrical Classifiers from Hanopore signals
Leech trains classifiers for motif-centered tasks on Oxford Nanopore signal
data -- modified-base calling, or any other label attached to a sequence
motif. It extracts dwell time features from move tables (the BAM mv
tag) and feeds them alongside raw signal and sequence context into a
multi-branch neural network, giving it information that signal-only tools
like Remora discard.
Development and validation used tRNA aminoacylation ("charging") state and amino acid identity classification from direct RNA sequencing as the driving example -- it shows up throughout the docs and the bundled Snakemake pipeline -- but nothing in the feature extraction, model, or CLI is specific to that assay: motifs, labels, and classes are all user-defined.
Install¶
Released on PyPI as leech plus
leech-core, the optional Rust
accelerator pulled by the rust extra. See
Installation for the from-source path and
platform notes.
Workflow¶
graph LR
A["leech data prepare"] --> B["leech model train"]
B --> C["leech eval test"]
C --> D["leech predict"]
- Prepare -- extract signal, sequence, and dwell features from POD5 + BAM files
- Train -- fit a multi-branch neural network on the extracted features
- Test -- evaluate on held-out data (accuracy, AUC, confusion matrix)
- Predict -- apply the model to new reads and write predictions to BAM
Documentation¶
-
Set up leech with uv or pip
-
Walk through prepare, train, test, predict
-
All commands, options, and workflows
-
How leech decodes the BAM
mvtag -
The 9-channel feature set and model architecture
-
Binary and multi-way classification, worked through the tRNA charging/amino acid example
-
Optimize signal context and hyperparameters
-
Parallel processing, motif search, multi-sample merging
-
Production workflows for HPC clusters
-
Common issues and solutions
Citation¶
If you use leech, please cite:
- This work (publication pending)
- Remora (underlying training framework)
License¶
MIT License -- see LICENSE for details.