#!/usr/bin/python """ (c) Molinspiration Cheminformatics 2010 script to automatize model generation and screening by the miscreen engine run as: screen.py act.smi|act.sdf ina.smi|ina.sdf|ina.frag toscreen.smi > out.smi as inactives either molecules, or "background" fragments may be used (i.e. 100k.frag provided by Molinspiration) if using the fragmnet file, it must end by '.frag' """ import sys import os import commands # --- edit the following parameters miscreen = "java -jar miscreen.jar" jobname = "run" # --- filename of output files minscore = -9999 # only molecules with score > minscore will be printed if (len(sys.argv) < 2): print "Usage: screen.py actives inactives toscreen > out" print "(you can use, of course, your own file names)" sys.exit() actdata = sys.argv[1] # --- file with active molecules inadata = sys.argv[2] # --- file with inactive molecules or fragments toscreen = sys.argv[3] # --- file to screen # --- checking miscreen jar d,out = commands.getstatusoutput(miscreen) if (out.find("Unable") > -1): print "Cannot access miscreen.jar" print "check miscreen.jar path and modify the respective parameter in the screen.py" sys.exit() def screenrun(): # --- checking file availability if not os.path.exists(actdata): print "Cannot open file",actdata sys.exit() if not os.path.exists(inadata): print "Cannot open file",inadata sys.exit() if not os.path.exists(toscreen): print "Cannot open file",toscreen sys.exit() # --- start of the run print "Running Molinspiration virtual screening protocol" # --- generation of active fragments print "generating active fragments ..."; actfragments = jobname+".af"; os.system(miscreen + " -fragment " + actdata + " > " + actfragments) print "file",actfragments,"with active fragments created"; # --- generation of inactive fragments (if file does not end by 'frag') if not inadata.endswith(".frag"): print "generating inactive fragments ..."; inafragments = jobname+".if"; os.system(miscreen + " -fragment " + inadata + " > " + inafragments) print "file",inafragments,"with inactive fragments created"; else: inafragments = inadata print "using supplied fragment set " + inafragments + " as inactives" # --- calculation of scores print "creating bioactivity model ..." model = jobname+".model" os.system(miscreen + " -createmodel -af " + actfragments + " -if " + inafragments + " > " + model) print "model " + model + " created" # --- screening print "screening ..." out = jobname+".out" os.system(miscreen + " -screen " + toscreen + " -model " + model + " -minscore " + str(minscore) + " > " + out) # main screenrun() print "Screened molecules with predicted activity in " + jobname+".out";