TFClassPredict
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.
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
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 |
--no-standardize |
Save not standardized TFBPDs. Is overwritten by --no-normalize |
--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 viatf.distribute.MirroredStrategyif--gpus > 1. - Setting
--cpus > 1enables 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 |
Metadata
Release files for tfclass-predict 1.1.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| tfclass_predict-1.1.9.tar.gz | 33.4 kB | Without provenance | Details for tfclass_predict-1.1.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| tfclass_predict-1.1.9-py3-none-any.whl | Python 3 | none | any | Details for tfclass_predict-1.1.9-py3-none-any.whl |
Total release size: 64.6 kB
Release files / tfclass_predict-1.1.9.tar.gz
| Download URL | tfclass_predict-1.1.9.tar.gz |
|---|---|
| Size | 33.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
01bc5f091cc980fd9cfba253bb2431330f7d3f05c38ecda45b9e09e236869adc
|
|
BLAKE2b-256 checksum How to use checksums |
be20a37f5c3893e7660e84a8fedb2ce293442565323c07d11db981a7894799fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.17
|
Release files / tfclass_predict-1.1.9-py3-none-any.whl
| Download URL | tfclass_predict-1.1.9-py3-none-any.whl |
|---|---|
| Size | 31.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1ca845a818409d0562ba8e2203c43ec55f0fda4a1a0c3f0bace6b37ecb52ec19
|
|
BLAKE2b-256 checksum How to use checksums |
1af14aa558ba9465e6c0b555aa72e41bc44b323938051c658b53331c78399127
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.17
|
Security for tfclass-predict 1.1.9
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.