Re: [Rdkit-discuss] Stereochemistry

2016-12-18 Thread Greg Landrum
One more piece that might help: the allHsExplicit to MolToSmiles() is there to make sure that implicit Hs (Hs not actually in the graph) show up in the output SMILES inside square brackets: In [12]: m = Chem.MolFromSmiles('CC(O)(Cl)') In [13]: Chem.MolToSmiles(m,allHsExplicit=True) Out[13]:

Re: [Rdkit-discuss] Stereochemistry

2016-12-18 Thread Greg Landrum
On Mon, Dec 19, 2016 at 1:00 AM, Paolo Tosco wrote: > > It looks like allHsExplicit=True prevents SMILES chirality specifications > from being output: > In [8]: m = Chem.MolFromSmiles('C[C@H](F)(Cl)') In [9]: Chem.MolToSmiles(m,isomericSmiles=True,allHsExplicit=True)

Re: [Rdkit-discuss] Stereochemistry

2016-12-18 Thread Paolo Tosco
Dear Jean-Marc, as lactic2.sdf is a 3D structure which does not carry any stereochemistry information in the SDF file, you will need to perceive stereochemistry from the 3D structure with Chem.AssignAtomChiralTagsFromStructure(mol) before calling Chem.AssignStereochemistry(). It looks like

[Rdkit-discuss] Stereochemistry

2016-12-18 Thread Jean-Marc Nuzillard
Hi again, When I run: # from rdkit import Chem molfilename = "lactic2.sdf" mol = Chem.SDMolSupplier(molfilename, removeHs = False)[0] Chem.AssignStereochemistry(mol, cleanIt=False, force=False, flagPossibleStereoCenters=True) chiralAtoms = [a for a in mol.GetAtoms() if

Re: [Rdkit-discuss] MolToSmiles

2016-12-18 Thread Jean-Marc Nuzillard
Thank you Andrew, Brian and David for your answers. mol.GetProp("_smilesAtomOutputOrder") does the job. I also expected a.GetProp("molAtomMapNumber") could do it for each atom a. All the best, Jean-Marc Le 18/12/2016 à 19:04, Andrew Dalke a écrit : > On Dec 18, 2016, at 6:32 PM, Brian Kelley

Re: [Rdkit-discuss] MolToSmiles

2016-12-18 Thread Andrew Dalke
On Dec 18, 2016, at 6:32 PM, Brian Kelley wrote: > >>> m.GetProp("_smilesAtomOutputOrder") > '[3,2,1,0,]' > > Note that this returns the list as a string which is sub-optimal. > GetPropsAsDict will convert these to proper python objects, however, this is > considered a private member so you

Re: [Rdkit-discuss] MolToSmiles

2016-12-18 Thread David Cosgrove
Hi Jean-Marc, There is a property of the molecule created when it is read that contains this information. I forget what it is called, but if you call the molecule's GetPropNames function you should see something obvious in the values returned. You can then call GetProp with that property name

Re: [Rdkit-discuss] MolToSmiles

2016-12-18 Thread Brian Kelley
Jean-Marc, This is very non-obvious, but here is how you can do it from python: >>> from rdkit import Chem >>> m = Chem.MolFromSmiles("NCCC") >>> Chem.MolToSmiles(m) 'CCCN' >>> m.GetProp("_smilesAtomOutputOrder") '[3,2,1,0,]' Note that this returns the list as a string which is