This repository contains the official implementation of D2T, as described in the paper:
A Novel Transformer Model of Protein Domains for Viral Taxonomy Classification (Bioinformatics, ISMB 2026)
D2T (Domain-to-Taxonomy) is a transformer-based model for viral taxonomy classification.
D2T represents each virus as a sequence of protein domain tokens generated using DCTdomain, and uses a transformer model to predict viral taxonomy from realm to genus.
Clone this repository and create the Conda environment:
git clone https://github.com/mgtools/D2T.git
cd D2T
conda env create -f D2T.yaml
conda activate D2TDue to file size limitations, the processed datasets are hosted on Google Drive.
This dataset contains pre-computed protein domain embeddings generated using DCTdomain.
The results/ directory contains the model checkpoint (.pt) trained on the MSL39 closed training set.
- MSL39 Closed-Test. Evaluation on the held-out test set within the MSL39 taxonomy.
python src/main.py \
--inference_only \
--checkpoint results/pt/ICTV_MSL39_NCBI+prodigal.pt \
--npzfile data/ICTV_MSL39_NCBI+prodigal-dct.npz \
--test_taxcsv data/MSL39_closed_test.csv \
--label_cache results/labels/ICTV_MSL39_NCBI+prodigal-labels.json \
--eval_label_cache results/labels/MSL39_closed_train-labels.json \
--split_by_taxcsv
- MSL39 Open-Set. Evaluation on viruses from singleton genera in MSL39 that are excluded from the training label set.
python src/main.py \
--inference_only \
--checkpoint results/pt/ICTV_MSL39_NCBI+prodigal.pt \
--npzfile data/ICTV_MSL39_NCBI+prodigal-dct.npz \
--test_taxcsv data/MSL39_openset.csv \
--label_cache results/labels/ICTV_MSL39_NCBI+prodigal-labels.json \
--eval_label_cache results/labels/MSL39_closed_train-labels.json \
--split_by_taxcsv
- MSL40 New Genera (Open-Set). Evaluation on isolates belonging to newly introduced genera in MSL40.
python src/main.py \
--inference_only \
--checkpoint results/pt/ICTV_MSL39_NCBI+prodigal.pt \
--npzfile data/ICTV_MSL40_newly_introduced_NCBI+prodigal-dct.npz \
--test_taxcsv data/VMR_MSL40_newly_introduced_genera.csv \
--label_cache results/labels/ICTV_MSL39_NCBI+prodigal-labels.json \
--eval_label_cache results/labels/MSL39_closed_train-labels.json \
--split_by_taxcsv
To train the model from scratch, prepare an .npz file (via DCTdomain) and taxonomy CSV files.
python src/main.py \
--npzfile data/ICTV_MSL39_NCBI+prodigal-dct.npz \
--train_taxcsv data/MSL39_closed_train.csv \
--test_taxcsv data/MSL39_closed_test.csv \
--split_by_taxcsv
The results/Kraken2/ directory contains Kraken2 classification results. To compare Kraken2 and D2T, or to run the hybrid K+D2T method, please use the provided notebook: src/Kraken2+D2T.ipynb
If you find D2T useful, please cite:
@article{shin2026novel,
title={A novel transformer model of protein domains for viral taxonomy classification},
author={Shin, Jihye and Xiao, Qingyang and Ye, Yuzhen},
journal={Bioinformatics},
volume={42},
number={Supplement\_1},
pages={btag291},
year={2026},
publisher={Oxford University Press}
}For questions, bug reports, or feature requests, please open a GitHub issue.