ProkBERT PhaStyle
Authors/Creators
Contributors
Contact person:
Description
- Introduction
- Dataset Overview
- Dataset Splits
- FastANI Results
- FASTA Files
- Models for Phage Lifestyle Prediction
- Prediction Score Files
- Containers for Prediction Tools
- License
- Contact
- References
This repository contains datasets used for training, validation, and testing of the ProkBERT PhaStyle model for phage lifestyle prediction. The datasets include phage nucleotide sequences, segmented sequences, and descriptive metadata.
The phastyle dataset supports training and evaluation of ProkBERT PhaStyle models for phage lifestyle prediction under both strict-holdout and standard-holdout scenarios. All data are stored in Hugging Face Dataset format under hf_datasets/phastyle/.
-
Strict-holdout (“ANI ≥ 80% filter”)
- Phage sequences infecting Escherichia (and any ≥80% ANI relative) are excluded from training.
- Training split:
BACPHLIP_TRAINING(1 798 non-Escherichia sequences) - Validation split:
BACPHLIP_VALIDATION(316 Escherichia sequences)
-
Standard-holdout
- All available BACPHLIP sequences used for training, including Escherichia relatives.
- Training split:
BACPHLIP_ALL
-
External test collections (always held out):
ESCHERICHIA(Guelin collection)BASEL(BASEL collection)EXTREMOPHILE
Contains all full-length phage genomes with metadata.
Fields:
sequence_id,dataset(one ofBACPHLIP_TRAINING,BACPHLIP_VALIDATION,BACPHLIP_ALL,ESCHERICHIA,BASEL,EXTREMOPHILE)class_label(“temperate” / “virulent”), binaryyL_seq(sequence length),sequence(nucleotides)- additional taxonomy/source columns
Simulated contig fragments (various lengths) for evaluating full-sequence performance.
Fields:
sequence_id,dataset,FragmentL(fragment length),Ls(lifestyle)sequence_start,sequence_end,sequence
Segments sampled at 10× coverage from BACPHLIP_TRAINING (strict-holdout).
- 512 bp segments in
512bp__train(2 270 027 rows) - 1 000 bp segments in
1000bp__train(1 162 326 rows)
Segments sampled at 10× coverage from BACPHLIP_ALL (standard-holdout).
- 512 bp segments in
512bp__train_all(2 754 145 rows) - 1 000 bp segments in
1000bp__train_all(1 410 107 rows)
Segments drawn from the three external collections (ESCHERICHIA, BASEL, EXTREMOPHILE):
- 512 bp segments in
512bp__test(675 086 rows) - 1 000 bp segments in
1000bp__test(408 409 rows)
Each segment record includes segment_id, sequence_id, start/end coordinates, nucleotide segment, FragmentL, Ls, and binary y.
from datasets import load_dataset # Load 512bp training set ds = load_dataset("hf_datasets/phastyle", "512bp__train") print(ds["train"].column_names) # ['segment_id','sequence_id','class_label','y','segment_start','segment_end','segment']
This file contains all-vs-all average nucleotide identity (ANI) comparisons between phage genomes in our training and test sets, used to enforce the 80% ANI exclusion criterion in the strict-holdout setting.
Each line of FastANI_results.tsv has the following tab-delimited fields:
- Source FASTA path
Path to the “query” genome FASTA file (e.g.…/BACPHLIP_TRAINING__0__0.fasta). - Target FASTA path
Path to the “reference” genome FASTA file (e.g.…/BACPHLIP_ALL__2524__0.fasta). - ANI (%)
Average nucleotide identity percentage (0–100). - Fragment count
Number of matching fragments used to compute ANI. - Total query fragments
(Optional) Total number of fragments in the source, indicating coverage of the alignment.
- Sequence IDs in the FASTA paths (e.g.
BACPHLIP_TRAINING__0__0) correspond directly tosequence_idvalues in thesequencedbsplits. - Any pair with ANI ≥ 80% and alignment coverage ≥ 80% of the shorter genome was flagged and removed from the training set in the strict-holdout splits.
- The full matrix of ANI comparisons and the exact removal decisions are archived here to ensure reproducibility of our dataset curation.
This file contains all full-length phage genomes used for model training and validation under both strict-holdout and standard-holdout regimes.
Header format:>dataset__sequence_id__y
- dataset: one of
BACPHLIP_TRAINING,BACPHLIP_VALIDATION,BACPHLIP_ALL,ESCHERICHIA,BASEL,EXTREMOPHILE - sequence_id: integer index matching the
sequence_idfield in thesequencedbsplit - y: binary label (
0 = temperate,1 = virulent)
Example entry:
BACPHLIP_TRAINING__0__0 ATGCGT… (Here, record 0 from BACPHLIP_TRAINING is labeled temperate.)
This file holds simulated contig fragments used for full-sequence evaluation on the external test collections.
Header format:>dataset__Lf{FragmentL}__sequence_id__y
- dataset:
BASEL,ESCHERICHIA, orEXTREMOPHILE - FragmentL: fragment length in base pairs (e.g.
500,2000,10000) - sequence_id: integer index matching the
sequence_idfield in thetest_sequencedbsplit - y: binary label (
0 = temperate,1 = virulent)
Each FASTA record ID directly corresponds to entries in the sequencedb and test_sequencedb.
This directory contains pretrained and finetuned models for ProkBERT PhaStyle, DNABERT-2, and Nucleotide Transformer under both strict-holdout and standard-holdout regimes. All models are packaged in Hugging Face format and provided as safetensors or pytorch_model.bin with accompanying tokenizer and config files.
We fine-tuned each model under two regimes:
-
Strict-holdout
We remove from the training set any BACPHLIP genome that either- infects Escherichia, or
- has ≥ 80 % ANI (over ≥ 80 % of its length) to any sequence in any external test collection (BASEL, Guelin/ESCHERICHIA, or EXTREMOPHILE).
-
Standard-holdout
We include all BACPHLIP genomes in the training set (no ANI or host-based exclusions).
For each regime, we sample 10× coverage segments (512 bp) from the appropriate training genomes, fine-tune the model as described above, and then evaluate on the three external test collections. Checkpoints are available under the corresponding strict_holdout/ and standard_holdout/ directories.
from transformers import AutoModelForSequenceClassification, AutoTokenizer # Example: load ProkBERT-mini standard-holdout model_name = "path/to/zenodo_phagelifestyle_models/standard_holdout/prokbert-mini" tokenizer = AutoTokenizer.from_pretrained(model_name) model = AutoModelForSequenceClassification.from_pretrained(model_name, trust_remote_code=False) # Tokenize and predict inputs = tokenizer("ATGCGT...", return_tensors="pt") outputs = model(**inputs) probs = outputs.logits.softmax(dim=-1)
Note: replace prokbert-mini with any other model folder (e.g. DNABERT2, NT50, prokbert-mini-long) and switch standard_holdout to strict_holdout as required.
-
prokbert-mini / prokbert-mini-long
6-layer, 6-head ProkBERT variants pretrained on microbial genomes (~21 M parameters). -
DNABERT2
Transformer encoder pretrained on 32.5 billion bases from 135 species (~117 M parameters). -
NT50 / NT500
Nucleotide Transformer models with 50 M and 500 M parameters, respectively, using 6-mer tokenization.
We provide two tab-delimited files containing all model prediction scores:
This file reports per-segment (fragment) predictions across all test collections and models.
Columns:
-
hold_out_setting
Eitherstrict_holdoutorstandard_holdout, indicating which training regime was used. -
Dataset
One ofESCHERICHIA,BASEL, orEXTREMOPHILE, indicating the external test collection. -
Model
The model name, e.g.prokbert-mini,prokbert-mini-long,DNABERT2,NT50,NT500,DeePhage, orPhaTYP. -
Fragment_length
Length of the input fragment in base pairs (e.g.500,1000,2000,10000). -
sequence_id
Integer index matching the fragment’s parent sequence intest_sequencedb. -
test_fastaid
FASTA record identifier fromtest_sequencedb.fasta, e.g.BASEL__Lf2000__323693__1. -
class_label
Ground-truth label:temperateorvirulent. -
predicted_label
Model’s binary prediction:temperateorvirulent. -
score_temperate
Model’s predicted probability (0–1) for thetemperateclass. -
score_virulent
Model’s predicted probability (0–1) for thevirulentclass.
This file reports per-contig (full-sequence) predictions, after aggregating fragment scores via weighted voting.
Columns:
-
hold_out_setting
Eitherstrict_holdoutorstandard_holdout. -
Dataset
One ofESCHERICHIA,BASEL, orEXTREMOPHILE. -
Model
The model name, as above. -
sequence_id
Integer index matching the full contig insequencedb. -
test_fastaid
FASTA record identifier fromsequencedb.fasta, e.g.ESCHERICHIA__45__1. -
source_description
Textual description of the phage source or isolate (where available). -
class_label
Ground-truth label:temperateorvirulent. -
predicted_label
Model’s final binary prediction for the full contig. -
score_temperate
Aggregated probability (0–1) for thetemperateclass. -
score_virulent
Aggregated probability (0–1) for thevirulentclass.
@article{ProkBERT2024, author = {Ligeti, Bal{\'a}zs and Szepesi-Nagy, Istv{\'a}n and Bodn{\'a}r, Babett and Ligeti-Nagy, No{\'e}mi and Juh{\'a}sz, J{\'a}nos}, journal = {Frontiers in Microbiology}, title = {{ProkBERT} PhaStyle: Genomic language models for phage lifestyle prediction}, year = {2024}, volume = {14}, url = {https://www.frontiersin.org/articles/10.3389/fmicb.2023.1331233}, doi = {10.3389/fmicb.2023.1331233}, issn = {1664-302X} }
This repository contains containerized versions of various phage lifestyle prediction tools. These containers are built using Singularity/Apptainer and Docker to facilitate easy deployment, reproducibility, and compatibility across different computing environments.
The available containers include:
- BACPHLIP
- PhaTYP
- PhagePred
- DeePhage
- DNABERT2
Each container encapsulates all dependencies required to run the respective tool, allowing users to execute the tools without worrying about installation complexities.
The containers are availabel in the previous version 3: https://zenodo.org/records/13959905/files/apptainers.tar.bz2?download=1
This directory contains Singularity (Apptainer) containers for various phage lifestyle prediction tools used in the ProkBERT PhaStyle project. These containers encapsulate the required environments and dependencies, ensuring reproducibility and ease of use across different computational platforms.
The containers are organized as follows:
containers/bacphlip/bacphlip.sifbacphlip.def- Additional files and data related to BACPHLIP
phagepred/phagepred.sifphagepred.def- Additional files and data related to PhagePred
dnabert2/prokbertdnabert.sifprokbertdnabert.def
deepphage/deephage.sifDeePhage/- Additional files and data related to DeePhage
phatyp/phatyp.sifmodel/- Additional files and data related to PhaTYP
- Container:
bacphlip.sif - Definition File:
bacphlip.def - Description: BACPHLIP (Bacteriophage Lifestyle Predictor) is a tool designed to predict the lifestyle of phages (temperate or virulent) based on sequence data. It utilizes Hidden Markov Models (HMMs) to identify integrase genes and other markers indicative of temperate phages. A random forest classifier is then applied to make the final prediction.
- Additional Information: This container includes all necessary dependencies and the BACPHLIP software, providing a consistent environment for running predictions.
- Container:
phagepred.sif - Definition File:
phagepred.def - Description: PhagePred is a machine learning-based tool for predicting phage lifestyles using k-mer frequency features extracted from phage genomes. It employs statistical methods and clustering algorithms to classify phages as lytic (virulent) or lysogenic (temperate).
- Additional Information: The container packages the PhagePred software along with its dependencies, facilitating seamless execution.
- Container:
prokbertdnabert.sif - Definition File:
prokbertdnabert.def - Description: DNABERT2 is a transformer-based deep learning model specifically designed for DNA sequence classification tasks. In this project, DNABERT2 has been fine-tuned for phage lifestyle prediction, leveraging its ability to capture long-range dependencies in DNA sequences.
- Additional Information: The container provides an isolated environment with all dependencies, enabling the use of DNABERT2 without complex setup.
- Container:
deephage.sif - Definition Files:
DeePhage.def,Dockerfile - Description: DeePhage is a deep learning framework that predicts phage lifestyles using convolutional neural networks (CNNs). It processes genomic sequences to classify phages into lytic or lysogenic categories based on sequence patterns.
- Additional Information: The container includes the DeePhage software, the MATLAB Compiler Runtime (required for execution), and all other necessary dependencies.
- Container:
phatyp.sif - Description: PhaTYP is a tool that predicts both phage types and their bacterial hosts using genomic sequence features and machine learning algorithms. It analyzes k-mer compositions and employs a random forest classifier for lifestyle prediction.
- Additional Information: The container encapsulates the PhaTYP software along with pre-trained models and dependencies.
- Usage: Each container is built to ensure compatibility and ease of use. By using these containers, users can avoid dependency conflicts and focus on running phage lifestyle predictions.
- Dependencies: The containers are built using Singularity (Apptainer). Ensure that Singularity is installed on your system to run these containers.
- Licensing: Please refer to each tool's individual license for terms of use and distribution.
- BACPHLIP: BACPHLIP GitHub Repository
- PhagePred: PhagePred GitHub Repository
- DNABERT2: DNABERT2 GitHub Repository
- DeePhage: DeePhage GitHub Repository
- PhaTYP: PhaTYP GitHub Repository
For questions or further assistance, please contact the project maintainers or open an issue in the repository.
Note: This README provides a concise description of each container and the associated phage lifestyle prediction tool. It is intended to help users understand the purpose of each container and how they fit into the ProkBERT PhaStyle project.
These datasets are provided under the CC BY-NC-SA 4.0 license. You are free to use, share, and adapt the material for non-commercial purposes, provided you give appropriate credit and distribute your contributions under the same license
For questions, feedback, or collaboration opportunities, please contact:
- Balázs Ligeti (Corresponding Author)
- Email: obalasz@gmail.com
- ORCID: 0000-0003-0301-0434
If you use these datasets in your research, please cite:
@article{ProkBERT2024, author = {Ligeti, Bal{\'a}zs and Szepesi-Nagy, Istv{\'a}n and Bodn{\'a}r, Babett and Ligeti-Nagy, No{\'e}mi and Juh{\'a}sz, J{\'a}nos}, journal = {Frontiers in Microbiology}, title = {{ProkBERT} PhaStyle: Genomic language models for phage lifestyle prediction}, year = {2024}, volume = {14}, url = {https://www.frontiersin.org/articles/10.3389/fmicb.2023.1331233}, doi = {10.3389/fmicb.2023.1331233}, issn = {1664-302X} }
Files
README.md
Files
(8.7 GB)
| Name | Size | |
|---|---|---|
|
md5:729f2a4e21f156db0518c91557aa0525
|
124.7 MB | Download |
|
md5:81c43cb024af109f4757bb8127aed058
|
1.5 GB | Download |
|
md5:9c4267952c19bb2853b96afa413db491
|
479.5 MB | Download |
|
md5:87d92d3c5c074b4f8646fd3786eda3f0
|
1.5 MB | Download |
|
md5:29ac670afd6b7418f4023a1ff77c605d
|
18.6 kB | Preview Download |
|
md5:0bbbed7546411f0eeee315570884c05d
|
338.4 MB | Download |
|
md5:9e9379df3d5b74fcb94aae6548e93c08
|
350.9 MB | Download |
|
md5:6b7618a463be695c1f238cc16e22f84f
|
486.0 MB | Download |
|
md5:f22573d35ba4b4770eda0832cd6b9f2c
|
5.4 GB | Download |
Additional details
Dates
- Submitted
-
2024-10-25
Software
- Repository URL
- https://github.com/nbrg-ppcu/PhaStyle