Skip to content
mgtoolsPublic

About

Domain-based Transformer for Viral Taxonomy Classification.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

D2T (Domain-to-Taxonomy)

Paper GitHub Data

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)


Overview

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.


Installation

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 D2T

Data and Model Availability

Due to file size limitations, the processed datasets are hosted on Google Drive.

Download Domain Embeddings

This dataset contains pre-computed protein domain embeddings generated using DCTdomain.


Usage

1. Inference with Pre-trained Model

The results/ directory contains the model checkpoint (.pt) trained on the MSL39 closed training set.

  1. 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
  1. 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
  1. 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

2. Training the model with new data

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

3. K+D2T

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


Citation

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}
}

Contact

For questions, bug reports, or feature requests, please open a GitHub issue.

About

Domain-based Transformer for Viral Taxonomy Classification.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages