PROPKA: Heuristic pKa calculations with ligands

3.5.1 · active · verified Tue Apr 14

PROPKA 3 is a Python library and command-line tool for predicting the pKa values of ionizable groups in proteins and protein-ligand complexes based on their 3D structure. It is actively maintained by the Jensen Group, with regular updates addressing bug fixes, performance improvements, and new features. The current version is 3.5.1.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to use PROPKA as a Python module to calculate pKa values for a protein structure. It creates a minimal dummy PDB file, runs the `propka.run.run_propka` function, and prints a success message, indicating that detailed results are written to a `.pka` file.

import os
import propka.run

# Example: Create a dummy PDB file for demonstration
# In a real scenario, you would load an existing PDB file.
example_pdb_content = """
ATOM      1  N   ALA A   1       0.000   0.000   0.000  1.00 20.00           N
ATOM      2  CA  ALA A   1       1.458   0.000   0.000  1.00 20.00           C
ATOM      3  C   ALA A   1       2.155   1.234   0.000  1.00 20.00           C
ATOM      4  O   ALA A   1       1.614   2.352   0.000  1.00 20.00           O
ATOM      5  CB  ALA A   1       2.000  -1.200   0.000  1.00 20.00           C
"""

with open("dummy.pdb", "w") as f:
    f.write(example_pdb_content)

# Run PROPKA programmatically
# The output will typically be written to a .pka file
# and potentially to standard output.

try:
    # propka.run.run_propka expects a list of filenames
    pka_results = propka.run.run_propka(["dummy.pdb"])

    # The 'pka_results' object contains detailed pKa information.
    # For a simple print of the summary (similar to command line output):
    print("\nPROPKA Calculation Summary (dummy.pdb):")
    # Note: Accessing results directly from the returned object might require
    # traversing its internal structure, e.g., MolecularContainer.
    # The exact structure depends on the PROPKA version and options.
    # For demonstration, we'll indicate successful execution and refer to the .pka file.
    print("Results written to dummy.pka and available in the returned object.")

    # You can read the generated .pka file for detailed results
    # with open("dummy.pka", "r") as f:
    #     print(f.read())

except Exception as e:
    print(f"An error occurred during PROPKA calculation: {e}")
finally:
    # Clean up the dummy PDB file and output if they exist
    if os.path.exists("dummy.pdb"):
        os.remove("dummy.pdb")
    if os.path.exists("dummy.pka"):
        os.remove("dummy.pka")

view raw JSON →