Skip to main content

ViTax-RAG: Alignment-augmented language model for viral taxonomy classification

Project description

ViTax-RAG: Retrieval-Augmented Language Model for Viral Taxonomy Classification

Introduction

ViTax-RAG is a hybrid viral taxonomy classification framework that integrates BLAST-based retrieval with a Bi-Hyena genomic language model to achieve adaptive, accurate, and robust taxonomic assignment from metagenomic sequences.

Installation

ViTax-RAG can be installed either via pip (recommended) or from source.

External Dependency: NCBI BLAST+ (Optional but Recommended)

ViTax-RAG optionally uses NCBI BLAST+ for retrieval-augmented inference.

Install via conda (recommended)

conda install -c bioconda blast

Verify installation:

which blastn
blastn -version

Option 1️⃣ (Recommended): Install via pip

pip install vitax-rag

This installs the ViTax-RAG command-line tool:

vitax-rag --help

Required External Data

ViTax-RAG requires external BLAST database files, which are not packaged inside the Python wheel.

git clone https://github.com/Ying-Lab/ViTax-Rag.git
cd ViTax-Rag

Quick Start

Basic run (automatic device selection)

vitax-rag \
  --contigs test_contigs.fasta \
  --data_dir ./data \
  --out result.txt

Option 2️⃣ : Install from Source (Development Mode)

Install dependencies:

git clone https://github.com/Ying-Lab/ViTax-Rag.git
cd ViTax-Rag
pip install -r requirements.txt

Install NCBI BLAST+:

# 1) Download the latest BLAST+ tarball (adjust version if needed)
mkdir -p ~/downloads && cd ~/downloads
wget https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/LATEST/ncbi-blast-2.12.0+-x64-linux.tar.gz

# 2) Extract and move to a permanent location
tar -zxvf ncbi-blast-2.12.0+-x64-linux.tar.gz
mv ncbi-blast-2.12.0+ ~/blast+

# 3) Persist PATH (so BLAST commands are available in every shell)
echo 'export PATH="$HOME/blast+/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc

# 4) Verify installation
which blastn
blastn -version

Quick Start

Basic run (auto device selection):

python predict.py --contigs test_contigs.fasta --out output.txt --device auto

Adjust chunking and batch size for long contigs:

python predict.py --contigs test_contigs.fasta --chunk_size 2000 --window_size 400 

Command-Line Options

  • --contigs FASTA input path, default test_contigs.fasta
  • --out output predictions file, default output.txt
  • --confidence confidence threshold, default 0.6
  • --window_size sliding step size, default 400
  • --chunk_size chunk length, default 2000
  • --batch_size batch size, default 64
  • --rc Use bidirectional prediction, default true
  • --augment use BLAST augmentation, default true
  • --augment_len target augmented length, default 4000
  • --device auto/cpu/cuda, default auto

Output

  • One line per input sequence; fields are space-separated: sequence_id label confidence

  • sequence_id: taken from the FASTA header (text after > up to the first space)

  • label: either unclassified or TaxonName_TaxonLevel

  • TaxonLevel: one of Genus, Family, Order, Class; if genus confidence is below --confidence, the classifier backs off to higher levels

  • confidence: normalized score in [0, 1], formatted to two decimals; higher means stronger support for the predicted taxon

  • Ordering: lines follow the order of sequences in the input FASTA

  • Device and augmentation: enabling --rc (reverse complement) and --augment (BLAST) can change predictions and confidence

  • Output file: written to the path specified by --out and printed as Done, please check the output file: <path>

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

vitax_rag-0.1.8.tar.gz (160.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vitax_rag-0.1.8-py3-none-any.whl (199.7 kB view details)

Uploaded Python 3

File details

Details for the file vitax_rag-0.1.8.tar.gz.

File metadata

  • Download URL: vitax_rag-0.1.8.tar.gz
  • Upload date:
  • Size: 160.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.18

File hashes

Hashes for vitax_rag-0.1.8.tar.gz
Algorithm Hash digest
SHA256 43f3c090e1cecc9b70ceb37ac254d0bb9794f75d02bc67961315e229df2c50df
MD5 584653055596b6fbd3129f1227993f50
BLAKE2b-256 adcfb37cd5b64acbbc7fd2baf8ed9088df021555fd19cf1fbe8bbddf700f46da

See more details on using hashes here.

File details

Details for the file vitax_rag-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: vitax_rag-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 199.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.18

File hashes

Hashes for vitax_rag-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 9c64e4622a24d7476049733045d0679834fbf50ae3d9d4dad1f38ceaf7ab30a1
MD5 f67002ddb576fa0f2f0af16c0ad1ae42
BLAKE2b-256 63f7d3a6bb575f93fc9af59f34febf27f4f441c78baeb6c8f1532d6ac5013a37

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page