aamutils 0.0.5__tar.gz → 0.0.7__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 (31) hide show
  1. {aamutils-0.0.5 → aamutils-0.0.7}/PKG-INFO +1 -1
  2. {aamutils-0.0.5 → aamutils-0.0.7}/aamutils/algorithm/ilp.py +3 -1
  3. {aamutils-0.0.5 → aamutils-0.0.7}/aamutils/mapping.py +3 -2
  4. {aamutils-0.0.5 → aamutils-0.0.7}/pyproject.toml +1 -1
  5. {aamutils-0.0.5 → aamutils-0.0.7}/test/test_mapping.py +7 -0
  6. {aamutils-0.0.5 → aamutils-0.0.7}/.github/workflows/publish-package.yml +0 -0
  7. {aamutils-0.0.5 → aamutils-0.0.7}/.github/workflows/test-and-lint.yml +0 -0
  8. {aamutils-0.0.5 → aamutils-0.0.7}/.gitignore +0 -0
  9. {aamutils-0.0.5 → aamutils-0.0.7}/LICENSE +0 -0
  10. {aamutils-0.0.5 → aamutils-0.0.7}/Makefile +0 -0
  11. {aamutils-0.0.5 → aamutils-0.0.7}/README.md +0 -0
  12. {aamutils-0.0.5 → aamutils-0.0.7}/aamutils/__init__.py +0 -0
  13. {aamutils-0.0.5 → aamutils-0.0.7}/aamutils/__main__.py +0 -0
  14. {aamutils-0.0.5 → aamutils-0.0.7}/aamutils/algorithm/__init__.py +0 -0
  15. {aamutils-0.0.5 → aamutils-0.0.7}/aamutils/algorithm/aaming.py +0 -0
  16. {aamutils-0.0.5 → aamutils-0.0.7}/aamutils/cmd/__init__.py +0 -0
  17. {aamutils-0.0.5 → aamutils-0.0.7}/aamutils/cmd/expanding.py +0 -0
  18. {aamutils-0.0.5 → aamutils-0.0.7}/aamutils/utils.py +0 -0
  19. {aamutils-0.0.5 → aamutils-0.0.7}/benchmark.py +0 -0
  20. {aamutils-0.0.5 → aamutils-0.0.7}/conf.py +0 -0
  21. {aamutils-0.0.5 → aamutils-0.0.7}/data/test_dataset.json +0 -0
  22. {aamutils-0.0.5 → aamutils-0.0.7}/doc/getting_started.rst +0 -0
  23. {aamutils-0.0.5 → aamutils-0.0.7}/doc/reference.rst +0 -0
  24. {aamutils-0.0.5 → aamutils-0.0.7}/index.rst +0 -0
  25. {aamutils-0.0.5 → aamutils-0.0.7}/lint.sh +0 -0
  26. {aamutils-0.0.5 → aamutils-0.0.7}/make.bat +0 -0
  27. {aamutils-0.0.5 → aamutils-0.0.7}/requirements.txt +0 -0
  28. {aamutils-0.0.5 → aamutils-0.0.7}/test/__init__.py +0 -0
  29. {aamutils-0.0.5 → aamutils-0.0.7}/test/algorithm/__init__.py +0 -0
  30. {aamutils-0.0.5 → aamutils-0.0.7}/test/algorithm/test_aaming.py +0 -0
  31. {aamutils-0.0.5 → aamutils-0.0.7}/test/algorithm/test_ilp.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: aamutils
3
- Version: 0.0.5
3
+ Version: 0.0.7
4
4
  Summary: Collection of atom-atom-mapping utility functions.
5
5
  Project-URL: homepage, https://github.com/klausweinbauer/AAMUtils
6
6
  Project-URL: source, https://github.com/klausweinbauer/AAMUtils
@@ -99,6 +99,7 @@ def expand_partial_aam_balanced(
99
99
  beta_map: None | list[tuple[int, int, int]] = None,
100
100
  bond_key="bond",
101
101
  expected_rc: None | tuple[None | int, None | int] = None,
102
+ time_limit: None | int = None,
102
103
  ) -> tuple[np.ndarray, str, float]:
103
104
  """Function to extend the partial atom-atom map beta of the balanced
104
105
  reaction G \u2192 H to a full atom-atom map based on the Minimal Chemical
@@ -118,6 +119,7 @@ def expand_partial_aam_balanced(
118
119
  help to get correct AAM for reactions where the Minimal Chemical
119
120
  Distance is unsuitable, e.g. for a Diels-Alder reaction you can set
120
121
  expected_rc to (6, 6).
122
+ :param time_limit: (optional) Set a timeout for the solver.
121
123
 
122
124
  :returns: A 3-tuple. The first element is the mapping matrix X. The second
123
125
  element is the status string of the ILP solver (e.g. 'Optimal') and the
@@ -186,7 +188,7 @@ def expand_partial_aam_balanced(
186
188
  _edge_diff_constraint(problem, lp_X, lp_D, A_G, A_H)
187
189
  _indicator_constraint(problem, lp_D, lp_G, lp_S, k)
188
190
 
189
- status = problem.solve(lp.PULP_CBC_CMD(logPath=r"solver.log"))
191
+ status = problem.solve(lp.PULP_CBC_CMD(logPath=r"solver.log", timeLimit=time_limit))
190
192
 
191
193
  np_X = np.zeros([m, m], dtype=np.int32)
192
194
  for (i, j), v in lp_X.items():
@@ -20,6 +20,8 @@ class Mapper:
20
20
  H = mol_to_graph(h_mol)
21
21
 
22
22
  M, status, e_diff = expand_partial_aam_balanced(G, H, expected_rc=expected_rc)
23
+ if status != "Optimal":
24
+ return None
23
25
 
24
26
  set_aam(G, H, M)
25
27
 
@@ -31,7 +33,7 @@ class Mapper:
31
33
  )
32
34
  return aam_smiles
33
35
 
34
- def get_aam(self, smiles: str | list[str], expected_rc) -> str | list[str]:
36
+ def get_aam(self, smiles: str | list[str], expected_rc=None) -> str | list[str]:
35
37
  return_list = True
36
38
  if isinstance(smiles, str):
37
39
  smiles = [smiles]
@@ -47,7 +49,6 @@ class Mapper:
47
49
  )
48
50
  )
49
51
  aam_smiles = []
50
- print(expected_rc)
51
52
  for smiles, exp_rc in zip(smiles, expected_rc):
52
53
  aam_smiles.append(self._map_rxn(smiles, expected_rc=exp_rc))
53
54
  if not return_list:
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "aamutils"
7
- version = "0.0.5"
7
+ version = "0.0.7"
8
8
  authors = [
9
9
  {name="Klaus Weinbauer", email="klaus@bioinf.uni-leipzig.de"}
10
10
  ]
@@ -14,3 +14,10 @@ def test_mapper_with_expected_rc():
14
14
  rc = get_rc(its)
15
15
  assert len(rc.nodes) == 6
16
16
  assert len(rc.edges) == 6
17
+
18
+
19
+ def test_mapper_infeasable():
20
+ smiles = "C>>C"
21
+ mapper = Mapper()
22
+ aam_smiles = mapper.get_aam(smiles, expected_rc=(2, 2))
23
+ assert aam_smiles is None
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes