rowan-python 3.1.2__py3-none-any.whl → 3.1.3__py3-none-any.whl

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.
rowan/molecule.py CHANGED
@@ -280,7 +280,8 @@ def load_named_ligands(path: Path | str) -> dict[str, Molecule]:
280
280
  Molecule names are read from the title field of each record. Use this when
281
281
  ligand identity needs to be preserved - for example, building a ligand dict
282
282
  for an RBFE workflow where names are used as keys throughout submission and
283
- results.
283
+ results. Every record must therefore have a unique name; duplicates raise
284
+ rather than silently collapsing into one ligand.
284
285
 
285
286
  Supported formats (all carry per-molecule name fields):
286
287
  - SDF / MOL (``.sdf``, ``.mol``) - name from the title line
@@ -288,7 +289,8 @@ def load_named_ligands(path: Path | str) -> dict[str, Molecule]:
288
289
 
289
290
  :param path: Path to an SDF, MOL, or MOL2 file.
290
291
  :returns: Dict mapping ligand name to Molecule, in file order.
291
- :raises ValueError: If no valid molecules are found or the format is unsupported.
292
+ :raises ValueError: If no valid molecules are found, the format is
293
+ unsupported, or two records share a name.
292
294
  """
293
295
  path = Path(path)
294
296
  suffix = path.suffix.lower()
@@ -311,4 +313,13 @@ def load_named_ligands(path: Path | str) -> dict[str, Molecule]:
311
313
  if not pairs:
312
314
  raise ValueError(f"No valid molecules found in {path}")
313
315
 
316
+ # require every record to have a unique name rather than dropping data
317
+ names = [name for name, _ in pairs]
318
+ duplicates = sorted({name for name in names if names.count(name) > 1})
319
+ if duplicates:
320
+ raise ValueError(
321
+ f"Ligand names must be unique, but {path} repeats: {', '.join(duplicates)}. "
322
+ "Rename the duplicate records before loading."
323
+ )
324
+
314
325
  return {name: Molecule(_stjames=stjames.Molecule.from_rdkit(rdkm)) for name, rdkm in pairs}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rowan-python
3
- Version: 3.1.2
3
+ Version: 3.1.3
4
4
  Summary: Rowan Python Library
5
5
  Project-URL: Homepage, https://github.com/rowansci/rowan-client
6
6
  Project-URL: Bug Tracker, https://github.com/rowansci/rowan-client/issues
@@ -4,7 +4,7 @@ rowan/calculation.py,sha256=lZZ52DxPsuJWCTzFZXjhauHK6dV0KCUwzoxtmoxSY48,3442
4
4
  rowan/config.py,sha256=TejQKSxnzNKKTNL9-2bCLq6RvAh54oVA5Ivl1p_ZT8Q,20899
5
5
  rowan/constants.py,sha256=emCH4m9OL2Hm5E-6mJGM_FgzrK_JrZT-FiKJ6pMNQ4Y,84
6
6
  rowan/folder.py,sha256=eyKdZjHR-LsNK0yS8iedb0vPi3OB10gluuA1-Ee_JCg,9202
7
- rowan/molecule.py,sha256=AcH13oKxfysQ5y44bxucUVlUdV1BTT6vwjBANP-waVo,10296
7
+ rowan/molecule.py,sha256=LyneBgSbNS7ByQ2sI8hcRLOXwljZMZQtALgAYcqX2tM,10844
8
8
  rowan/project.py,sha256=RtxYE9jv3Yz6fH5I56iDGRG5EbwlOHiSK-HF1uxc0d4,4582
9
9
  rowan/protein.py,sha256=hfDqk_LgU8o39Zg2kHHWf8EqPcQOnT3Mo43Ik1gAO68,14856
10
10
  rowan/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -49,7 +49,7 @@ rowan/workflows/solvent_dependent_conformers.py,sha256=Z2xESmcM8WcTsR2TSTUa--Rrh
49
49
  rowan/workflows/spin_states.py,sha256=rjkgie2-XVNIN7O6P93yn6EPv9Ogjy8iTj3ufZIsUgY,9331
50
50
  rowan/workflows/strain.py,sha256=kCW_BlX__sdQG1JVbFZuB-57rkpnxa_JCw3h4uKdGDk,6425
51
51
  rowan/workflows/tautomer_search.py,sha256=mbRl0ZJ7wibueRF8c8_idhXJ1rtwg7LBt--5QwQ_Cck,5767
52
- rowan_python-3.1.2.dist-info/METADATA,sha256=poPK5z_485P_QgH_M-RVS8GkqGUhlojTCR5BlZW-iC0,2052
53
- rowan_python-3.1.2.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
54
- rowan_python-3.1.2.dist-info/licenses/LICENSE,sha256=i05z7xEhyrg6f8j0lR3XYjShnF-MJGFQ-DnpsZ8yiVI,1084
55
- rowan_python-3.1.2.dist-info/RECORD,,
52
+ rowan_python-3.1.3.dist-info/METADATA,sha256=mv9y4fxN9Ds7WCnd2W-vZL-LdLCNkp_1XxWipE5Q2Yg,2052
53
+ rowan_python-3.1.3.dist-info/WHEEL,sha256=mffPy8wBnZQn2VnJUU5jE99KsxaSfiyMHV9Yt0aLVxs,87
54
+ rowan_python-3.1.3.dist-info/licenses/LICENSE,sha256=i05z7xEhyrg6f8j0lR3XYjShnF-MJGFQ-DnpsZ8yiVI,1084
55
+ rowan_python-3.1.3.dist-info/RECORD,,