def main(argv=[__name__]): if len(argv) != 5: oechem.OEThrow.Usage("%s <queryfile> <fitfile> <outfile> <nhits>" % argv[0]) if oechem.OEGetFileExtension(sys.argv[1]) != "sq": oechem.OEThrow.Fatal("Requires a shape query .sq input file format") fitfs = oechem.oemolistream(sys.argv[2]) outfs = oechem.oemolostream(sys.argv[3]) nhits = int(sys.argv[4]) query = oeshape.OEShapeQuery() oeshape.OEReadShapeQuery(sys.argv[1], query) # Setup OEROCS with specified number of best hits options = oeshape.OEROCSOptions() options.SetNumBestHits(nhits) rocs = oeshape.OEROCS(options) rocs.SetDatabase(fitfs) for res in rocs.Overlay(query): outmol = res.GetOverlayConf() oechem.OEWriteMolecule(outfs, outmol) print("title: %s tanimoto combo = %.2f" % (outmol.GetTitle(), res.GetTanimotoCombo()))
def run_one_roc(mol): fitfs = oechem.oemolistream("/Users/austin/Downloads/template_ligands/alls.mol2") options = oeshape.OEROCSOptions() options.SetNumBestHits(1) rocs = oeshape.OEROCS(options) rocs.SetDatabase(fitfs) max_score = 0 for res in rocs.Overlay(mol): max_score = max(res.GetTanimotoCombo(), max_score) return max_score
def from_oemol(self, from_oemol): with self.logger("from_oemol") as logger: tautomer_options = oequacpac.OETautomerOptions() tautomer_options.SetMaxTautomersGenerated(4096) tautomer_options.SetMaxTautomersToReturn(16) tautomer_options.SetCarbonHybridization(True) tautomer_options.SetMaxZoneSize(50) tautomer_options.SetApplyWarts(True) pKa_norm = True omegaOpts = oeomega.OEOmegaOptions(oeomega.OEOmegaSampling_Pose) omegaOpts.SetStrictAtomTypes(False) omegaOpts.SetSampleHydrogens(True) omegaOpts.SetMaxSearchTime(30) omegaOpts.SetFixDeleteH(True) omega = oeomega.OEOmega(omegaOpts) options = oeshape.OEROCSOptions() overlayoptions = oeshape.OEOverlayOptions() overlayoptions.SetOverlapFunc( oeshape.OEOverlapFunc(oeshape.OEAnalyticShapeFunc())) options.SetOverlayOptions(overlayoptions) # options.SetNumBestHits(10) options.SetConfsPerHit(200) # options.SetMaxHits(10000) rocs = oeshape.OEROCS(options) for tautomer in oequacpac.OEGetReasonableTautomers( from_oemol, tautomer_options, pKa_norm): logger.log("got enantiomer") for enantiomer in oeomega.OEFlipper(tautomer, 4, False): logger.log("got tautomer ") enantiomer_ = oechem.OEMol(enantiomer) ret_code = omega.Build(enantiomer_) if ret_code != oeomega.OEOmegaReturnCode_Success: logger.error("got oemeg_failed", oeomega.OEGetOmegaError(ret_code)) else: rocs.AddMolecule(oechem.OEMol(enantiomer_)) for res in rocs.Overlay(self.refmol): outmol = oechem.OEMol(res.GetOverlayConfs()) good_mol = oechem.OEMol(outmol) oechem.OEAddExplicitHydrogens(good_mol) oechem.OEClearSDData(good_mol) oeshape.OEDeleteCompressedColorAtoms(good_mol) oeshape.OEClearCachedSelfColor(good_mol) oeshape.OEClearCachedSelfShape(good_mol) oeshape.OERemoveColorAtoms(good_mol) return good_mol logger.error("Returning None.") return None
def main(argv=[__name__]): if len(argv) != 5: oechem.OEThrow.Usage("%s <reffile> <fitfile> <outfile> <nhits>" % argv[0]) reffs = oechem.oemolistream(sys.argv[1]) fitfs = oechem.oemolistream(sys.argv[2]) outfs = oechem.oemolostream(sys.argv[3]) nhits = int(sys.argv[4]) refmol = oechem.OEMol() oechem.OEReadMolecule(reffs, refmol) # Setup OEROCS with specified number of best hits options = oeshape.OEROCSOptions() options.SetNumBestHits(nhits) rocs = oeshape.OEROCS(options) rocs.SetDatabase(fitfs) for res in rocs.Overlay(refmol): outmol = res.GetOverlayConf() oechem.OEWriteMolecule(outfs, outmol) print("title: %s tanimoto combo = %.2f" % (outmol.GetTitle(), res.GetTanimotoCombo()))