O.K. Problem solved. Sorry about the spam, folks.

I can use GetSubstructMatch, as follows.

# sinput is the input smiles
# scanon is the output smiles

minput = Chem.MolFromSmiles(sinput)
scanon=Chem.MolToSmiles(minput)
mcanon=Chem.MolFromSmiles(scanon)
map_forward = minput.GetSubstructMatch(mcanon)
map_backward = mcanon.GetSubstructMatch(minput)




Ling Chan <lingtrek...@gmail.com> 於 2021年11月2日週二 下午3:55寫道:

> Dear colleagues,
>
> Just wonder if I can obtain a mapping of the atom indices upon
> canonicalization by MolToSmiles ? I am aware that canonicalization (and
> hence atom reordering) can be suppressed in MolToSmiles, but I do want to
> canonicalize the output smiles.
>
> If you are interested, here is a bit more details of my problem. For each
> molecule, I want to delete one or two side chains, and obtain a smiles of
> what is left. Just that I want to know what are the atoms that bonded to
> the deleted side chains. I know, by suppressing canonicalization things
> will work. But I would like to canonicalize the smiles so that I can know
> if there are duplicates.
>
> I tried marking the atoms. But I believe that properties that got carried
> over to the output smiles, e.g. Isotope, affect the canonicalization, while
> properties that do not affect canonicalization, e.g, IntProp, are lost upon
> the conversion to smiles.
>
> Thank you for your insight.
>
> Ling
>
>
>
>
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to