DOI: 10.5281/zenodo.11482774
title: ProkBERT PhaStyle

description: ProkBERT PhaStyle Datasets




Table of Contents




Introduction

Dataset Overview

Dataset Splits



sequencedb

test_sequencedb

512bp__train / 1000bp__train

512bp__train_all / 1000bp__train_all

512bp__test / 1000bp__test



FastANI Results

FASTA Files



sequencedb.fasta

test_sequencedb.fasta



Models for Phage Lifestyle Prediction



Directory Structure

Holdout Settings

Model Loading & Usage

Model Summaries



Prediction Score Files

Containers for Prediction Tools



BACPHLIP

PhagePred

DNABERT2

DeePhage

PhaTYP



License

Contact

References




Introduction


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.



phastyle Dataset


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



Overview






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






Splits




1. sequencedb


Contains all full-length phage genomes with metadata.Fields:



sequence_id, dataset (one of BACPHLIP_TRAINING, BACPHLIP_VALIDATION, BACPHLIP_ALL, ESCHERICHIA, BASEL, EXTREMOPHILE)

class_label (“temperate” / “virulent”), binary y

L_seq (sequence length), sequence (nucleotides)

additional taxonomy/source columns




2. test_sequencedb


Simulated contig fragments (various lengths) for evaluating full-sequence performance.Fields:



sequence_id, dataset, FragmentL (fragment length), Ls (lifestyle)

sequence_start, sequence_end, sequence




3. 512bp__train & 1000bp__train


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)




4. 512bp__train_all & 1000bp__train_all


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)




5. 512bp__test & 1000bp__test


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']

 




FastANI Results (FastANI_results.tsv)


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.



File format


Each line of FastANI_results.tsv has the following tab-delimited fields:



Source FASTA pathPath to the “query” genome FASTA file (e.g. …/BACPHLIP_TRAINING__0__0.fasta).

Target FASTA pathPath to the “reference” genome FASTA file (e.g. …/BACPHLIP_ALL__2524__0.fasta).

ANI (%)Average nucleotide identity percentage (0–100).

Fragment countNumber of matching fragments used to compute ANI.

Total query fragments(Optional) Total number of fragments in the source, indicating coverage of the alignment.




Interpretation




Sequence IDs in the FASTA paths (e.g. BACPHLIP_TRAINING__0__0) correspond directly to sequence_id values in the sequencedb splits.

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.




sequencedb.fasta


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_id field in the sequencedb split

y: binary label (0 = temperate, 1 = virulent)


Example entry:BACPHLIP_TRAINING__0__0 ATGCGT… (Here, record 0 from BACPHLIP_TRAINING is labeled temperate.)



test_sequencedb.fasta


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, or EXTREMOPHILE

FragmentL: fragment length in base pairs (e.g. 500, 2000, 10000)

sequence_id: integer index matching the sequence_id field in the test_sequencedb split

y: binary label (0 = temperate, 1 = virulent)


Each FASTA record ID directly corresponds to entries in the sequencedb and test_sequencedb.



Models for ProkBERT PhaStyle Phage Lifestyle Prediction


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





Model summaries






prokbert-mini / prokbert-mini-long6-layer, 6-head ProkBERT variants pretrained on microbial genomes (~21 M parameters).




DNABERT2Transformer encoder pretrained on 32.5 billion bases from 135 species (~117 M parameters).




NT50 / NT500Nucleotide Transformer models with 50 M and 500 M parameters, respectively, using 6-mer tokenization.





Prediction Score Files


We provide two tab-delimited files containing all model prediction scores:



1. prediction_scores.tsv


This file reports per-segment (fragment) predictions across all test collections and models.

Columns:





hold_out_settingEither strict_holdout or standard_holdout, indicating which training regime was used.




DatasetOne of ESCHERICHIA, BASEL, or EXTREMOPHILE, indicating the external test collection.




ModelThe model name, e.g. prokbert-mini, prokbert-mini-long, DNABERT2, NT50, NT500, DeePhage, or PhaTYP.




Fragment_lengthLength of the input fragment in base pairs (e.g. 500, 1000, 2000, 10000).




sequence_idInteger index matching the fragment’s parent sequence in test_sequencedb.




test_fastaidFASTA record identifier from test_sequencedb.fasta, e.g. BASEL__Lf2000__323693__1.




class_labelGround-truth label: temperate or virulent.




predicted_labelModel’s binary prediction: temperate or virulent.




score_temperateModel’s predicted probability (0–1) for the temperate class.




score_virulentModel’s predicted probability (0–1) for the virulent class.







2. prediction_scores_sequences.tsv


This file reports per-contig (full-sequence) predictions, after aggregating fragment scores via weighted voting.

Columns:





hold_out_settingEither strict_holdout or standard_holdout.




DatasetOne of ESCHERICHIA, BASEL, or EXTREMOPHILE.




ModelThe model name, as above.




sequence_idInteger index matching the full contig in sequencedb.




test_fastaidFASTA record identifier from sequencedb.fasta, e.g. ESCHERICHIA__45__1.




source_descriptionTextual description of the phage source or isolate (where available).




class_labelGround-truth label: temperate or virulent.




predicted_labelModel’s final binary prediction for the full contig.




score_temperateAggregated probability (0–1) for the temperate class.




score_virulentAggregated probability (0–1) for the virulent class.





Overview


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

 



Containers for Phage Lifestyle Prediction Tools




Overview


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.





Containers for Phage Lifestyle Prediction Tools


The containers are availabel in the previous version 3: https://zenodo.org/records/13959905/files/apptainers.tar.bz2?download=1



Overview


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.



Directory Structure


The containers are organized as follows:



containers/



bacphlip/



bacphlip.sif

bacphlip.def

Additional files and data related to BACPHLIP



phagepred/



phagepred.sif

phagepred.def

Additional files and data related to PhagePred



dnabert2/



prokbertdnabert.sif

prokbertdnabert.def



deepphage/



deephage.sif

DeePhage/

Additional files and data related to DeePhage



phatyp/



phatyp.sif

model/

Additional files and data related to PhaTYP








Containers and Methods




1. BACPHLIP




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.




2. PhagePred




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.




3. DNABERT2




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.




4. DeePhage




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.




5. PhaTYP




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.




Notes




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.




References




BACPHLIP: BACPHLIP GitHub Repository

PhagePred: PhagePred GitHub Repository

DNABERT2: DNABERT2 GitHub Repository

DeePhage: DeePhage GitHub Repository

PhaTYP: PhaTYP GitHub Repository




Contact Information


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.



License


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



Contact


For questions, feedback, or collaboration opportunities, please contact:



Balázs Ligeti (Corresponding Author)



Email: obalasz@gmail.com

ORCID: 0000-0003-0301-0434






References


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

 




License

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