Hi Sridhar, To expand a little bit on Nik's point below: The RDKit is pretty picky about what it will accept as being a valid molecule. With a couple of exceptions, it generally won't deal with hypervalent species like [SnCl5]-. When you try and read a molecule that the system doesn't accept, the return value from the molecule construction function will be the special python value None. Elsewhere in this thread are a couple of examples of how to catch the None values so that you don't get exceptions.
Another point: from the SMILES below, it looks like you are trying to deal with organometalic molecules. The RDKit will often accept these (it does not have strict valence rules for most metals), but I wouldn't expect most of the descriptor calculators to return sensible results; most of those have been parameterized for standard organic molecules. Best Regards, -greg On Fri, Oct 22, 2010 at 4:51 PM, <nikolaus.sti...@novartis.com> wrote: > > Hi, > > your molecule itself is not ok - the Sn has a larger valence then permitted. > There was a similar case recently about phosphor. I would guess that you > should fix your molecule first. > > In your code example below your molecule m is None and hence the rest will > not work. > > Hope that helps > > Cheers > Nik > > > > <sridhar.kuntamukk...@thomsonreuters.com> > > 10/22/2010 04:41 PM > > To > <rdkit-discuss@lists.sourceforge.net> > cc > Subject > [Rdkit-discuss] How to trap the exceptions in RDKit? > > > > > Hi, > I have the following code which raises an exception because the molecule is > not up to its expectations. But I can’t find a way to trap the exception. Can > someone suggest one, please? > > from rdkit import Chem > from rdkit.Chem import AvailDescriptors > from rdkit.Chem import Crippen > > > m=Chem.MolFromSmiles('c1ccc2c(c1)/C=N/c3ccccc3S[Ti]O2.[CH]1[CH][CH][CH][CH]1.Cl[Sn-](Cl)(Cl)(Cl)Cl') > # I tried this way > molog = Crippen.MolLogP(m) > print molog > # and also this way first > if AvailDescriptors.descDict['MolLogP'](m): > mollogp = AvailDescriptors.descDict['MolLogP'](m) > > I also wanted to calc. NumHDonors and NumHAcceptors. But if it failed on one > descriptor, will it fail on other descriptors as well? > Any suggestions? > Thanks > Sridhar > ------------------------------------------------------------------------------ Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev _______________________________________________ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss