Hydrogen Bond Analysis Tool for PDB structures
Project description
HBAT 2 (Hydrogen Bond Analysis Tool 2)
A Python package to automate the analysis of potential hydrogen bonds and similar type of weak interactions in macromolecular structures, available in Protein Data Bank (PDB) file format. HBAT 2 uses a geometric approach to identify molecular interactions by analyzing distance and angular criteria.
Supported Interaction Types:
- Hydrogen Bonds: Classical
N-H···O,O-H···O, and weakC-H···Ointeractions - Halogen Bonds:
C-X···Ainteractions (X = Cl, Br, I) - π Interactions: X-H···π and
C-X···πinteractions with aromatic rings (Phe,Tyr,Trp,His, etc.) - π-π Stacking: Aromatic ring-ring interactions (parallel, T-shaped, offset)
- Carbonyl Interactions:
n→π*interactions between carbonyl groups - n-π Interactions: Lone pair interactions with aromatic
πsystems
HBAT 2 Web Interface is Live! Try it out at hbat-web.abhishek-tiwari.com
HBAT Desktop (Mac, Windows, Linux):
HBAT Web: Try it out at hbat-web.abhishek-tiwari.com
Visualizing interactions using HBAT Web (Halogen Bond in PDB Entry 4x21):
Cooperativity chain detection and visualization (PDB Entry 6RSA):
Background
HBAT 2 is a modern Python re-implementation of the original Perl-based tool developed by Abhishek Tiwari and Sunil Kumar Panigrahi. HBAT v1 can still be downloaded from SourceForge however Perl version is not maintained anymore.
Highlights of HBAT 2
- Detect and analyze potential hydrogen bonds, halogen bonds, π interactions, π-π stacking, carbonyl interactions, and n-π interactions
- Automated PDB fixing with OpenBabel and PDBFixer integration
- Support graphical (tkinter), command-line, and programming API interfaces
- Use graphical interfaces for interactive analysis, CLI/API for batch processing and automation
- Cooperativity chain visualization using NetworkX/matplotlib and GraphViz
- Export cooperativity chain visualizations to PNG, SVG, PDF formats
- Built-in presets for different structure types (high-resolution, NMR, membrane proteins, etc.)
- Customizable distance cutoffs, angle thresholds, and analysis modes.
- Multiple Output Formats: Text, CSV, and JSON export options
- Optimized algorithms for efficient analysis of large structures
- Cross-Platform: Works on Windows, macOS, and Linux.
Please review HBAT documentation for more details.
Installation
Option 1: Install from PyPI (Recommended)
pip install hbat
Run HBAT Command-Line Interface (CLI) using hbat or launch HBAT GUI using hbat-gui.
Option 2: Install from Source
git clone https://github.com/abhishektiwari/hbat.git
cd hbat
pip install -e .
Alternatively,
pip install git+https://github.com/abhishektiwari/hbat.git
Run HBAT Command-Line Interface (CLI) using hbat or launch HBAT GUI using hbat-gui.
Option 3: Install from Conda
conda install -c hbat hbat
Requirements
System Requirements
- Python: 3.9 or higher
- tkinter: tkinter is included with Python standard library on most systems. However, on Mac install Python and tkinter using
brew.
brew install python python3-tk
- GraphViz (Optional): Required for advanced cooperativity chain visualization with high-quality graph rendering. HBAT will automatically fall back to NetworkX/matplotlib visualization if GraphViz is not available.
Install GraphViz:
On Ubuntu/Debian:
sudo apt-get update
sudo apt-get install graphviz
On macOS (using Homebrew):
brew install graphviz
On Windows:
- Download and install from GraphViz official website
- Or using Chocolatey:
choco install graphviz - Or using conda:
conda install -c conda-forge graphviz
Note: After installing GraphViz, restart your terminal/command prompt before running HBAT to ensure the GraphViz executables are available in your PATH.
Usage
Graphical Interface
Launch the GUI application:
hbat-gui
The GUI provides,
- File browser for loading PDB files
- Parameter configuration panels
- Tabbed results display
- Export and visualization options
Command-Line Interface
Basic usage:
hbat input.pdb
Output Format Options
HBAT supports multiple output formats:
# No output flag - displays results to console
hbat input.pdb # Display results to console
# Single file outputs (format auto-detected from extension)
hbat input.pdb -o results.txt # Text format (human-readable summary + details)
hbat input.pdb -o results.json # JSON format (single file with all interactions)
# Multiple file outputs (separate files per interaction type)
hbat input.pdb --csv results # Creates results_h_bonds.csv, results_x_bonds.csv, etc.
hbat input.pdb --json results # Creates results_h_bonds.json, results_x_bonds.json, etc.
With custom parameters:
hbat input.pdb -o results.txt --hb-distance 3.0 --mode local
List Available Presets
hbat --list-presets
Use a specific preset
hbat protein.pdb --preset high_resolution
hbat membrane_protein.pdb --preset membrane_proteins
Use preset with custom overrides
hbat protein.pdb --preset drug_design_strict --hb-distance 3.0 --verbose
CLI Options
positional arguments:
input Input PDB file
optional arguments:
-h, --help show this help message and exit
-o OUTPUT, --output OUTPUT
Output file (format auto-detected from extension: .txt, .json)
--json JSON Export to multiple JSON files (base name for files)
--csv CSV Export to multiple CSV files (base name for files)
Preset Options:
--preset PRESET Load parameters from preset file (.hbat or .json)
--list-presets List available example presets and exit
Analysis Parameters:
Hydrogen Bond Parameters:
--hb-distance HB_DISTANCE
Hydrogen bond H...A distance cutoff in Å (default: 2.5)
--hb-angle HB_ANGLE Hydrogen bond D-H...A angle cutoff in degrees (default: 120)
--da-distance DA_DISTANCE
Donor-acceptor distance cutoff in Å (default: 3.5)
Halogen Bond Parameters:
--xb-distance XB_DISTANCE
Halogen bond X...A distance cutoff in Å (default: 3.9)
--xb-angle XB_ANGLE Halogen bond C-X...A angle cutoff in degrees (default: 150)
π Interaction Parameters:
--pi-distance PI_DISTANCE
π interaction H...π distance cutoff in Å (default: 3.5)
--pi-angle PI_ANGLE π interaction D-H...π angle cutoff in degrees (default: 110)
π-π Stacking Parameters:
--pi-pi-distance PI_PI_DISTANCE
π-π centroid-to-centroid distance cutoff in Å (default: 3.8)
--pi-pi-parallel-angle PI_PI_PARALLEL_ANGLE
Maximum angle for parallel π-π stacking in degrees (default: 30.0)
--pi-pi-tshaped-angle-min PI_PI_TSHAPED_ANGLE_MIN
Minimum angle for T-shaped π-π stacking in degrees (default: 60.0)
--pi-pi-tshaped-angle-max PI_PI_TSHAPED_ANGLE_MAX
Maximum angle for T-shaped π-π stacking in degrees (default: 90.0)
--pi-pi-offset PI_PI_OFFSET
Maximum lateral offset for parallel π-π stacking in Å (default: 2.0)
Carbonyl Interaction Parameters (n→π*):
--carbonyl-distance CARBONYL_DISTANCE
Carbonyl O···C distance cutoff in Å (default: 3.2)
--carbonyl-angle-min CARBONYL_ANGLE_MIN
Minimum O···C=O angle for carbonyl interactions in degrees (default: 95.0)
--carbonyl-angle-max CARBONYL_ANGLE_MAX
Maximum O···C=O angle for carbonyl interactions in degrees (default: 125.0)
n→π* Interaction Parameters:
--n-pi-distance N_PI_DISTANCE
Lone pair to π center distance cutoff in Å (default: 3.6)
--n-pi-sulfur-distance N_PI_SULFUR_DISTANCE
Sulfur-specific distance cutoff in Å (default: 4.0)
--n-pi-angle-min N_PI_ANGLE_MIN
Minimum angle to π plane in degrees (default: 0.0)
--n-pi-angle-max N_PI_ANGLE_MAX
Maximum angle to π plane in degrees (default: 45.0)
General Parameters:
--covalent-factor COVALENT_FACTOR
Covalent bond detection factor (default: 0.85)
--mode {complete,local}
Analysis mode: complete (all interactions) or local (intra-residue only)
Output Control:
--verbose, -v Verbose output with detailed progress
--quiet, -q Quiet mode with minimal output
--summary-only Output summary statistics only
Analysis Filters:
--no-hydrogen-bonds Skip hydrogen bond analysis
--no-halogen-bonds Skip halogen bond analysis
--no-pi-interactions Skip π interaction analysis
--no-pi-pi-stacking Skip π-π stacking analysis
--no-carbonyl-interactions
Skip carbonyl n→π* interaction analysis
--no-n-pi-interactions
Skip n→π* interaction analysis
Example Notebooks
Interactive Jupyter notebooks demonstrating HBAT usage with 3D visualizations using Py3DMol.
| Notebook | Description | Colab |
|---|---|---|
| 01_analyze_6rsa_with_visualization.ipynb | Hydrogen bond analysis of 6RSA (Ribonuclease A) with py3Dmol visualization | |
| 02_halogen_bonds_4x21.ipynb | Halogen bond detection and visualization in 4X21 structure | |
| 03_pdbfixer_vs_openbabel_comparison.ipynb | Comparing PDBFixer vs OpenBabel for hydrogen addition |
See the notebooks directory for more details.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Cite HBAT and HBAT 2
If you use HBAT or HBAT 2 in your research, please cite:
@misc{tiwari_2025_17645321,
author = {Tiwari, Abhishek},
title = {HBAT 2: A Python Package to analyse Hydrogen Bonds and Other Non-covalent Interactions in Macromolecular Structures},
year = 2026,
publisher = {arXiv},
doi = {10.48550/arXiv.2602.17712},
url. = {https://arxiv.org/abs/2602.17712},
}
@article{tiwari2007hbat,
author = {Tiwari, Abhishek and Panigrahi, Sunil Kumar},
doi = {10.3233/ISI-2007-00337},
journal = {In Silico Biology},
month = dec,
number = {6},
title = {{HBAT: A Complete Package for Analysing Strong and Weak Hydrogen Bonds in Macromolecular Crystal Structures}},
volume = {7},
year = {2007}
}
Contributing
See our contributing guide and development guide. At a high-level,
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hbat-2.4.1rc401778151483.tar.gz.
File metadata
- Download URL: hbat-2.4.1rc401778151483.tar.gz
- Upload date:
- Size: 3.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d569be5856ed4e3b99439cc5f0c9ec603c3983340e8548c70b2a2e5529e39917
|
|
| MD5 |
be8cc5000bd748d2b8d8b1c4dbc7eabc
|
|
| BLAKE2b-256 |
5540ebe2a4f52161833dec1cf4cd95211b0717d056df2f9d895f4518fa185f6a
|
Provenance
The following attestation bundles were made for hbat-2.4.1rc401778151483.tar.gz:
Publisher:
release.yml on abhishektiwari/hbat
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hbat-2.4.1rc401778151483.tar.gz -
Subject digest:
d569be5856ed4e3b99439cc5f0c9ec603c3983340e8548c70b2a2e5529e39917 - Sigstore transparency entry: 1460739047
- Sigstore integration time:
-
Permalink:
abhishektiwari/hbat@44e984d7b980d580f2105596e8b2fde47aeeb980 -
Branch / Tag:
refs/pull/40/merge - Owner: https://github.com/abhishektiwari
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@44e984d7b980d580f2105596e8b2fde47aeeb980 -
Trigger Event:
pull_request
-
Statement type:
File details
Details for the file hbat-2.4.1rc401778151483-py3-none-any.whl.
File metadata
- Download URL: hbat-2.4.1rc401778151483-py3-none-any.whl
- Upload date:
- Size: 751.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c579f35e4d6551930a2a82da68db830e615f9c30b85ac402b04cb8260a277c2
|
|
| MD5 |
e4139c65e256af44252bc455a310c2a8
|
|
| BLAKE2b-256 |
fb7c234dd59b7cb9fcd5d0a42d69bfcdd5730fe3670b72820848cb936c251e4b
|
Provenance
The following attestation bundles were made for hbat-2.4.1rc401778151483-py3-none-any.whl:
Publisher:
release.yml on abhishektiwari/hbat
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hbat-2.4.1rc401778151483-py3-none-any.whl -
Subject digest:
2c579f35e4d6551930a2a82da68db830e615f9c30b85ac402b04cb8260a277c2 - Sigstore transparency entry: 1460739226
- Sigstore integration time:
-
Permalink:
abhishektiwari/hbat@44e984d7b980d580f2105596e8b2fde47aeeb980 -
Branch / Tag:
refs/pull/40/merge - Owner: https://github.com/abhishektiwari
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@44e984d7b980d580f2105596e8b2fde47aeeb980 -
Trigger Event:
pull_request
-
Statement type: