Hi Greg, Greg wrote: > You actually don't need to add the Hs: > >>> p1 = Chem.MolFromSmarts('[#7,#8;H1]') > >>> p2 = Chem.MolFromSmarts('[#7,#8;H2]') > >>> p3 = Chem.MolFromSmarts('[#7,#8;H3]') m = > >>> Chem.MolFromSmiles('CC(=O)N') > >>> m2 = Chem.MolFromSmiles('OCC(=O)N') > >>> def NHOHCount(mol): return > >>> > len(mol.GetSubstructMatches(p1))+2*len(mol.GetSubstructMatches(p2))+ > >>> 3*len(mol.GetSubstructMatches(p3)) > ... > >>> NHOHCount(m) > 2 > >>> NHOHCount(m2) > 3
I think this system works well in almost all cases : ) However, I had a nagging concern over a couple of 'edge' cases - namely water, and ammonia (and for that matter, the oxonium and ammonium ions). I guess the simple inclusion of P4 = Chem.MolFromSmarts('[#8;H4]') would make sure all cases were covered(?). Out of interest, I decided to compile a small list of 'normal' and 'edge' case SMILES, and ran it through the MOE descriptor node in KNIME. For all these cases, lip_don behaves as I would expect (tab-separated output included below) Kind regards James "SMILES" "a_acc" "a_don" "lip_acc" "lip_don" "CO" 1.0 1.0 1.0 1.0 "C(=O)N" 1.0 1.0 2.0 2.0 "O" 1.0 1.0 1.0 2.0 "CN" 1.0 1.0 1.0 2.0 "[O+]" 1.0 0.0 1.0 3.0 "C[O+]" 1.0 0.0 1.0 2.0 "[N+]" 0.0 0.0 1.0 4.0 "C[N+]" 0.0 0.0 1.0 3.0 "[N-]" 0.0 1.0 1.0 2.0 "[O-]" 0.0 1.0 1.0 1.0 "C(=O)[N-]" 0.0 1.0 2.0 1.0 ______________________________________________________________________ PLEASE READ: This email is confidential and may be privileged. It is intended for the named addressee(s) only and access to it by anyone else is unauthorised. If you are not an addressee, any disclosure or copying of the contents of this email or any action taken (or not taken) in reliance on it is unauthorised and may be unlawful. If you have received this email in error, please notify the sender or postmas...@vernalis.com. Email is not a secure method of communication and the Company cannot accept responsibility for the accuracy or completeness of this message or any attachment(s). Please check this email for virus infection for which the Company accepts no responsibility. If verification of this email is sought then please request a hard copy. Unless otherwise stated, any views or opinions presented are solely those of the author and do not represent those of the Company. The Vernalis Group of Companies Oakdene Court 613 Reading Road Winnersh, Berkshire RG41 5UA. Tel: +44 118 977 3133 To access trading company registration and address details, please go to the Vernalis website at www.vernalis.com and click on the "Company address and registration details" link at the bottom of the page.. ______________________________________________________________________ ------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2dcopy2 _______________________________________________ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss