hbat 2.2.9.dev27__tar.gz → 2.2.10__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {hbat-2.2.9.dev27 → hbat-2.2.10}/.github/workflows/test.yml +8 -4
- {hbat-2.2.9.dev27 → hbat-2.2.10}/Makefile +1 -1
- {hbat-2.2.9.dev27 → hbat-2.2.10}/PKG-INFO +1 -1
- {hbat-2.2.9.dev27 → hbat-2.2.10}/docs/source/api/constants/pdb_constants.rst +9 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/docs/source/cli.rst +23 -10
- {hbat-2.2.9.dev27 → hbat-2.2.10}/docs/source/index.rst +2 -2
- {hbat-2.2.9.dev27 → hbat-2.2.10}/docs/source/quickstart.rst +1 -1
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat/_version.py +2 -2
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat/constants/pdb_constants.py +5 -1
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat/core/atom_classifier.py +4 -1
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat/core/interactions.py +146 -29
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat/core/np_analyzer.py +12 -1
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat/core/structure.py +12 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat/gui/export_manager.py +6 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat/gui/graphviz_renderer.py +30 -2
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat/gui/main_window.py +380 -8
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat/gui/results_panel.py +11 -3
- {hbat-2.2.9.dev27 → hbat-2.2.10}/tests/conftest.py +3 -3
- {hbat-2.2.9.dev27 → hbat-2.2.10}/tests/e2e/test_complete_workflows.py +1 -1
- {hbat-2.2.9.dev27 → hbat-2.2.10}/tests/e2e/test_graphviz_workflows.py +39 -23
- {hbat-2.2.9.dev27 → hbat-2.2.10}/tests/integration/test_analyzer_components.py +1 -1
- {hbat-2.2.9.dev27 → hbat-2.2.10}/tests/integration/test_graphviz_renderer.py +3 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/tests/unit/test_graphviz_utils.py +14 -8
- {hbat-2.2.9.dev27 → hbat-2.2.10}/tests/unit/test_interactions.py +6 -6
- {hbat-2.2.9.dev27 → hbat-2.2.10}/tests/unit/test_scrollable_canvas.py +2 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/.github/workflows/cleanup-prereleases.yml +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/.github/workflows/release.yml +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/CITATION.cff +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/CODE_OF_CONDUCT.md +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/CONTRIBUTING.md +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/LICENSE +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/MANIFEST.in +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/README.md +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/build_standalone.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/build_standalone_linux.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/build_standalone_windows.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/conda/meta.yaml +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/docs/Makefile +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/docs/requirements.txt +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/docs/source/_static/custom.css +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/docs/source/_static/light-theme.css +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/docs/source/api/ccd/ccd_analyzer.rst +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/docs/source/api/ccd/constants_generator.rst +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/docs/source/api/ccd/generate_ccd_constants.rst +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/docs/source/api/ccd/index.rst +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/docs/source/api/cli/index.rst +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/docs/source/api/constants/app.rst +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/docs/source/api/constants/atomic_data.rst +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/docs/source/api/constants/index.rst +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/docs/source/api/constants/misc.rst +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/docs/source/api/constants/parameters.rst +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/docs/source/api/core/index.rst +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/docs/source/api/core/interactions.rst +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/docs/source/api/core/np_analyzer.rst +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/docs/source/api/core/np_vector.rst +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/docs/source/api/core/pdb_fixer.rst +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/docs/source/api/core/pdb_parser.rst +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/docs/source/api/core/structure.rst +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/docs/source/api/examples/index.rst +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/docs/source/api/gui/index.rst +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/docs/source/api/index.rst +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/docs/source/api/utilities/atom_utils.rst +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/docs/source/api/utilities/graphviz_utils.rst +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/docs/source/api/utilities/index.rst +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/docs/source/conf.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/docs/source/development.rst +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/docs/source/installation.rst +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/docs/source/license.rst +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/docs/source/logic.rst +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/docs/source/parameters.rst +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/docs/source/pdbfixing.rst +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/example_pdb_files/1bhl.pdb +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/example_pdb_files/1gai.pdb +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/example_pdb_files/1ubi.pdb +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/example_pdb_files/2izf.pdb +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/example_pdb_files/4jsv.pdb +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/example_pdb_files/4laz.pdb +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/example_pdb_files/4ub7.pdb +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/example_pdb_files/4x21.pdb +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/example_pdb_files/6rsa.pdb +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/example_presets/drug_design_strict.hbat +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/example_presets/high_resolution.hbat +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/example_presets/low_resolution.hbat +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/example_presets/membrane_proteins.hbat +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/example_presets/nmr_structures.hbat +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/example_presets/standard_resolution.hbat +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/example_presets/strong_interactions_only.hbat +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/example_presets/weak_interactions_permissive.hbat +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat/__init__.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat/ccd/__init__.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat/ccd/ccd_analyzer.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat/ccd/constants_generator.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat/ccd/generate_ccd_constants.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat/cli/__init__.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat/cli/main.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat/constants/__init__.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat/constants/app.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat/constants/atomic_data.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat/constants/misc.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat/constants/parameters.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat/constants/residue_bonds.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat/core/__init__.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat/core/analysis.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat/core/analyzer.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat/core/app_config.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat/core/np_vector.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat/core/pdb_fixer.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat/core/pdb_parser.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat/gui/__init__.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat/gui/chain_visualization.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat/gui/graphviz_preferences_dialog.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat/gui/matplotlib_renderer.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat/gui/parameter_panel.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat/gui/visualization_renderer.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat/utilities/__init__.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat/utilities/atom_utils.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat/utilities/graphviz_utils.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat.egg-info/SOURCES.txt +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat.icns +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat.ico +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat.png +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat.svg +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat_cli.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/hbat_gui.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/pyproject.toml +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/pytest.ini +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/requirements-dev.txt +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/requirements.txt +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/setup.cfg +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/tests/README.md +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/tests/__init__.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/tests/cli/__init__.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/tests/cli/test_cli_main.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/tests/e2e/__init__.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/tests/e2e/test_cli_workflows.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/tests/e2e/test_gui_workflows.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/tests/gui/__init__.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/tests/gui/test_gui_components.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/tests/integration/__init__.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/tests/integration/test_cli_integration.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/tests/integration/test_molecular_validation.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/tests/integration/test_pdb_parsing.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/tests/performance/__init__.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/tests/performance/test_ccd_performance.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/tests/performance/test_performance_workflows.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/tests/run_tests.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/tests/unit/__init__.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/tests/unit/test_cli_parsing.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/tests/unit/test_gui_components.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/tests/unit/test_parameters.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/tests/unit/test_structures.py +0 -0
- {hbat-2.2.9.dev27 → hbat-2.2.10}/tests/unit/test_vector_math.py +0 -0
|
@@ -21,10 +21,10 @@ jobs:
|
|
|
21
21
|
with:
|
|
22
22
|
python-version: ${{ matrix.python-version }}
|
|
23
23
|
|
|
24
|
-
- name: Install
|
|
24
|
+
- name: Install system dependencies
|
|
25
25
|
run: |
|
|
26
26
|
sudo apt-get update
|
|
27
|
-
sudo apt-get install -y graphviz
|
|
27
|
+
sudo apt-get install -y graphviz xvfb
|
|
28
28
|
|
|
29
29
|
- name: Install dependencies
|
|
30
30
|
run: |
|
|
@@ -39,11 +39,15 @@ jobs:
|
|
|
39
39
|
run: make type-check
|
|
40
40
|
|
|
41
41
|
- name: Run tests
|
|
42
|
-
run: make test
|
|
42
|
+
run: xvfb-run -a make test
|
|
43
|
+
env:
|
|
44
|
+
DISPLAY: :99
|
|
43
45
|
|
|
44
46
|
- name: Run coverage
|
|
45
|
-
run: make test-coverage
|
|
47
|
+
run: xvfb-run -a make test-coverage
|
|
46
48
|
if: matrix.python-version == '3.10'
|
|
49
|
+
env:
|
|
50
|
+
DISPLAY: :99
|
|
47
51
|
|
|
48
52
|
- name: Upload coverage to Codecov
|
|
49
53
|
uses: codecov/codecov-action@v5
|
|
@@ -63,6 +63,15 @@ Water molecule recognition patterns.
|
|
|
63
63
|
|
|
64
64
|
.. autodata:: hbat.constants.pdb_constants.WATER_MOLECULES
|
|
65
65
|
|
|
66
|
+
Classification Codes
|
|
67
|
+
~~~~~~~~~~~~~~~~~~~~
|
|
68
|
+
|
|
69
|
+
Single letter codes for molecular classification systems.
|
|
70
|
+
|
|
71
|
+
.. autodata:: hbat.constants.pdb_constants.RESIDUE_TYPE_CODES
|
|
72
|
+
.. autodata:: hbat.constants.pdb_constants.BACKBONE_SIDECHAIN_CODES
|
|
73
|
+
.. autodata:: hbat.constants.pdb_constants.AROMATIC_CODES
|
|
74
|
+
|
|
66
75
|
Atom Name Mapping
|
|
67
76
|
~~~~~~~~~~~~~~~~~
|
|
68
77
|
|
|
@@ -166,11 +166,11 @@ Basic analysis with default parameters:
|
|
|
166
166
|
|
|
167
167
|
hbat protein.pdb
|
|
168
168
|
|
|
169
|
-
Save results to a
|
|
169
|
+
Save results to a CSV file (default format):
|
|
170
170
|
|
|
171
171
|
.. code-block:: bash
|
|
172
172
|
|
|
173
|
-
hbat protein.pdb -o results.
|
|
173
|
+
hbat protein.pdb -o results.csv
|
|
174
174
|
|
|
175
175
|
Use custom hydrogen bond criteria:
|
|
176
176
|
|
|
@@ -182,7 +182,7 @@ Export results in multiple formats:
|
|
|
182
182
|
|
|
183
183
|
.. code-block:: bash
|
|
184
184
|
|
|
185
|
-
hbat protein.pdb -o results.
|
|
185
|
+
hbat protein.pdb -o results.csv --json results.json
|
|
186
186
|
|
|
187
187
|
Use a high-resolution preset:
|
|
188
188
|
|
|
@@ -236,23 +236,36 @@ The default text output includes:
|
|
|
236
236
|
JSON Output
|
|
237
237
|
~~~~~~~~~~~
|
|
238
238
|
|
|
239
|
-
The JSON format
|
|
239
|
+
The JSON format automatically generates separate files for each interaction type with structured data:
|
|
240
240
|
|
|
241
241
|
- Metadata section with version and file information
|
|
242
|
-
- Complete statistics
|
|
242
|
+
- Complete statistics for each interaction type
|
|
243
243
|
- Arrays of interactions with all geometric parameters
|
|
244
|
-
- Atom coordinates for further processing
|
|
244
|
+
- Atom coordinates and structural properties for further processing
|
|
245
|
+
|
|
246
|
+
When using ``--json results.json``, HBAT creates:
|
|
247
|
+
- ``results_h_bonds.json``
|
|
248
|
+
- ``results_halogen_bonds.json``
|
|
249
|
+
- ``results_pi_interactions.json``
|
|
250
|
+
- ``results_cooperativity_chains.json``
|
|
245
251
|
|
|
246
252
|
CSV Output
|
|
247
253
|
~~~~~~~~~~
|
|
248
254
|
|
|
249
|
-
The CSV format
|
|
255
|
+
The CSV format automatically generates separate files for each interaction type:
|
|
250
256
|
|
|
251
|
-
- Hydrogen bonds with
|
|
252
|
-
- Halogen bonds with geometric data
|
|
257
|
+
- Hydrogen bonds with donor-acceptor properties and backbone/sidechain classification
|
|
258
|
+
- Halogen bonds with geometric data and structural properties
|
|
253
259
|
- π interactions with distance and angle information
|
|
260
|
+
- Cooperativity chains showing interaction networks
|
|
261
|
+
|
|
262
|
+
When using ``--csv results.csv``, HBAT creates:
|
|
263
|
+
- ``results_h_bonds.csv``
|
|
264
|
+
- ``results_halogen_bonds.csv``
|
|
265
|
+
- ``results_pi_interactions.csv``
|
|
266
|
+
- ``results_cooperativity_chains.csv``
|
|
254
267
|
|
|
255
|
-
Each
|
|
268
|
+
Each file includes comprehensive data with appropriate column headers for easy import into spreadsheet applications.
|
|
256
269
|
|
|
257
270
|
Exit Codes
|
|
258
271
|
----------
|
|
@@ -126,7 +126,7 @@ Basic usage
|
|
|
126
126
|
.. code-block:: bash
|
|
127
127
|
|
|
128
128
|
hbat input.pdb # Basic analysis
|
|
129
|
-
hbat input.pdb -o results.
|
|
129
|
+
hbat input.pdb -o results.csv # Save results to CSV file (default)
|
|
130
130
|
|
|
131
131
|
See full CLI options :doc:`cli`.
|
|
132
132
|
|
|
@@ -137,7 +137,7 @@ Features
|
|
|
137
137
|
- **Cooperativity Detection**: Identifies chains of cooperative molecular interactions
|
|
138
138
|
- **Structure Enhancement**: Automated PDB fixing with OpenBabel and PDBFixer integration
|
|
139
139
|
- **Flexible Parameters**: Customizable analysis parameters for different research needs
|
|
140
|
-
- **Multiple Output Formats**: Support for CSV, JSON, and formatted text output
|
|
140
|
+
- **Multiple Output Formats**: Support for CSV (default), JSON, and formatted text output with automated file generation for each interaction type
|
|
141
141
|
- **GUI Interface**: User-friendly graphical interface for interactive analysis
|
|
142
142
|
- **Command Line Tool**: Scriptable CLI for batch processing and automation
|
|
143
143
|
|
|
@@ -14,7 +14,7 @@ See full CLI options :doc:`cli`.
|
|
|
14
14
|
.. code-block:: bash
|
|
15
15
|
|
|
16
16
|
hbat input.pdb # Basic analysis
|
|
17
|
-
hbat input.pdb -o results.
|
|
17
|
+
hbat input.pdb -o results.csv # Save results to CSV file (default)
|
|
18
18
|
hbat input.pdb --hb-distance 3.0 # Custom H-bond distance cutoff
|
|
19
19
|
hbat input.pdb --mode local # Local interactions only
|
|
20
20
|
hbat input.pdb --json results.json # Export to JSON format
|
|
@@ -17,5 +17,5 @@ __version__: str
|
|
|
17
17
|
__version_tuple__: VERSION_TUPLE
|
|
18
18
|
version_tuple: VERSION_TUPLE
|
|
19
19
|
|
|
20
|
-
__version__ = version = '2.2.
|
|
21
|
-
__version_tuple__ = version_tuple = (2, 2,
|
|
20
|
+
__version__ = version = '2.2.10'
|
|
21
|
+
__version_tuple__ = version_tuple = (2, 2, 10)
|
|
@@ -792,7 +792,7 @@ Used for:
|
|
|
792
792
|
- Ion binding site analysis
|
|
793
793
|
"""
|
|
794
794
|
|
|
795
|
-
RESIDUE_TYPES: List[str] = ["DNA", "RNA", "PROTEIN", "LIGAND"]
|
|
795
|
+
RESIDUE_TYPES: List[str] = ["DNA", "RNA", "PROTEIN", "LIGAND", "WATER"]
|
|
796
796
|
"""List[str]: Standard residue type classifications for molecular analysis.
|
|
797
797
|
|
|
798
798
|
Classification categories for different types of molecular residues:
|
|
@@ -800,6 +800,8 @@ Classification categories for different types of molecular residues:
|
|
|
800
800
|
- RNA: Ribonucleotide residues (A, G, C, U, I)
|
|
801
801
|
- PROTEIN: Amino acid residues (20 standard amino acids and variants)
|
|
802
802
|
- LIGAND: Ligands, cofactors, metals, and other heteroatom residues
|
|
803
|
+
- WATER: Water molecules and solvent
|
|
804
|
+
|
|
803
805
|
|
|
804
806
|
Used for:
|
|
805
807
|
- Residue type identification and classification
|
|
@@ -813,6 +815,7 @@ RESIDUE_TYPE_CODES: Dict[str, str] = {
|
|
|
813
815
|
"DNA": "D",
|
|
814
816
|
"RNA": "R",
|
|
815
817
|
"PROTEIN": "P",
|
|
818
|
+
"WATER": "W",
|
|
816
819
|
"LIGAND": "L",
|
|
817
820
|
}
|
|
818
821
|
"""Dict[str, str]: Single letter codes for residue types.
|
|
@@ -821,6 +824,7 @@ Mapping of full residue type names to compact single letter codes:
|
|
|
821
824
|
- "DNA" → "D": Deoxyribonucleotide residues
|
|
822
825
|
- "RNA" → "R": Ribonucleotide residues
|
|
823
826
|
- "PROTEIN" → "P": Amino acid residues
|
|
827
|
+
- "WATER" → "W": Water molecules and solvent
|
|
824
828
|
- "LIGAND" → "L": Ligands, cofactors, metals, and other heteroatom residues
|
|
825
829
|
|
|
826
830
|
Used for compact representation in hydrogen bond descriptions and atom records.
|
|
@@ -19,6 +19,7 @@ from ..constants.pdb_constants import (
|
|
|
19
19
|
RESIDUES_WITH_AROMATIC_RINGS,
|
|
20
20
|
RING_ATOMS_FOR_RESIDUES_WITH_AROMATIC_RINGS,
|
|
21
21
|
RNA_RESIDUES,
|
|
22
|
+
WATER_MOLECULES,
|
|
22
23
|
)
|
|
23
24
|
|
|
24
25
|
|
|
@@ -27,7 +28,7 @@ def classify_residue_type(res_name: str) -> str:
|
|
|
27
28
|
|
|
28
29
|
:param res_name: Three-letter residue name (e.g., 'ALA', 'DA', 'HOH')
|
|
29
30
|
:type res_name: str
|
|
30
|
-
:returns: Single letter code for residue type ('P', 'D', 'R', 'L')
|
|
31
|
+
:returns: Single letter code for residue type ('P', 'D', 'R', 'W', 'L')
|
|
31
32
|
:rtype: str
|
|
32
33
|
"""
|
|
33
34
|
res_name = res_name.strip().upper()
|
|
@@ -38,6 +39,8 @@ def classify_residue_type(res_name: str) -> str:
|
|
|
38
39
|
return RESIDUE_TYPE_CODES["DNA"] # "D"
|
|
39
40
|
elif res_name in RNA_RESIDUES:
|
|
40
41
|
return RESIDUE_TYPE_CODES["RNA"] # "R"
|
|
42
|
+
elif res_name in WATER_MOLECULES:
|
|
43
|
+
return RESIDUE_TYPE_CODES["WATER"] # "W"
|
|
41
44
|
else:
|
|
42
45
|
return RESIDUE_TYPE_CODES["LIGAND"] # "L"
|
|
43
46
|
|
|
@@ -220,24 +220,24 @@ class HydrogenBond(MolecularInteraction):
|
|
|
220
220
|
including the participating atoms, geometric parameters, and
|
|
221
221
|
classification information.
|
|
222
222
|
|
|
223
|
-
:param
|
|
224
|
-
:type
|
|
223
|
+
:param _donor: The hydrogen bond donor atom
|
|
224
|
+
:type _donor: Atom
|
|
225
225
|
:param hydrogen: The hydrogen atom in the bond
|
|
226
226
|
:type hydrogen: Atom
|
|
227
|
-
:param
|
|
228
|
-
:type
|
|
227
|
+
:param _acceptor: The hydrogen bond acceptor atom
|
|
228
|
+
:type _acceptor: Atom
|
|
229
229
|
:param distance: H...A distance in Angstroms
|
|
230
230
|
:type distance: float
|
|
231
231
|
:param angle: D-H...A angle in radians
|
|
232
232
|
:type angle: float
|
|
233
|
-
:param
|
|
234
|
-
:type
|
|
233
|
+
:param _donor_acceptor_distance: D...A distance in Angstroms
|
|
234
|
+
:type _donor_acceptor_distance: float
|
|
235
235
|
:param bond_type: Classification of the hydrogen bond type
|
|
236
236
|
:type bond_type: str
|
|
237
|
-
:param
|
|
238
|
-
:type
|
|
239
|
-
:param
|
|
240
|
-
:type
|
|
237
|
+
:param _donor_residue: Identifier for donor residue
|
|
238
|
+
:type _donor_residue: str
|
|
239
|
+
:param _acceptor_residue: Identifier for acceptor residue
|
|
240
|
+
:type _acceptor_residue: str
|
|
241
241
|
"""
|
|
242
242
|
|
|
243
243
|
def __init__(
|
|
@@ -252,6 +252,27 @@ class HydrogenBond(MolecularInteraction):
|
|
|
252
252
|
_donor_residue: str,
|
|
253
253
|
_acceptor_residue: str,
|
|
254
254
|
):
|
|
255
|
+
"""Initialize a HydrogenBond object.
|
|
256
|
+
|
|
257
|
+
:param _donor: The hydrogen bond donor atom
|
|
258
|
+
:type _donor: Atom
|
|
259
|
+
:param hydrogen: The hydrogen atom in the bond
|
|
260
|
+
:type hydrogen: Atom
|
|
261
|
+
:param _acceptor: The hydrogen bond acceptor atom
|
|
262
|
+
:type _acceptor: Atom
|
|
263
|
+
:param distance: H...A distance in Angstroms
|
|
264
|
+
:type distance: float
|
|
265
|
+
:param angle: D-H...A angle in radians
|
|
266
|
+
:type angle: float
|
|
267
|
+
:param _donor_acceptor_distance: D...A distance in Angstroms
|
|
268
|
+
:type _donor_acceptor_distance: float
|
|
269
|
+
:param bond_type: Classification of the hydrogen bond type
|
|
270
|
+
:type bond_type: str
|
|
271
|
+
:param _donor_residue: Identifier for donor residue
|
|
272
|
+
:type _donor_residue: str
|
|
273
|
+
:param _acceptor_residue: Identifier for acceptor residue
|
|
274
|
+
:type _acceptor_residue: str
|
|
275
|
+
"""
|
|
255
276
|
self._donor = _donor
|
|
256
277
|
self.hydrogen = hydrogen
|
|
257
278
|
self._acceptor = _acceptor
|
|
@@ -301,7 +322,7 @@ class HydrogenBond(MolecularInteraction):
|
|
|
301
322
|
return self._acceptor_residue
|
|
302
323
|
|
|
303
324
|
def get_interaction_type(self) -> str:
|
|
304
|
-
return "
|
|
325
|
+
return "H-Bond"
|
|
305
326
|
|
|
306
327
|
def get_donor_interaction_distance(self) -> float:
|
|
307
328
|
"""Distance from donor to hydrogen."""
|
|
@@ -394,18 +415,18 @@ class HalogenBond(MolecularInteraction):
|
|
|
394
415
|
|
|
395
416
|
:param halogen: The halogen atom (F, Cl, Br, I)
|
|
396
417
|
:type halogen: Atom
|
|
397
|
-
:param
|
|
398
|
-
:type
|
|
418
|
+
:param _acceptor: The electron donor/acceptor atom
|
|
419
|
+
:type _acceptor: Atom
|
|
399
420
|
:param distance: X...A distance in Angstroms
|
|
400
421
|
:type distance: float
|
|
401
422
|
:param angle: C-X...A angle in radians
|
|
402
423
|
:type angle: float
|
|
403
424
|
:param bond_type: Classification of the halogen bond type
|
|
404
425
|
:type bond_type: str
|
|
405
|
-
:param
|
|
406
|
-
:type
|
|
407
|
-
:param
|
|
408
|
-
:type
|
|
426
|
+
:param _halogen_residue: Identifier for halogen-containing residue
|
|
427
|
+
:type _halogen_residue: str
|
|
428
|
+
:param _acceptor_residue: Identifier for acceptor residue
|
|
429
|
+
:type _acceptor_residue: str
|
|
409
430
|
"""
|
|
410
431
|
|
|
411
432
|
def __init__(
|
|
@@ -418,6 +439,23 @@ class HalogenBond(MolecularInteraction):
|
|
|
418
439
|
_halogen_residue: str,
|
|
419
440
|
_acceptor_residue: str,
|
|
420
441
|
):
|
|
442
|
+
"""Initialize a HalogenBond object.
|
|
443
|
+
|
|
444
|
+
:param halogen: The halogen atom (F, Cl, Br, I)
|
|
445
|
+
:type halogen: Atom
|
|
446
|
+
:param _acceptor: The electron donor/acceptor atom
|
|
447
|
+
:type _acceptor: Atom
|
|
448
|
+
:param distance: X...A distance in Angstroms
|
|
449
|
+
:type distance: float
|
|
450
|
+
:param angle: C-X...A angle in radians
|
|
451
|
+
:type angle: float
|
|
452
|
+
:param bond_type: Classification of the halogen bond type
|
|
453
|
+
:type bond_type: str
|
|
454
|
+
:param _halogen_residue: Identifier for halogen-containing residue
|
|
455
|
+
:type _halogen_residue: str
|
|
456
|
+
:param _acceptor_residue: Identifier for acceptor residue
|
|
457
|
+
:type _acceptor_residue: str
|
|
458
|
+
"""
|
|
421
459
|
self.halogen = halogen
|
|
422
460
|
self._acceptor = _acceptor
|
|
423
461
|
self._distance = distance
|
|
@@ -426,6 +464,9 @@ class HalogenBond(MolecularInteraction):
|
|
|
426
464
|
self._halogen_residue = _halogen_residue
|
|
427
465
|
self._acceptor_residue = _acceptor_residue
|
|
428
466
|
|
|
467
|
+
# Generate donor-acceptor property description
|
|
468
|
+
self._donor_acceptor_properties = self._generate_donor_acceptor_description()
|
|
469
|
+
|
|
429
470
|
# Backward compatibility properties
|
|
430
471
|
@property
|
|
431
472
|
def distance(self) -> float:
|
|
@@ -467,7 +508,7 @@ class HalogenBond(MolecularInteraction):
|
|
|
467
508
|
return self._acceptor_residue
|
|
468
509
|
|
|
469
510
|
def get_interaction_type(self) -> str:
|
|
470
|
-
return "
|
|
511
|
+
return "X-Bond"
|
|
471
512
|
|
|
472
513
|
def get_donor_interaction_distance(self) -> float:
|
|
473
514
|
"""Distance from donor to interaction point (0 for halogen bonds)."""
|
|
@@ -494,11 +535,61 @@ class HalogenBond(MolecularInteraction):
|
|
|
494
535
|
# by ensuring the halogen is bonded to carbon
|
|
495
536
|
return True # Assuming validation was done during creation
|
|
496
537
|
|
|
538
|
+
def _generate_donor_acceptor_description(self) -> str:
|
|
539
|
+
"""Generate donor-acceptor property description string.
|
|
540
|
+
|
|
541
|
+
Describes the halogen bond in terms of:
|
|
542
|
+
- Donor properties: residue type, backbone/sidechain, aromatic (halogen donor)
|
|
543
|
+
- Acceptor properties: residue type, backbone/sidechain, aromatic
|
|
544
|
+
|
|
545
|
+
Format: "donor_props-acceptor_props" (e.g., "PSN-LBN", "LSN-PSA")
|
|
546
|
+
|
|
547
|
+
:returns: Property description string
|
|
548
|
+
:rtype: str
|
|
549
|
+
"""
|
|
550
|
+
# Get halogen (donor) properties
|
|
551
|
+
donor_residue_type = getattr(self.halogen, "residue_type", "L")
|
|
552
|
+
donor_backbone_sidechain = getattr(self.halogen, "backbone_sidechain", "S")
|
|
553
|
+
donor_aromatic = getattr(self.halogen, "aromatic", "N")
|
|
554
|
+
|
|
555
|
+
# Get acceptor properties
|
|
556
|
+
acceptor_residue_type = getattr(self._acceptor, "residue_type", "L")
|
|
557
|
+
acceptor_backbone_sidechain = getattr(self._acceptor, "backbone_sidechain", "S")
|
|
558
|
+
acceptor_aromatic = getattr(self._acceptor, "aromatic", "N")
|
|
559
|
+
|
|
560
|
+
# Build property strings
|
|
561
|
+
donor_props = f"{donor_residue_type}{donor_backbone_sidechain}{donor_aromatic}"
|
|
562
|
+
acceptor_props = (
|
|
563
|
+
f"{acceptor_residue_type}{acceptor_backbone_sidechain}{acceptor_aromatic}"
|
|
564
|
+
)
|
|
565
|
+
|
|
566
|
+
return f"{donor_props}-{acceptor_props}"
|
|
567
|
+
|
|
568
|
+
@property
|
|
569
|
+
def donor_acceptor_properties(self) -> str:
|
|
570
|
+
"""Get the donor-acceptor property description.
|
|
571
|
+
|
|
572
|
+
:returns: Property description string
|
|
573
|
+
:rtype: str
|
|
574
|
+
"""
|
|
575
|
+
return self._donor_acceptor_properties
|
|
576
|
+
|
|
577
|
+
def get_backbone_sidechain_interaction(self) -> str:
|
|
578
|
+
"""Get simplified backbone/sidechain interaction description.
|
|
579
|
+
|
|
580
|
+
:returns: Interaction type (B-B, B-S, S-B, S-S)
|
|
581
|
+
:rtype: str
|
|
582
|
+
"""
|
|
583
|
+
donor_bs = getattr(self.halogen, "backbone_sidechain", "S")
|
|
584
|
+
acceptor_bs = getattr(self._acceptor, "backbone_sidechain", "S")
|
|
585
|
+
return f"{donor_bs}-{acceptor_bs}"
|
|
586
|
+
|
|
497
587
|
def __str__(self) -> str:
|
|
498
588
|
return (
|
|
499
589
|
f"X-Bond: {self._halogen_residue}({self.halogen.name}) - "
|
|
500
590
|
f"{self._acceptor_residue}({self._acceptor.name}) "
|
|
501
|
-
f"[{self.distance:.2f}Å, {math.degrees(self.angle):.1f}°]"
|
|
591
|
+
f"[{self.distance:.2f}Å, {math.degrees(self.angle):.1f}°] "
|
|
592
|
+
f"[{self.get_backbone_sidechain_interaction()}] [{self.donor_acceptor_properties}]"
|
|
502
593
|
)
|
|
503
594
|
|
|
504
595
|
|
|
@@ -508,8 +599,8 @@ class PiInteraction(MolecularInteraction):
|
|
|
508
599
|
This class stores information about a detected X-H...π interaction,
|
|
509
600
|
where a hydrogen bond donor interacts with an aromatic π system.
|
|
510
601
|
|
|
511
|
-
:param
|
|
512
|
-
:type
|
|
602
|
+
:param _donor: The hydrogen bond donor atom
|
|
603
|
+
:type _donor: Atom
|
|
513
604
|
:param hydrogen: The hydrogen atom
|
|
514
605
|
:type hydrogen: Atom
|
|
515
606
|
:param pi_center: Center of the aromatic π system
|
|
@@ -518,10 +609,10 @@ class PiInteraction(MolecularInteraction):
|
|
|
518
609
|
:type distance: float
|
|
519
610
|
:param angle: D-H...π angle in radians
|
|
520
611
|
:type angle: float
|
|
521
|
-
:param
|
|
522
|
-
:type
|
|
523
|
-
:param
|
|
524
|
-
:type
|
|
612
|
+
:param _donor_residue: Identifier for donor residue
|
|
613
|
+
:type _donor_residue: str
|
|
614
|
+
:param _pi_residue: Identifier for π-containing residue
|
|
615
|
+
:type _pi_residue: str
|
|
525
616
|
"""
|
|
526
617
|
|
|
527
618
|
def __init__(
|
|
@@ -534,6 +625,23 @@ class PiInteraction(MolecularInteraction):
|
|
|
534
625
|
_donor_residue: str,
|
|
535
626
|
_pi_residue: str,
|
|
536
627
|
):
|
|
628
|
+
"""Initialize a PiInteraction object.
|
|
629
|
+
|
|
630
|
+
:param _donor: The hydrogen bond donor atom
|
|
631
|
+
:type _donor: Atom
|
|
632
|
+
:param hydrogen: The hydrogen atom
|
|
633
|
+
:type hydrogen: Atom
|
|
634
|
+
:param pi_center: Center of the aromatic π system
|
|
635
|
+
:type pi_center: NPVec3D
|
|
636
|
+
:param distance: H...π distance in Angstroms
|
|
637
|
+
:type distance: float
|
|
638
|
+
:param angle: D-H...π angle in radians
|
|
639
|
+
:type angle: float
|
|
640
|
+
:param _donor_residue: Identifier for donor residue
|
|
641
|
+
:type _donor_residue: str
|
|
642
|
+
:param _pi_residue: Identifier for π-containing residue
|
|
643
|
+
:type _pi_residue: str
|
|
644
|
+
"""
|
|
537
645
|
self._donor = _donor
|
|
538
646
|
self.hydrogen = hydrogen
|
|
539
647
|
self.pi_center = pi_center
|
|
@@ -581,7 +689,7 @@ class PiInteraction(MolecularInteraction):
|
|
|
581
689
|
return self._pi_residue
|
|
582
690
|
|
|
583
691
|
def get_interaction_type(self) -> str:
|
|
584
|
-
return "
|
|
692
|
+
return "π–Inter"
|
|
585
693
|
|
|
586
694
|
def get_donor_interaction_distance(self) -> float:
|
|
587
695
|
"""Distance from donor to hydrogen."""
|
|
@@ -716,6 +824,15 @@ class CooperativityChain(MolecularInteraction):
|
|
|
716
824
|
chain_length: int,
|
|
717
825
|
chain_type: str,
|
|
718
826
|
):
|
|
827
|
+
"""Initialize a CooperativityChain object.
|
|
828
|
+
|
|
829
|
+
:param interactions: List of interactions in the chain
|
|
830
|
+
:type interactions: List[Union[HydrogenBond, HalogenBond, PiInteraction]]
|
|
831
|
+
:param chain_length: Number of interactions in the chain
|
|
832
|
+
:type chain_length: int
|
|
833
|
+
:param chain_type: Description of the interaction types in the chain
|
|
834
|
+
:type chain_type: str
|
|
835
|
+
"""
|
|
719
836
|
self.interactions = interactions
|
|
720
837
|
self.chain_length = chain_length
|
|
721
838
|
self.chain_type = chain_type # e.g., "H-Bond -> X-Bond -> π-Int"
|
|
@@ -887,8 +1004,8 @@ class CooperativityChain(MolecularInteraction):
|
|
|
887
1004
|
def _get_interaction_symbol(self, interaction_type: str) -> str:
|
|
888
1005
|
"""Get display symbol for interaction type."""
|
|
889
1006
|
symbols = {
|
|
890
|
-
"
|
|
891
|
-
"
|
|
892
|
-
"
|
|
1007
|
+
"H-Bond": "->",
|
|
1008
|
+
"X-Bond": "=X=>",
|
|
1009
|
+
"π–Inter": "~π~>",
|
|
893
1010
|
}
|
|
894
1011
|
return symbols.get(interaction_type, "->")
|
|
@@ -77,7 +77,18 @@ class NPMolecularInteractionAnalyzer:
|
|
|
77
77
|
self.progress_callback: Optional[Callable[[str], None]] = None
|
|
78
78
|
|
|
79
79
|
def analyze_file(self, pdb_file: str) -> bool:
|
|
80
|
-
"""Analyze a PDB file for molecular interactions.
|
|
80
|
+
"""Analyze a PDB file for molecular interactions.
|
|
81
|
+
|
|
82
|
+
Performs comprehensive analysis of hydrogen bonds, halogen bonds, π interactions,
|
|
83
|
+
and cooperativity chains in the provided PDB structure. Optionally applies PDB
|
|
84
|
+
fixing to add missing atoms if enabled in parameters.
|
|
85
|
+
|
|
86
|
+
:param pdb_file: Path to PDB file to analyze
|
|
87
|
+
:type pdb_file: str
|
|
88
|
+
:returns: True if analysis completed successfully, False if parsing failed
|
|
89
|
+
:rtype: bool
|
|
90
|
+
:raises Exception: If PDB fixing fails when enabled
|
|
91
|
+
"""
|
|
81
92
|
self._analysis_start_time = time.time()
|
|
82
93
|
self._pdb_fixing_info = {}
|
|
83
94
|
|
|
@@ -176,6 +176,12 @@ class Atom:
|
|
|
176
176
|
:type charge: str
|
|
177
177
|
:param record_type: PDB record type (ATOM or HETATM)
|
|
178
178
|
:type record_type: str
|
|
179
|
+
:param residue_type: Residue type classification (P=Protein, D=DNA, R=RNA, L=Ligand)
|
|
180
|
+
:type residue_type: str
|
|
181
|
+
:param backbone_sidechain: Backbone/sidechain classification (B=Backbone, S=Sidechain)
|
|
182
|
+
:type backbone_sidechain: str
|
|
183
|
+
:param aromatic: Aromatic classification (A=Aromatic, N=Non-aromatic)
|
|
184
|
+
:type aromatic: str
|
|
179
185
|
"""
|
|
180
186
|
|
|
181
187
|
def __init__(
|
|
@@ -225,6 +231,12 @@ class Atom:
|
|
|
225
231
|
:type charge: str
|
|
226
232
|
:param record_type: PDB record type (ATOM or HETATM)
|
|
227
233
|
:type record_type: str
|
|
234
|
+
:param residue_type: Residue type classification (P=Protein, D=DNA, R=RNA, L=Ligand)
|
|
235
|
+
:type residue_type: str
|
|
236
|
+
:param backbone_sidechain: Backbone/sidechain classification (B=Backbone, S=Sidechain)
|
|
237
|
+
:type backbone_sidechain: str
|
|
238
|
+
:param aromatic: Aromatic classification (A=Aromatic, N=Non-aromatic)
|
|
239
|
+
:type aromatic: str
|
|
228
240
|
"""
|
|
229
241
|
self.serial = serial
|
|
230
242
|
self.name = name
|
|
@@ -45,6 +45,12 @@ EXPORT_FORMATS = {
|
|
|
45
45
|
"description": "Encapsulated PostScript",
|
|
46
46
|
"filetypes": [("EPS files", "*.eps")],
|
|
47
47
|
},
|
|
48
|
+
"dot": {
|
|
49
|
+
"name": "DOT Source",
|
|
50
|
+
"extension": ".dot",
|
|
51
|
+
"description": "GraphViz DOT language source file",
|
|
52
|
+
"filetypes": [("DOT files", "*.dot")],
|
|
53
|
+
},
|
|
48
54
|
}
|
|
49
55
|
|
|
50
56
|
|
|
@@ -150,7 +150,7 @@ class GraphVizRenderer(BaseVisualizationRenderer):
|
|
|
150
150
|
:returns: List of supported format names
|
|
151
151
|
:rtype: List[str]
|
|
152
152
|
"""
|
|
153
|
-
return ["png", "svg", "pdf"]
|
|
153
|
+
return ["png", "svg", "pdf", "dot"]
|
|
154
154
|
|
|
155
155
|
def get_supported_layouts(self) -> List[str]:
|
|
156
156
|
"""Get list of supported layout algorithms.
|
|
@@ -401,6 +401,10 @@ class GraphVizRenderer(BaseVisualizationRenderer):
|
|
|
401
401
|
:returns: True if successful
|
|
402
402
|
:rtype: bool
|
|
403
403
|
"""
|
|
404
|
+
# Handle DOT format specially - just save the source
|
|
405
|
+
if format.lower() == "dot":
|
|
406
|
+
return self._export_dot_source(dot_string, filename)
|
|
407
|
+
|
|
404
408
|
engine = self.config.get_graphviz_engine()
|
|
405
409
|
|
|
406
410
|
if GRAPHVIZ_PYTHON_AVAILABLE:
|
|
@@ -430,8 +434,13 @@ class GraphVizRenderer(BaseVisualizationRenderer):
|
|
|
430
434
|
graph = graphviz.Source(dot_string)
|
|
431
435
|
graph.engine = engine
|
|
432
436
|
|
|
437
|
+
# Remove extension from filename since graph.render() adds it automatically
|
|
438
|
+
from pathlib import Path
|
|
439
|
+
|
|
440
|
+
base_filename = str(Path(filename).with_suffix(""))
|
|
441
|
+
|
|
433
442
|
# Render to file
|
|
434
|
-
graph.render(
|
|
443
|
+
graph.render(base_filename, format=format, cleanup=True)
|
|
435
444
|
return True
|
|
436
445
|
|
|
437
446
|
except Exception as e:
|
|
@@ -483,6 +492,25 @@ class GraphVizRenderer(BaseVisualizationRenderer):
|
|
|
483
492
|
logger.error(f"Failed to export with subprocess: {e}")
|
|
484
493
|
return False
|
|
485
494
|
|
|
495
|
+
def _export_dot_source(self, dot_string: str, filename: str) -> bool:
|
|
496
|
+
"""Export DOT source code to file.
|
|
497
|
+
|
|
498
|
+
:param dot_string: DOT format string
|
|
499
|
+
:type dot_string: str
|
|
500
|
+
:param filename: Output filename
|
|
501
|
+
:type filename: str
|
|
502
|
+
:returns: True if successful
|
|
503
|
+
:rtype: bool
|
|
504
|
+
"""
|
|
505
|
+
try:
|
|
506
|
+
with open(filename, "w", encoding="utf-8") as f:
|
|
507
|
+
f.write(dot_string)
|
|
508
|
+
logger.info(f"Successfully exported DOT source to {filename}")
|
|
509
|
+
return True
|
|
510
|
+
except Exception as e:
|
|
511
|
+
logger.error(f"Failed to export DOT source: {e}")
|
|
512
|
+
return False
|
|
513
|
+
|
|
486
514
|
def _create_canvas(self) -> None:
|
|
487
515
|
"""Create scrollable canvas widget for displaying rendered images."""
|
|
488
516
|
if self.parent:
|