⚡ currtag
Nanopore signal classification — label every raw read by species, barcode or taxon, straight from the current, with no basecalling step.
📖 Table of Contents
🧬 Overview
Reads are trimmed to their informative region (adapter/polyA detection for DNA, poly(A)-tail trimming for RNA), encoded, and passed through a small 1-D CNN that predicts one class per read. Training works either on real labelled reads or on signal simulated from reference genomes, so you can build a classifier without per-species reads for every class.
The pipeline is a fixed chain of subcommands:
label → split → gendata → train → predict → evaluation
Every step is also importable as a module (currtag.label, currtag.train, ...), and
the package depends on nothing outside requirements.txt.
📦 Installation
From PyPI:
pip install currtag
From source:
git clone <this-repo>
cd currtag
pip install -e .
torch is deliberately unpinned so the resolver picks a build matching your local
CUDA toolkit. For GPU work, install the CUDA toolkit first and verify nvcc is on
$PATH:
conda install -c nvidia cuda-toolkit=12.8
🚀 Quick start
currtag --help # list the subcommands
currtag label --help # one subcommand, with its own flags
currtag -v # print the version
🎯 Subcommands
| Subcommand | Purpose |
|---|---|
label |
Build label_map.json / inverse_label_map.json from a FASTA whose headers are the class names |
split |
Split a read→label pairs file into train / test sets |
gendata |
Convert POD5/FAST5 + labels into train.hdf5 / valid.hdf5 |
train |
Train the classification CNN (real or simulated data) |
predict |
Classify reads with a trained model |
precision |
One-class precision / recall / F1 / ROC evaluation |
evaluation |
Full multiclass panel (confusion matrix, PR/ROC, ...) |
comparison |
Side-by-side comparison of two models |
🧪 Training modes
| Mode | Description |
|---|---|
| Real-data | gendata extracts signal chunks from reads already labelled by species, then train (no --simu) fits the CNN directly. |
| Simulation | train --simu <refs.fa> --preset <name> synthesises chunks on the fly from a FASTA of reference genomes. Presets: dna-r9-min, dna-r10-min, rna-r9-min, rna004-min, ... |
The CNN architecture is set by a small TOML (dna.toml with strides=[2,2,2,2,2] for
DNA, rna.toml with strides=[5,2,2,2,2] for RNA) passed via -config. The
label_map.json / inverse_label_map.json pair must be produced first with
currtag label.
🧪 Examples
Barcode / species classification on real reads
# 1. build the label map
currtag label species.fa
# 2. split read→label pairs
currtag split readid_species.txt --train_file train_labels.txt --test_file test_labels.txt
# 3. extract training chunks
currtag gendata train.pod5 \
--label_path train_labels.txt --save_path ./ --seqlen 6000 --do-trim
# 4. train
currtag train model_real \
-config dna.toml --directory ./ --label-map label_map.json \
--chunksize 6000 -f --new -y
# 5. predict
currtag predict model_real test.pod5 inverse_label_map.json \
--chunksize 6000 > result_real.txt
# 6. evaluate
currtag evaluation result_real.txt test_labels.txt \
-m label_map.json -o ./real
Simulation-based training (no real per-species data)
currtag label species.fa
currtag train model_simu \
-config dna.toml --directory ./ --label-map label_map.json \
--chunksize 25000 -f --new --simu species.fa --preset dna-r10-min -y
currtag predict model_simu reads_dir/ inverse_label_map.json \
--chunksize 25000 > result_simu.txt
currtag precision result_simu.txt test_labels.txt -m label_map.json
RNA direct-read classification
RNA reads are reverse-complement mapped and sequenced after the poly(A) tail, so
gendata / predict take --rna --tail, and RNA models use rna.toml:
currtag gendata train.pod5 \
--label_path train_labels.txt --save_path ./ --rna --seqlen 50000 --tail
currtag train model \
-config rna.toml --directory ./ --label-map label_map.json \
-f --new -y --chunksize 50000 --rna
currtag predict model test.pod5 inverse_label_map.json \
--rna --tail --chunksize 50000 > result_real.txt
🙏 Acknowledgements
- k-mer tables. The per-kit k-mer look-up tables behind the signal simulation
(the
.npzprofiles each--presetresolves to) come from Uncalled4. - Simulation. The current-simulation algorithm and its per-kit configuration follow Squigulator.
📄 License
MIT — see LICENCE.txt.
Metadata
Release files for currtag 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| currtag-0.2.1.tar.gz | 59.0 kB | Without provenance | Details for currtag-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| currtag-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for currtag-0.2.1-py3-none-any.whl |
Total release size: 116.0 kB
Release files / currtag-0.2.1.tar.gz
| Download URL | currtag-0.2.1.tar.gz |
|---|---|
| Size | 59.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
37a8dd02221011dba29f503b34ebd581a5780e4bde14d8eb4412cc1937232dea
|
|
BLAKE2b-256 checksum How to use checksums |
9bd2ab5e13c221dc71ff6c31717a136eff2f1302fd010a0a63462ad1b2187d7f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.19
|
Release files / currtag-0.2.1-py3-none-any.whl
| Download URL | currtag-0.2.1-py3-none-any.whl |
|---|---|
| Size | 57.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c52b64569e9c67df8731e09c81f3b4aaa1e966bc8509fd2d4dbe27d28aeecc6d
|
|
BLAKE2b-256 checksum How to use checksums |
f35e2280fad76e69fa9886c6f6a6f5a50a339c5bc073942d2aaf304ef96ae0aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.19
|
Security for currtag 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.