FANTASIA (Functional ANnoTAtion based on embedding space SImilArity) is a pipeline for annotating Gene Ontology (GO) terms for protein sequences using advanced protein language models like ProtT5, ProstT5, and ESM2. This system automates complex workflows, from sequence processing to functional annotation, providing a scalable and efficient solution for protein structure and functionality analysis.
- Introduction
- Key Features
- Prerequisites
- Step 1: Clone the Repository
- Step 2: Create and Activate a Virtual Environment
- Step 3: Start Services
- Step 4: Configuration
- Step 5: Initialization
- Step 6: Run the Pipeline
- Documentation
- Citation
- Contact Information
- Redundancy Filtering: Removes identical sequences with CD-HIT and optionally excludes sequences based on length constraints.
- Embedding Generation: Utilizes state-of-the-art models for protein sequence embeddings.
- GO Term Lookup: Matches embeddings with a vector database to retrieve associated GO terms.
- Results: Outputs transferred annotations with the correspondant distance matrix
- Operating System: Updated Linux (Ubuntu recommended).
- Python: Version 3.10 or higher installed.
- Poetry: Installed for dependency management:
pip install poetry
- Docker: Installed and running. If not installed, follow the Docker installation guide.
- NVIDIA Driver: Version 550.120 or newer (verify using
nvidia-smi
). - CUDA: Version 12.4 or newer installed (verify using
nvcc --version
).
git clone https://github.com/CBBIO/FANTASIA.git
cd FANTASIA
Let poetry
manage the virtual environment.
poetry install
poetry shell
To ensure the PostgreSQL and RabbitMQ services are running, use the following commands to start the containers:
Run the following command to start a PostgreSQL container with the pgvector extension:
docker run -d --name pgvectorsql \
-e POSTGRES_USER=usuario \
-e POSTGRES_PASSWORD=clave \
-e POSTGRES_DB=BioData \
-p 5432:5432 \
pgvector/pgvector:pg16
Run the following command to start a RabbitMQ container:
docker run -d --name rabbitmq \
-p 15672:15672 \
-p 5672:5672 \
rabbitmq:management
You can access the RabbitMQ management interface at http://localhost:15672 using the default credentials (guest
/guest
).
Before proceeding, create the necessary directories with proper permissions:
mkdir -p ~/fantasia/dumps ~/fantasia/embeddings ~/fantasia/results ~/fantasia/redundancy
chmod -R 755 ~/fantasia
Ensure the following parameters are correctly set in the config.yaml :
max_workers: 1
constants: "./fantasia/constants.yaml" # Auxiliary file for the information system, used to add or remove models in this pipeline.
DB_USERNAME: usuario
DB_PASSWORD: clave
DB_HOST: pgvectorsql
DB_PORT: 5432
DB_NAME: BioData
rabbitmq_host: rabbitmq
rabbitmq_user: guest
rabbitmq_password: guest
embeddings_url: "https://zenodo.org/records/14546346/files/embeddings.tar?download=1"
Pay special attention to the paths you configure for FANTASIA:
~/fantasia
: This is used for input, intermediary, and output files. Ensure that this directory exists and has the correct permissions../fantasia
: Refers to the project root directory where configuration files and scripts reside.
Properly managing these paths ensures smooth execution of the pipeline and prevents errors related to missing files or directories.
embeddings_path: ~/fantasia/dumps/
fantasia_output_h5: ~/fantasia/embeddings/
fantasia_output_csv: ~/fantasia/results/
redundancy_file: ~/fantasia/redundancy/output.fasta
-
Download embeddings and load the database:
python fantasia/main.py initialize --config ./fantasia/config.yaml
-
Verify that the data has been downloaded and loaded into:
- The folder defined in
embeddings_path
. - The configured PostgreSQL database.
- The folder defined in
Before running the pipeline, ensure the necessary input file is placed in the correct location. Copy the sample.fasta
file from the data_sample
directory to the expected input directory:
mkdir -p ~/fantasia/input
cp ./data_sample/sample.fasta ~/fantasia/input/sample.fasta
Run the pipeline using an input FASTA file and the following command:
python fantasia/main.py run \
--fasta ~/fantasia/input/sample.fasta \
--prefix sample \
--length_filter 5000 \
--redundancy_filter 0.65 \
--sequence_queue_package 200 \
--esm \
--prost \
--prot \
--distance_threshold 1:1.2,2:0.7,3:0.7 \
--batch_size 1:50,2:60,3:40
--fasta
: Specifies the path to the input FASTA file containing protein sequences. In this case:~/fantasia/input/sample.fasta
.--prefix
: Sets the prefix for naming the output files. Here, the prefix isfinger_zinc
.--length_filter
: Filters out sequences longer than 5000 amino acids.--redundancy_filter
: Removes redundant sequences with a similarity threshold of 0.65.--sequence_queue_package
: Defines the number of sequences to be processed per queue package (e.g., 200 sequences).--esm
,--prost
,--prot
: Enables the use of the specified models (ESM, Prost, Prot).--distance_threshold
: Sets the maximum allowed distances for similarity matching, specific to each model. Here:- Model 1 (ESM): 1.2
- Model 2 (Prost): 0.7
- Model 3 (Prot): 0.7
--batch_size
: Specifies the batch sizes for embedding generation, tailored per model. Here:- Model 1 (ESM): 50
- Model 2 (Prost): 60
- Model 3 (Prot): 40
Results will be stored in the paths specified under:
fantasia_output_h5
: HDF5 embeddings.fantasia_output_csv
: Processed results.
(Work In Progress)
For complete details on pipeline configuration, parameters, and deployment, visit the FANTASIA Documentation.
If you use FANTASIA in your work, please cite the following:
-
Martínez-Redondo, G. I., Barrios, I., Vázquez-Valls, M., Rojas, A. M., & Fernández, R. (2024). Illuminating the functional landscape of the dark proteome across the Animal Tree of Life.
https://doi.org/10.1101/2024.02.28.582465. -
Barrios-Núñez, I., Martínez-Redondo, G. I., Medina-Burgos, P., Cases, I., Fernández, R. & Rojas, A.M. (2024). Decoding proteome functional information in model organisms using protein language models.
https://doi.org/10.1101/2024.02.14.580341.
- Francisco Miguel Pérez Canales: [email protected]
- Gemma I. Martínez-Redondo: [email protected]
- Ana M. Rojas: [email protected]
- Rosa Fernández: [email protected]