GraphTFactor
GraphTFactor predicts whether a protein is a transcription factor using protein language model embeddings and a graph neural network. It segments protein sequences with a minimum description length method, builds a graph from the segments, and predicts a class for each sequence.
Install
python -m pip install graphtfactor
Python 3.10 or newer is required. The package includes the pretrained GraphTFactor classifier checkpoints for all supported organism groups and ESM layer configurations. The first time a configuration is used, fair-esm downloads the corresponding ESM-2 model weights; internet access is needed for that download. ESM-2 models range from 8 million to 15 billion parameters, so memory and accelerator requirements vary substantially. Start with 6 layers if you are unsure.
PyTorch supports CPU, NVIDIA CUDA, and Apple Silicon MPS, subject to the PyTorch build installed for your platform. For CUDA, install the matching PyTorch build using the instructions on the official PyTorch site before installing GraphTFactor.
Quick start
import torch
from graphtfactor import GraphTFactor
if torch.cuda.is_available():
device = "cuda"
elif torch.backends.mps.is_available():
device = "mps"
else:
device = "cpu"
model = GraphTFactor(device=device, esm_layers=6, org="Virus")
predictions, probabilities = model.predict([
"MDQYITLVELYIYDCNLFKSKNLKSFYKVHRVPEGDIVPKRRGGQLAGVTKSWVETNLVH"
])
print(predictions) # class: 0 (non-TF) or 1 (TF)
print(probabilities) # probability for the predicted class
predict() takes a list of amino-acid sequences and returns two lists, one with predicted class labels and one with their predicted-class probabilities. Unrecognized amino-acid symbols are treated as X.
Supported models
Choose org from "All", "Virus", "Eukaryotic", or "Prokaryotic". Choose esm_layers from 6, 12, 30, 33, 36, or 48.
esm_layers |
ESM-2 model | Parameters |
|---|---|---|
| 6 | esm2_t6_8M_UR50D |
8M |
| 12 | esm2_t12_35M_UR50D |
35M |
| 30 | esm2_t30_150M_UR50D |
150M |
| 33 | esm2_t33_650M_UR50D |
650M |
| 36 | esm2_t36_3B_UR50D |
3B |
| 48 | esm2_t48_15B_UR50D |
15B |
Larger ESM-2 models require considerably more memory and may not run on every device.
Streamlit app
Try the GraphTFactor Streamlit app. Paste a protein sequence, select an ESM-2 model and organism group, and view the predicted class, confidence, and protein graph.
The app source and research experiments are available in the GitHub repository.
Citation
A paper citation will be added here when the publication details are available.
License
GraphTFactor is distributed under the MIT License. See LICENSE.
Contact
For questions, feedback, or collaboration inquiries, email Salvatore Calderaro or open an issue in the GitHub repository.
Metadata
Release files for graphtfactor 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| graphtfactor-0.1.2.tar.gz | 87.5 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| graphtfactor-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 175.0 MB
Release files / graphtfactor-0.1.2.tar.gz
| Download URL | graphtfactor-0.1.2.tar.gz |
|---|---|
| Size | 87.5 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ad3d0d6224f53f14a588f7745749a3587d917f6d16e704f3e5931b3b4e9627db
|
|
BLAKE2b-256 checksum How to use checksums |
b36dc064fc71a828cdaa8142d4f05774e22e4b3f16d7bb2e2b90c4a75f8cfb4f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.0
|
Release files / graphtfactor-0.1.2-py3-none-any.whl
| Download URL | graphtfactor-0.1.2-py3-none-any.whl |
|---|---|
| Size | 87.5 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
133d95ee09071b30a3610005bcb9c84f351f6e69b5d6f44dacfc3c3a2a5370e0
|
|
BLAKE2b-256 checksum How to use checksums |
e81b874f27211525a254adde16498d6645f271de403b035735606b8a8dda501c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.0
|