Skip to content

Commit

Permalink
fix: use rdkit API to remove implicit hydrogens (#2278)
Browse files Browse the repository at this point in the history
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

- **New Features**
- Enhanced SMILES conversion process with improved implicit hydrogen
handling for atoms.
  
- **Bug Fixes**
- Removed outdated method that previously handled SMILES conversion,
streamlining the conversion process.

- **Tests**
- Removed a test related to the now-removed SMILES handling method,
reflecting updates in testing strategy.

- **Chores**
- Minor formatting adjustments and removal of unused imports for cleaner
code.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Signed-off-by: Jinzhe Zeng <[email protected]>
  • Loading branch information
njzjz authored Oct 3, 2024
1 parent a8d9641 commit ac39c96
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions reacnetgenerator/_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,10 @@ def convertSMILES(self, atoms, bonds):
d[number] = m.AddAtom(Chem.Atom(name))
for atom1, atom2, level in bonds:
m.AddBond(d[atom1], d[atom2], Chem.BondType(level))
# https://github.com/rdkit/rdkit/discussions/6613#discussioncomment-6688021
for a in m.GetAtoms(): # type:ignore
a.SetNoImplicit(True)
a.UpdatePropertyCache()
name = Chem.MolToSmiles(m)
return self._re(name)

Expand Down

0 comments on commit ac39c96

Please sign in to comment.