Hi Markus, On Aug 8, 2019, at 12:17, Markus Grimm via OpenBabel-discuss <openbabel-discuss@lists.sourceforge.net> wrote: > I would like to know how can I rearrange a smile of a Molecule Object in > Pybel in a way where I customize which atom should be first in the smile?
Noel O'Boyle described that (then new) feature at http://baoilleach.blogspot.com/2011/07/alpha-and-omega-of-smiles-strings.html It starts: I've just added a feature to the SMILES output in Open Babel that allows the user to specify a particular start and end atom for a SMILES string. It's implemented via the "f"irst and "l"ast options, which are passed to the write() method as a Python dictionary. Here's an example of generating a SMILES for phenol, with the oxygen first instead of the default position which is last: >>> mol = pybel.readstring("smi", "c1ccccc1O") >>> mol.write("smi") 'c1ccccc1O\t\n' >>> mol.write("smi", opt={"f": 7}) 'Oc1ccccc1\t\n' Cheers, Andrew da...@dalkescientific.com _______________________________________________ OpenBabel-discuss mailing list OpenBabel-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbabel-discuss