Functional group abbreviation
- Dominant language
- C++
- Stars
- 406
- Forks
- 134
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 24
Description
I am rendering molecule images from SMILES and I want to replace some functional groups with their abbreviations. My current implementation is
```
def add_sgroup(indigo, mol, substitutions):
matcher = indigo.substructureMatcher(mol)
for abbrv, smarts, p in substitutions:
query = indigo.loadSmarts(smarts)
for match in matcher.iterateMatches(query):
if random.random() < p:
mol.createSGroup("SUP", match, abbrv)
return mol
```
It works well but may fail in some cases. For example, I replaced the -OMe functional group with the label "OMe", but it should be "MeO" in the image below.
I know the simplest way is just changing "OMe" to "MeO", but I am rendering thousands of molecules and need an automatic method.
I am wondering if there are better ways to replace functional groups with their abbreviations. Or something similar to the RDKit function https://www.rdkit.org/docs/Cookbook.html#with-abbreviations
Thank you!
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.