On Nov 18, 2019, at 17:40, David Cosgrove <davidacosgrov...@gmail.com> wrote:
> 
> Point taken. I don’t think you’d be able to get RDKit to spit such SMILES 
> strings out unless you tortured it pretty hard, however. 

Did someone mention one of my favorite things to do? :)  See:

  
http://dalkescientific.com/writings/diary/archive/2010/12/28/reordering_smiles.html

Note that that code does not preserve stereochemistry.

It's for Python 2, so change the:

  available_closures = range(100)

to

 available_closures = list(range(100))

to make it work under Python 3.

Here's what it looks like:

>>> from x import reordered_smiles
>>> from rdkit import Chem
>>> mol = Chem.MolFromSmiles("OCCl")
>>> atoms = list(mol.GetAtoms())
>>> reordered_smiles(mol, [atoms[1], atoms[0], atoms[2]])
'[CH2]12.[OH1]1.[Cl]2'



                                Andrew
                                da...@dalkescientific.com




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

Reply via email to