Skip to main content

GraphTFactor

GraphTFactor logo

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 demo and source

The repository also contains a Streamlit demo and research experiments. See the GitHub repository for the application, source code, and updates.

Citation

A paper citation will be added here when the publication details are available.

License

GraphTFactor is distributed under the MIT License. See LICENSE.

Metadata

Release files for graphtfactor 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for graphtfactor 0.1.1
File Size Uploaded
graphtfactor-0.1.1.tar.gz 87.5 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for graphtfactor 0.1.1
File Interpreter ABI Platform
graphtfactor-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 175.0 MB

Release files / graphtfactor-0.1.1.tar.gz

Download URL graphtfactor-0.1.1.tar.gz
Size 87.5 MB
Tags Source
SHA-256 checksum
How to use checksums
514f1cfca8c90e125e8e3bb0d2613fdd9046dd4d74022139a4f6e62cbd69eb84
BLAKE2b-256 checksum
How to use checksums
d247bec213b347753357587ed25cabc6f49c90eede60d12ac9d2860d4bbc3287
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.1-py3-none-any.whl

Download URL graphtfactor-0.1.1-py3-none-any.whl
Size 87.5 MB
Tags Python 3
SHA-256 checksum
How to use checksums
69c73406e8a5dd4e9815d924c098394bd67136162785865587d4c83355d1094b
BLAKE2b-256 checksum
How to use checksums
328f2a5b9a8e65552dea6db356e4dd1c1152610b4665522da5ac2287d355912b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.0

Release history Release notifications | RSS feed

0.1.2

2 release files

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page