Repository navigation
Drop duplicate map_smiles function - #211
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #211 +/- ##
==========================================
+ Coverage 82.06% 82.11% +0.04%
==========================================
Files 59 58 -1
Lines 5313 5311 -2
==========================================
+ Hits 4360 4361 +1
+ Misses 953 950 -3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
🟢 Approval recommended
No active issues were found and the change is a clean, self-contained refactor consolidating duplicate helpers with all call sites updated.
No open issues 🎉
What changed in this PR
This PR resolves #191 by eliminating a duplicate map_smiles implementation. Previously tyff/molecule.py defined an OpenFF-based map_smiles (Molecule.from_smiles(...).to_smiles(mapped=True)), while tyff/utils/molecule.py defined an RDKit-based one plus mol_to_smiles/unmap_smiles. The RDKit code path is preferred because these mapped SMILES are used as dictionary keys where literal string comparison stands in for chemical equivalence, so it must avoid toolkit-dependent (OEChem vs. RDKit) output differences. The PR moves the RDKit helpers into tyff/molecule.py, deletes tyff/utils/molecule.py, and updates all call sites.
Changes:
- Moved
mol_to_smiles,map_smiles, andunmap_smiles(RDKit implementations) intotyff/molecule.py, replacing the OpenFF-basedmap_smiles, and addedfrom __future__ import annotationsfor theChem.Moltype hint. - Deleted
tyff/utils/molecule.py. - Updated all importers (
tyff/targets/thermo.py,tyff/targets/dimers.py, andtyff/_tests/targets/test_thermo.py) to usetyff.molecule.
| File | Description |
|---|---|
tyff/molecule.py |
Now hosts the consolidated RDKit-based mol_to_smiles/map_smiles/unmap_smiles, replacing the OpenFF map_smiles. |
tyff/utils/molecule.py |
Deleted; its functions were relocated to tyff/molecule.py. |
tyff/targets/thermo.py |
Import and call sites updated from tyff.utils.molecule to tyff.molecule. |
tyff/targets/dimers.py |
Import and mol_to_smiles call sites updated to tyff.molecule. |
tyff/_tests/targets/test_thermo.py |
Test import of map_smiles updated to tyff.molecule. |
I verified there are no remaining references to tyff.utils.molecule, no external uses of the removed tyff.molecule.Molecule symbol, and no stale references in docs or __init__ modules. The change is a clean, self-contained refactor and I found no objective issues to flag.
Review effort: Balanced
Description
Closes #191
Mostly moves
tyff.utils.moleculeintotyff.molecule. There is no only onemap_smilesfunction and it uses an RDKit code path to avoid different behavior from OpenFF if OEChem is installed and licensed.Checklist