Small toolkit for classifying DNA/ITS sequences using k-mer/recoding, an embedding layer and a BiLSTM.
Quickstart
- Create environment & install dependencies (recommended):
pip install uv
uv install- Train a tiny model (CLI):
python train.py path/to/input.fasta experiment_name 10 --epochs 50 --batch-size 256- Predict using a trained experiment:
python predict.py queries.fasta experiment_name results.csvInput format
- Files expect alternating header and sequence lines (header on one line,
sequence on the next). Sequences should be long enough to pass configured
filtering (
--minseq, default 100).
Model formats
- Training saves a single-file Keras archive (
.keras) and also attempts to export a TensorFlow SavedModel directory. The code prefers the.kerasarchive for reload with Keras 3.predict.pywill load a.kerasfile if present, or wrap a SavedModel directory withTFSMLayerfor inference.
Tests
- Run the full test suite with:
pytest -q- Tests live under
tests/.tests/conftest.pyensures the repo root is onsys.pathand includes a cleanup fixture that removes temporarysmall_test*directories after the session.
Repository layout
MycoNet/— package modules (recode.py,make_model.py,kmer_embedding.py,data.py,utils.py).train.py— promoted training CLI (canonical training entrypoint).predict.py— prediction script (loads.kerasor SavedModel dirs).tests/— pytest tests and fixtures.
Notes
- Tested on Python 3.12 with TensorFlow/Keras; GPU usage is optional and TensorFlow will try to enable memory growth when GPUs are available.
Performance on simulated data:
