Skip to content

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

PyPI CI Python 3.12+ License: MIT

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

uv add "leech[rust]"     # or: pip install "leech[rust]"

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"]
  1. Prepare -- extract signal, sequence, and dwell features from POD5 + BAM files
  2. Train -- fit a multi-branch neural network on the extracted features
  3. Test -- evaluate on held-out data (accuracy, AUC, confusion matrix)
  4. Predict -- apply the model to new reads and write predictions to BAM

Documentation

Citation

If you use leech, please cite:

  • This work (publication pending)
  • Remora (underlying training framework)

License

MIT License -- see LICENSE for details.