Skip to main content

TF-MINDI: Transcription Factor Motif Instance Neighborhood Decomposition and Interpretation

Tests Documentation

TF-MINDI is a Python package for analyzing transcription factor binding patterns from deep learning model attribution scores. It identifies and clusters sequence motifs from contribution scores, maps them to transcription factor families, and provides visualization tools for regulatory genomics analysis.

Getting Started

See the tutorials and the API documentation.

Key Features

  • Seqlet Extraction: Identifies important sequence regions from contribution scores with a choice of seqlet callers (recursive, hysteresis, local-contrast, wavelet-Otsu, finemo)
  • Motif Similarity Analysis: Compares extracted seqlets to known motif databases using TomTom
  • TF Family Annotation: Projects seqlets into a reference motif space and assigns them a TF family
  • Clustering & Dimensionality Reduction: Groups similar seqlets using Leiden clustering and t-SNE visualization
  • Pattern Generation: Creates consensus motifs from clustered seqlets with alignment
  • Visualization: Region-level contribution plots, t-SNE embeddings, motif logos, and heatmaps

Installation

tfmindi requires Python 3.12 and Linux.

pip install tfmindi          # CPU
pip install tfmindi[gpu]     # GPU, CUDA 12.x -- recommended

GPU Acceleration

Every heavy step runs on the GPU when one is available: TomTom motif similarity, PCA, the neighborhood graph, t-SNE, Leiden clustering, and the TF-family kNN projection. On a genome-scale run this is 6x-7x end to end compared to the cpu version.

The backend is auto-detected. Override it with tm.set_backend("cpu"/"gpu") or the TFMINDI_BACKEND environment variable. Every accelerated step falls back to its CPU implementation with a warning if the GPU path fails, so a run never breaks on a GPU problem.

If tfmindi can't find your GPU, import rapids_singlecell directly and see what errors you get. You may have to set LD_LIBRARY_PATH for cuml as described here.

Quick Start

TF-MINDI follows a scanpy-inspired workflow: tm.pp (preprocess) → tm.tl (analyze) → tm.pl (plot), with a single AnnData carrying state between steps.

import tfmindi as tm

# --- Preprocessing: seqlets -> motif similarity -> AnnData ---
collection = tm.MotifCollectionData("mcv11.refdata.tar.gz")
motifs = collection.get_motifs(20)  # 20 motifs per reference cluster

# contrib and oh are (n_regions, 4, region_width) arrays
seqlets_df, seqlet_matrices = tm.pp.extract_seqlets(contrib=contrib, oh=oh, threshold=0.05)
sim_matrix = tm.pp.calculate_motif_similarity(seqlet_matrices, motifs)
adata = tm.pp.create_seqlet_adata(
    sim_matrix,
    seqlets_df,
    oh_sequences=oh,
    contrib_scores=contrib,
    motif_collection=motifs,
)

# --- Tools: annotate, cluster, build consensus patterns ---
tm.tl.predict_tf_family_seqlets(adata, collection, cluster_resolution=5.0, n_motifs_per_reference_cluster=20)
tm.tl.embed_and_cluster(adata, resolution=2.5)
patterns = tm.tl.create_patterns(adata, annotation_col="predicted_5.0_predicted_family")

# --- Plotting ---
tm.pl.tsne(adata, color_by="predicted_5.0_predicted_family")
tm.pl.pattern_logos(patterns)
tm.pl.region_contributions(adata, annotation_col="predicted_5.0_predicted_family", example_idx=0)

tm.save_h5ad(adata, "seqlets.h5ad")  # use these, not adata.write_h5ad

Release Notes

See the changelog.

Contact

If you found a bug, please use the issue tracker.

Citation

De Winter S. et al. (2026). System-wide extraction of cis-regulatory rules from sequence-to-function models in human neural development. BioRxiv. https://doi.org/10.64898/2026.01.14.699402

Metadata

Release files for tfmindi 2.0.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 tfmindi 2.0.0
File Size Uploaded Provenance Actions
tfmindi-2.0.0.tar.gz 12.1 MB With provenance Details for tfmindi-2.0.0.tar.gz

Built distribution (wheel)

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

Total release size: 12.2 MB

Release files / tfmindi-2.0.0.tar.gz

Download URL tfmindi-2.0.0.tar.gz
Size 12.1 MB
Tags Source
SHA-256 checksum
How to use checksums
9f7f624dbbc382369cbab8e1f33f928c58bb9ac1078fdb489018bc2f690afefe
BLAKE2b-256 checksum
How to use checksums
11f9577a32ece1e08d2f04f45a2cf6f7e350fc2f25f219f0f643dc552f38b005
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Release files / tfmindi-2.0.0-py3-none-any.whl

Download URL tfmindi-2.0.0-py3-none-any.whl
Size 135.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
67f718109610a6524219fe5884b556a431729f6b10d7a8d348298b4bdb170c74
BLAKE2b-256 checksum
How to use checksums
49251c31c7e320c8ee6a19be1ad89809820bb746ed242b360aa4e016ff36681c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

Security for tfmindi 2.0.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for tfmindi-2.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2026.

Transparency log

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.

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