PDB2PQR
PDB2PQR is a Python software package designed to automate the preparation of biomolecular structures for continuum solvation calculations and various other modeling, analysis, and simulation tasks. It processes PDB files, adding missing heavy atoms and hydrogens, optimizing hydrogen bonding, estimating titration states, and assigning atomic charges and radii from various force fields to generate PQR files. The current version is 3.7.1, and the project maintains an active release cadence with updates typically on an annual or semi-annual basis.
Warnings
- breaking The primary executable name changed from `pdb2pqr30` to `pdb2pqr` in version 3.6.0. While `pdb2pqr30` is still available, it is slated for future deprecation. Users should update scripts to use `pdb2pqr` to ensure future compatibility.
- gotcha PDB2PQR has limitations regarding ligand processing, specifically it cannot handle more than one ligand per structure. This includes multiple copies of the same ligand, where only one will be processed. Additionally, residues not recognized by the chosen force field will be omitted from the output. Users should pre-process PDB files to remove unwanted residues (e.g., waters) or ensure only a single ligand is present.
- gotcha As of version 3.7.1, PDB2PQR requires Python versions `>=3.11` and `<4`. Older versions (e.g., v3.6.0) supported `>=3.8` to `3.11`. Upgrading PDB2PQR may necessitate updating your Python environment, and using it with unsupported Python versions can lead to installation or runtime errors.
- gotcha There are confirmed issues with naming conventions when using the CHARMM force field for uncommon protonation states. There is also a potential problem when adding hydrogens to non-experimental computer-generated structures.
- deprecated The web service provided by the National Biomedical Computation Resource (NBCR) was discontinued on April 30, 2020. Any tools or scripts (e.g., older Chimera integrations) that relied on this specific web service will no longer function unless PDB2PQR is installed locally and configured to use a local backend.
Install
-
pip install pdb2pqr
Quickstart
import subprocess
import os
# Create a dummy PDB file for demonstration
pdb_content = """
HETATM 1 N UNL A 1 -0.003 -0.003 0.000 1.00 0.00 N
HETATM 2 C UNL A 1 1.400 0.001 0.000 1.00 0.00 C
HETATM 3 O UNL A 1 2.000 -0.800 0.000 1.00 0.00 O
END
"""
with open("dummy.pdb", "w") as f:
f.write(pdb_content)
input_pdb = "dummy.pdb"
output_pqr = "dummy.pqr"
try:
# Run pdb2pqr as a command-line tool via subprocess
# Using --keep-chain to preserve chain IDs, --ff=PARSE for force field, --clean for minimal processing
# Note: For complex proteins, you would typically use options like --with-ph, --titration-state-method=propka, etc.
command = [
"pdb2pqr",
"--keep-chain",
"--ff=PARSE",
"--clean", # Use --clean to skip optimization for a minimal example
input_pdb,
output_pqr
]
print(f"Executing command: {' '.join(command)}")
result = subprocess.run(command, capture_output=True, text=True, check=True)
print("PDB2PQR ran successfully.")
print("STDOUT:", result.stdout)
print("STDERR:", result.stderr)
if os.path.exists(output_pqr):
print(f"Generated PQR file: {output_pqr}")
with open(output_pqr, "r") as f:
print("\nContent of dummy.pqr:")
print(f.read())
else:
print("Error: PQR file not generated.")
except FileNotFoundError:
print("Error: 'pdb2pqr' command not found. Please ensure pdb2pqr is installed and in your PATH.")
except subprocess.CalledProcessError as e:
print(f"Error running pdb2pqr: {e}")
print("STDOUT:", e.stdout)
print("STDERR:", e.stderr)
finally:
# Clean up dummy files
if os.path.exists(input_pdb):
os.remove(input_pdb)
if os.path.exists(output_pqr):
os.remove(output_pqr)