Skip to content

Drop duplicate map_smiles function - #211

Merged
mattwthompson merged 1 commit into
mainfrom
one-map-smiles
Oct 30, 2026
Merged

mattwthompson merged 1 commit into
mainfrom
one-map-smiles

Conversation

@mattwthompson

Copy link
Copy Markdown
Member

Description

Closes #191

Mostly moves tyff.utils.molecule into tyff.molecule. There is no only one map_smiles function and it uses an RDKit code path to avoid different behavior from OpenFF if OEChem is installed and licensed.

Checklist

@codecov-commenter

codecov-commenter commented Oct 29, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 91.17647% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.11%. Comparing base (6a816ff) to head (c47c8f2).

Files with missing lines Patch % Lines
tyff/molecule.py 89.65% 3 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 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, and unmap_smiles (RDKit implementations) into tyff/molecule.py, replacing the OpenFF-based map_smiles, and added from __future__ import annotations for the Chem.Mol type hint.
  • Deleted tyff/utils/molecule.py.
  • Updated all importers (tyff/targets/thermo.py, tyff/targets/dimers.py, and tyff/_tests/targets/test_thermo.py) to use tyff.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

@mattwthompson
mattwthompson marked this pull request as ready for review October 30, 2026 14:13
@mattwthompson
mattwthompson merged commit 08ad267 into main Oct 30, 2026
6 checks passed
@mattwthompson
mattwthompson deleted the one-map-smiles branch October 30, 2026 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Do not have two map_smiles functions

3 participants