license: mit
language:
- en
- zh
tags:
- OneScience
- life-science
- protein
- thermostability
- ProtTrans
- TemStaPro
frameworks: PyTorch
TemStaPro
Model Introduction
TemStaPro (Temperatures of Stability for Proteins) is a protein thermostability prediction tool based on protein language model representations. It takes protein FASTA sequences as input, uses ProtTrans/ProtT5 to generate sequence representations, and applies classifiers for multiple temperature thresholds to predict stability across different temperature ranges.
Paper:
TemStaPro: protein thermostability prediction using sequence representations from protein language models
https://doi.org/10.1093/bioinformatics/btae157
Model Description
TemStaPro uses ProtT5-XL-Half-UniRef50 to encode protein sequences and predicts thermostability from the resulting mean or per-residue embeddings. The default mode uses binary classifiers to independently assess stability at thresholds of 40, 45, 50, 55, 60, and 65 Β°C, then combines the classification results to produce a predicted temperature range.
Use Cases
| Use case | Description |
|---|---|
| Protein thermostability prediction | Predict the stable temperature range from a protein sequence |
| Multi-temperature threshold classification | Assess protein stability independently at thresholds such as 40β65 Β°C |
| Per-residue stability analysis | Output local prediction results for each amino acid position |
| Local segment stability analysis | Predict thermostability in different protein regions using a sliding window |
| Protein engineering and screening | Help screen potential thermostable proteins or candidate mutants |
Usage
1. Using OneCode
Experience intelligent one-click AI4S programming in the OneCode online environment:
Try intelligent one-click AI4S programming
2. Manual Installation and Usage
Hardware Requirements
- TemStaPro supports execution on CPUs and GPUs.
- Most of the computational cost comes from generating ProtT5 embeddings, so a GPU/DCU is recommended for acceleration.
- In the official tests, 1,000 protein sequences with an average length of approximately 1,137 aa took about 10 hours on a standard laptop CPU and about 10 minutes on an RTX 2080 Ti GPU system. An accelerator is therefore recommended for batch prediction.
Set Up the Runtime Environment
DCU Environment
# Activate DTK and CONDA first
conda create -n onescience311 python=3.11 -y
conda activate onescience311
# Install with uv support
pip install onescience[bio] \
-i http://mirrors.onescience.ai:3141/pypi/simple/ \
--trusted-host mirrors.onescience.ai
Environment Notes
- If you encounter missing dependencies or version incompatibilities during execution, refer to the dependency versions specified in
environment_CPU.ymlorenvironment_GPU.ymland install or adjust the relevant dependencies as needed.
Prepare Weights and Models
- TemStaPro inference requires two model resources:
(1) TemStaPro classifier weights. (2) The ProtT5-XL-Half-UniRef50 pretrained model.
- TemStaPro inference does not require additional dataset downloads; the standard workflow takes the user's own FASTA file as input.
1) TemStaPro Classifier Weights
The current repository provides trained classifier weights in the weight/ directory, for example:
weight/
βββ mean_major_imbal-40_s1.pt
βββ mean_major_imbal-40_s2.pt
βββ ...
βββ mean_major_imbal-45_s1.pt
βββ ...
βββ mean_major_imbal-50_s1.pt
βββ ...
Different files correspond to different temperature thresholds and random seeds. TemStaPro automatically loads the corresponding classifiers from weight/, so after downloading the complete Hugging Face model package, separate classifier weight downloads are normally unnecessary.
2) ProtT5-XL-Half-UniRef50
TemStaPro uses ProtT5-XL-Half-UniRef50 to generate protein sequence representations. This model is not included in the current repository and must be prepared separately.
Rostlab/prot_t5_xl_half_uniref50-enc
It is recommended to save the ProtTrans model under ProtTrans/ in the repository root and specify this directory at runtime with -d/--PT-directory:
python scripts/temstapro \
-f ./scripts/tests/data/long_sequence.fasta \
-d ./ProtTrans/ \
--mean-output ./long_sequence_predictions.tsv
If ./ProtTrans/ already contains the following model files, the program loads them locally:
pytorch_model.bin
config.json
tokenizer_config.json
special_tokens_map.json
spiece.model
If the specified directory does not contain the complete model files, the program attempts to download them automatically from Hugging Face and save them there. For network-restricted or offline environments, download them in advance with the Hugging Face CLI:
huggingface-cli download \
Rostlab/prot_t5_xl_half_uniref50-enc \
--local-dir ./ProtTrans
The model page is shown below; you can also download the required files manually:
https://huggingface.co/Rostlab/prot_t5_xl_half_uniref50-enc/tree/main
3. Quick Start
Download the Model Package
hf download OneScience-Group/TemStaPro --local-dir ./TemStaPro
cd TemStaPro
- Complete TemStaPro inference additionally depends on ProtT5-XL-Half-UniRef50. Follow "Prepare Weights and Models" to make sure the ProtTrans model is ready first.
- Training, validation, and test datasets from Zenodo are not required for inference-only use.
Quick Verification
First, view the command-line options:
python scripts/temstapro --help
Run the official test files retained in the repository:
make -f scripts/makefile all
The first test run may fail while the ProtTrans model is being downloaded. Clean the outputs and run the tests again:
make -f scripts/makefile clean
make -f scripts/makefile all
In offline environments, prepare the ProtTrans model before running the tests.
Example Data
The official test data is located in scripts/tests/data/, primarily using:
scripts/tests/data/long_sequence.fasta
as the example input.
TemStaPro inputs use the standard FASTA format:
>protein_id
MSEQUENCE...
For your own prediction tasks, prepare a FASTA file containing one or more protein sequences. No protein structure is required.
Inference Examples
Protein-Level Thermostability Prediction
Mean-embedding prediction is recommended by default:
python scripts/temstapro \
-f ./scripts/tests/data/long_sequence.fasta \
-d ./ProtTrans/ \
-e ./scripts/tests/outputs/ \
--mean-output ./long_sequence_predictions.tsv
Where:
| Parameter | Description |
|---|---|
-f |
Input FASTA file |
-d |
ProtTrans/ProtT5 model directory |
-e |
Embedding cache directory |
--mean-output |
Protein-level prediction results in TSV format |
-e is optional, but enabling embedding caching is recommended when running the same sequences multiple times.
Per-Residue Prediction
python scripts/temstapro \
-f ./scripts/tests/data/long_sequence.fasta \
-e ./scripts/tests/outputs/ \
-d ./ProtTrans/ \
-p ./ \
--per-res-output ./long_sequence_predictions_per_res.tsv
-p specifies the output directory for prediction plots.
Local Segment Prediction
TemStaPro uses a window size of 41 for per-segment prediction by default:
python scripts/temstapro \
-f ./scripts/tests/data/long_sequence.fasta \
-e ./scripts/tests/outputs/ \
-d ./ProtTrans/ \
--curve-smoothening \
-p ./ \
--per-segment-output ./long_sequence_predictions_k41.tsv
Additional Temperature Thresholds
To enable additional thresholds such as 70, 75, and 80 Β°C, together with the thermophilicity label, add:
--more-thresholds
Output Description
The default protein-level output is a TSV table containing the binary and raw predictions from classifiers at each temperature threshold. It also generates a predicted temperature label from the combined threshold results.
The default temperature thresholds are:
40
45
50
55
60
65 Β°C
The results also contain the:
clash
field, which indicates whether the threshold classifiers disagree:
- No obvious conflict
* Inconsistent classification results
When per-residue or local-segment prediction is enabled, additional TSV files can be generated. Specifying -p also generates SVG prediction plots.
With -e, ProtTrans embedding cache files are saved in the specified directory and can be reused in later runs, reducing repeated ProtT5 feature extraction overhead.
Typical runtime/intermediate files include:
*.tsv Final prediction results
*.pt ProtTrans embedding cache
*.svg Per-residue or local-segment prediction plots
Official OneScience Information
| Platform | Main OneScience repository | Skills repository |
|---|---|---|
| Gitee | https://gitee.com/onescience-ai/onescience | https://gitee.com/onescience-ai/oneskills |
| GitHub | https://github.com/onescience-ai/OneScience | https://github.com/onescience-ai/oneskills |
Citation and License
- Original TemStaPro paper: TemStaPro: protein thermostability prediction using sequence representations from protein language models.
- The official TemStaPro source code is released under the MIT License; see
LICENCE.mdin the repository root. - TemStaPro uses ProtTrans/ProtT5 to generate protein representations. Use or redistribution of the corresponding model weights must also comply with the license requirements of ProtTrans, the relevant Hugging Face model page, and the associated pretraining data.
- The official training, validation, and test data are published on Zenodo. If you use these data for reproduction, training, or evaluation, cite them as required by the data page.
- If you use this repository in research, cite the original TemStaPro paper and the relevant OneScience project information.