Detector for XH-π interactions in protein structures.
Project description
Xpid
Xpid detects XH–π interactions in protein structures from PDB/mmCIF files using Gemmi.
- Source code: https://github.com/SeanWang5868/xpid2
- PyPI: https://pypi.org/project/xpid/
Installation
pip install xpid
For Parquet export:
pip install "xpid[parquet]"
The demo notebook also uses:
pip install "xpid[demo]"
Monomer Library
Hydrogen placement depends on the CCP4 monomer library. Xpid handles this automatically:
- It first looks for an existing CCP4 monomer library through
CLIBD_MON,GEMMI_MON_LIB_PATH,CLIBD, orCCP4. - If no local CCP4 library is found, it downloads the CCP4 monomer library from MonomerLibrary/monomers into the user cache.
There is no manual monomer-library setup step for normal use.
Quick Start
Scan one structure:
xpid 1abc.cif --file-type csv
By default, the result is written beside the scanned structure:
/path/to/1abc.cif
/path/to/xpid_results.csv
Scan a directory:
xpid ./structures --file-type json
The merged result is written into ./structures/xpid_results.json.
Use a PDB code list with a local mirror:
xpid --pdb-list codes.txt --pdb-mirror /path/to/pdb/mirror
Prefer PDB-REDO structures when available:
xpid --pdb-list codes.txt --redo-mirror /path/to/pdb-redo/mirror --pdb-mirror /path/to/pdb/mirror
Python API
from xpid import detect
results = detect("structure.cif")
for hit in results:
print(hit["pdb"], hit["pi_res"], hit["X_res"], hit["dist_X_Pi"])
Output column names currently remain ASCII for compatibility with existing scripts.
Demo Notebook
xpid_demo.ipynb is a complete guided tutorial. It:
- lists the required Python packages,
- downloads PDB entry
5FJJbeside the notebook, - verifies which CCP4 monomer library Xpid is using,
- runs detection,
- summarizes XH–π interactions with tables and plots,
- demonstrates filtering and command-line usage.
Geometric Criteria
Definitions: Cπ = ring centroid, n = ring normal, X = donor heavy atom, Xp = projection of X onto the π plane, H = hydrogen.
Hudson System
| Parameter | Threshold |
|---|---|
| d(X–Cπ) | ≤ 4.5 Å |
| angle(X–H–n) | ≤ 40° |
| d(Xp–Cπ) | ≤ 1.6 Å for 5-membered rings; ≤ 2.0 Å for 6-membered rings |
Plevin System
| Parameter | Threshold |
|---|---|
| d(X–Cπ) | ≤ donor-element cutoff |
| angle(X–H–Cπ) | ≥ 120° |
| angle(X–Cπ–n) | < 25° |
Command-Line Options
Input
| Argument | Description |
|---|---|
inputs |
PDB/CIF file(s) or directory path(s). |
--pdb-list |
Text file containing PDB codes, separated by commas or whitespace. |
--pdb-mirror |
Path to a local PDB mirror. |
--redo-mirror |
Path to a local PDB-REDO mirror, prioritized over --pdb-mirror. |
Output
| Argument | Description |
|---|---|
--out-dir |
Override the output directory. |
--output-name |
Merged output filename stem. Default: xpid_results. |
--separate |
Write separate output files per structure. |
--file-type |
json, csv, or parquet. Default: json. |
-v, --verbose |
Include detailed geometric columns. |
--log |
Save a run log. |
Processing
| Argument | Description |
|---|---|
--jobs N |
Number of worker processes. Default: 1. |
--h-mode N |
Gemmi hydrogen mode: 0=NoChange, 1=Shift, 2=Remove, 3=ReAdd, 4=ReAddButWater, 5=ReAddKnown. |
--model ID |
Model index to analyze, or all. |
--cone |
Enable implicit cone rescue for rotatable groups. |
--sym-contacts |
Detect contacts across crystallographic symmetry mates. |
--include-water |
Include water molecules as potential donors. |
--max-b N |
Exclude contacts when any π-ring atom or X atom has B-factor above N. 0 disables this filter. |
Filters
| Argument | Description |
|---|---|
--pi-res |
Limit π-acceptor residues, for example TRP,TYR. |
--donor-res |
Limit donor residues, for example LYS,ARG. |
--donor-atom |
Limit donor element symbols or exact atom names, for example N,O,C or OG,NZ. |
--min-occ N |
Minimum combined occupancy to report. Default: 0.0. |
Output Data
Simple mode includes structure ID, resolution, donor/π-acceptor residue IDs, X atom, H atom, d(X–Cπ), Hudson/Plevin flags, remarks, and symmetry operation index.
Verbose mode adds secondary-structure annotations, π-center and X coordinates, angles, projection distance, sequence separation, and B-factors.
Notes
- Same-residue donor/π-acceptor contacts are excluded.
- The automatic monomer-library download is stored in the user cache, not inside the installed package directory.
- Output column names currently remain ASCII (
pi_res,dist_X_Pi) to avoid breaking existing scripts.
Contact
Sean Wang, York Structural Biology Laboratory (YSBL), University of York
Project details
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 xpid-2.1.3.tar.gz.
File metadata
- Download URL: xpid-2.1.3.tar.gz
- Upload date:
- Size: 28.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5965edd655b7ffda9347f40a4c2340f3c242d51abf25f0d03c69648f838e7f6d
|
|
| MD5 |
778a1a9218d0909fcb7acf69b16a2d9e
|
|
| BLAKE2b-256 |
2040c79a93cbadc6905d7c3b696eb0f0caf938682ba993e8b2d27a43c00ffca2
|
File details
Details for the file xpid-2.1.3-py3-none-any.whl.
File metadata
- Download URL: xpid-2.1.3-py3-none-any.whl
- Upload date:
- Size: 28.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c4140425c684a0d8019acc02d7ecba541fa0fc698ce0a52a2e97a48f15b9f8e
|
|
| MD5 |
18172f139c5bc485e863e82417009d95
|
|
| BLAKE2b-256 |
0b8694a582e91c001b453166fc666659d44187b4b7ccd58ec1cde81225d5341e
|