rdworks 0.37.1__tar.gz → 0.38.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.37.1 → rdworks-0.38.1}/PKG-INFO +1 -1
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/__init__.py +1 -1
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/conf.py +1 -1
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/mol.py +3 -5
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/std.py +23 -1
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks.egg-info/PKG-INFO +1 -1
- {rdworks-0.37.1 → rdworks-0.38.1}/tests/test_basics.py +30 -2
- {rdworks-0.37.1 → rdworks-0.38.1}/LICENSE +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/README.md +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/pyproject.toml +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/setup.cfg +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/autograph/__init__.py +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/autograph/autograph.py +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/autograph/centroid.py +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/autograph/dynamictreecut.py +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/autograph/nmrclust.py +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/autograph/rckmeans.py +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/bitqt/__init__.py +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/bitqt/bitqt.py +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/descriptor.py +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/display.py +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/ionized.py +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/matchedseries.py +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/mollibr.py +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/pka.py +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/predefined/Asinex_fragment.xml +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/predefined/Astex_RO3.xml +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/predefined/Baell2010_PAINS/Baell2010A.xml +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/predefined/Baell2010_PAINS/Baell2010B.xml +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/predefined/Baell2010_PAINS/Baell2010C.xml +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/predefined/Baell2010_PAINS/PAINS-less-than-015-hits.xml +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/predefined/Baell2010_PAINS/PAINS-less-than-150-hits.xml +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/predefined/Baell2010_PAINS/PAINS-more-than-150-hits.xml +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/predefined/Baell2010_PAINS/makexml.py +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/predefined/Brenk2008_Dundee/makexml.py +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/predefined/CNS.xml +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/predefined/ChEMBL_Walters/BMS.xml +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/predefined/ChEMBL_Walters/Dundee.xml +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/predefined/ChEMBL_Walters/Glaxo.xml +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/predefined/ChEMBL_Walters/Inpharmatica.xml +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/predefined/ChEMBL_Walters/LINT.xml +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/predefined/ChEMBL_Walters/MLSMR.xml +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/predefined/ChEMBL_Walters/PAINS.xml +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/predefined/ChEMBL_Walters/SureChEMBL.xml +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/predefined/ChEMBL_Walters/makexml.py +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/predefined/Hann1999_Glaxo/Hann1999.xml +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/predefined/Hann1999_Glaxo/Hann1999Acid.xml +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/predefined/Hann1999_Glaxo/Hann1999Base.xml +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/predefined/Hann1999_Glaxo/Hann1999ElPh.xml +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/predefined/Hann1999_Glaxo/Hann1999NuPh.xml +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/predefined/Hann1999_Glaxo/makexml.py +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/predefined/Kazius2005/Kazius2005.xml +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/predefined/Kazius2005/makexml.py +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/predefined/ZINC_druglike.xml +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/predefined/ZINC_fragment.xml +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/predefined/ZINC_leadlike.xml +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/predefined/fragment.xml +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/predefined/ionized/simple_smarts_pattern.csv +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/predefined/ionized/smarts_pattern.csv +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/predefined/misc/makexml.py +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/predefined/misc/reactive-part-2.xml +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/predefined/misc/reactive-part-3.xml +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/predefined/misc/reactive.xml +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/readin.py +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/rgroup.py +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/scaffold.py +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/stereoisomers.py +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/tautomers.py +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/torsion.py +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/units.py +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/utils.py +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/xml.py +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/xtb/__init__.py +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks/xtb/wrapper.py +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks.egg-info/SOURCES.txt +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks.egg-info/dependency_links.txt +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks.egg-info/requires.txt +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/src/rdworks.egg-info/top_level.txt +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/tests/test_decimals.py +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/tests/test_gypsumdl.py +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/tests/test_iupac_name.py +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/tests/test_nn_xtb.py +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/tests/test_web.py +0 -0
- {rdworks-0.37.1 → rdworks-0.38.1}/tests/test_xtb_wrapper.py +0 -0
@@ -417,7 +417,7 @@ class Conf:
|
|
417
417
|
|
418
418
|
Args:
|
419
419
|
calculator (str | Callable): 'MMFF', 'UFF', or ASE calculator.
|
420
|
-
torsion_key (int | None): torsion
|
420
|
+
torsion_key (int | None): key to the torsion indices to calculate. Defaults to None (all).
|
421
421
|
simplify (bool, optional): whether to use fragment surrogate. Defaults to True.
|
422
422
|
fmax (float, optional): fmax of ASE optimizer. Defaults to 0.05.
|
423
423
|
interval (float, optional): interval of torsion angles in degree. Defaults to 15.0.
|
@@ -33,7 +33,7 @@ from rdkit.ML.Cluster import Butina
|
|
33
33
|
from PIL import Image
|
34
34
|
|
35
35
|
from rdworks.conf import Conf
|
36
|
-
from rdworks.std import desalt_smiles, standardize, clean_2d
|
36
|
+
from rdworks.std import generate_inchi_key, desalt_smiles, standardize, clean_2d
|
37
37
|
from rdworks.xml import list_predefined_xml, get_predefined_xml, parse_xml
|
38
38
|
from rdworks.scaffold import rigid_fragment_indices
|
39
39
|
from rdworks.descriptor import rd_descriptor, rd_descriptor_f
|
@@ -141,8 +141,7 @@ class Mol:
|
|
141
141
|
self.name = 'untitled'
|
142
142
|
|
143
143
|
self.rdmol.SetProp('_Name', self.name) # _Name can't be None
|
144
|
-
self.
|
145
|
-
self.InChIKey = inchi.InchiToInchiKey(self.InChI)
|
144
|
+
self.InChIKey = generate_inchi_key(self.rdmol)
|
146
145
|
self.props.update({
|
147
146
|
'aka' : [], # <-- to be set by MolLibr.unique()
|
148
147
|
'atoms' : self.rdmol.GetNumAtoms(), # hydrogens not excluded?
|
@@ -1596,8 +1595,7 @@ class Mol:
|
|
1596
1595
|
self.smiles = data['smiles'] # isomeric SMILES, no H
|
1597
1596
|
self.rdmol = Chem.MolFromSmiles(data['smiles']) # for 2D depiction
|
1598
1597
|
self.rdmol.SetProp('_Name', self.name)
|
1599
|
-
self.
|
1600
|
-
self.InChIKey = inchi.InchiToInchiKey(self.InChI)
|
1598
|
+
self.InChIKey = generate_inchi_key(self.rdmol)
|
1601
1599
|
self.props = data['props']
|
1602
1600
|
self.confs = [Conf().deserialize(_) for _ in data['confs']] # for 3D conformers (iterable)
|
1603
1601
|
|
@@ -1,10 +1,32 @@
|
|
1
1
|
import operator
|
2
2
|
|
3
3
|
from rdkit import Chem
|
4
|
-
from rdkit.Chem import rdDepictor
|
4
|
+
from rdkit.Chem import rdDepictor, inchi
|
5
5
|
from rdkit.Chem.MolStandardize import rdMolStandardize
|
6
6
|
|
7
7
|
|
8
|
+
def generate_inchi_key(rdmol: Chem.Mol) -> str:
|
9
|
+
"""Generate InChIKey.
|
10
|
+
|
11
|
+
Note:
|
12
|
+
- An InChIKey is a 27-character string consisting of three parts:
|
13
|
+
- 14 characters: Derived from the connectivity layer of the InChI.
|
14
|
+
- Hyphen (-): Separates the first two blocks.
|
15
|
+
- 9 characters: Derived from the remaining InChI layers.
|
16
|
+
- A hyphen (-): Separates the second and third blocks.
|
17
|
+
- A final checksum character: Ensures the integrity of the key.
|
18
|
+
|
19
|
+
Args:
|
20
|
+
rdmol (Chem.Mol): input molecule
|
21
|
+
|
22
|
+
Returns:
|
23
|
+
str: 27-character InChIKey
|
24
|
+
"""
|
25
|
+
InChI = Chem.MolToInchi(rdmol)
|
26
|
+
InChIKey = inchi.InchiToInchiKey(InChI)
|
27
|
+
|
28
|
+
return InChIKey
|
29
|
+
|
8
30
|
|
9
31
|
def desalt_smiles(smiles: str) -> tuple[str, Chem.Mol]:
|
10
32
|
"""Remove salt(s) from SMILES.
|
@@ -475,7 +475,6 @@ def test_torsion_fragment():
|
|
475
475
|
frag, frag_ijkl = create_torsion_fragment(mol.confs[0].rdmol, ta[6])
|
476
476
|
assert frag_ijkl == (5, 6, 7, 12)
|
477
477
|
|
478
|
-
|
479
478
|
mol2 = Mol(molecule='CC(=O)Nc1ccc(O)cc1', name='acetaminophen.3').make_confs(n=1)
|
480
479
|
ta2 = mol2.torsion_atoms()
|
481
480
|
# {0: (5, 4, 3, 1)}
|
@@ -486,12 +485,41 @@ def test_torsion_fragment():
|
|
486
485
|
assert frag_ijkl == ta2[0]
|
487
486
|
|
488
487
|
|
488
|
+
def test_torsion_fragment_from_conf():
|
489
|
+
from rdworks.torsion import create_torsion_fragment
|
490
|
+
mol = Mol(molecule="CC(C)C1=C(C(=C(N1CC[C@H](C[C@H](CC(=O)O)O)O)C2=CC=C(C=C2)F)C3=CC=CC=C3)C(=O)NC4=CC=CC=C4",
|
491
|
+
name="atorvastatin").make_confs(n=1)
|
492
|
+
ref_conf = mol.confs[0]
|
493
|
+
ta = ref_conf.torsion_atoms()
|
494
|
+
assert len(ta) == 12
|
495
|
+
# {0: (0, 1, 3, 7), 1: (3, 4, 32, 33), 2: (4, 5, 26, 27), 3: (7, 6, 19, 20),
|
496
|
+
# 4: (3, 7, 8, 9), 5: (7, 8, 9, 10), 6: (8, 9, 10, 18), 7: (18, 10, 11, 12),
|
497
|
+
# 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])
|
499
|
+
assert frag_ijkl == (5, 6, 7, 12)
|
500
|
+
|
501
|
+
ref_conf = ref_conf.torsion_energies(calculator='MMFF94', torsion_key=6, interval=15)
|
502
|
+
|
503
|
+
mol2 = Mol(molecule='CC(=O)Nc1ccc(O)cc1', name='acetaminophen.3').make_confs(n=1)
|
504
|
+
ref_conf2 = mol2.confs[0]
|
505
|
+
ta2 = ref_conf2.torsion_atoms()
|
506
|
+
# {0: (5, 4, 3, 1)}
|
507
|
+
assert len(ta2) == 1
|
508
|
+
frag, frag_ijkl = create_torsion_fragment(ref_conf2.rdmol, ta2[0])
|
509
|
+
# expects no fragmentation
|
510
|
+
assert frag == ref_conf2.rdmol
|
511
|
+
assert frag_ijkl == ta2[0]
|
512
|
+
|
513
|
+
ref_conf2 = ref_conf2.torsion_energies(calculator='MMFF94', interval=15)
|
514
|
+
|
515
|
+
|
489
516
|
def test_torsion_energies():
|
490
517
|
libr = MolLibr(torsion_dataset_smiles, torsion_dataset_names)
|
491
518
|
with open(workdir / 'test_torsion_energies.html', 'w') as f:
|
492
519
|
for mol in libr[:1]:
|
493
520
|
mol = mol.make_confs().drop_confs(similar=True, similar_rmsd=0.3).sort_confs().rename()
|
494
|
-
mol = mol.optimize_confs(calculator='MMFF94').torsion_energies(calculator='MMFF94',
|
521
|
+
mol = mol.optimize_confs(calculator='MMFF94').torsion_energies(calculator='MMFF94',
|
522
|
+
interval=15)
|
495
523
|
f.write(mol.to_html())
|
496
524
|
print(mol.dumps('torsion', decimals=2))
|
497
525
|
|
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
|