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.
Files changed (84) hide show
  1. {rdworks-0.36.2 → rdworks-0.36.4}/PKG-INFO +1 -1
  2. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/__init__.py +1 -1
  3. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/mol.py +51 -44
  4. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/torsion.py +6 -1
  5. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks.egg-info/PKG-INFO +1 -1
  6. {rdworks-0.36.2 → rdworks-0.36.4}/tests/test_basics.py +11 -3
  7. {rdworks-0.36.2 → rdworks-0.36.4}/LICENSE +0 -0
  8. {rdworks-0.36.2 → rdworks-0.36.4}/README.md +0 -0
  9. {rdworks-0.36.2 → rdworks-0.36.4}/pyproject.toml +0 -0
  10. {rdworks-0.36.2 → rdworks-0.36.4}/setup.cfg +0 -0
  11. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/autograph/__init__.py +0 -0
  12. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/autograph/autograph.py +0 -0
  13. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/autograph/centroid.py +0 -0
  14. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/autograph/dynamictreecut.py +0 -0
  15. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/autograph/nmrclust.py +0 -0
  16. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/autograph/rckmeans.py +0 -0
  17. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/bitqt/__init__.py +0 -0
  18. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/bitqt/bitqt.py +0 -0
  19. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/conf.py +0 -0
  20. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/descriptor.py +0 -0
  21. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/display.py +0 -0
  22. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/ionized.py +0 -0
  23. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/matchedseries.py +0 -0
  24. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/mollibr.py +0 -0
  25. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/pka.py +0 -0
  26. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/Asinex_fragment.xml +0 -0
  27. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/Astex_RO3.xml +0 -0
  28. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/Baell2010_PAINS/Baell2010A.xml +0 -0
  29. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/Baell2010_PAINS/Baell2010B.xml +0 -0
  30. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/Baell2010_PAINS/Baell2010C.xml +0 -0
  31. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/Baell2010_PAINS/PAINS-less-than-015-hits.xml +0 -0
  32. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/Baell2010_PAINS/PAINS-less-than-150-hits.xml +0 -0
  33. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/Baell2010_PAINS/PAINS-more-than-150-hits.xml +0 -0
  34. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/Baell2010_PAINS/makexml.py +0 -0
  35. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/Brenk2008_Dundee/makexml.py +0 -0
  36. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/CNS.xml +0 -0
  37. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/ChEMBL_Walters/BMS.xml +0 -0
  38. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/ChEMBL_Walters/Dundee.xml +0 -0
  39. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/ChEMBL_Walters/Glaxo.xml +0 -0
  40. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/ChEMBL_Walters/Inpharmatica.xml +0 -0
  41. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/ChEMBL_Walters/LINT.xml +0 -0
  42. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/ChEMBL_Walters/MLSMR.xml +0 -0
  43. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/ChEMBL_Walters/PAINS.xml +0 -0
  44. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/ChEMBL_Walters/SureChEMBL.xml +0 -0
  45. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/ChEMBL_Walters/makexml.py +0 -0
  46. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/Hann1999_Glaxo/Hann1999.xml +0 -0
  47. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/Hann1999_Glaxo/Hann1999Acid.xml +0 -0
  48. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/Hann1999_Glaxo/Hann1999Base.xml +0 -0
  49. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/Hann1999_Glaxo/Hann1999ElPh.xml +0 -0
  50. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/Hann1999_Glaxo/Hann1999NuPh.xml +0 -0
  51. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/Hann1999_Glaxo/makexml.py +0 -0
  52. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/Kazius2005/Kazius2005.xml +0 -0
  53. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/Kazius2005/makexml.py +0 -0
  54. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/ZINC_druglike.xml +0 -0
  55. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/ZINC_fragment.xml +0 -0
  56. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/ZINC_leadlike.xml +0 -0
  57. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/fragment.xml +0 -0
  58. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/ionized/simple_smarts_pattern.csv +0 -0
  59. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/ionized/smarts_pattern.csv +0 -0
  60. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/misc/makexml.py +0 -0
  61. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/misc/reactive-part-2.xml +0 -0
  62. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/misc/reactive-part-3.xml +0 -0
  63. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/predefined/misc/reactive.xml +0 -0
  64. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/readin.py +0 -0
  65. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/rgroup.py +0 -0
  66. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/scaffold.py +0 -0
  67. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/std.py +0 -0
  68. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/stereoisomers.py +0 -0
  69. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/tautomers.py +0 -0
  70. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/units.py +0 -0
  71. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/utils.py +0 -0
  72. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/xml.py +0 -0
  73. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/xtb/__init__.py +0 -0
  74. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks/xtb/wrapper.py +0 -0
  75. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks.egg-info/SOURCES.txt +0 -0
  76. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks.egg-info/dependency_links.txt +0 -0
  77. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks.egg-info/requires.txt +0 -0
  78. {rdworks-0.36.2 → rdworks-0.36.4}/src/rdworks.egg-info/top_level.txt +0 -0
  79. {rdworks-0.36.2 → rdworks-0.36.4}/tests/test_decimals.py +0 -0
  80. {rdworks-0.36.2 → rdworks-0.36.4}/tests/test_gypsumdl.py +0 -0
  81. {rdworks-0.36.2 → rdworks-0.36.4}/tests/test_iupac_name.py +0 -0
  82. {rdworks-0.36.2 → rdworks-0.36.4}/tests/test_nn_xtb.py +0 -0
  83. {rdworks-0.36.2 → rdworks-0.36.4}/tests/test_web.py +0 -0
  84. {rdworks-0.36.2 → rdworks-0.36.4}/tests/test_xtb_wrapper.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rdworks
3
- Version: 0.36.2
3
+ Version: 0.36.4
4
4
  Summary: Frequently used tasks built on RDKit and other tools
5
5
  Author-email: Sung-Hun Bae <sunghun.bae@gmail.com>
6
6
  Maintainer-email: Sung-Hun Bae <sunghun.bae@gmail.com>
@@ -1,4 +1,4 @@
1
- __version__ = '0.36.2'
1
+ __version__ = '0.36.4'
2
2
 
3
3
  from rdworks.conf import Conf
4
4
  from rdworks.mol import Mol
@@ -368,56 +368,62 @@ class Mol:
368
368
  self.confs.append(conf)
369
369
 
370
370
  elif method.upper() == 'CONFORGE':
371
- with tempfile.NamedTemporaryFile(suffix='.sdf', delete=False) as tmpfile:
372
- mol = CDPL.Chem.parseSMILES(self.smiles)
373
- # create and initialize an instance of the class ConfGen.ConformerGenerator which
374
- # will perform the actual conformer ensemble generation work
375
- conf_gen = CDPL.ConfGen.ConformerGenerator()
376
- conf_gen.settings.timeout = 60 * 1000 # 60 sec.
377
- conf_gen.settings.minRMSD = 0.5
378
- conf_gen.settings.energyWindow = 20.0 # kcal/mol(?)
379
- conf_gen.settings.maxNumOutputConformers = n
380
- # dictionary mapping status codes to human readable strings
381
- status_to_str = {
382
- CDPL.ConfGen.ReturnCode.UNINITIALIZED : 'uninitialized',
383
- CDPL.ConfGen.ReturnCode.TIMEOUT : 'max. processing time exceeded',
384
- CDPL.ConfGen.ReturnCode.ABORTED : 'aborted',
385
- CDPL.ConfGen.ReturnCode.FORCEFIELD_SETUP_FAILED : 'force field setup failed',
386
- CDPL.ConfGen.ReturnCode.FORCEFIELD_MINIMIZATION_FAILED : 'force field structure refinement failed',
387
- CDPL.ConfGen.ReturnCode.FRAGMENT_LIBRARY_NOT_SET : 'fragment library not available',
388
- CDPL.ConfGen.ReturnCode.FRAGMENT_CONF_GEN_FAILED : 'fragment conformer generation failed',
389
- CDPL.ConfGen.ReturnCode.FRAGMENT_CONF_GEN_TIMEOUT : 'fragment conformer generation timeout',
390
- CDPL.ConfGen.ReturnCode.FRAGMENT_ALREADY_PROCESSED : 'fragment already processed',
391
- CDPL.ConfGen.ReturnCode.TORSION_DRIVING_FAILED : 'torsion driving failed',
392
- CDPL.ConfGen.ReturnCode.CONF_GEN_FAILED : 'conformer generation failed',
393
- }
394
- writer = CDPL.Chem.MolecularGraphWriter(tmpfile.name, "sdf" )
395
- # SB - io.StringIO does not work with Chem.MolecularGraphWriter()
396
- # We have to create a temporary file and re-read it for storing individual conformers.
397
- try:
398
- # prepare the molecule for conformer generation
399
- CDPL.ConfGen.prepareForConformerGeneration(mol)
400
- # generate the conformer ensemble
401
- status = conf_gen.generate(mol)
402
- # if successful, store the generated conformer ensemble as
403
- # per atom 3D coordinates arrays (= the way conformers are represented in CDPKit)
404
- if status == CDPL.ConfGen.ReturnCode.SUCCESS or status == CDPL.ConfGen.ReturnCode.TOO_MUCH_SYMMETRY:
405
- # TOO_MUCH_SYMMETRY: output ensemble may contain duplicates
406
- conf_gen.setConformers(mol)
407
- writer.write(mol)
408
- else:
409
- raise RuntimeError('Error: conformer generation failed: %s' % status_to_str[status])
410
- except Exception as e:
411
- raise RuntimeError('Error: conformer generation failed: %s' % str(e))
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(tmpfile.name, sanitize=True, removeHs=False) as sdf:
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(tmpfile.name)
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)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rdworks
3
- Version: 0.36.2
3
+ Version: 0.36.4
4
4
  Summary: Frequently used tasks built on RDKit and other tools
5
5
  Author-email: Sung-Hun Bae <sunghun.bae@gmail.com>
6
6
  Maintainer-email: Sung-Hun Bae <sunghun.bae@gmail.com>
@@ -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
- # ta[6] = (8, 9, 10, 18, _rot, _fix)
473
- # _rot and _fix are not used
474
- frag, frag_ijkl = create_torsion_fragment(mol.confs[0].rdmol, (8, 9, 10, 18, None, None))
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