Hi,
2010/1/4 Christian de Bouillé <[email protected]>:
>
> Dealing with various smiles in a library,
> some smile has a wrong number of valence as N
> for this one
> ClCC(=O)NC1=C(NN=[N]1Cc2ccccc2)C(=O)NCc3ccccc3
>
> Testing in a loop "try and except" or "mol is None"
> I did not find howto raise the exception in the loop.
>
> Do you have a function that checks if the valences are correct ?
What exactly are you trying to do?
This code loops over a set of smiles and prints out the ones that the
RDKit cannot convert into molecules:
# --------------------------
smis = ['c1ccccc1','ClCC(=O)NC1=C(NN=[N]1Cc2ccccc2)C(=O)NCc3ccccc3',
'CC','c1cccc1']
for smi in smis:
m = Chem.MolFromSmiles(smi)
if m is None:
print 'Problem smiles:',smi
# --------------------------
I suspect this is not what you want.
Are you trying to find out, from inside your Python script, what the
problem with the smiles was? I'm afraid that this is not a really easy
thing to do.
-greg
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Rdkit-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss