pdbeccdutils 1.0.3__tar.gz → 1.0.4__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.
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/PKG-INFO +1 -1
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/core/ccd_reader.py +47 -22
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/core/prd_reader.py +22 -6
- pdbeccdutils-1.0.4/pdbeccdutils/tests/test_ccd_reader.py +93 -0
- pdbeccdutils-1.0.4/pdbeccdutils/tests/test_prd_reader.py +28 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pyproject.toml +2 -2
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/LICENSE +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/README.md +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/computations/__init__.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/computations/parity_method.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/core/__init__.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/core/boundmolecule.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/core/ccd_writer.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/core/clc_reader.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/core/clc_writer.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/core/component.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/core/depictions.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/core/exceptions.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/core/fragment_library.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/core/models.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/core/prd_writer.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/data/coordgen_templates/templates.mae +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/data/fragment_library.tsv +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/data/general_templates/adamantane.sdf +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/data/general_templates/cube.sdf +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/data/general_templates/decahydrocorrin.sdf +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/data/general_templates/hem.sdf +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/data/general_templates/nonbornane.sdf +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/data/general_templates/phorbine.sdf +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/data/general_templates/porphin.sdf +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/data/general_templates/porphycene.sdf +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/data/general_templates/ru_complex.sdf +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/data/general_templates/ru_complex2.sdf +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/helpers/__init__.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/helpers/cif_tools.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/helpers/conversions.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/helpers/drawing.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/helpers/helper.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/helpers/mol_tools.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/scripts/__init__.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/scripts/boundmolecule_cli.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/scripts/process_components_cif_cli.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/scripts/setup_pubchem_library_cli.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/UNL.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/depiction_test/0KA.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/depiction_test/11R.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/depiction_test/1CL.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/depiction_test/6KK.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/depiction_test/ADM.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/depiction_test/AXM.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/depiction_test/G2O.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/depiction_test/HDD.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/depiction_test/HEA.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/depiction_test/HEB.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/depiction_test/HEC.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/depiction_test/HEG.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/depiction_test/HEM.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/depiction_test/HME.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/depiction_test/HNN.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/depiction_test/SF4.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/random_sample/000.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/random_sample/007.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/random_sample/00O.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/random_sample/03R.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/random_sample/08T.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/random_sample/099.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/random_sample/0KA.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/random_sample/0OD.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/random_sample/10R.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/random_sample/3CD.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/random_sample/7OM.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/random_sample/880.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/random_sample/ASX.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/random_sample/ATP.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/random_sample/BCD.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/random_sample/CDL.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/random_sample/CMO.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/random_sample/D3O.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/random_sample/DMS.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/random_sample/EOH.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/random_sample/FES.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/random_sample/GLC.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/random_sample/GLU.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/random_sample/GOL.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/random_sample/HEM.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/random_sample/IBP.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/random_sample/MAN.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/random_sample/NA.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/random_sample/NAD.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/random_sample/NAG.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/random_sample/SAC.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/random_sample/SEH.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/random_sample/SO4.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/random_sample/SY9.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/random_sample/V55.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/ccd_mmcif_test_files/random_sample/VIA.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/conftest.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/prd_mmcif_test_files/PRDCC_000103.cif +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/test_bound_molecule.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/test_boundmolecule_cli.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/test_clc_reader.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/test_clc_writer.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/test_file_writing.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/test_fragment_library.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/test_helper_methods.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/test_inchi_key_matches.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/test_load_eoh_cif.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/test_parity.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/test_process_components_cif_cli.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/test_property_generation.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/test_rdkit_fixtures.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/test_residue.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/test_scaffold_generation.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/test_web_services.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/test_write_img.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/tst_utilities.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/updated_mmcif_test_files/1c4q/1c4q_bio.cif.gz +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/updated_mmcif_test_files/1c4q/1c4q_bio_before_fixing.cif.gz +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/updated_mmcif_test_files/1c4q/1c4q_processed.cif.gz +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/updated_mmcif_test_files/1c4q/1c4q_updated.cif.gz +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/updated_mmcif_test_files/1c4q/bound_molecules.json +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/updated_mmcif_test_files/1tqh/1tqh_bio.cif.gz +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/updated_mmcif_test_files/1tqh/1tqh_bio_before_fixing.cif.gz +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/updated_mmcif_test_files/1tqh/1tqh_processed.cif.gz +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/updated_mmcif_test_files/1tqh/1tqh_updated.cif.gz +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/updated_mmcif_test_files/1tqh/bound_molecules.json +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/utils/__init__.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/utils/config.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/utils/pubchem_downloader.py +0 -0
- {pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/utils/web_services.py +0 -0
|
@@ -28,7 +28,7 @@ of molecules. The basic use can be as easy as this:
|
|
|
28
28
|
import logging
|
|
29
29
|
import os
|
|
30
30
|
from datetime import date
|
|
31
|
-
from typing import Dict, List, NamedTuple
|
|
31
|
+
from typing import Collection, Dict, List, NamedTuple, Optional
|
|
32
32
|
|
|
33
33
|
import rdkit
|
|
34
34
|
from pdbeccdutils.core.component import Component
|
|
@@ -101,7 +101,7 @@ def read_pdb_cif_file(path_to_cif: str, sanitize: bool = True) -> CCDReaderResul
|
|
|
101
101
|
|
|
102
102
|
|
|
103
103
|
def read_pdb_components_file(
|
|
104
|
-
path_to_cif: str, sanitize: bool = True, include:
|
|
104
|
+
path_to_cif: str, sanitize: bool = True, include: Optional[Collection[str]] = None
|
|
105
105
|
) -> Dict[str, CCDReaderResult]:
|
|
106
106
|
"""
|
|
107
107
|
Process multiple compounds stored in the wwPDB CCD
|
|
@@ -112,8 +112,10 @@ def read_pdb_components_file(
|
|
|
112
112
|
multiple ligands in it.
|
|
113
113
|
sanitize (bool): Whether or not the components should be sanitized
|
|
114
114
|
Defaults to True.
|
|
115
|
-
include (
|
|
116
|
-
|
|
115
|
+
include (Optional[Collection[str]]): List of CCDs to be parsed. By default it
|
|
116
|
+
is None and parses all the CCDs. If a collection of CCDs is provided, only
|
|
117
|
+
those CCDs are parsed. Empty collections parse all CCDs, matching the
|
|
118
|
+
previous behavior.
|
|
117
119
|
|
|
118
120
|
Raises:
|
|
119
121
|
ValueError: if the file does not exist.
|
|
@@ -126,16 +128,27 @@ def read_pdb_components_file(
|
|
|
126
128
|
raise ValueError("File '{}' does not exists".format(path_to_cif))
|
|
127
129
|
|
|
128
130
|
result_bag = {}
|
|
129
|
-
|
|
130
|
-
if (block.name in include) or (len(include) == 0):
|
|
131
|
-
try:
|
|
132
|
-
result_bag[block.name] = _parse_pdb_mmcif(block, sanitize)
|
|
133
|
-
except CCDUtilsError as e:
|
|
134
|
-
logging.error(
|
|
135
|
-
f"ERROR: Data block {block.name} not processed. Reason: ({str(e)})."
|
|
136
|
-
)
|
|
137
|
-
return result_bag
|
|
131
|
+
doc = cif.read(path_to_cif)
|
|
138
132
|
|
|
133
|
+
if not include:
|
|
134
|
+
blocks = doc
|
|
135
|
+
else:
|
|
136
|
+
blocks = []
|
|
137
|
+
for block_name in dict.fromkeys(include):
|
|
138
|
+
block = doc.find_block(block_name)
|
|
139
|
+
if block is None:
|
|
140
|
+
logging.warning(f"Data block {block_name} not found in {path_to_cif}.")
|
|
141
|
+
continue
|
|
142
|
+
blocks.append(block)
|
|
143
|
+
|
|
144
|
+
for block in blocks:
|
|
145
|
+
try:
|
|
146
|
+
result_bag[block.name] = _parse_pdb_mmcif(block, sanitize)
|
|
147
|
+
except CCDUtilsError as e:
|
|
148
|
+
logging.error(
|
|
149
|
+
f"ERROR: Data block {block.name} not processed. Reason: ({str(e)})."
|
|
150
|
+
)
|
|
151
|
+
return result_bag
|
|
139
152
|
|
|
140
153
|
# region parse mmcif
|
|
141
154
|
|
|
@@ -316,19 +329,31 @@ def _parse_pdb_bonds(mol, cif_block, errors):
|
|
|
316
329
|
bonds = cif_block.find(
|
|
317
330
|
"_chem_comp_bond.", ["atom_id_1", "atom_id_2", "value_order"]
|
|
318
331
|
)
|
|
319
|
-
|
|
320
|
-
|
|
332
|
+
atom_indices = {
|
|
333
|
+
atom_id: atom_index
|
|
334
|
+
for atom_index, _atom_id in enumerate(
|
|
335
|
+
atoms.find_column("_chem_comp_atom.atom_id")
|
|
336
|
+
) if (atom_id := cif.as_string(_atom_id))
|
|
337
|
+
}
|
|
338
|
+
for index, row in enumerate(bonds):
|
|
339
|
+
atom_1 = cif.as_string(row["_chem_comp_bond.atom_id_1"])
|
|
340
|
+
atom_2 = cif.as_string(row["_chem_comp_bond.atom_id_2"])
|
|
341
|
+
|
|
321
342
|
try:
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
343
|
+
atom_1_id = atom_indices[atom_1]
|
|
344
|
+
atom_2_id = atom_indices[atom_2]
|
|
345
|
+
bond_order = helper.bond_pdb_order(cif.as_string(row["_chem_comp_bond.value_order"]))
|
|
346
|
+
if bond_order is None:
|
|
347
|
+
errors.append(
|
|
348
|
+
f"""Unknown bond order {cif.as_string(row['_chem_comp_bond.value_order'])} in
|
|
349
|
+
{index} entry in _chem_comp_bond"""
|
|
350
|
+
)
|
|
351
|
+
continue
|
|
327
352
|
|
|
328
353
|
mol.AddBond(atom_1_id, atom_2_id, bond_order)
|
|
329
|
-
except
|
|
354
|
+
except KeyError:
|
|
330
355
|
errors.append(
|
|
331
|
-
f"
|
|
356
|
+
f"Missing atom in {index} entry in _chem_comp_bond"
|
|
332
357
|
)
|
|
333
358
|
except RuntimeError:
|
|
334
359
|
errors.append(f"Duplicit bond {atom_1} - {atom_2}")
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
import logging
|
|
20
20
|
import os
|
|
21
|
-
from typing import Dict
|
|
21
|
+
from typing import Collection, Dict, Optional
|
|
22
22
|
import rdkit
|
|
23
23
|
from pdbeccdutils.core.component import Component
|
|
24
24
|
from pdbeccdutils.core import ccd_reader
|
|
@@ -69,31 +69,47 @@ def read_pdb_cif_file(
|
|
|
69
69
|
|
|
70
70
|
|
|
71
71
|
def read_pdb_components_file(
|
|
72
|
-
path_to_cif: str, sanitize: bool = True
|
|
72
|
+
path_to_cif: str, sanitize: bool = True, include: Optional[Collection[str]] = None
|
|
73
73
|
) -> Dict[str, ccd_reader.CCDReaderResult]:
|
|
74
74
|
"""
|
|
75
|
-
Process multiple compounds stored in the wwPDB
|
|
76
|
-
`
|
|
75
|
+
Process multiple compounds stored in the wwPDB PRD
|
|
76
|
+
`prdcc-all.cif` file.
|
|
77
77
|
|
|
78
78
|
Args:
|
|
79
79
|
path_to_cif (str): Path to the `prdcc-all.cif` file with
|
|
80
80
|
multiple ligands in it.
|
|
81
81
|
sanitize (bool): Whether or not the components should be sanitized
|
|
82
82
|
Defaults to True.
|
|
83
|
+
include (Optional[Collection[str]]): List of PRDs to be parsed. By default it
|
|
84
|
+
is None and parses all the PRDs. If a collection of PRDs is provided, only
|
|
85
|
+
those PRDs are parsed. Empty collections parse all PRDs, matching the
|
|
86
|
+
previous behavior.
|
|
83
87
|
|
|
84
88
|
Raises:
|
|
85
89
|
ValueError: if the file does not exist.
|
|
86
90
|
|
|
87
91
|
Returns:
|
|
88
92
|
dict[str, CCDReaderResult]: Internal representation of all
|
|
89
|
-
the components in the `
|
|
93
|
+
the components in the `prdcc-all.cif` file.
|
|
90
94
|
"""
|
|
91
95
|
if not os.path.isfile(path_to_cif):
|
|
92
96
|
raise ValueError("File '{}' does not exists".format(path_to_cif))
|
|
93
97
|
|
|
94
98
|
result_bag = {}
|
|
99
|
+
doc = cif.read(path_to_cif)
|
|
95
100
|
|
|
96
|
-
|
|
101
|
+
if not include:
|
|
102
|
+
blocks = doc
|
|
103
|
+
else:
|
|
104
|
+
blocks = []
|
|
105
|
+
for block_name in dict.fromkeys(include):
|
|
106
|
+
block = doc.find_block(block_name)
|
|
107
|
+
if block is None:
|
|
108
|
+
logging.warning(f"Data block {block_name} not found in {path_to_cif}.")
|
|
109
|
+
continue
|
|
110
|
+
blocks.append(block)
|
|
111
|
+
|
|
112
|
+
for block in blocks:
|
|
97
113
|
try:
|
|
98
114
|
result_bag[block.name] = _parse_pdb_mmcif(block, sanitize)
|
|
99
115
|
except CCDUtilsError as e:
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
from gemmi import cif
|
|
5
|
+
from rdkit import Chem
|
|
6
|
+
|
|
7
|
+
from pdbeccdutils.core import ccd_reader
|
|
8
|
+
from pdbeccdutils.tests.tst_utilities import cif_filename
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def _components_cif(tmp_path):
|
|
12
|
+
path = tmp_path / "components.cif"
|
|
13
|
+
ccds = [Path(cif_filename("00O")), Path(cif_filename("007"))]
|
|
14
|
+
path.write_text("\n".join(ccd.read_text() for ccd in ccds))
|
|
15
|
+
return path
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def test_read_pdb_components_file_parses_all_for_empty_include(tmp_path):
|
|
19
|
+
path = _components_cif(tmp_path)
|
|
20
|
+
|
|
21
|
+
for include in (None, []):
|
|
22
|
+
result = ccd_reader.read_pdb_components_file(
|
|
23
|
+
str(path), sanitize=False, include=include
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
assert list(result) == ["00O", "007"]
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def test_read_pdb_components_file_uses_include_order_and_skips_missing(
|
|
30
|
+
tmp_path, caplog
|
|
31
|
+
):
|
|
32
|
+
path = _components_cif(tmp_path)
|
|
33
|
+
|
|
34
|
+
with caplog.at_level(logging.WARNING):
|
|
35
|
+
result = ccd_reader.read_pdb_components_file(
|
|
36
|
+
str(path), sanitize=False, include=["007", "MISSING", "00O", "007"]
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
assert list(result) == ["007", "00O"]
|
|
40
|
+
assert "Data block MISSING not found" in caplog.text
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def test_parse_pdb_bonds_uses_atom_id_lookup():
|
|
44
|
+
block = cif.read_string(
|
|
45
|
+
"""
|
|
46
|
+
data_TST
|
|
47
|
+
loop_
|
|
48
|
+
_chem_comp_atom.atom_id
|
|
49
|
+
A
|
|
50
|
+
B
|
|
51
|
+
loop_
|
|
52
|
+
_chem_comp_bond.atom_id_1
|
|
53
|
+
_chem_comp_bond.atom_id_2
|
|
54
|
+
_chem_comp_bond.value_order
|
|
55
|
+
A B SING
|
|
56
|
+
"""
|
|
57
|
+
).sole_block()
|
|
58
|
+
mol = Chem.RWMol()
|
|
59
|
+
mol.AddAtom(Chem.Atom("C"))
|
|
60
|
+
mol.AddAtom(Chem.Atom("O"))
|
|
61
|
+
errors = []
|
|
62
|
+
|
|
63
|
+
ccd_reader._parse_pdb_bonds(mol, block, errors)
|
|
64
|
+
|
|
65
|
+
assert errors == []
|
|
66
|
+
assert mol.GetNumBonds() == 1
|
|
67
|
+
assert mol.GetBondBetweenAtoms(0, 1) is not None
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def test_parse_pdb_bonds_missing_atom_1_does_not_mask_error():
|
|
71
|
+
block = cif.read_string(
|
|
72
|
+
"""
|
|
73
|
+
data_TST
|
|
74
|
+
loop_
|
|
75
|
+
_chem_comp_atom.atom_id
|
|
76
|
+
A
|
|
77
|
+
loop_
|
|
78
|
+
_chem_comp_bond.atom_id_1
|
|
79
|
+
_chem_comp_bond.atom_id_2
|
|
80
|
+
_chem_comp_bond.value_order
|
|
81
|
+
? A SING
|
|
82
|
+
"""
|
|
83
|
+
).sole_block()
|
|
84
|
+
mol = Chem.RWMol()
|
|
85
|
+
mol.AddAtom(Chem.Atom("C"))
|
|
86
|
+
errors = []
|
|
87
|
+
|
|
88
|
+
ccd_reader._parse_pdb_bonds(mol, block, errors)
|
|
89
|
+
|
|
90
|
+
assert errors == [
|
|
91
|
+
f"Missing atom in 0 entry in _chem_comp_bond"
|
|
92
|
+
]
|
|
93
|
+
assert mol.GetNumBonds() == 0
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
|
|
3
|
+
from pdbeccdutils.core import prd_reader
|
|
4
|
+
from pdbeccdutils.tests.tst_utilities import prd_cif_filename
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def test_read_prd_components_file_parses_all_for_empty_include():
|
|
8
|
+
path = prd_cif_filename("PRDCC_000103")
|
|
9
|
+
|
|
10
|
+
for include in (None, []):
|
|
11
|
+
result = prd_reader.read_pdb_components_file(
|
|
12
|
+
path, sanitize=False, include=include
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
assert list(result) == ["PRD_000103"]
|
|
16
|
+
|
|
17
|
+
def test_read_prd_components_file_uses_include_order_and_skips_missing(caplog):
|
|
18
|
+
path = prd_cif_filename("PRDCC_000103")
|
|
19
|
+
|
|
20
|
+
with caplog.at_level(logging.WARNING):
|
|
21
|
+
result = prd_reader.read_pdb_components_file(
|
|
22
|
+
path,
|
|
23
|
+
sanitize=False,
|
|
24
|
+
include=["PRD_000103", "MISSING", "PRD_000103"],
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
assert list(result) == ["PRD_000103"]
|
|
28
|
+
assert "Data block MISSING not found" in caplog.text
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "pdbeccdutils"
|
|
3
|
-
version = "1.0.
|
|
3
|
+
version = "1.0.4"
|
|
4
4
|
description = "Toolkit to parse and process small molecules in wwPDB"
|
|
5
5
|
authors = ["Protein Data Bank in Europe <pdbehelp@ebi.ac.uk>"]
|
|
6
6
|
license = "Apache License 2.0."
|
|
@@ -41,7 +41,7 @@ setup_pubchem_library = "pdbeccdutils.scripts.setup_pubchem_library_cli:main"
|
|
|
41
41
|
read_boundmolecule = "pdbeccdutils.scripts.boundmolecule_cli:run"
|
|
42
42
|
|
|
43
43
|
[tool.poetry.group.tests.dependencies]
|
|
44
|
-
pytest = "
|
|
44
|
+
pytest = ">=8.3.2,<10.0.0"
|
|
45
45
|
pytest-cov = "^5.0.0"
|
|
46
46
|
pre-commit = "^3.8.0"
|
|
47
47
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/data/coordgen_templates/templates.mae
RENAMED
|
File without changes
|
|
File without changes
|
{pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/data/general_templates/adamantane.sdf
RENAMED
|
File without changes
|
|
File without changes
|
{pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/data/general_templates/decahydrocorrin.sdf
RENAMED
|
File without changes
|
|
File without changes
|
{pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/data/general_templates/nonbornane.sdf
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/data/general_templates/porphycene.sdf
RENAMED
|
File without changes
|
{pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/data/general_templates/ru_complex.sdf
RENAMED
|
File without changes
|
{pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/data/general_templates/ru_complex2.sdf
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/scripts/process_components_cif_cli.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/prd_mmcif_test_files/PRDCC_000103.cif
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pdbeccdutils-1.0.3 → pdbeccdutils-1.0.4}/pdbeccdutils/tests/test_process_components_cif_cli.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|