Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

TFClassPredict

Python Version TensorFlow License PyPI Docs

Description

TFClassPredict predicts transcription factor binding sites (TFBSs) on the human genome according to their DNA-binding domain, encapsulated in 23 DBD-classes defined by the TFClass class-level hierarchy. By leveraging the DNABERT model, TFClassPredict achieves high predictive performance across all DBD-classes.

Installation

pysam and pyBigWig require system-level build tools. On Ubuntu/Debian, verify their installation before running pip install tfclass_predict:

sudo apt-get install build-essential libcurl4-openssl-dev libssl-dev \
    zlib1g-dev libbz2-dev liblzma-dev libncurses5-dev

The package can be installed via pip:

pip install tfclass_predict

Installation time: typically 1–3 minutes depending on your internet connection and system, as several large dependencies (tensorflow, pysam, pyBigWig) need to be compiled from source.

Required Data

To use TFClassPredict, at least one of the following data sources must be provided:


Option A – Precompiled hg38 Dataset (Recommended)

Using the precompiled dataset is strongly recommended as it drastically reduces runtime and works on virtually any system without requiring a GPU.

Download TFCP_precompiled


Option B – TFClassPredict Model + Reference Genome

For non-hg38 genomes, the full deep learning model can be run directly alongside the human reference genome (hg38) as an alternative approach.

Download HG38 from UCSC

Download TFCP_model


Note: All downloads must be unzipped before use. Pass the path to the TFCP_precompiled directory, or both the hg38.fa file and the TFCP_model directory, to the command-line tool or PredictionManager. The genome file should be indexed for faster processing, otherwise it will be created within the first run:

samtools faidx hg38.fa

Usage

Command-Line Interface

tfclass_predict [-h] [--genome GENOME] [--precompiled PRECOMPILED]
                [--model MODEL] [--detailed] [--no-normalize]
                [--gpus GPUS] [--cpus CPUS]
                bed_file output_dir

Positional Arguments

Argument Description
bed_file Path to BED file of ATAC-seq or other NGS experiment
output_dir Path to output directory

The bed file should contain chromosome names in the UCSC format (i.e. chr1). In case the precompiled model is used, alternative contigs need to be discarded beforehand.

Optional Arguments

Argument Description
--genome GENOME Path to human genome reference (recommended: hg38) .fa
--precompiled PRECOMPILED Path to precompiled hg38 predictions (unzipped folder)
--model MODEL Path to TFClassPredict model archive (unzipped folder)
--detailed Return per-window predictions instead of per-peak/region predictions
--no-normalize Save raw DBD-class binding site counts instead of standardized TFBPD scores
--gpus GPUS Number of GPUs to use in parallel (default: 1)
--cpus CPUS Maximum number of CPUs to use in parallel (default: 1)

If both --precompiled and --model are specified, the precompiled dataset takes precedence.

Examples

# Using the precompiled dataset (recommended)
tfclass_predict sample.bed results/ --precompiled path/to/TFCP_precompiled

# Using the model and reference genome
tfclass_predict sample.bed results/ --genome hg38.fa --model path/to/TFCP_model

# With multiple GPUs and CPUs
tfclass_predict sample.bed results/ --genome hg38.fa --model path/to/TFCP_model \
    --gpus 4 --cpus 8

# Save raw counts instead of normalized TFBPD scores
tfclass_predict sample.bed results/ --precompiled path/to/TFCP_precompiled --no-normalize

# Return per-window predictions
tfclass_predict sample.bed results/ --precompiled path/to/TFCP_precompiled --detailed

Python API

from tfclass_predict import PredictionManager

bed_file            = "path/to/experiment.bed"
genome_file         = "path/to/hg38.fa"
tfclass_model       = "path/to/TFCP_model"
tfclass_precompiled = "path/to/TFCP_precompiled"
res_dir             = "results/"

# ── Option A: precompiled dataset (recommended) ────────────────────────────
pm = PredictionManager(bed_file, res_dir, precompiled=tfclass_precompiled)
pm.predict()
pm.get_TFBPDs()           # compute normalized TFBPD scores
pm.save_results()         # saves <bed_file>_TFBPDs.csv

# save raw counts instead
pm.save_results(normalized=False)   # saves <bed_file>_DBDcounts.csv

# ── Option B: model + reference genome ────────────────────────────────────
pm = PredictionManager(
    bed_file,
    res_dir,
    genome_file = genome_file,
    tfcp_model  = tfclass_model,
    ngpus       = 1,
    ncpus       = 4,
)
pm.predict()
pm.get_TFBPDs()
pm.save_results()

# ── Detailed mode: per-window predictions ─────────────────────────────────
pm = PredictionManager(bed_file, res_dir, precompiled=tfclass_precompiled, detailed=True)
pm.predict()
pm.save_results(normalized=False)

Output Files

File Description
<name>_TFBPDs.csv Standardized TFBPD scores per region and DBD-class (default)
<name>_DBDcounts.csv Raw DBD-class binding site counts per region

Both files include the original BED coordinates (chr, start, end) as the first three columns, followed by one column per DBD-class.


Tutorial and Further Documentation

Full API documentation including a tutorial is available at ReadTheDocs.


Performance Notes

  • When using TFCP_model, predictions are automatically distributed across multiple GPUs via tf.distribute.MirroredStrategy if --gpus > 1.
  • Setting --cpus > 1 enables parallel sequence tokenization and can significantly reduce preprocessing time for large BED files.
  • The precompiled dataset does not require a GPU and is suitable for standard compute environments.

System Requirements

Precompiled Dataset - Minimum Requirements

Component Requirement
OS Linux
Python 3.9 – 3.11
CPU 4+ cores
RAM 8 GB
Disk ~20 GB (precompiled dataset)
GPU Not required

Full Model - Minimum Requirements)

Component Requirement
OS Linux
Python 3.9 – 3.11
CPU 8+ cores
RAM 32+ GB
Disk ~15 GB (model + genome)
GPU Recommended

Software Dependencies

Package Version
tensorflow >=2.13.0
transformers 4.46.3
numpy
pandas
pysam
pyBigWig
scikit-learn

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tfclass_predict-1.1.6a0.tar.gz (33.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tfclass_predict-1.1.6a0-py3-none-any.whl (31.1 kB view details)

Uploaded Python 3

File details

Details for the file tfclass_predict-1.1.6a0.tar.gz.

File metadata

  • Download URL: tfclass_predict-1.1.6a0.tar.gz
  • Upload date:
  • Size: 33.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for tfclass_predict-1.1.6a0.tar.gz
Algorithm Hash digest
SHA256 97963c8730c460ce30b9ca3514c1b6253cd324c00532a36234549fbd13745fc5
MD5 cd957a91a6cdf3fd2553040662426e5a
BLAKE2b-256 2bbec8e5af2c4dd631017dafdb08b6947a16d8b1da4312f88e54f5be7fe6b477

See more details on using hashes here.

File details

Details for the file tfclass_predict-1.1.6a0-py3-none-any.whl.

File metadata

File hashes

Hashes for tfclass_predict-1.1.6a0-py3-none-any.whl
Algorithm Hash digest
SHA256 180ae79535e7bbd8fdd6f215f5a3ca35071fc05478b25c542309bf8264488af2
MD5 fda42eeb488b5ae489210de83e76a8f9
BLAKE2b-256 e0565ae4d383835993455c6bc89f86fbc9ea2312f63da9db967dd88d2ae25c5c

See more details on using hashes here.

Release history Release notifications | RSS feed

1.1.7

2 files

1.1.6

2 files

This release

1.1.6a0 This release

2 files

1.1.5

2 files

1.1.4

2 files

1.1.3

2 files

1.1.0

2 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