Hi Nick,

Here is some code to get you started:


In:

from rdkit import Chem
from rdkit.Chem import AllChem

molList = ['Nc1cc(C)cc(Br)c1','CNc1cc(C)cc(Cl)c1', 'CCC']

#create screening dataset
mol_DB = [Chem.MolFromSmiles(m) for m in molList]


#create query mol from smarts
try:                              
        substr = AllChem.MolFromSmarts('[#7;H2]c1ccccc1')  

except:
        print 'error parsing smarts query'
        exit(1)

#screen
for m in mol_DB:
    try:
        if (m.HasSubstructMatch(substr)):  
            print Chem.MolToSmiles(m)         
    except:
        print 'error during substructure matching with mol '+Chem.MolToSmiles(m)
        continue



Out:
Cc1cc(N)cc(Br)c1


Is it that what you are looking for? You can find more examples here:

http://www.rdkit.org/docs/GettingStartedInPython.html


Cheers,
Markus

On 04/25/2013 02:36 PM, Nicholas Firth wrote:
Hi RDKitters,

I've just been made aware that the PAINS filters have been nicely put into SMARTS (http://www.macinchem.org/reviews/pains/painsFilter.php), my question is how do people think would be the most efficient way to implement this in RDKit?

I don't have much experience with SMARTS matching in RDKit, but I thought I could create a list of molecules from SMARTS and iterate over these using the 'HasSubstructMatch()' function to show any failures. Does this sound sensible or is there a more efficient way?

Best,
Nick

Nicholas C. Firth | PhD Student | Cancer Therapeutics
The Institute of Cancer Research | 15 Cotswold Road | Belmont | Sutton | Surrey | SM2 5NG

T 020 8722 4033 | E nicholas.fi...@icr.ac.uk | W www.icr.ac.uk | Twitter @ICRnews

Facebook www.facebook.com/theinstituteofcancerresearch

Making the discoveries that defeat cancer




The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company Limited by Guarantee, Registered in England under Company No. 534147 with its Registered Office at 123 Old Brompton Road, London SW7 3RP.

This e-mail message is confidential and for use by the addressee only. If the message is received by anyone other than the addressee, please return the message to the sender by replying to it and then delete the message from your computer and network.


------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr


_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_apr
_______________________________________________
Rdkit-discuss mailing list
Rdkit-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rdkit-discuss

Reply via email to