DOI: 10.5281/zenodo.13944254
title: ProkBERT PhaStyle

description: ProkBERT PhaStyle datasets, models and containers




Table of Contents




Introduction

Dataset Descriptions



1. BACPHLIP Dataset



a. Training Set



Segmentation

Tokenized Datasets



b. Validation Set



Segmentation and Tokenization





2. ESCHERICHIA Dataset



Segmentation and Tokenization



3. EXTREMOPHILE Dataset



Segmentation and Tokenization





File Descriptions

Naming Conventions

Usage Instructions



Training

Validation

Testing



Additional Notes

References

License

Models for ProkBERT PhaStyle Phage Lifestyle Prediction



Overview

Directory Structure

Model Descriptions



ProkBERT-mini

ProkBERT-mini-long

ProkBERT-mini-c

DNABERT2

Nucleotide Transformer



Summary Table

Usage Instructions

References



Containers for Phage Lifestyle Prediction Tools



Overview

Directory Structure

Containers and Methods



1. BACPHLIP

2. PhagePred

3. DNABERT2

4. DeePhage

5. PhaTYP



Notes

References



Contact

License




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, tokenized datasets, and descriptive metadata. They are prepared for various segment sizes (512bp and 1022bp) and are organized to help experimentation with different tokenization parameters and segment lengths.

These datasets enable the training and evaluation of genomic language models for predicting phage lifestyles (virulentor temperate) directly from nucleotide sequences, eliminating the need for protein annotations or complex bioinformatics pipelines.



Dataset Descriptions




1. BACPHLIP Dataset


The BACPHLIP dataset is divided into training and validation sets. It is based on the BACPHLIP phage lifestyle annotations and excludes Escherichia coli sequences in the training set to assess model generalization.



a. Training Set




Directory: datasets/BACPHLIP/training/

Sequences: Phage sequences excluding Escherichia species.

Files:



BACPHLIP_training.fasta: Contains phage sequences for training.

NONESCHERICHIA.fasta: Phage sequences excluding Escherichia.

sequencedb.tsv: Metadata and labels for each sequence.






Segmentation




Purpose: Simulates fragmented sequences as found in metagenomic assemblies.

Segment Lengths: 512 bp and 1022 bp.

Files:



segmentdb/BACPHLIP_random_L512_segmentdb.tsv

segmentdb/BACPHLIP_random_L1022_segmentdb.tsv






Tokenized Datasets




Directory: tokenized_datasets/ProkBERT/

Tokenization Parameters:



k-mer sizes (k): 1 (character-level), 6.

Shift sizes (s): 1, 2.



Files:



BACPHLIP_L{SegmentLength}_k{KmerSize}s{Shift}_train_X.pt: Tokenized input features.

BACPHLIP_L{SegmentLength}_k{KmerSize}s{Shift}_train_y.pt: Corresponding labels.

BACPHLIP_L{SegmentLength}_k{KmerSize}s{Shift}_train_torchdb.tsv: Mapping information.






b. Validation Set




Directory: datasets/BACPHLIP/validation/

Sequences: Escherichia coli phage sequences.

Files:



BACPHLIP_validation.fasta: Validation sequences.

sequencedb.tsv: Metadata and labels.






Segmentation and Tokenization




Similar to the training set, with segment lengths of 512 bp and 1022 bp.

Tokenized datasets are prepared using the same k-mer and shift sizes.

Purpose: To validate the model's performance on Escherichia coli phages not seen during training.




2. ESCHERICHIA Dataset




Directory: datasets/ESCHERICHIA/

Sequences: Escherichia phages, including the Guelin collection and additional temperate phages.

Files:



ESCHERICHIA.fasta: Phage sequences.

sequence_db.tsv: Metadata and labels.






Segmentation and Tokenization




Segment Lengths: 512 bp and 1022 bp.

Segmented Files:



segmentdb/ESCHERICHIA_contiguous_L512_segmentdb.tsv

segmentdb/ESCHERICHIA_contiguous_L1022_segmentdb.tsv



Tokenized Datasets:



Located in tokenized_datasets/ProkBERT/.

Prepared using various k-mer and shift sizes.






3. EXTREMOPHILE Dataset




Directory: datasets/EXTREMOPHILE/

Sequences: Phages from extreme environments (deep-sea, acidic, arsenic-rich habitats).

Files:



extremophiles.fasta: Phage sequences.

sequence_db.tsv: Metadata and labels.






Segmentation and Tokenization




Segment Lengths: 512 bp and 1022 bp.

Segmented Files:



segmentdb/EXTRMPHIL_contiguous_L512_segmentdb.tsv

segmentdb/EXTRMPHIL_contiguous_L1022_segmentdb.tsv



Tokenized Datasets:



Located in tokenized_datasets/ProkBERT/.

Prepared using various k-mer and shift sizes.






File Descriptions




Fasta Files (*.fasta): Contain the raw nucleotide sequences of phages.

Sequence Databases (sequencedb.tsv, sequence_db.tsv): Provide metadata, including sequence IDs, descriptions, labels (virulent or temperate), and other relevant information.

Segmented Databases (segmentdb/*.tsv): Contain information about the segmented sequences, including:



segment_id: Unique ID for each segment.

sequence_id: ID of the original sequence.

label: Phage lifestyle label.

y: Numerical label (1 for virulent, 0 for temperate).

segment_start and segment_end: Positions within the original sequence.

segment: Nucleotide sequence of the segment.



Tokenized Datasets (*.pt, *.tsv):



*_X.pt: Tokenized input features ready for model input.

*_y.pt: Corresponding labels for the input features.

*_torchdb.tsv: Mapping between segment IDs and tokenized inputs.






Naming Conventions




Segment Lengths:



L512: Segments of 512 base pairs.

L1022: Segments of 1022 base pairs.



Tokenization Parameters:



k{KmerSize}s{Shift}:



k1s1: k-mer size 1 (character-level), shift 1.

k6s1: k-mer size 6, shift 1.

k6s2: k-mer size 6, shift 2.





File Types:



train, val, test: Indicates the dataset split.

X.pt: Tokenized inputs.

y.pt: Labels.

torchdb.tsv: Tokenization mapping information.






Usage Instructions




Training




Select Dataset: Use the training data from datasets/BACPHLIP/training/.

Choose Tokenization Parameters: Decide on the k-mer size and shift that suit your model.

Load Tokenized Data: Use the *_X.pt and *_y.pt files for model input and labels.

Model Training: Train your model using the selected tokenized dataset.




Validation




Use Validation Data: Located in datasets/BACPHLIP/validation/.

Load Tokenized Data: Corresponding to your training tokenization parameters.

Evaluate Model: Assess performance to tune hyperparameters.




Testing




ESCHERICHIA Dataset: Evaluate model generalization on Escherichia phages.

EXTREMOPHILE Dataset: Test model performance on phages from extreme environments.

Procedure:



Load Tokenized Data: From the respective tokenized_datasets/ProkBERT/ directories.

Run Inference: Use your trained model to predict labels.

Analyze Results: Compare predictions with true labels to assess performance.






Additional Notes




Segmented Sequences: Simulate real-world scenarios where sequences may be fragmented due to metagenomic assembly processes.

Tokenization: Varies to allow experimentation with different modeling approaches.

Compatibility: Datasets are prepared for use with ProkBERT models but can be adapted for other sequence models.




Models for ProkBERT PhaStyle Phage Lifestyle Prediction




Overview


This repository contains fine-tuned models used for phage lifestyle prediction with ProkBERT PhaStyle. The models are trained on various datasets and are designed to classify phages as either virulent or temperate based on their nucleotide sequences. The collection includes fine-tuned versions of ProkBERT-mini, ProkBERT-mini-long, ProkBERT-mini-c, DNABERT2, and Nucleotide Transformer models of various sizes.



Directory Structure


The models are organized as follows:

Note: Some directories contain additional files such as optimizer states, scheduler states, and training arguments (*.pt, *.bin, trainer_state.json, etc.) necessary for resuming training or detailed analysis.



Model Descriptions




ProkBERT-mini




Description: A smaller version of the ProkBERT model fine-tuned for phage lifestyle prediction.

Variants:



prokbert-mini-L512: Fine-tuned on 512 bp segments.

prokbert-mini-L1022: Fine-tuned on 1022 bp segments.






ProkBERT-mini-long




Description: ProkBERT-mini model fine-tuned with a k-mer size of 6 and shift size of 2, capturing longer contextual information.

Variants:



prokbert-mini-long-L512: Fine-tuned on 512 bp segments with longer k-mer shifts.

prokbert-mini-long-L1022: Fine-tuned on 1022 bp segments with longer k-mer shifts.






ProkBERT-mini-c




Description: Character-level ProkBERT-mini model fine-tuned for phage lifestyle prediction, using k-mer size 1.

Variants:



prokbert-mini-c-L512: Fine-tuned on 512 bp segments at character level.

prokbert-mini-c-L1022: Fine-tuned on 1022 bp segments at character level.






DNABERT2




Description: DNABERT2 model fine-tuned for phage lifestyle prediction, known for its effectiveness in DNA sequence tasks.

Variants:



DNABERT2-L512: Fine-tuned on 512 bp segments.

DNABERT2-L1022: Fine-tuned on 1022 bp segments.






Nucleotide Transformer




Description: Nucleotide Transformer models of various sizes fine-tuned for phage lifestyle prediction.

Variants:



nucleotide-transformer-v2-50m-L512: 50 million parameters, fine-tuned on 512 bp segments.

nucleotide-transformer-v2-50m-L1022: 50 million parameters, fine-tuned on 1022 bp segments.

nucleotide-transformer-v2-100m-L512: 100 million parameters, fine-tuned on 512 bp segments.

nucleotide-transformer-v2-100m-L1022: 100 million parameters, fine-tuned on 1022 bp segments.

nucleotide-transformer-v2-500m-L512: 500 million parameters, fine-tuned on 512 bp segments.

nucleotide-transformer-v2-500m-L1022: 500 million parameters, fine-tuned on 1022 bp segments.






Summary Table





Model Name
Segment Length
Parameters
Description




prokbert-mini-L512
512 bp
~25 million
ProkBERT-mini fine-tuned on 512 bp segments


prokbert-mini-L1022
1022 bp
~25 million
ProkBERT-mini fine-tuned on 1022 bp segments


prokbert-mini-long-L512
512 bp
~25 million
ProkBERT-mini with k=6, s=2, capturing longer contexts


prokbert-mini-long-L1022
1022 bp
~25 million
ProkBERT-mini-long fine-tuned on 1022 bp segments


prokbert-mini-c-L512
512 bp
~25 million
Character-level ProkBERT-mini, k=1, s=1


prokbert-mini-c-L1022
1022 bp
~25 million
ProkBERT-mini-c fine-tuned on 1022 bp segments


DNABERT2-L512
512 bp
117 million
DNABERT2 model fine-tuned on 512 bp segments


DNABERT2-L1022
1022 bp
117 million
DNABERT2 model fine-tuned on 1022 bp segments


nucleotide-transformer-v2-50m-L512
512 bp
50 million
Nucleotide Transformer 50M, fine-tuned on 512 bp segments


nucleotide-transformer-v2-50m-L1022
1022 bp
50 million
Nucleotide Transformer 50M, fine-tuned on 1022 bp segments


nucleotide-transformer-v2-100m-L512
512 bp
100 million
Nucleotide Transformer 100M, fine-tuned on 512 bp segments


nucleotide-transformer-v2-100m-L1022
1022 bp
100 million
Nucleotide Transformer 100M, fine-tuned on 1022 bp segments


nucleotide-transformer-v2-500m-L512
512 bp
500 million
Nucleotide Transformer 500M, fine-tuned on 512 bp segments


nucleotide-transformer-v2-500m-L1022
1022 bp
500 million
Nucleotide Transformer 500M, fine-tuned on 1022 bp segments






Usage Instructions


To use these models for phage lifestyle prediction, you can load them using the Hugging Face Transformers library and ProkBERT.



@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




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