rdworks 0.36.2__tar.gz → 0.36.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.
- {rdworks-0.36.2 → rdworks-0.36.4}/PKG-INFO +1 -1
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/__init__.py +1 -1
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/mol.py +51 -44
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/torsion.py +6 -1
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks.egg-info/PKG-INFO +1 -1
- {rdworks-0.36.2 → rdworks-0.36.4}/tests/test_basics.py +11 -3
- {rdworks-0.36.2 → rdworks-0.36.4}/LICENSE +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/README.md +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/pyproject.toml +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/setup.cfg +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/autograph/__init__.py +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/autograph/autograph.py +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/autograph/centroid.py +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/autograph/dynamictreecut.py +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/autograph/nmrclust.py +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/autograph/rckmeans.py +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/bitqt/__init__.py +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/bitqt/bitqt.py +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/conf.py +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/descriptor.py +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/display.py +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/ionized.py +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/matchedseries.py +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/mollibr.py +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/pka.py +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/Asinex_fragment.xml +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/Astex_RO3.xml +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/Baell2010_PAINS/Baell2010A.xml +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/Baell2010_PAINS/Baell2010B.xml +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/Baell2010_PAINS/Baell2010C.xml +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/Baell2010_PAINS/PAINS-less-than-015-hits.xml +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/Baell2010_PAINS/PAINS-less-than-150-hits.xml +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/Baell2010_PAINS/PAINS-more-than-150-hits.xml +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/Baell2010_PAINS/makexml.py +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/Brenk2008_Dundee/makexml.py +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/CNS.xml +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/ChEMBL_Walters/BMS.xml +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/ChEMBL_Walters/Dundee.xml +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/ChEMBL_Walters/Glaxo.xml +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/ChEMBL_Walters/Inpharmatica.xml +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/ChEMBL_Walters/LINT.xml +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/ChEMBL_Walters/MLSMR.xml +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/ChEMBL_Walters/PAINS.xml +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/ChEMBL_Walters/SureChEMBL.xml +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/ChEMBL_Walters/makexml.py +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/Hann1999_Glaxo/Hann1999.xml +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/Hann1999_Glaxo/Hann1999Acid.xml +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/Hann1999_Glaxo/Hann1999Base.xml +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/Hann1999_Glaxo/Hann1999ElPh.xml +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/Hann1999_Glaxo/Hann1999NuPh.xml +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/Hann1999_Glaxo/makexml.py +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/Kazius2005/Kazius2005.xml +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/Kazius2005/makexml.py +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/ZINC_druglike.xml +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/ZINC_fragment.xml +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/ZINC_leadlike.xml +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/fragment.xml +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/ionized/simple_smarts_pattern.csv +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/ionized/smarts_pattern.csv +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/misc/makexml.py +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/misc/reactive-part-2.xml +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/misc/reactive-part-3.xml +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/misc/reactive.xml +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/readin.py +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/rgroup.py +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/scaffold.py +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/std.py +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/stereoisomers.py +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/tautomers.py +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/units.py +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/utils.py +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/xml.py +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/xtb/__init__.py +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/xtb/wrapper.py +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks.egg-info/SOURCES.txt +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks.egg-info/dependency_links.txt +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks.egg-info/requires.txt +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks.egg-info/top_level.txt +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/tests/test_decimals.py +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/tests/test_gypsumdl.py +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/tests/test_iupac_name.py +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/tests/test_nn_xtb.py +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/tests/test_web.py +0 -0
- {rdworks-0.36.2 → rdworks-0.36.4}/tests/test_xtb_wrapper.py +0 -0
@@ -368,56 +368,62 @@ class Mol:
|
|
368
368
|
self.confs.append(conf)
|
369
369
|
|
370
370
|
elif method.upper() == 'CONFORGE':
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
371
|
+
mol = CDPL.Chem.parseSMILES(self.smiles)
|
372
|
+
# create and initialize an instance of the class ConfGen.ConformerGenerator which
|
373
|
+
# will perform the actual conformer ensemble generation work
|
374
|
+
conf_gen = CDPL.ConfGen.ConformerGenerator()
|
375
|
+
conf_gen.settings.timeout = 60 * 1000 # 60 sec.
|
376
|
+
conf_gen.settings.minRMSD = 0.5
|
377
|
+
conf_gen.settings.energyWindow = 20.0 # kcal/mol(?)
|
378
|
+
conf_gen.settings.maxNumOutputConformers = n
|
379
|
+
# dictionary mapping status codes to human readable strings
|
380
|
+
status_to_str = {
|
381
|
+
CDPL.ConfGen.ReturnCode.UNINITIALIZED : 'uninitialized',
|
382
|
+
CDPL.ConfGen.ReturnCode.TIMEOUT : 'max. processing time exceeded',
|
383
|
+
CDPL.ConfGen.ReturnCode.ABORTED : 'aborted',
|
384
|
+
CDPL.ConfGen.ReturnCode.FORCEFIELD_SETUP_FAILED : 'force field setup failed',
|
385
|
+
CDPL.ConfGen.ReturnCode.FORCEFIELD_MINIMIZATION_FAILED : 'force field structure refinement failed',
|
386
|
+
CDPL.ConfGen.ReturnCode.FRAGMENT_LIBRARY_NOT_SET : 'fragment library not available',
|
387
|
+
CDPL.ConfGen.ReturnCode.FRAGMENT_CONF_GEN_FAILED : 'fragment conformer generation failed',
|
388
|
+
CDPL.ConfGen.ReturnCode.FRAGMENT_CONF_GEN_TIMEOUT : 'fragment conformer generation timeout',
|
389
|
+
CDPL.ConfGen.ReturnCode.FRAGMENT_ALREADY_PROCESSED : 'fragment already processed',
|
390
|
+
CDPL.ConfGen.ReturnCode.TORSION_DRIVING_FAILED : 'torsion driving failed',
|
391
|
+
CDPL.ConfGen.ReturnCode.CONF_GEN_FAILED : 'conformer generation failed',
|
392
|
+
}
|
393
|
+
|
394
|
+
# We have to create a temporary file and re-read it for storing individual conformers.
|
395
|
+
tmp_dir = os.environ.get('TMPDIR', '/tmp')
|
396
|
+
tmp_name = next(tempfile._get_candidate_names()) + '.sdf'
|
397
|
+
tmp_filename = os.path.join(tmp_dir, tmp_name)
|
398
|
+
|
399
|
+
writer = CDPL.Chem.MolecularGraphWriter(tmp_filename, "sdf" )
|
400
|
+
# SB - io.StringIO does not work with Chem.MolecularGraphWriter()
|
401
|
+
|
402
|
+
try:
|
403
|
+
# prepare the molecule for conformer generation
|
404
|
+
CDPL.ConfGen.prepareForConformerGeneration(mol)
|
405
|
+
# generate the conformer ensemble
|
406
|
+
status = conf_gen.generate(mol)
|
407
|
+
# if successful, store the generated conformer ensemble as
|
408
|
+
# per atom 3D coordinates arrays (= the way conformers are represented in CDPKit)
|
409
|
+
if status == CDPL.ConfGen.ReturnCode.SUCCESS or status == CDPL.ConfGen.ReturnCode.TOO_MUCH_SYMMETRY:
|
410
|
+
# TOO_MUCH_SYMMETRY: output ensemble may contain duplicates
|
411
|
+
conf_gen.setConformers(mol)
|
412
|
+
writer.write(mol)
|
413
|
+
writer.close()
|
414
|
+
else:
|
415
|
+
raise RuntimeError('Error: conformer generation failed: %s' % status_to_str[status])
|
416
|
+
except Exception as e:
|
417
|
+
raise RuntimeError('Error: conformer generation failed: %s' % str(e))
|
412
418
|
|
413
|
-
# tmpfile is automatically closed here
|
419
|
+
# tmpfile is automatically closed here but kept, as delete=False was set
|
414
420
|
|
415
|
-
with Chem.SDMolSupplier(
|
421
|
+
with Chem.SDMolSupplier(tmp_filename, sanitize=True, removeHs=False) as sdf:
|
416
422
|
self.confs = [ Conf(m) for m in sdf if m is not None ]
|
417
423
|
|
418
424
|
# tmpfile is not deleted here because delete=False
|
419
425
|
# we should remove the file when it is no longer needed
|
420
|
-
os.remove(
|
426
|
+
os.remove(tmp_filename)
|
421
427
|
|
422
428
|
# energy evaluations for ranking
|
423
429
|
for conf in self.confs:
|
@@ -996,6 +1002,7 @@ class Mol:
|
|
996
1002
|
|
997
1003
|
if torsion_key is None:
|
998
1004
|
torsion_atoms_indices = self.torsion_atoms()
|
1005
|
+
# {0: (5, 4, 3, 1)}
|
999
1006
|
else:
|
1000
1007
|
torsion_atoms_indices = {torsion_key: self.torsion_atoms()[torsion_key]}
|
1001
1008
|
|
@@ -453,10 +453,14 @@ def create_torsion_fragment(rdmol: Chem.Mol,
|
|
453
453
|
|
454
454
|
candidates = find_bonds_to_prune(rdmol, torsion_indices)
|
455
455
|
|
456
|
+
if not candidates:
|
457
|
+
# no fragmentation
|
458
|
+
return rdmol, torsion_indices
|
459
|
+
|
456
460
|
if GFN2xTB().version() is not None:
|
461
|
+
# filter candidate(s) by Wiberg bond order (WBO) if xTB is available
|
457
462
|
jk = tuple(sorted([j, k]))
|
458
463
|
wbo_passed_candidates = {}
|
459
|
-
# filter candidate(s) by Wiberg bond order (WBO)
|
460
464
|
parent = GFN2xTB(rdmol).singlepoint()
|
461
465
|
assert hasattr(parent, 'wbo'), "create_torsion_fragment() Error: no wbo for parent"
|
462
466
|
for bond_idx, (p, q) in candidates.items():
|
@@ -470,6 +474,7 @@ def create_torsion_fragment(rdmol: Chem.Mol,
|
|
470
474
|
wbo_passed_candidates[bond_idx] = (p, q)
|
471
475
|
frag_multi_breaks = create_fragment_on_bonds(rdmol, wbo_passed_candidates)
|
472
476
|
else:
|
477
|
+
# skip WBO filtering
|
473
478
|
frag_multi_breaks = create_fragment_on_bonds(rdmol, candidates)
|
474
479
|
|
475
480
|
frag_ijkl = get_fragment_idx(rdmol, (i, j, k, l), frag_multi_breaks)
|
@@ -469,12 +469,20 @@ def test_torsion_fragment():
|
|
469
469
|
name="atorvastatin").make_confs(n=1)
|
470
470
|
ta = mol.torsion_atoms()
|
471
471
|
assert len(ta) == 12
|
472
|
-
#
|
473
|
-
#
|
474
|
-
|
472
|
+
# {0: (0, 1, 3, 7), 1: (3, 4, 32, 33), 2: (4, 5, 26, 27), 3: (7, 6, 19, 20),
|
473
|
+
# 4: (3, 7, 8, 9), 5: (7, 8, 9, 10), 6: (8, 9, 10, 18), 7: (18, 10, 11, 12),
|
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
476
|
assert frag_ijkl == (5, 6, 7, 12)
|
476
477
|
|
477
478
|
|
479
|
+
mol2 = Mol(molecule='CC(=O)Nc1ccc(O)cc1', name='acetaminophen.3').make_confs(n=1)
|
480
|
+
ta2 = mol2.torsion_atoms()
|
481
|
+
# {0: (5, 4, 3, 1)}
|
482
|
+
assert len(ta2) == 1
|
483
|
+
frag, frag_ijkl = create_torsion_fragment(mol2.confs[0].rdmol, ta2[0])
|
484
|
+
|
485
|
+
|
478
486
|
def test_torsion_energies():
|
479
487
|
libr = MolLibr(torsion_dataset_smiles, torsion_dataset_names)
|
480
488
|
with open(workdir / 'test_torsion_energies.html', 'w') as f:
|
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
|