Fantasia Lite bundles the essentials for running GO annotation transfer on local FASTA files without the full FANTASIA infrastructure. The lightweight Python pipeline builds embeddings, performs nearest-neighbour lookup against the static bundle, and exports TopGO-ready tables.
Pep8
3
41 commits
updated Oct 11, 2026
FANTASIA Lite V1.2 is a streamlined, standalone version of the full FANTASIA pipeline, designed for fast and efficient Gene Ontology (GO) annotation of protein sequences from local FASTA files using embedding comparisons.
FANTASIA Lite generates deep learning embeddings and performs nearest-neighbor annotation transfer, while intentionally removing the service stack used by the full project. The bundled lookup table covers five reference embedding spaces, and the built-in Lite embedder can generate matching query embeddings for all five model families exposed through the local CLI.
The simplest way to run it is:
./scripts/minimal_pipeline.sh your_proteins.fa
For an Apptainer/Singularity deployment on an HPC system where compute nodes have no Internet access, see the offline HPC guide.
Before any annotation run can work, create data/lookup/, then download the
required lookup data from Zenodo. These
directories are intentionally not tracked by Git and are not created by a
fresh clone:
mkdir -p data/lookup
Unlike the full FANTASIA pipeline, FANTASIA Lite does not require PostgreSQL, RabbitMQ, or a database-backed orchestration layer. It runs locally from flat files:
lookup_table.npz for reference embeddingsannotations.json for GO annotationsaccessions.json for accession mappingThe tradeoff is that Lite is simpler to deploy but can be slower if embedding and lookup are not tuned well. This repository now includes GPU-aware embedding and lookup controls intended to recover as much performance as possible without reintroducing external services.
The main purpose of Lite V1.1is to provide a fast local annotator that can be dropped into other pipelines with minimal setup. The default fast path is intentionally simple: ProtT5 embeddings, cosine lookup, and k=1 transfer. More advanced configuration is still available when you need multi-model runs, layered embedding export, larger k, or other custom settings.
This repository is ideal for users who want:
For advanced features, large-scale annotation, or integration with external databases, see the full FANTASIA repository.
Lite V1.2 adds an Apptainer workflow for offline HPC systems. It provides a CUDA image, a configurable site YAML, a node0-only asset preparation command, offline validation, and a Slurm launcher that mounts lookup data, model caches, inputs, outputs, and scratch storage explicitly. See Apptainer on HPC systems.
Compared with the earlier Lite V0 branch, Lite V1.1includes several practical improvements:
--reuse-embeddings--topgo is requestedesm2, prost_t5, prot_t5, ankh3, and esmctorchvision and torchtext, preventing fragile torch/torchvision wheel mismatchessrc/generate_embeddings.py, separate from lookupesm==3.2.3, which currently supports Python >=3.12,<3.13; all-five-model runs therefore require Python 3.12.lookup_table.npz, annotations.json, accessions.json) from Zenodo placed in data/lookup/ before running the pipeline--torch-index or TORCH_INDEX is explicitly set.wget or curl (for downloading the lookup bundle)The FANTASIA Lite V1.1lookup table is built from the UniProt November 2025 release and includes only proteins with experimental evidence, ensuring high-quality functional annotations. All data was generated using PIS v3.1.0, the internal system used to extract and preprocess UniProt, PDB, and GOA data.
Lookup bundle Zenodo concept DOI: 10.5281/zenodo.19742925
Use this concept DOI to cite the lookup table or access its latest published version. Individual releases also have version-specific DOIs.
accessions.json: 124,397annotations.json: 124,397annotations.json: 621,024These are the measured per-model embedding counts in the current lookup bundle. annotations.json and accessions.json both contain 124,397 entries, while the individual model spaces in lookup_table.npz can differ slightly in coverage.
The Zenodo deposition provides the three essential lookup files both as the
single convenience archive fantasia_lite_data_folder.tgz and as separate
downloads. The archive contains:
lookup_table.npz
annotations.json
accessions.json
lookup_table.npz is the reference embedding space. It does not contain GO terms by itself. It stores the precomputed vectors that query embeddings are compared against.annotations.json is the annotation layer. After the nearest reference proteins are found, this file is used to expand those hits into GO terms, GO categories, descriptions, and evidence codes.accessions.json is the identifier layer. It maps the internal lookup-table positions back to UniProt accessions and metadata.--lookup-batch-size controls how many query embeddings are processed together, not how many reference proteins are searched.k is controlled by --limit-per-entry. With k=1, the pipeline keeps only the top reference hit per query. With larger k, it keeps more nearest neighbors before GO-term consolidation.results.csv is the consolidated final annotation table. It keeps the best supporting row for each (query, GO term, category) combination.raw_results.csv is optional and preserves the neighbor-level rows before GO-term consolidation. It is especially useful when k > 1.k=1. Layered embedding export is separate from lookup.--layer-indices.The lookup table includes only high-confidence experimental annotations:
No database server or external dependencies are required.
FANTASIA Lite V1.1is designed first as a fast local annotator that is easy to integrate into other pipelines, while still supporting more configurable research-style runs when needed.
The easiest default path is:
./scripts/minimal_pipeline.sh your_proteins.fa
This script keeps the intended Lite defaults explicit:
prot_t5k=1float32)In Lite, k is controlled by --limit-per-entry.
Beyond that, Lite V1.1provides two main Python entrypoints:
fantasia_pipeline.py)For processing protein sequences and obtaining GO annotations:
Lite V1.1keeps embedding and lookup in full precision (float32) for comparability with the full FANTASIA workflow. Mixed precision is not enabled by default.
# Basic usage - single model annotation
fantasia_pipeline your_proteins.fa
# Recommended general usage with a single model
fantasia_pipeline --serial-models --embed-models prot_t5 your_proteins.fa
# Recommended fast GPU usage without sequence truncation
fantasia_pipeline \
--device cuda \
--use-gpu-lookup \
--serial-models \
--embed-models prot_t5 \
--sequence-queue-package 100 \
--embed-batch-size 4 \
--model-batch-sizes prot_t5=4 \
--lookup-batch-size 1024 \
your_proteins.fa
# Multiple models (slower but more comprehensive; keep --serial-models enabled)
python3.12 src/fantasia_pipeline.py \
--serial-models \
--embed-models "esm2 prost_t5 prot_t5 ankh3 esmc" \
your_proteins.fa
# RTX 5090 / Blackwell CUDA example with conservative per-model batches
python3.12 src/fantasia_pipeline.py \
--device cuda \
--use-gpu-lookup \
--serial-models \
--embed-models "esm2 prost_t5 prot_t5 ankh3 esmc" \
--model-batch-sizes esm2=1 prost_t5=1 prot_t5=4 ankh3=4 esmc=1 \
your_proteins.fa
# Advanced configuration
fantasia_pipeline \
--embed-models prot_t5 \
--limit-per-entry 5 \
--results-csv my_results.csv \
your_proteins.fa
Three ready-to-run helper scripts are included under scripts/:
These helper scripts use paths relative to the repository root. Run them from inside the cloned FANTASIA-Lite directory. If needed, you can override the Python interpreter with PYTHON_BIN=/path/to/python. Use a Python 3.12 interpreter for ESM-C or all-five-model runs.
scripts/minimal_pipeline.sh
This is the main Lite V1.1entrypoint for fast annotation and pipeline integration. It runs the standard end-to-end workflow with the intended Lite defaults:
k=1Example:
./scripts/minimal_pipeline.sh fasta_test/PRUB1_longiso.pep
scripts/default_last_layer.sh
Runs the standard end-to-end Lite workflow with the current recommended tuned settings for a 24 GB-class GPU:
Example:
./scripts/default_last_layer.sh fasta_test/PRUB1_longiso.pep
scripts/embedding_only_with_layers.sh
Runs embedding generation only, with no lookup, and exports the default last-layer embeddings plus either:
0 is the earliest exported hidden-state representation, while 24 is the final encoder layer. The standard last-layer embedding is also always written separately as Prot-T5_embeddings.
For Ankh3, the same ordering rule applies: 0 is the earliest exported hidden-state representation and 48 is the final exported layer. The standard last-layer embedding is also written separately as Ankh3-Large_embeddings.
These layer options should be used in embedding-only mode, not as a replacement for the default lookup workflow.Examples:
# Export all available layers
./scripts/embedding_only_with_layers.sh fasta_test/PRUB1_longiso.pep outputs_layers.npz
# Export only selected layers
./scripts/embedding_only_with_layers.sh fasta_test/PRUB1_longiso.pep outputs_layers.npz 0 8 16 24
Key Options:
--embed-models: Choose models (esm2, prost_t5, prot_t5, ankh3, esmc) - default: prot_t5. Aliases such as ESM, Prost-T5, Prot-T5, Ankh3-Large, and ESM3c are accepted.--serial-models: Process requested models one after another instead of as one combined model-group. For a single model, this usually makes no practical difference. For more than one model, it is the recommended and safer setting because it reduces GPU/CPU memory pressure and avoids loading multiple embedders at the same time.--limit-per-entry N: Return top N annotations per sequence (default: 1)--raw-results-csv PATH: Optional raw neighbor-level output before GO-term consolidation. If omitted, Lite writes only results.csv unless --limit-per-entry > 1, in which case a raw file is created automatically as k.<N>.results.csv--topgo: Optional. Generate TopGO files after lookup. TopGO export is disabled by default--distance-metric {cosine,euclidean}: Lookup metric. Lite V1.1defaults to cosine, but euclidean is also supported--use-gpu-lookup: Force GPU nearest-neighbor lookup when CUDA is available--lookup-batch-size N: Number of query embeddings compared per lookup batch--sequence-queue-package N: Outer packaging size before embedding forward passes--embed-batch-size N: Default forward-pass batch size for embeddings--model-batch-sizes MODEL=N ...: Per-model embedding batch size overrides, for example esm2=1 prost_t5=1 prot_t5=4 ankh3=4 esmc=1--length-filter N: Optional truncation before embedding; 0 disables truncation and is the defaultFANTASIA Lite V1.1is installed by cloning the repository, placing the lookup bundle in data/lookup/, and running a simple setup check from inside the cloned folder.
FANTASIA Lite annotates protein FASTA files by embedding each query, searching a local reference table, and transferring experimentally supported Gene Ontology (GO) terms from nearby reference proteins.
Lite runs from flat files without PostgreSQL or RabbitMQ. An NVIDIA GPU is strongly recommended; CPU mode is available as a slower fallback. For service-backed reference management and all five built-in embedders, use FANTASIA Full.
git clone https://github.com/CBBIO/FANTASIA-Lite.git
cd FANTASIA-Lite
mkdir -p data/lookup
Download fantasia_lite_data_folder.tgz from
Zenodo, place it in the repository
root, and extract it:
tar -xzf fantasia_lite_data_folder.tgz
test -s data/lookup/lookup_table.npz
test -s data/lookup/annotations.json
test -s data/lookup/accessions.json
The archive contains the data/lookup/ path. Alternatively, download those
three files separately into data/lookup/.
./scripts/minimal_pipeline.sh fasta_test/test.fa
The default minimal script uses prot_t5. If your system default python3 is not Python 3.12 and you plan to run ESM-C or all five models later, use an explicit interpreter for those runs:
PYTHON_BIN=/path/to/python3.12 ./scripts/minimal_pipeline.sh fasta_test/test.fa
The first run creates venv/, installs dependencies, and downloads ProtT5.
Lite automatically uses CUDA when available.
./scripts/minimal_pipeline.sh data/my_proteome.faa.gz
Plain and gzip-compressed FASTA files are accepted. Gzip input is decompressed while reading.
The helper script runs ProtT5 with cosine distance, k=1, float32 embeddings,
no sequence truncation, GPU lookup when CUDA is available, and TopGO disabled.
Each invocation creates outputs_<timestamp>/.
| To change | Option |
|---|---|
| retrieve five donors | --limit-per-entry 5 |
| force GPU | --device cuda --use-gpu-lookup |
| force CPU fallback | --device cpu --no-gpu-lookup |
| use Ankh3-Large | --serial-models --embed-models ankh3 |
| reuse embeddings | --reuse-embeddings --embeddings-npz FILE |
| enable TopGO | --topgo |
| truncate explicitly | --length-filter N (0 is uncapped) |
Show all options:
python3 src/fantasia_pipeline.py --help
outputs_<timestamp>/
├── results.csv
├── query_embeddings.npz
├── failed_sequences.csv
├── fantasia_config.yaml
├── run_metadata.yaml
├── model_provenance.yaml
├── run.log
├── k.<N>.results.csv # when k > 1
└── topgo/ # only with --topgo
results.csv contains final consolidated GO assignments. A protein can have
multiple rows because it can receive multiple GO terms.k.<N>.results.csv is the donor-level table before GO consolidation. It
preserves hit_rank, reference IDs, UniProt accessions, distances, and GO
terms.failed_sequences.csv reports proteins that could not be embedded.run_metadata.yaml records the command, Git commit, parameters, device,
coverage, and stage timings.model_provenance.yaml records model repositories, enforced Hugging Face
revisions, lookup keys, device, Python, and package versions.Lite pins both tokenizer and model downloads to these commits:
| Lite model | Repository | Enforced revision |
|---|---|---|
| ProtT5 | Rostlab/prot_t5_xl_uniref50 | 973be27c52ee6474de9c945952a8008aeb2a1a73 |
| Ankh3-Large | ElnaggarLab/ankh3-large | 2be091622e8a393f0ef21735070084123c874b6e |
Keep both YAML files with published results.
GPU run with tuned batches:
python3 src/fantasia_pipeline.py \
--device cuda --use-gpu-lookup --serial-models \
--embed-models prot_t5 --model-batch-sizes prot_t5=4 \
--lookup-batch-size 1024 data/my_proteome.faa.gz
Retrieve five donors and retain the raw neighborhood:
python3 src/fantasia_pipeline.py \
--embed-models prot_t5 --distance-metric cosine \
--limit-per-entry 5 data/my_proteome.faa.gz
Reuse an existing query archive:
python3 src/fantasia_pipeline.py \
--reuse-embeddings \
--embeddings-npz outputs_<timestamp>/query_embeddings.npz \
--limit-per-entry 5 data/my_proteome.faa.gz
Generate embeddings without GO lookup:
./scripts/default_last_layer.sh fasta_test/PRUB1_longiso.pep
./scripts/minimal_pipeline.sh fasta_test/UP000001940_6239.fasta
./scripts/minimal_pipeline.sh fasta_test/MUSM_10090.fasta
This corresponds to:
prot_t5k=1float32)prot_t5=4)| Dataset | Sequences | Model | Runtime | Rate (seq/s) | Coverage | Failed |
|---|---|---|---|---|---|---|
| PRUB1_longiso.pep | 20,223 | ProtT5 | 22m 38.60s | 14.89 | 99.72% | 56 |
| UP000001940_6239.fasta | 19,831 | ProtT5 | 23m 33.86s | 14.03 | 99.75% | 49 |
| MUSM_10090.fasta | 21,852 | ProtT5 | 35m 43.23s | 10.20 | 99.31% | 150 |
k=1 vs k=5 on GPUThe following comparison keeps the device, model family, and full-length setting aligned, and changes only the lookup depth:
| Dataset | k | Runtime | Rate (seq/s) | Coverage | Failed |
|---|---|---|---|---|---|
| PRUB1_longiso.pep | 1 | 22m 38.60s | 14.89 | 99.72% | 56 |
| PRUB1_longiso.pep | 5 | 23m 19.46s | 14.45 | 99.83% | 34 |
For the revalidated k=5 PRUB1 run, the recorded stage split was approximately 22m 41.35s embedding, 37.58s lookup, and 0.53s post-processing. In practice, increasing k from 1 to 5 added only a modest overhead because embedding remains the dominant cost.
Small validation runs on the first 5 sequences of fasta_test/test.fa were used to confirm that Lite V1 behaves correctly in CPU-only mode, GPU k=5 mode, and layered embedding export mode:
| Test | Device | Settings | Runtime | Notes |
|---|---|---|---|---|
| End-to-end lookup | CPU | ProtT5, cosine, k=1 | 118.90s | Confirms Lite works without GPU |
| End-to-end lookup | GPU | ProtT5, cosine, k=5 | 64.43s | Not directly comparable with the CPU row because the device changed |
| Embedding-only layered export | GPU | ProtT5 layers 0, 12, 24 | 12.97s | Wrote Prot-T5_layer_0_embeddings, Prot-T5_layer_12_embeddings, and Prot-T5_layer_24_embeddings, each with shape (5, 1024); here 24 is the final encoder layer, not 0 |
| Embedding-only layered export | GPU | Ankh3 all layers | 70.58s | Wrote Ankh3-Large_layer_0_embeddings through Ankh3-Large_layer_48_embeddings; representative shapes confirmed for layer_0, layer_24, and layer_48, each (5, 1536) |
Notes:
The pipeline automatically manages Python virtual environments:
# Virtual environment is created automatically in venv/
# To clean up and force rebuild:
rm -rf venv/
./scripts/minimal_pipeline.sh your_file.fa # Will recreate venv automatically
For processing multiple files systematically:
# Process multiple specific files
python3 src/pipeline_timing_analyzer.py \
--files file1.fa file2.fa file3.fa \
--model prot_t5
# Process all files in a directory
python3 src/pipeline_timing_analyzer.py \
--fasta-dir my_proteomes/ \
--report-csv batch_results.csv
The timing analyzer is useful for benchmarking and regression testing. In Lite V1 it now also reads per-run stage timings from run_metadata.yaml, so benchmark reports can separate embedding time, lookup time, and post-processing time.
For large files or limited memory systems:
# Use a single model, smaller chunks, and explicit serial processing
fantasia_pipeline \
--serial-models \
--embed-models prot_t5 \
--chunk-size 200 \
large_proteome.fa
For the current Lite V1 fast path, prot_t5 with --model-batch-sizes prot_t5=4 is the best starting point on a 24 GB-class GPU. If you see CUDA OOM skips, reduce the model batch size further before changing lookup settings.
In Lite V1, the embedding step and lookup step are intentionally separated:
src/generate_embeddings.pydata/lookup/These two layers are related, but they do not currently expose exactly the same model set through the Lite CLI.
The built-in Lite embedder currently supports:
prot_t5: Protein T5 model (recommended, good balance of speed and accuracy)ankh3: ANKH large protein language model (slower but potentially more accurate)The Lite embedder can now also export:
--layer-indices--all-layersThis embedding-only mode is independent of lookup. In other words, Lite can generate embeddings locally for the models above, with optional layer export, even when you do not want to run annotation lookup.
The bundled Lite lookup table currently contains last-layer reference embeddings for:
So the lookup bundle is broader than the built-in Lite embedder. The lookup side is not limited to only two model spaces; the current local embedding CLI is the narrower component.
The current built-in end-to-end Lite pipeline is intended for the last-layer models that the Lite embedder can generate directly today:
If you provide externally generated embeddings that match the lookup bundle keys and format, the lookup layer itself is separate and can in principle operate on the additional lookup-table models as well. So the practical distinction is:
prot_t5 and ankh3, with optional layer exportESM-2, ProstT5, ProtT5, Ankh3-Large, and ESM3c, using last-layer reference embeddings.fa, .faa, .fasta) and gzip-compressed versions (.fa.gz, .fasta.gz)Lookup files missing: ensure the three files are directly under
data/lookup/, not in an additional nested directory.
CUDA unavailable: check nvidia-smi; otherwise use
--device cpu --no-gpu-lookup as a slower fallback.
CUDA out of memory: use one model with --serial-models, then reduce
--model-batch-sizes, --embed-batch-size, and --max-batch-residues.
Failures for individual proteins remain listed in failed_sequences.csv.
Several rows per protein: expected—results.csv has one row per retained
query/model/GO/category combination.
If you use FANTASIA-Lite in your research, please cite the tool paper:
Pérez-Canales, F. M., Domínguez-Rodríguez, À., Carbonetto, B., Fernández, R., Cases, I., & Rojas, A. M. (2026). FANTASIA suite: a reproducible and configurable framework for embedding-based functional annotation of proteins. NAR Genomics and Bioinformatics, 8(3), lqag106. DOI: 10.1093/nargab/lqag106
Please also cite this repository and the version-specific Zenodo lookup record used in the analysis.
Fantasia Lite bundles the essentials for running GO annotation transfer on local FASTA files without the full FANTASIA infrastructure. The lightweight Python pipeline builds embeddings, performs nearest-neighbour lookup against the static bundle, and exports TopGO-ready tables.
Pep8
3
41 commits
updated Oct 11, 2026
FANTASIA Lite V1.2 is a streamlined, standalone version of the full FANTASIA pipeline, designed for fast and efficient Gene Ontology (GO) annotation of protein sequences from local FASTA files using embedding comparisons.
FANTASIA Lite generates deep learning embeddings and performs nearest-neighbor annotation transfer, while intentionally removing the service stack used by the full project. The bundled lookup table covers five reference embedding spaces, and the built-in Lite embedder can generate matching query embeddings for all five model families exposed through the local CLI.
The simplest way to run it is:
./scripts/minimal_pipeline.sh your_proteins.fa
For an Apptainer/Singularity deployment on an HPC system where compute nodes have no Internet access, see the offline HPC guide.
Before any annotation run can work, create data/lookup/, then download the
required lookup data from Zenodo. These
directories are intentionally not tracked by Git and are not created by a
fresh clone:
mkdir -p data/lookup
Unlike the full FANTASIA pipeline, FANTASIA Lite does not require PostgreSQL, RabbitMQ, or a database-backed orchestration layer. It runs locally from flat files:
lookup_table.npz for reference embeddingsannotations.json for GO annotationsaccessions.json for accession mappingThe tradeoff is that Lite is simpler to deploy but can be slower if embedding and lookup are not tuned well. This repository now includes GPU-aware embedding and lookup controls intended to recover as much performance as possible without reintroducing external services.
The main purpose of Lite V1.1is to provide a fast local annotator that can be dropped into other pipelines with minimal setup. The default fast path is intentionally simple: ProtT5 embeddings, cosine lookup, and k=1 transfer. More advanced configuration is still available when you need multi-model runs, layered embedding export, larger k, or other custom settings.
This repository is ideal for users who want:
For advanced features, large-scale annotation, or integration with external databases, see the full FANTASIA repository.
Lite V1.2 adds an Apptainer workflow for offline HPC systems. It provides a CUDA image, a configurable site YAML, a node0-only asset preparation command, offline validation, and a Slurm launcher that mounts lookup data, model caches, inputs, outputs, and scratch storage explicitly. See Apptainer on HPC systems.
Compared with the earlier Lite V0 branch, Lite V1.1includes several practical improvements:
--reuse-embeddings--topgo is requestedesm2, prost_t5, prot_t5, ankh3, and esmctorchvision and torchtext, preventing fragile torch/torchvision wheel mismatchessrc/generate_embeddings.py, separate from lookupesm==3.2.3, which currently supports Python >=3.12,<3.13; all-five-model runs therefore require Python 3.12.lookup_table.npz, annotations.json, accessions.json) from Zenodo placed in data/lookup/ before running the pipeline--torch-index or TORCH_INDEX is explicitly set.wget or curl (for downloading the lookup bundle)The FANTASIA Lite V1.1lookup table is built from the UniProt November 2025 release and includes only proteins with experimental evidence, ensuring high-quality functional annotations. All data was generated using PIS v3.1.0, the internal system used to extract and preprocess UniProt, PDB, and GOA data.
Lookup bundle Zenodo concept DOI: 10.5281/zenodo.19742925
Use this concept DOI to cite the lookup table or access its latest published version. Individual releases also have version-specific DOIs.
accessions.json: 124,397annotations.json: 124,397annotations.json: 621,024These are the measured per-model embedding counts in the current lookup bundle. annotations.json and accessions.json both contain 124,397 entries, while the individual model spaces in lookup_table.npz can differ slightly in coverage.
The Zenodo deposition provides the three essential lookup files both as the
single convenience archive fantasia_lite_data_folder.tgz and as separate
downloads. The archive contains:
lookup_table.npz
annotations.json
accessions.json
lookup_table.npz is the reference embedding space. It does not contain GO terms by itself. It stores the precomputed vectors that query embeddings are compared against.annotations.json is the annotation layer. After the nearest reference proteins are found, this file is used to expand those hits into GO terms, GO categories, descriptions, and evidence codes.accessions.json is the identifier layer. It maps the internal lookup-table positions back to UniProt accessions and metadata.--lookup-batch-size controls how many query embeddings are processed together, not how many reference proteins are searched.k is controlled by --limit-per-entry. With k=1, the pipeline keeps only the top reference hit per query. With larger k, it keeps more nearest neighbors before GO-term consolidation.results.csv is the consolidated final annotation table. It keeps the best supporting row for each (query, GO term, category) combination.raw_results.csv is optional and preserves the neighbor-level rows before GO-term consolidation. It is especially useful when k > 1.k=1. Layered embedding export is separate from lookup.--layer-indices.The lookup table includes only high-confidence experimental annotations:
No database server or external dependencies are required.
FANTASIA Lite V1.1is designed first as a fast local annotator that is easy to integrate into other pipelines, while still supporting more configurable research-style runs when needed.
The easiest default path is:
./scripts/minimal_pipeline.sh your_proteins.fa
This script keeps the intended Lite defaults explicit:
prot_t5k=1float32)In Lite, k is controlled by --limit-per-entry.
Beyond that, Lite V1.1provides two main Python entrypoints:
fantasia_pipeline.py)For processing protein sequences and obtaining GO annotations:
Lite V1.1keeps embedding and lookup in full precision (float32) for comparability with the full FANTASIA workflow. Mixed precision is not enabled by default.
# Basic usage - single model annotation
fantasia_pipeline your_proteins.fa
# Recommended general usage with a single model
fantasia_pipeline --serial-models --embed-models prot_t5 your_proteins.fa
# Recommended fast GPU usage without sequence truncation
fantasia_pipeline \
--device cuda \
--use-gpu-lookup \
--serial-models \
--embed-models prot_t5 \
--sequence-queue-package 100 \
--embed-batch-size 4 \
--model-batch-sizes prot_t5=4 \
--lookup-batch-size 1024 \
your_proteins.fa
# Multiple models (slower but more comprehensive; keep --serial-models enabled)
python3.12 src/fantasia_pipeline.py \
--serial-models \
--embed-models "esm2 prost_t5 prot_t5 ankh3 esmc" \
your_proteins.fa
# RTX 5090 / Blackwell CUDA example with conservative per-model batches
python3.12 src/fantasia_pipeline.py \
--device cuda \
--use-gpu-lookup \
--serial-models \
--embed-models "esm2 prost_t5 prot_t5 ankh3 esmc" \
--model-batch-sizes esm2=1 prost_t5=1 prot_t5=4 ankh3=4 esmc=1 \
your_proteins.fa
# Advanced configuration
fantasia_pipeline \
--embed-models prot_t5 \
--limit-per-entry 5 \
--results-csv my_results.csv \
your_proteins.fa
Three ready-to-run helper scripts are included under scripts/:
These helper scripts use paths relative to the repository root. Run them from inside the cloned FANTASIA-Lite directory. If needed, you can override the Python interpreter with PYTHON_BIN=/path/to/python. Use a Python 3.12 interpreter for ESM-C or all-five-model runs.
scripts/minimal_pipeline.sh
This is the main Lite V1.1entrypoint for fast annotation and pipeline integration. It runs the standard end-to-end workflow with the intended Lite defaults:
k=1Example:
./scripts/minimal_pipeline.sh fasta_test/PRUB1_longiso.pep
scripts/default_last_layer.sh
Runs the standard end-to-end Lite workflow with the current recommended tuned settings for a 24 GB-class GPU:
Example:
./scripts/default_last_layer.sh fasta_test/PRUB1_longiso.pep
scripts/embedding_only_with_layers.sh
Runs embedding generation only, with no lookup, and exports the default last-layer embeddings plus either:
0 is the earliest exported hidden-state representation, while 24 is the final encoder layer. The standard last-layer embedding is also always written separately as Prot-T5_embeddings.
For Ankh3, the same ordering rule applies: 0 is the earliest exported hidden-state representation and 48 is the final exported layer. The standard last-layer embedding is also written separately as Ankh3-Large_embeddings.
These layer options should be used in embedding-only mode, not as a replacement for the default lookup workflow.Examples:
# Export all available layers
./scripts/embedding_only_with_layers.sh fasta_test/PRUB1_longiso.pep outputs_layers.npz
# Export only selected layers
./scripts/embedding_only_with_layers.sh fasta_test/PRUB1_longiso.pep outputs_layers.npz 0 8 16 24
Key Options:
--embed-models: Choose models (esm2, prost_t5, prot_t5, ankh3, esmc) - default: prot_t5. Aliases such as ESM, Prost-T5, Prot-T5, Ankh3-Large, and ESM3c are accepted.--serial-models: Process requested models one after another instead of as one combined model-group. For a single model, this usually makes no practical difference. For more than one model, it is the recommended and safer setting because it reduces GPU/CPU memory pressure and avoids loading multiple embedders at the same time.--limit-per-entry N: Return top N annotations per sequence (default: 1)--raw-results-csv PATH: Optional raw neighbor-level output before GO-term consolidation. If omitted, Lite writes only results.csv unless --limit-per-entry > 1, in which case a raw file is created automatically as k.<N>.results.csv--topgo: Optional. Generate TopGO files after lookup. TopGO export is disabled by default--distance-metric {cosine,euclidean}: Lookup metric. Lite V1.1defaults to cosine, but euclidean is also supported--use-gpu-lookup: Force GPU nearest-neighbor lookup when CUDA is available--lookup-batch-size N: Number of query embeddings compared per lookup batch--sequence-queue-package N: Outer packaging size before embedding forward passes--embed-batch-size N: Default forward-pass batch size for embeddings--model-batch-sizes MODEL=N ...: Per-model embedding batch size overrides, for example esm2=1 prost_t5=1 prot_t5=4 ankh3=4 esmc=1--length-filter N: Optional truncation before embedding; 0 disables truncation and is the defaultFANTASIA Lite V1.1is installed by cloning the repository, placing the lookup bundle in data/lookup/, and running a simple setup check from inside the cloned folder.
FANTASIA Lite annotates protein FASTA files by embedding each query, searching a local reference table, and transferring experimentally supported Gene Ontology (GO) terms from nearby reference proteins.
Lite runs from flat files without PostgreSQL or RabbitMQ. An NVIDIA GPU is strongly recommended; CPU mode is available as a slower fallback. For service-backed reference management and all five built-in embedders, use FANTASIA Full.
git clone https://github.com/CBBIO/FANTASIA-Lite.git
cd FANTASIA-Lite
mkdir -p data/lookup
Download fantasia_lite_data_folder.tgz from
Zenodo, place it in the repository
root, and extract it:
tar -xzf fantasia_lite_data_folder.tgz
test -s data/lookup/lookup_table.npz
test -s data/lookup/annotations.json
test -s data/lookup/accessions.json
The archive contains the data/lookup/ path. Alternatively, download those
three files separately into data/lookup/.
./scripts/minimal_pipeline.sh fasta_test/test.fa
The default minimal script uses prot_t5. If your system default python3 is not Python 3.12 and you plan to run ESM-C or all five models later, use an explicit interpreter for those runs:
PYTHON_BIN=/path/to/python3.12 ./scripts/minimal_pipeline.sh fasta_test/test.fa
The first run creates venv/, installs dependencies, and downloads ProtT5.
Lite automatically uses CUDA when available.
./scripts/minimal_pipeline.sh data/my_proteome.faa.gz
Plain and gzip-compressed FASTA files are accepted. Gzip input is decompressed while reading.
The helper script runs ProtT5 with cosine distance, k=1, float32 embeddings,
no sequence truncation, GPU lookup when CUDA is available, and TopGO disabled.
Each invocation creates outputs_<timestamp>/.
| To change | Option |
|---|---|
| retrieve five donors | --limit-per-entry 5 |
| force GPU | --device cuda --use-gpu-lookup |
| force CPU fallback | --device cpu --no-gpu-lookup |
| use Ankh3-Large | --serial-models --embed-models ankh3 |
| reuse embeddings | --reuse-embeddings --embeddings-npz FILE |
| enable TopGO | --topgo |
| truncate explicitly | --length-filter N (0 is uncapped) |
Show all options:
python3 src/fantasia_pipeline.py --help
outputs_<timestamp>/
├── results.csv
├── query_embeddings.npz
├── failed_sequences.csv
├── fantasia_config.yaml
├── run_metadata.yaml
├── model_provenance.yaml
├── run.log
├── k.<N>.results.csv # when k > 1
└── topgo/ # only with --topgo
results.csv contains final consolidated GO assignments. A protein can have
multiple rows because it can receive multiple GO terms.k.<N>.results.csv is the donor-level table before GO consolidation. It
preserves hit_rank, reference IDs, UniProt accessions, distances, and GO
terms.failed_sequences.csv reports proteins that could not be embedded.run_metadata.yaml records the command, Git commit, parameters, device,
coverage, and stage timings.model_provenance.yaml records model repositories, enforced Hugging Face
revisions, lookup keys, device, Python, and package versions.Lite pins both tokenizer and model downloads to these commits:
| Lite model | Repository | Enforced revision |
|---|---|---|
| ProtT5 | Rostlab/prot_t5_xl_uniref50 | 973be27c52ee6474de9c945952a8008aeb2a1a73 |
| Ankh3-Large | ElnaggarLab/ankh3-large | 2be091622e8a393f0ef21735070084123c874b6e |
Keep both YAML files with published results.
GPU run with tuned batches:
python3 src/fantasia_pipeline.py \
--device cuda --use-gpu-lookup --serial-models \
--embed-models prot_t5 --model-batch-sizes prot_t5=4 \
--lookup-batch-size 1024 data/my_proteome.faa.gz
Retrieve five donors and retain the raw neighborhood:
python3 src/fantasia_pipeline.py \
--embed-models prot_t5 --distance-metric cosine \
--limit-per-entry 5 data/my_proteome.faa.gz
Reuse an existing query archive:
python3 src/fantasia_pipeline.py \
--reuse-embeddings \
--embeddings-npz outputs_<timestamp>/query_embeddings.npz \
--limit-per-entry 5 data/my_proteome.faa.gz
Generate embeddings without GO lookup:
./scripts/default_last_layer.sh fasta_test/PRUB1_longiso.pep
./scripts/minimal_pipeline.sh fasta_test/UP000001940_6239.fasta
./scripts/minimal_pipeline.sh fasta_test/MUSM_10090.fasta
This corresponds to:
prot_t5k=1float32)prot_t5=4)| Dataset | Sequences | Model | Runtime | Rate (seq/s) | Coverage | Failed |
|---|---|---|---|---|---|---|
| PRUB1_longiso.pep | 20,223 | ProtT5 | 22m 38.60s | 14.89 | 99.72% | 56 |
| UP000001940_6239.fasta | 19,831 | ProtT5 | 23m 33.86s | 14.03 | 99.75% | 49 |
| MUSM_10090.fasta | 21,852 | ProtT5 | 35m 43.23s | 10.20 | 99.31% | 150 |
k=1 vs k=5 on GPUThe following comparison keeps the device, model family, and full-length setting aligned, and changes only the lookup depth:
| Dataset | k | Runtime | Rate (seq/s) | Coverage | Failed |
|---|---|---|---|---|---|
| PRUB1_longiso.pep | 1 | 22m 38.60s | 14.89 | 99.72% | 56 |
| PRUB1_longiso.pep | 5 | 23m 19.46s | 14.45 | 99.83% | 34 |
For the revalidated k=5 PRUB1 run, the recorded stage split was approximately 22m 41.35s embedding, 37.58s lookup, and 0.53s post-processing. In practice, increasing k from 1 to 5 added only a modest overhead because embedding remains the dominant cost.
Small validation runs on the first 5 sequences of fasta_test/test.fa were used to confirm that Lite V1 behaves correctly in CPU-only mode, GPU k=5 mode, and layered embedding export mode:
| Test | Device | Settings | Runtime | Notes |
|---|---|---|---|---|
| End-to-end lookup | CPU | ProtT5, cosine, k=1 | 118.90s | Confirms Lite works without GPU |
| End-to-end lookup | GPU | ProtT5, cosine, k=5 | 64.43s | Not directly comparable with the CPU row because the device changed |
| Embedding-only layered export | GPU | ProtT5 layers 0, 12, 24 | 12.97s | Wrote Prot-T5_layer_0_embeddings, Prot-T5_layer_12_embeddings, and Prot-T5_layer_24_embeddings, each with shape (5, 1024); here 24 is the final encoder layer, not 0 |
| Embedding-only layered export | GPU | Ankh3 all layers | 70.58s | Wrote Ankh3-Large_layer_0_embeddings through Ankh3-Large_layer_48_embeddings; representative shapes confirmed for layer_0, layer_24, and layer_48, each (5, 1536) |
Notes:
The pipeline automatically manages Python virtual environments:
# Virtual environment is created automatically in venv/
# To clean up and force rebuild:
rm -rf venv/
./scripts/minimal_pipeline.sh your_file.fa # Will recreate venv automatically
For processing multiple files systematically:
# Process multiple specific files
python3 src/pipeline_timing_analyzer.py \
--files file1.fa file2.fa file3.fa \
--model prot_t5
# Process all files in a directory
python3 src/pipeline_timing_analyzer.py \
--fasta-dir my_proteomes/ \
--report-csv batch_results.csv
The timing analyzer is useful for benchmarking and regression testing. In Lite V1 it now also reads per-run stage timings from run_metadata.yaml, so benchmark reports can separate embedding time, lookup time, and post-processing time.
For large files or limited memory systems:
# Use a single model, smaller chunks, and explicit serial processing
fantasia_pipeline \
--serial-models \
--embed-models prot_t5 \
--chunk-size 200 \
large_proteome.fa
For the current Lite V1 fast path, prot_t5 with --model-batch-sizes prot_t5=4 is the best starting point on a 24 GB-class GPU. If you see CUDA OOM skips, reduce the model batch size further before changing lookup settings.
In Lite V1, the embedding step and lookup step are intentionally separated:
src/generate_embeddings.pydata/lookup/These two layers are related, but they do not currently expose exactly the same model set through the Lite CLI.
The built-in Lite embedder currently supports:
prot_t5: Protein T5 model (recommended, good balance of speed and accuracy)ankh3: ANKH large protein language model (slower but potentially more accurate)The Lite embedder can now also export:
--layer-indices--all-layersThis embedding-only mode is independent of lookup. In other words, Lite can generate embeddings locally for the models above, with optional layer export, even when you do not want to run annotation lookup.
The bundled Lite lookup table currently contains last-layer reference embeddings for:
So the lookup bundle is broader than the built-in Lite embedder. The lookup side is not limited to only two model spaces; the current local embedding CLI is the narrower component.
The current built-in end-to-end Lite pipeline is intended for the last-layer models that the Lite embedder can generate directly today:
If you provide externally generated embeddings that match the lookup bundle keys and format, the lookup layer itself is separate and can in principle operate on the additional lookup-table models as well. So the practical distinction is:
prot_t5 and ankh3, with optional layer exportESM-2, ProstT5, ProtT5, Ankh3-Large, and ESM3c, using last-layer reference embeddings.fa, .faa, .fasta) and gzip-compressed versions (.fa.gz, .fasta.gz)Lookup files missing: ensure the three files are directly under
data/lookup/, not in an additional nested directory.
CUDA unavailable: check nvidia-smi; otherwise use
--device cpu --no-gpu-lookup as a slower fallback.
CUDA out of memory: use one model with --serial-models, then reduce
--model-batch-sizes, --embed-batch-size, and --max-batch-residues.
Failures for individual proteins remain listed in failed_sequences.csv.
Several rows per protein: expected—results.csv has one row per retained
query/model/GO/category combination.
If you use FANTASIA-Lite in your research, please cite the tool paper:
Pérez-Canales, F. M., Domínguez-Rodríguez, À., Carbonetto, B., Fernández, R., Cases, I., & Rojas, A. M. (2026). FANTASIA suite: a reproducible and configurable framework for embedding-based functional annotation of proteins. NAR Genomics and Bioinformatics, 8(3), lqag106. DOI: 10.1093/nargab/lqag106
Please also cite this repository and the version-specific Zenodo lookup record used in the analysis.