Skip to main content

⚡ currtag

Nanopore signal classification — label every raw read by species, barcode or taxon, straight from the current, with no basecalling step.

PyPI Python License


📖 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

📄 License

MIT — see LICENCE.txt.

Metadata

Release files for currtag 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for currtag 0.2.0
File Size Uploaded Provenance Actions
currtag-0.2.0.tar.gz 58.0 kB Without provenance Details for currtag-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for currtag 0.2.0
File Interpreter ABI Platform Actions
currtag-0.2.0-py3-none-any.whl Python 3 none any Details for currtag-0.2.0-py3-none-any.whl

Total release size: 114.2 kB

Release files / currtag-0.2.0.tar.gz

Download URL currtag-0.2.0.tar.gz
Size 58.0 kB
Tags Source
SHA-256 checksum
How to use checksums
8412c7db8965e33469f57c7ebfedb27abe93441d2e3e93e3c086757e62b11f22
BLAKE2b-256 checksum
How to use checksums
21ce44f56187323965d7f98484e88ee3240e634014a61ec4237921263d057701
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.0-py3-none-any.whl

Download URL currtag-0.2.0-py3-none-any.whl
Size 56.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3fa66c8b5dd87f8e129542b916b5c65401b5b0f260ddf0af334828ea7e75e55c
BLAKE2b-256 checksum
How to use checksums
0c3c7b1744a533c8586b7b818189120414fb7f4874167be6afab497395e68c6d
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.0

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.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page