HTRP is a hierarchical eDNA classification pipeline designed for deep-sea and marine metagenomic samples. It leverages a Deterministic Jaccard filter followed by a 5-stage Machine Learning Cascade (Phylum $\rightarrow$ Class $\rightarrow$ Order $\rightarrow$ Family $\rightarrow$ Genus) using Supervised Contrastive CNN embeddings and FAISS vector search.
This architecture enables Search by Elimination, aggressively filtering out novel (unseen) taxa at higher taxonomic ranks to prevent hallucinations at the Genus level.
CNNEmbedder models trained independently per rank.IndexIVFFlat.git clone https://github.com/organization/HTRP.git
cd HTRP
pip install -r requirements.txt
(Requires PyTorch and FAISS. Windows users may need to install faiss-cpu or faiss-gpu via Conda).
To classify a single sequence or a FASTA file using the pretrained models:
from hierarchical_infer import HierarchicalPipeline
# Initialize the pipeline (loads FAISS indexes and CNN weights)
pipeline = HierarchicalPipeline(marker="16S")
sequence = "ACGTACGTACGTACGTACGT..."
result = pipeline.predict(sequence)
print(result["prediction"])
# Outputs: 'KNOWN_EXACT', 'KNOWN_GENUS', or 'NOVEL_<RANK>'
To reproduce the model weights from scratch using your own reference database:
python split_data.py --input raw_16S.fasta --train assets/16S/train.fasta --test assets/16S/test.fasta --tax taxonomy.tsv
powershell .\run_hierarchical.ps1
python eval_harness.py --train_fasta assets/16S/train.fasta --test_fasta assets/16S/test.fasta
The reference databases (SILVA, PR2, BOLD, UNITE, MitoFish, GenBank) used for the canonical models in our paper are publicly available. Accession IDs and exact train/test split definitions can be found in the assets/ metadata.
HTRP is a hierarchical eDNA classification pipeline designed for deep-sea and marine metagenomic samples. It leverages a Deterministic Jaccard filter followed by a 5-stage Machine Learning Cascade (Phylum $\rightarrow$ Class $\rightarrow$ Order $\rightarrow$ Family $\rightarrow$ Genus) using Supervised Contrastive CNN embeddings and FAISS vector search.
This architecture enables Search by Elimination, aggressively filtering out novel (unseen) taxa at higher taxonomic ranks to prevent hallucinations at the Genus level.
CNNEmbedder models trained independently per rank.IndexIVFFlat.git clone https://github.com/organization/HTRP.git
cd HTRP
pip install -r requirements.txt
(Requires PyTorch and FAISS. Windows users may need to install faiss-cpu or faiss-gpu via Conda).
To classify a single sequence or a FASTA file using the pretrained models:
from hierarchical_infer import HierarchicalPipeline
# Initialize the pipeline (loads FAISS indexes and CNN weights)
pipeline = HierarchicalPipeline(marker="16S")
sequence = "ACGTACGTACGTACGTACGT..."
result = pipeline.predict(sequence)
print(result["prediction"])
# Outputs: 'KNOWN_EXACT', 'KNOWN_GENUS', or 'NOVEL_<RANK>'
To reproduce the model weights from scratch using your own reference database:
python split_data.py --input raw_16S.fasta --train assets/16S/train.fasta --test assets/16S/test.fasta --tax taxonomy.tsv
powershell .\run_hierarchical.ps1
python eval_harness.py --train_fasta assets/16S/train.fasta --test_fasta assets/16S/test.fasta
The reference databases (SILVA, PR2, BOLD, UNITE, MitoFish, GenBank) used for the canonical models in our paper are publicly available. Accession IDs and exact train/test split definitions can be found in the assets/ metadata.