rdworks 0.40.2__tar.gz → 0.42.1__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.
- {rdworks-0.40.2 → rdworks-0.42.1}/PKG-INFO +1 -1
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/__init__.py +1 -1
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/conf.py +9 -2
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/torsion.py +13 -7
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks.egg-info/PKG-INFO +1 -1
- {rdworks-0.40.2 → rdworks-0.42.1}/tests/test_basics.py +13 -4
- {rdworks-0.40.2 → rdworks-0.42.1}/LICENSE +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/README.md +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/pyproject.toml +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/setup.cfg +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/autograph/__init__.py +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/autograph/autograph.py +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/autograph/centroid.py +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/autograph/dynamictreecut.py +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/autograph/nmrclust.py +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/autograph/rckmeans.py +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/bitqt/__init__.py +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/bitqt/bitqt.py +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/descriptor.py +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/display.py +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/ionized.py +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/matchedseries.py +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/mol.py +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/mollibr.py +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/pka.py +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/predefined/Asinex_fragment.xml +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/predefined/Astex_RO3.xml +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/predefined/Baell2010_PAINS/Baell2010A.xml +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/predefined/Baell2010_PAINS/Baell2010B.xml +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/predefined/Baell2010_PAINS/Baell2010C.xml +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/predefined/Baell2010_PAINS/PAINS-less-than-015-hits.xml +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/predefined/Baell2010_PAINS/PAINS-less-than-150-hits.xml +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/predefined/Baell2010_PAINS/PAINS-more-than-150-hits.xml +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/predefined/Baell2010_PAINS/makexml.py +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/predefined/Brenk2008_Dundee/makexml.py +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/predefined/CNS.xml +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/predefined/ChEMBL_Walters/BMS.xml +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/predefined/ChEMBL_Walters/Dundee.xml +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/predefined/ChEMBL_Walters/Glaxo.xml +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/predefined/ChEMBL_Walters/Inpharmatica.xml +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/predefined/ChEMBL_Walters/LINT.xml +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/predefined/ChEMBL_Walters/MLSMR.xml +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/predefined/ChEMBL_Walters/PAINS.xml +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/predefined/ChEMBL_Walters/SureChEMBL.xml +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/predefined/ChEMBL_Walters/makexml.py +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/predefined/Hann1999_Glaxo/Hann1999.xml +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/predefined/Hann1999_Glaxo/Hann1999Acid.xml +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/predefined/Hann1999_Glaxo/Hann1999Base.xml +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/predefined/Hann1999_Glaxo/Hann1999ElPh.xml +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/predefined/Hann1999_Glaxo/Hann1999NuPh.xml +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/predefined/Hann1999_Glaxo/makexml.py +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/predefined/Kazius2005/Kazius2005.xml +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/predefined/Kazius2005/makexml.py +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/predefined/ZINC_druglike.xml +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/predefined/ZINC_fragment.xml +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/predefined/ZINC_leadlike.xml +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/predefined/fragment.xml +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/predefined/ionized/simple_smarts_pattern.csv +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/predefined/ionized/smarts_pattern.csv +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/predefined/misc/makexml.py +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/predefined/misc/reactive-part-2.xml +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/predefined/misc/reactive-part-3.xml +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/predefined/misc/reactive.xml +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/readin.py +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/rgroup.py +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/scaffold.py +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/std.py +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/stereoisomers.py +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/tautomers.py +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/testdata.py +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/units.py +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/utils.py +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/xml.py +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/xtb/__init__.py +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks/xtb/wrapper.py +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks.egg-info/SOURCES.txt +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks.egg-info/dependency_links.txt +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks.egg-info/requires.txt +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/src/rdworks.egg-info/top_level.txt +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/tests/test_decimals.py +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/tests/test_gypsumdl.py +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/tests/test_iupac_name.py +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/tests/test_nn_xtb.py +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/tests/test_web.py +0 -0
- {rdworks-0.40.2 → rdworks-0.42.1}/tests/test_xtb_wrapper.py +0 -0
@@ -27,12 +27,17 @@ from rdworks.display import render_png, render_svg
|
|
27
27
|
class Conf:
|
28
28
|
"""Container for 3D conformers."""
|
29
29
|
|
30
|
-
def __init__(self,
|
30
|
+
def __init__(self,
|
31
|
+
molecule: str | Chem.Mol | None = None,
|
32
|
+
name: str = '',
|
33
|
+
compressed: bool = False) -> None:
|
31
34
|
"""Initialize.
|
32
35
|
|
33
36
|
Args:
|
34
37
|
molecule (Chem.Mol | MolBlock string): Molecule for 3D conformer.
|
35
38
|
name (str): Name prefix of the generated conformers. Defaults to ''.
|
39
|
+
compressed (bool): whether the MolBlock string is compressed or not.
|
40
|
+
Defaults to False.
|
36
41
|
|
37
42
|
Raises:
|
38
43
|
ValueError: if `molecule` is not rdkit.Chem.Mol object.
|
@@ -59,6 +64,8 @@ class Conf:
|
|
59
64
|
return
|
60
65
|
|
61
66
|
if isinstance(molecule, str): # 3-D MolBLock string
|
67
|
+
if compressed:
|
68
|
+
molecule = decompress_string(molecule)
|
62
69
|
try:
|
63
70
|
self.rdmol = Chem.MolFromMolBlock(molecule,
|
64
71
|
sanitize=False,
|
@@ -446,7 +453,7 @@ class Conf:
|
|
446
453
|
}
|
447
454
|
|
448
455
|
if simplify:
|
449
|
-
frag, frag_ijkl = create_torsion_fragment(ref_conf.rdmol, indices)
|
456
|
+
(frag, frag_ijkl, frag_created, wbo_filtered) = create_torsion_fragment(ref_conf.rdmol, indices)
|
450
457
|
frag_conf = Conf(frag)
|
451
458
|
for angle in np.arange(-180.0, 180.0, interval):
|
452
459
|
# Iterated numpy.ndarray does not contain the last 180: -180., ..., (180).
|
@@ -426,7 +426,7 @@ def create_fragment_on_bonds(rdmol: Chem.Mol, bonds: dict, cap: bool = True) ->
|
|
426
426
|
|
427
427
|
def create_torsion_fragment(rdmol: Chem.Mol,
|
428
428
|
torsion_indices: tuple,
|
429
|
-
wbo_tolerance: float = 0.03) -> tuple[Chem.Mol, list[int]]:
|
429
|
+
wbo_tolerance: float = 0.03) -> tuple[Chem.Mol, list[int], bool, bool]:
|
430
430
|
"""Create a close surrogate fragment that captures the PES of the intended torsion.
|
431
431
|
|
432
432
|
Fragmentation aims to preserve the local chemical environment around the targeted torsion
|
@@ -443,7 +443,10 @@ def create_torsion_fragment(rdmol: Chem.Mol,
|
|
443
443
|
torsion_indices (tuple): (i, j, k, l, atoms to be rotated, atoms to be fixed)
|
444
444
|
|
445
445
|
Returns:
|
446
|
-
Chem.Mol:
|
446
|
+
(Chem.Mol: fragment molecule,
|
447
|
+
list[int]: fragment indices,
|
448
|
+
bool: True if fragmented,
|
449
|
+
bool: True if WBO filtering is used)
|
447
450
|
|
448
451
|
References:
|
449
452
|
https://pubs.acs.org/doi/10.1021/acs.jcim.2c01153
|
@@ -455,8 +458,10 @@ def create_torsion_fragment(rdmol: Chem.Mol,
|
|
455
458
|
|
456
459
|
if not candidates:
|
457
460
|
# no fragmentation
|
458
|
-
return rdmol, torsion_indices
|
459
|
-
|
461
|
+
return (rdmol, torsion_indices, False, False)
|
462
|
+
|
463
|
+
# fragmented
|
464
|
+
WBO_filtered = False
|
460
465
|
if GFN2xTB().version() is not None:
|
461
466
|
# filter candidate(s) by Wiberg bond order (WBO) if xTB is available
|
462
467
|
jk = tuple(sorted([j, k]))
|
@@ -472,11 +477,12 @@ def create_torsion_fragment(rdmol: Chem.Mol,
|
|
472
477
|
frag_jk = tuple(sorted(frag_jk))
|
473
478
|
if abs(fragment.wbo[frag_jk] - parent.wbo[jk]) < wbo_tolerance:
|
474
479
|
wbo_passed_candidates[bond_idx] = (p, q)
|
475
|
-
frag_multi_breaks = create_fragment_on_bonds(rdmol, wbo_passed_candidates)
|
480
|
+
frag_multi_breaks = create_fragment_on_bonds(rdmol, wbo_passed_candidates)
|
481
|
+
WBO_filtered = True
|
476
482
|
else:
|
477
483
|
# skip WBO filtering
|
478
484
|
frag_multi_breaks = create_fragment_on_bonds(rdmol, candidates)
|
479
485
|
|
480
|
-
|
486
|
+
frag_indices = get_fragment_idx(rdmol, (i, j, k, l), frag_multi_breaks)
|
481
487
|
|
482
|
-
return frag_multi_breaks,
|
488
|
+
return (frag_multi_breaks, frag_indices, True, WBO_filtered)
|
@@ -472,17 +472,22 @@ def test_torsion_fragment():
|
|
472
472
|
# {0: (0, 1, 3, 7), 1: (3, 4, 32, 33), 2: (4, 5, 26, 27), 3: (7, 6, 19, 20),
|
473
473
|
# 4: (3, 7, 8, 9), 5: (7, 8, 9, 10), 6: (8, 9, 10, 18), 7: (18, 10, 11, 12),
|
474
474
|
# 8: (10, 11, 12, 17), 9: (17, 12, 13, 14), 10: (12, 13, 14, 15), 11: (36, 35, 34, 32)}
|
475
|
-
frag, frag_ijkl = create_torsion_fragment(mol.confs[0].rdmol, ta[6])
|
475
|
+
(frag, frag_ijkl, frag_created, wbo_filtered) = create_torsion_fragment(mol.confs[0].rdmol, ta[6])
|
476
476
|
assert frag_ijkl == (5, 6, 7, 12)
|
477
|
+
assert frag_created == True
|
478
|
+
assert wbo_filtered == True
|
477
479
|
|
478
480
|
mol2 = Mol(molecule='CC(=O)Nc1ccc(O)cc1', name='acetaminophen.3').make_confs(n=1)
|
479
481
|
ta2 = mol2.torsion_atoms()
|
480
482
|
# {0: (5, 4, 3, 1)}
|
481
483
|
assert len(ta2) == 1
|
482
|
-
|
484
|
+
|
485
|
+
(frag, frag_ijkl, frag_created, wbo_filtered) = create_torsion_fragment(mol2.confs[0].rdmol, ta2[0])
|
483
486
|
# expects no fragmentation
|
484
487
|
assert frag == mol2.confs[0].rdmol
|
485
488
|
assert frag_ijkl == ta2[0]
|
489
|
+
assert frag_created == False
|
490
|
+
assert wbo_filtered == False
|
486
491
|
|
487
492
|
|
488
493
|
def test_torsion_fragment_from_conf():
|
@@ -495,8 +500,10 @@ def test_torsion_fragment_from_conf():
|
|
495
500
|
# {0: (0, 1, 3, 7), 1: (3, 4, 32, 33), 2: (4, 5, 26, 27), 3: (7, 6, 19, 20),
|
496
501
|
# 4: (3, 7, 8, 9), 5: (7, 8, 9, 10), 6: (8, 9, 10, 18), 7: (18, 10, 11, 12),
|
497
502
|
# 8: (10, 11, 12, 17), 9: (17, 12, 13, 14), 10: (12, 13, 14, 15), 11: (36, 35, 34, 32)}
|
498
|
-
frag, frag_ijkl = create_torsion_fragment(ref_conf.rdmol, ta[6])
|
503
|
+
frag, frag_ijkl, frag_created, wbo_filtered = create_torsion_fragment(ref_conf.rdmol, ta[6])
|
499
504
|
assert frag_ijkl == (5, 6, 7, 12)
|
505
|
+
assert frag_created == True
|
506
|
+
assert wbo_filtered == True
|
500
507
|
|
501
508
|
ref_conf = ref_conf.torsion_energies(calculator='MMFF94', torsion_key=6, interval=15)
|
502
509
|
|
@@ -505,10 +512,12 @@ def test_torsion_fragment_from_conf():
|
|
505
512
|
ta2 = ref_conf2.torsion_atoms()
|
506
513
|
# {0: (5, 4, 3, 1)}
|
507
514
|
assert len(ta2) == 1
|
508
|
-
frag, frag_ijkl = create_torsion_fragment(ref_conf2.rdmol, ta2[0])
|
515
|
+
frag, frag_ijkl, frag_created, wbo_filtered = create_torsion_fragment(ref_conf2.rdmol, ta2[0])
|
509
516
|
# expects no fragmentation
|
510
517
|
assert frag == ref_conf2.rdmol
|
511
518
|
assert frag_ijkl == ta2[0]
|
519
|
+
assert frag_created == False
|
520
|
+
assert wbo_filtered == False
|
512
521
|
|
513
522
|
ref_conf2 = ref_conf2.torsion_energies(calculator='MMFF94', interval=15)
|
514
523
|
ref_conf3 = ref_conf2.torsion_energies_one(calculator='MMFF94', indices=frag_ijkl)
|
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
|
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
|