#!/usr/bin/python import os, sys from openeye.oechem import * #************************************************************* def start_and_end_with(strng, startpattern, endpattern): l_startpattern = len(startpattern) l_endpattern = len(endpattern) if strng[:l_startpattern] == startpattern and strng[-l_endpattern:] == endpattern: return 1 else: return 0 #************************************************************* try: start = sys.argv[1] end = sys.argv[2] except IndexError: print 'usage: c1_corina.py start-file-pattern end-file-pattern' raise SystemExit() for file in os.listdir('.'): if start_and_end_with(file, start, end): prefix = 'c1_'+file[:-8] if file[-3:] != 'ism': print 'Skip '+file+' ism-file needed as input' continue elif os.path.exists('./'+prefix+'_out.sdf'): print prefix+'_out.sdf exists already, skip '+file continue else: pass # create 3d coordinates from ring_confs and stereoisomers # recommended mc=10, but in study used mc=25 -> typing error? print 'run corina for '+file+'; DB-params are used ....ringconfs, stereoisomers....' os.system('corina -d errorfile='+prefix+'_error.sdf,r2d,wh,stergen,msc=5,msi=13,names,preserve,rc,flapn,mc=10,sc -t tracefile='+prefix+'_trace.trc -i t=smiles -o t=sdf -o mdlcompact '+prefix[3:]+'_out.ism '+prefix+'_out.sdf')