Skip to main content

EnzymeHunter

Overview

EnzymeHunter: Achieving fine-grained enzyme function prediction with a hierarchically-aware contrastive learning framework. This source code was developed and tested on Linux (CentOS) with Python 3.9.

EnzymeHunter Architecture

Architecture and workflow of the EnzymeHunter model:

EnzymeHunter Architecture

Installation & Setup

1. Install from PyPI

The project provides both a Python API and a command-line interface for convenient programmatic and command-line use.

conda create -n enzymehunter python=3.9 -y
conda activate enzymehunter
pip install enzymehunter

The package installs the CPU FAISS backend required by tmvec-search. The neural-network feature extraction can still use CUDA when --device cuda:N is selected.

The package requires NumPy 1.x (numpy<2) because the current Biotite extension used by the pipeline is not compatible with NumPy 2.x.

The PyPI package does not embed the large pretrained weights or reference database. Run the command below to download the model and reference data automatically, or download them manually from Hugging Face:

enzymehunter download-hf-assets \
  --model-dir /data/enzymehunter

This downloads the model/ and data/ trees. The --model-dir value is the assets directory, and the downloader creates model/ and data/ inside it. The downloader first tests the official Hugging Face endpoint, falls back to hf-mirror.com if necessary, and displays file download progress. Then run a prediction without changing directories:

enzymehunter predict input.fasta \
  --model-dir /data/enzymehunter \
  -o results.csv

Use a specific device when needed:

# Automatically choose CUDA when available, otherwise CPU
enzymehunter predict input.fasta --device auto -o results.csv

# Force CPU
enzymehunter predict input.fasta --device cpu -o results.csv

# Use physical GPU 1
enzymehunter predict input.fasta --device cuda:1 -o results.csv

# Model stored outside the default locations
enzymehunter predict input.fasta --model-dir /data/enzymehunter \
  --device cuda:1 -o results.csv

The same operation is available from Python:

from enzymehunter import predict

# Uses ./model by default
predict("input.fasta", "results.csv")

# Use this only when the model is stored elsewhere
predict("input.fasta", "results.csv", model_dir="/data/enzymehunter")

2. Install from source for development

Clone the repository

git clone https://github.com/cgxbio/EnzymeHunter.git
cd EnzymeHunter

Create and activate the virtual environment

conda env create -f environment.yml
conda activate EnzymeHunter

Data and Model Download

Please download the pretrained data and model files from Zenodo or Hugging Face:

After downloading, place the contents into the following directories:

EnzymeHunter/
├── data/          # Place dataset files here
│   └── pdb/       # (PDB mode) Place PDB files here, named {UNIPROT_ID}.pdb
├── model/         # Place model files here
├── EnzymeHunter.py
├── ...

For ESM2 contact-map and ResNet101 feature extraction, keep the local ResNet101 checkpoint at model/diamond_tmvec_database/resnet_model/resnet101-cd907fc2.pth. EnzymeHunter loads this file locally and does not download ResNet101 weights from download.pytorch.org.

The bundled DIAMOND executable is at model/diamond_tmvec_database/diamond. If the executable bit was not preserved by the download, run chmod +x model/diamond_tmvec_database/diamond; recent versions of EnzymeHunter restore this permission automatically.

Usage Example

Here are the common examples of using the EnzymeHunter, corresponding to different running modes:

Normal Mode (Default Mode)

Use this mode when you need the program to automatically distinguish between enzymes and non-enzymes, and only predict EC numbers for proteins classified as enzymes:

# Example: run prediction on a dataset where not all proteins are enzymes
python EnzymeHunter.py --dataset example_test --all_are_enzymes False

Explanation:

  • --example_test is your test dataset name (without the .fasta extension)
  • --The program will first perform enzyme/non-enzyme classification prediction
  • --Only proteins predicted as enzymes (pred_label=1) will undergo subsequent EC number prediction
  • --Non-enzyme proteins will be marked with EC number 0.0.0.0

All-Enzymes Mode

Use this mode when you know all proteins in the dataset are enzymes and want to skip the enzyme/non-enzyme classification step, proceeding directly to EC number prediction:

# Example: run prediction assuming all proteins are enzymes
python EnzymeHunter.py --dataset example_test --all_are_enzymes True

Explanation:

  • --example_test is your enzyme dataset name (without the .fasta extension)
  • --The --all_are_enzymes flag forces the program to treat all proteins as enzymes
  • --Skips the enzyme/non-enzyme classification step and proceeds directly to EC number prediction
  • --All proteins will have pred_label set to 1 and pred_prob set to 1.0

PDB-Based Contact Map Mode

By default, EnzymeHunter uses ESM2-predicted contact maps. You can switch to PDB-based contact maps (computed from AlphaFold or ESMFold 3D structures) by setting --contact_map_source pdb:

  1. Place your PDB structure files (named {UNIPROT_ID}.pdb) into ./data/pdb/
  2. Run the pipeline with --contact_map_source pdb:

In this mode, EnzymeHunter will use the model trained with PDB-derived contact maps.

# Normal mode with PDB contact maps
python EnzymeHunter.py --dataset example_test --all_are_enzymes False --contact_map_source pdb

# All-enzymes mode with PDB contact maps
python EnzymeHunter.py --dataset example_test --all_are_enzymes True --contact_map_source pdb

Output

After running, the prediction results will be saved to:

./results/example_test_final_pred_results.csv

Metadata

Release files for enzymehunter 0.1.12

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

Source distribution (sdist)

Source distribution for enzymehunter 0.1.12
File Size Uploaded
enzymehunter-0.1.12.tar.gz 33.8 kB Details

Built distribution (wheel)

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

Total release size: 70.7 kB

Release files / enzymehunter-0.1.12.tar.gz

Download URL enzymehunter-0.1.12.tar.gz
Size 33.8 kB
Tags Source
SHA-256 checksum
How to use checksums
927556c7cc6490c18149076d0ef7155833e89fbfff1381673ca6831592be8b91
BLAKE2b-256 checksum
How to use checksums
605811d09ceb7d9ecb7459f6c39becafe7ad87dd83dff318f2c6132d510e28ff
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 27, 2026.

Transparency log

Release files / enzymehunter-0.1.12-py3-none-any.whl

Download URL enzymehunter-0.1.12-py3-none-any.whl
Size 36.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5fa13fa035183e12fee168caac2ac09b2be67e37c99859c07f996e753f178dee
BLAKE2b-256 checksum
How to use checksums
877599ebd7ecac4be35188b4cb750df14e5e2d359c7c2d25c5bb21ba81ec2026
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Aug 27, 2026.

Transparency log

Release history Release notifications | RSS feed

0.1.15

2 release files

0.1.14

2 release files

0.1.13

2 release files

This release

0.1.12 This release

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

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