Skip to main content

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 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.0

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.0
File Size Uploaded
graphtfactor-0.1.0.tar.gz 87.5 MB Details

Built distribution (wheel)

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

Total release size: 175.0 MB

Release files / graphtfactor-0.1.0.tar.gz

Download URL graphtfactor-0.1.0.tar.gz
Size 87.5 MB
Tags Source
SHA-256 checksum
How to use checksums
5463e05568e32a81906baa390dd7cd9f0ce6053542866ef516cdb88f60b8c11c
BLAKE2b-256 checksum
How to use checksums
58bf78342a2843403eb26226942cf1017a974dcd2790719818ca6d37be649ea6
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.0-py3-none-any.whl

Download URL graphtfactor-0.1.0-py3-none-any.whl
Size 87.5 MB
Tags Python 3
SHA-256 checksum
How to use checksums
0f2114f93bc3e899a6f7bf79673817350cc3e1cb304217723f9fb0aa658abfa4
BLAKE2b-256 checksum
How to use checksums
7997aafa47c1b5f38cb631251110e94f20b77fb540c0fe66a636f7c1fc5ef7d6
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

0.1.1

2 release files

This release

0.1.0 This release

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