Hi RDKit community,

I’m using RDKit (version 2020.09.4) to read and manipulate CXSMILES with 
enhanced stereochemistry group definitions. I’d like to read in a CXSMILES with 
“OR” stereo groups and to change the “OR” to “absolute” within the graph mol, 
before outputting the new CXSMILES. I have found the methods: 
RWMol.SetStereoGroups and rdchem.CreateStereoGroups, which I assume should 
provide the functionality I need, however I’m struggling to use them. Are any 
of the following options in the example code possible? And if so, please can 
someone advise how to implement them?

Example code:

cxsmiles = 'Cl[C@@H](F)(Br) |o1:1|'
mol = Chem.MolFromSmiles(cxsmiles)
editable_mol = Chem.RWMol(mol)
orig_stereo_grps = editable_mol.GetStereoGroups()

# option 1 - can I change the stereo group type from STEREO_OR to 
STEREO_ABSOLUTE by editing an the StereoGroup object itself?
for grp in orig_stereo_grps:
        print([atom.GetIdx() for atom in grp.GetAtoms()])
        print(grp.GetGroupType())

# option 2 - can I construct a StereoGroup_vect object with the STEREO_ABSOLUTE 
type and feed this into the SetStereoGroups command?
stereo_grps = Chem.StereoGroup_vect()
editable_mol.SetStereoGroups(list(stereo_grps))

# option 3 - can I use Chem.CreateStereoGroup to change the stereo group type? 
Chem.CreateStereoGroup(Chem.StereoGroupType.STEREO_ABSOLUTE, editable_mol, [1])
print(Chem.MolToCXSmiles(editable_mol)) # no change seen in output

Thanks in advance for any help,

Lauren 

Dr Lauren Reid
Computational Chemist / Developer
MedChemica Ltd

Medchemica Ltd is a company registered in England and Wales with company number 
8162245

_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to