Hi Pat, On Sat, Jan 12, 2019 at 2:41 AM Patrick Walters <wpwalt...@gmail.com> wrote:
> Hi all, > > I ran into a case that I found confusing. If convert this SMILES to an > RDKit molecule, I get a valid molecule. > > In [2]: mol = Chem.MolFromSmiles("O=C(CC1SCCC1)c1coooo1N") > > In [3]: mol > Out[3]: <rdkit.Chem.rdchem.Mol at 0x10caefbc0> > > However, if I convert the molecule to SMILES then covert it back to a > molecule, it is no longer valid. > I believe the initial sanitization should fail here. That degree-three neutral O should result in an error. Here's the bug: https://github.com/rdkit/rdkit/issues/2218 These things almost always end up being more complicated than I'd like to fix, but it shouldn't be too bad. -greg > In [4]: smi = Chem.MolToSmiles(mol) > > In [5]: new_mol = Chem.MolFromSmiles(smi) > [20:35:06] Explicit valence for atom # 1 O, 3, is greater than permitted > RDKit ERROR: [20:35:06] Explicit valence for atom # 1 O, 3, is greater > than permitted > > In [6]: new_mol > > In [7]: new_mol is None > Out[7]: True > > I'd like to be able to catch invalid molecules like this in one step > rather than two. What am I > doing wrong? > > Thanks, > > Pat > > _______________________________________________ > Rdkit-discuss mailing list > Rdkit-discuss@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/rdkit-discuss >
_______________________________________________ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss