def main(argv=[__name__]): if len(argv) != 3: oechem.OEThrow.Usage("calc_et.py <reffile> <fitfile>") refmol = oechem.OEGraphMol() ifs = oechem.oemolistream() if not ifs.open(argv[1]): oechem.OEThrow.Fatal("Unable to open %s for reading" % argv[1]) oechem.OEReadMolecule(ifs, refmol) oechem.OEAssignBondiVdWRadii(refmol) oechem.OEMMFFAtomTypes(refmol) oechem.OEMMFF94PartialCharges(refmol) et = oezap.OEET() et.SetRefMol(refmol) oechem.OEThrow.Info("dielectric: %.4f" % et.GetDielectric()) oechem.OEThrow.Info("inner mask: %.4f" % et.GetInnerMask()) oechem.OEThrow.Info("outer mask: %.4f" % et.GetOuterMask()) oechem.OEThrow.Info("salt conc : %.4f" % et.GetSaltConcentration()) oechem.OEThrow.Info("join : %d" % et.GetJoin()) if not ifs.open(argv[2]): oechem.OEThrow.Fatal("Unable to open %s for reading" % argv[2]) fitmol = oechem.OEGraphMol() while oechem.OEReadMolecule(ifs, fitmol): oechem.OEAssignBondiVdWRadii(fitmol) oechem.OEMMFFAtomTypes(fitmol) oechem.OEMMFF94PartialCharges(fitmol) oechem.OEThrow.Info("Title: %s, ET %4.2f" % (fitmol.GetTitle(), et.Tanimoto(fitmol))) return 0
def main(args): if len(args) != 3: oechem.OEThrow.Usage("%s <protein> <ligand>" % args[0]) pifs = oechem.oemolistream() if not pifs.open(args[1]): oechem.OEThrow.Fatal("Unable to open %s for reading protein." % args[1]) prot = oechem.OEGraphMol() if not oechem.OEReadMolecule(pifs, prot): oechem.OEThrow.Fatal("Unable to read protein") oechem.OEAddExplicitHydrogens(prot) oechem.OEAssignBondiVdWRadii(prot) lifs = oechem.oemolistream() if not lifs.open(args[2]): oechem.OEThrow.Fatal("Unable to open %s for reading ligand." % args[2]) lig = oechem.OEGraphMol() if not oechem.OEReadMolecule(lifs, lig): oechem.OEThrow.Fatal("Unable to read ligand") oechem.OEAddExplicitHydrogens(lig) oechem.OEAssignBondiVdWRadii(lig) comp = oechem.OEGraphMol(prot) oechem.OEAddMols(comp, lig) compSurf = oespicoli.OESurface() oespicoli.OEMakeMolecularSurface(compSurf, comp) protSurf = oespicoli.OESurface() oespicoli.OEMakeMolecularSurface(protSurf, prot) ligSurf = oespicoli.OESurface() oespicoli.OEMakeMolecularSurface(ligSurf, lig) compVol = oespicoli.OESurfaceVolume(compSurf) protVol = oespicoli.OESurfaceVolume(protSurf) ligVol = oespicoli.OESurfaceVolume(ligSurf) oespicoli.OEWriteSurface("comp.oesrf", compSurf) oespicoli.OEWriteSurface("prot.oesrf", protSurf) oespicoli.OEWriteSurface("lig.oesrf", ligSurf) oechem.OEThrow.Info( "%s-%s: dV(C-P) = %.1f V(L) = %.1f V(C) = %.1f V(P) = %.1f" % (prot.GetTitle(), lig.GetTitle(), compVol - protVol, ligVol, compVol, protVol)) return 0
def main(argv=[__name__]): itf = oechem.OEInterface() if not SetupInterface(argv, itf): return 1 zap = oezap.OEZap() zap.SetInnerDielectric(itf.GetFloat("-epsin")) zap.SetOuterDielectric(itf.GetFloat("-epsout")) zap.SetGridSpacing(itf.GetFloat("-grid_spacing")) zap.SetBoundarySpacing(itf.GetFloat("-buffer")) mol = oechem.OEGraphMol() ifs = oechem.oemolistream() if not ifs.open(itf.GetString("-in")): oechem.OEThrow.Fatal("Unable to open %s for reading" % itf.GetString("-in")) oechem.OEReadMolecule(ifs, mol) oechem.OEAssignBondiVdWRadii(mol) oechem.OEMMFFAtomTypes(mol) oechem.OEMMFF94PartialCharges(mol) zap.SetMolecule(mol) grid = oegrid.OEScalarGrid() if zap.CalcPotentialGrid(grid): if itf.GetBool("-mask"): oegrid.OEMaskGridByMolecule(grid, mol) oegrid.OEWriteGrid(itf.GetString("-out"), grid) return 0
def main(args): if len(args) != 4: oechem.OEThrow.Usage("%s <protein> <ligand> <surface>" % args[0]) pfs = oechem.oemolistream(args[1]) prot = oechem.OEGraphMol() oechem.OEReadMolecule(pfs, prot) oechem.OEAssignBondiVdWRadii(prot) lfs = oechem.oemolistream(args[2]) lig = oechem.OEGraphMol() oechem.OEReadMolecule(lfs, lig) surf = oespicoli.OESurface() oespicoli.OEMakeMolecularSurface(surf, prot) # Iterate through all the protein surface vertices for i in range(surf.GetNumVertices()): vert = surf.GetVertex(i) # Check the distance to each atom for atom in lig.GetAtoms(): dist2 = GetDist2(lig.GetCoords(atom), vert) if dist2 < MAX_DIST * MAX_DIST: surf.SetVertexCliqueElement(i, 1) # Crop to the binding site and output oespicoli.OESurfaceCropToClique(surf, 1) oespicoli.OEWriteSurface(args[3], surf) return 0
def main(args): if len(args) != 4: oechem.OEThrow.Usage("%s <protein> <ligand> <surface>" % args[0]) pfs = oechem.oemolistream(args[1]) prot = oechem.OEGraphMol() oechem.OEReadMolecule(pfs, prot) oechem.OEAssignBondiVdWRadii(prot) lfs = oechem.oemolistream(args[2]) lig = oechem.OEGraphMol() oechem.OEReadMolecule(lfs, lig) surf = oespicoli.OESurface() oespicoli.OEMakeMolecularSurface(surf, prot) oespicoli.OESurfaceToMoleculeDistance(surf, lig) # Mark the vertices to keep for i in range(surf.GetNumVertices()): if surf.GetDistanceElement(i) < MAX_DIST: surf.SetVertexCliqueElement(i, 1) # Crop to the binding site and output oespicoli.OESurfaceCropToClique(surf, 1) oespicoli.OEWriteSurface(args[3], surf) return 0
def main(argv=[__name__]): if len(argv) != 2: oechem.OEThrow.Usage("%s <molfile>" % argv[0]) epsin = 1.0 zap = oezap.OEZap() zap.SetInnerDielectric(epsin) zap.SetGridSpacing(0.5) area = oezap.OEArea() mol = oechem.OEGraphMol() ifs = oechem.oemolistream() if not ifs.open(argv[1]): oechem.OEThrow.Fatal("Unable to open %s for reading" % argv[1]) oechem.OEThrow.Info("%-20s %6s\n" % ("Title", "Vacuum->Water(kcal)")) while oechem.OEReadMolecule(ifs, mol): oechem.OEAssignBondiVdWRadii(mol) oechem.OEMMFFAtomTypes(mol) oechem.OEMMFF94PartialCharges(mol) zap.SetMolecule(mol) solv = zap.CalcSolvationEnergy() aval = area.GetArea(mol) oechem.OEThrow.Info("%-20s %6.2f" % (mol.GetTitle(), KCalsPerKT*solv+KCalsPerSqAngstrom*aval)) return 0
def main(argv=[__name__]): if len(argv) != 2: oechem.OEThrow.Usage("%s <molfile>" % argv[0]) epsin = 1.0 zap = oezap.OEZap() zap.SetInnerDielectric(epsin) zap.SetGridSpacing(0.5) area = oezap.OEArea() PrintHeader() mol = oechem.OEGraphMol() ifs = oechem.oemolistream() if not ifs.open(argv[1]): oechem.OEThrow.Fatal("Unable to open %s for reading" % argv[1]) while oechem.OEReadMolecule(ifs, mol): oechem.OEAssignBondiVdWRadii(mol) oechem.OEMMFFAtomTypes(mol) oechem.OEMMFF94PartialCharges(mol) zap.SetMolecule(mol) solv = zap.CalcSolvationEnergy() aval = area.GetArea(mol) coul = oezap.OECoulombicSelfEnergy(mol, epsin) PrintLine(mol.GetTitle(), solv, aval, coul) return 0
def main(args): if len(args) != 3: oechem.OEThrow.Usage("%s <ref> <fit>" % args[0]) refifs = oechem.oemolistream() if not refifs.open(args[1]): oechem.OEThrow.Fatal("Unable to open %s for reading" % args[1]) refmol = oechem.OEGraphMol() oechem.OEReadMolecule(refifs, refmol) oechem.OEAssignBondiVdWRadii(refmol) fitifs = oechem.oemolistream() if not fitifs.open(args[2]): oechem.OEThrow.Fatal("Unable to open %s for reading" % args[2]) fitmol = oechem.OEGraphMol() oechem.OEReadMolecule(fitifs, fitmol) oechem.OEAssignBondiVdWRadii(fitmol) # Map the reference molecule onto a grid grd = oegrid.OEScalarGrid() oegrid.OEMakeMolecularGaussianGrid(grd, refmol, 0.5) # Get the total volume of the reference molecule refsrf = oespicoli.OESurface() oespicoli.OEMakeSurfaceFromGrid(refsrf, grd, 1.0) totalv = oespicoli.OESurfaceVolume(refsrf) # Mask out the fit molecule oegrid.OEMaskGridByMolecule(grd, fitmol) # Find how much of the reference volume is remaining fitsrf = oespicoli.OESurface() oespicoli.OEMakeSurfaceFromGrid(fitsrf, grd, 1.0) remaining = oespicoli.OESurfaceVolume(fitsrf) print("Percent overlap: %f" % ((1 - remaining / totalv) * 100)) return 0
def main(argv=[__name__]): if len(argv) != 3: oechem.OEThrow.Usage("%s <protein> <ligand>" % argv[0]) ifs = oechem.oemolistream() if not ifs.open(argv[1]): oechem.OEThrow.Fatal("Unable to open %s for reading" % argv[1]) protein = oechem.OEGraphMol() oechem.OEReadMolecule(ifs, protein) if not ifs.open(argv[2]): oechem.OEThrow.Fatal("Unable to open %s for reading" % argv[2]) ligand = oechem.OEGraphMol() oechem.OEReadMolecule(ifs, ligand) oechem.OEAssignBondiVdWRadii(protein) oechem.OEMMFFAtomTypes(protein) oechem.OEMMFF94PartialCharges(protein) oechem.OEAssignBondiVdWRadii(ligand) oechem.OEMMFFAtomTypes(ligand) oechem.OEMMFF94PartialCharges(ligand) cmplx = oechem.OEGraphMol(protein) oechem.OEAddMols(cmplx, ligand) epsin = 1.0 spacing = 0.5 zap = oezap.OEZap() zap.SetInnerDielectric(epsin) zap.SetGridSpacing(spacing) PrintHeader(protein.GetTitle(), ligand.GetTitle()) CalcBindingEnergy(zap, protein, ligand, cmplx) zap.SetFocusTarget(ligand) CalcBindingEnergy(zap, protein, ligand, cmplx) return 0
def main(argv=[__name__]): if len(argv) != 3: oechem.OEThrow.Usage("%s <protein> <ligands>" % argv[0]) protein = oechem.OEMol() ifs = oechem.oemolistream() if not ifs.open(argv[1]): oechem.OEThrow.Fatal("Unable to open %s for reading" % argv[1]) oechem.OEReadMolecule(ifs, protein) oechem.OEAssignBondiVdWRadii(protein) oechem.OEMMFFAtomTypes(protein) oechem.OEMMFF94PartialCharges(protein) print("protein: " + protein.GetTitle()) epsin = 1.0 bind = oezap.OEBind() bind.GetZap().SetInnerDielectric(epsin) bind.SetProtein(protein) results = oezap.OEBindResults() if not ifs.open(argv[2]): oechem.OEThrow.Fatal("Unable to open %s for reading" % argv[2]) ifs.SetConfTest(oechem.OEIsomericConfTest()) ligand = oechem.OEMol() while oechem.OEReadMolecule(ifs, ligand): oechem.OEAssignBondiVdWRadii(ligand) oechem.OEMMFFAtomTypes(ligand) oechem.OEMMFF94PartialCharges(ligand) print("ligand: %s has %d conformers" % (ligand.GetTitle(), ligand.NumConfs())) for conf in ligand.GetConfs(): bind.Bind(conf, results) print(" conf# %d be = %f" % (conf.GetIdx(), results.GetBindingEnergy())) return 0
def ImportMolecule(filename): ifs = oechem.oemolistream() if not ifs.open(filename): oechem.OEThrow.Fatal("Unable to open %s for reading" % filename) mol = oechem.OEGraphMol() oechem.OEReadMolecule(ifs, mol) oechem.OEAssignBondiVdWRadii(mol) oechem.OESuppressHydrogens(mol) return mol
def main(args): if len(args) != 4: oechem.OEThrow.Usage("%s <protein> <ligand> <surface>" % args[0]) prtfs = oechem.oemolistream(args[1]) prt = oechem.OEGraphMol() oechem.OEReadMolecule(prtfs, prt) oechem.OESuppressHydrogens(prt) oechem.OEAssignBondiVdWRadii(prt) ligfs = oechem.oemolistream(args[2]) lig = oechem.OEGraphMol() oechem.OEReadMolecule(ligfs, lig) oechem.OESuppressHydrogens(lig) oechem.OEAssignBondiVdWRadii(lig) grid = oegrid.OEScalarGrid() oespicoli.OEMakeVoidVolume(prt, lig, grid, 0.5) surf = oespicoli.OESurface() oespicoli.OEMakeSurfaceFromGrid(surf, grid, 0.5) oespicoli.OEWriteSurface(args[3], surf) return 0
def main(argv=[__name__]): if len(argv) != 2: oechem.OEThrow.Usage("%s <molfile>" % argv[0]) ifs = oechem.oemolistream(argv[1]) for mol in ifs.GetOEMols(): oechem.OEAssignBondiVdWRadii(mol) area, polararea = AverageSurfaceArea(mol) print(mol.GetTitle()) print("molecule has %d conformers" % mol.NumConfs()) print("Average total surface area: %f" % area) print("Average polar area : %f" % polararea) print("Average %% polar : %f" % ((polararea/area) * 100)) print() return 0
def main(args): if len(args) != 3: oechem.OEThrow.Usage("%s <protein> <surface>" % args[0]) ifs = oechem.oemolistream() if not ifs.open(args[1]): oechem.OEThrow.Fatal("Unable to open %s for reading" % args[1]) mol = oechem.OEGraphMol() oechem.OEReadMolecule(ifs, mol) oechem.OEPerceiveResidues(mol) oechem.OEAssignBondiVdWRadii(mol) # Generate the molecular surface surf = oespicoli.OESurface() oespicoli.OEMakeMolecularSurface(surf, mol, 0.5) # Mark all the vertices associated with hydrophobic atoms for i in range(surf.GetNumVertices()): atom = mol.GetAtom(oechem.OEHasAtomIdx(surf.GetAtomsElement(i))) if (AtomInHydrophobicResidue(atom)): surf.SetVertexCliqueElement(i, 1) # Crop to only those triangles oespicoli.OESurfaceCropToClique(surf, 1) # nlqs is the number of different connected components nclqs = oespicoli.OEMakeConnectedSurfaceCliques(surf) # Find the largest component maxclq = 0 maxarea = 0.0 for i in range(nclqs): area = oespicoli.OESurfaceCliqueArea(surf, i+1) print("clique: %d area: %f" % (i+1, area)) if (area > maxarea): maxclq = i+1 maxarea = area # Crop to it oespicoli.OESurfaceCropToClique(surf, maxclq) oespicoli.OEWriteSurface(args[2], surf) return 0
def main(args): if len(args) != 3: oechem.OEThrow.Usage("%s <protein> <surface>" % args[0]) prtfs = oechem.oemolistream() if not prtfs.open(args[1]): oechem.OEThrow.Fatal("Unable to open %s for reading" % args[1]) prt = oechem.OEGraphMol() oechem.OEReadMolecule(prtfs, prt) oechem.OEAssignBondiVdWRadii(prt) surf = oespicoli.OESurface() oespicoli.OEMakeCavitySurfaces(prt, surf) oespicoli.OEInvertSurface(surf) oespicoli.OEWriteSurface(args[2], surf) return 0
def main(argv=[__name__]): if len(argv) != 2: oechem.OEThrow.Usage("%s <molfile>" % argv[0]) ifs = oechem.oemolistream() if not ifs.open(argv[1]): oechem.OEThrow.Fatal("Unable to open %s for reading" % argv[1]) mol = oechem.OEGraphMol() oechem.OEReadMolecule(ifs, mol) oechem.OEAssignBondiVdWRadii(mol) oechem.OEMMFFAtomTypes(mol) oechem.OEMMFF94PartialCharges(mol) epsin = 1.0 zap = oezap.OEZap() zap.SetInnerDielectric(epsin) zap.SetMolecule(mol) grid = oegrid.OEScalarGrid() if zap.CalcPotentialGrid(grid): oegrid.OEWriteGrid("zap.grd", grid)
def main(argv=[__name__]): if len(argv) != 2: oechem.OEThrow.Usage("%s <molfile>" % argv[0]) epsin = 1.0 zap = oezap.OEZap() zap.SetInnerDielectric(epsin) mol = oechem.OEGraphMol() ifs = oechem.oemolistream() if not ifs.open(argv[1]): oechem.OEThrow.Fatal("Unable to open %s for reading" % argv[1]) while oechem.OEReadMolecule(ifs, mol): PrintHeader(mol.GetTitle()) forces = oechem.OEFloatArray(mol.GetMaxAtomIdx() * 3) oechem.OEAssignBondiVdWRadii(mol) oechem.OEMMFFAtomTypes(mol) oechem.OEMMFF94PartialCharges(mol) zap.SetMolecule(mol) zap.CalcForces(forces) PrintForces(mol, forces) return 0
def main(args): if len(args) != 3: oechem.OEThrow.Usage("%s <molecules> <oebfile>" % args[0]) ifs = oechem.oemolistream() if not ifs.open(args[1]): oechem.OEThrow.Fatal("Unable to open %s for reading" % args[1]) ofs = oechem.oemolostream() if not ofs.open(args[2]): oechem.OEThrow.Fatal("Unable to open %s for writing" % args[2]) for mol in ifs.GetOEGraphMols(): oechem.OEAssignBondiVdWRadii(mol) surf = oespicoli.OESurface() oespicoli.OEMakeMolecularSurface(surf, mol, 0.5) ColorSurface(surf, mol) mol.SetData("psasurf", surf) oechem.OEWriteMolecule(ofs, mol) return 0
def main(argv=[__name__]): if len(argv) != 2: oechem.OEThrow.Usage("%s <molfile>" % argv[0]) ifs = oechem.oemolistream() if not ifs.open(argv[1]): oechem.OEThrow.Fatal("Unable to open %s for reading" % argv[1]) mol = oechem.OEGraphMol() oechem.OEReadMolecule(ifs, mol) oechem.OEAssignBondiVdWRadii(mol) oechem.OEMMFFAtomTypes(mol) oechem.OEMMFF94PartialCharges(mol) zap = oezap.OEZap() zap.SetInnerDielectric(1.0) zap.SetGridSpacing(0.5) zap.SetMolecule(mol) # calculate standard 2-dielectric grid grid1 = oegrid.OEScalarGrid() zap.CalcPotentialGrid(grid1) # calculate grid with single dielectric grid2 = oegrid.OEScalarGrid() zap.SetOuterDielectric(zap.GetInnerDielectric()) zap.CalcPotentialGrid(grid2) # take the difference oegrid.OESubtractScalarGrid(grid1, grid2) # mask out everything outside the molecule oegrid.OEMaskGridByMolecule(grid1, mol, oegrid.OEGridMaskType_GaussianMinus) oegrid.OEWriteGrid("zap_diff.grd", grid1)
import sys from openeye import oechem from openeye import oespicoli if len(sys.argv) != 2: oechem.OEThrow.Usage("%s <input>" % sys.argv[0]) ims = oechem.oemolistream() if not ims.open(sys.argv[1]): oechem.OEThrow.Fatal("Unable to open %s" % sys.argv[1]) mol = oechem.OEGraphMol() if not oechem.OEReadMolecule(ims, mol): oechem.OEThrow.Fatal("Unable to read a molecule") oechem.OEAssignBondiVdWRadii(mol) # @ <SNIPPET-SetData> surf = oespicoli.OESurface() oespicoli.OEMakeMolecularSurface(surf, mol) mol.SetData("surface", surf) ofs = oechem.oemolostream("foo.oeb") oechem.OEWriteMolecule(ofs, mol) # @ </SNIPPET-SetData> ofs.close() # @ <SNIPPET-GetData> ifs = oechem.oemolistream("foo.oeb") oechem.OEReadMolecule(ifs, mol)