epam / epam/Indigo

Functional group abbreviation

Open
#486 0 comments 0 reactions 0 assignees View on GitHub
User`s Feedback
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.
image
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.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.