def Apply(self): path = self.getPaths()[0] surf = self.surfList.getvalue() if not surf: replyobj.error("No surface chosen to save.\n") return from WriteDMS import writeDMS replyobj.status("Writing DMS surface to %s\n" % path) writeDMS(surf, path, writeNormals=self.saveNormalsVar.get(), displayedOnly=self.displayedOnlyVar.get()) replyobj.status("Wrote DMS surface to %s\n" % path)
def main(): if len(sys.argv) != 3: # if no input print "ERORR" return input_mol2 = sys.argv[1] output_dms = sys.argv[2] runCommand("open " + input_mol2) # generate surface using 'surf' command runCommand("surf") # get the surf object surf = openModels.list(modelTypes=[MSMSModel])[0] # write DMS writeDMS(surf, output_dms) return
import optparse parser = optparse.OptionParser() parser.add_option('--pdb_in', default=None, help='Input PDB file') parser.add_option('--dms_out', default=None, help='Output dms file') (args, options) = parser.parse_args() import os if not os.path.exists(args.pdb_in): raise Exception(args.pdb_in+' does not exist') print 'Processing '+args.pdb_in import chimera chimera.openModels.open(args.pdb_in) # Molecular surface from chimera import runCommand, openModels, MSMSModel chimera.runCommand("surf") # generate surface using 'surf' command surf = openModels.list(modelTypes=[MSMSModel])[0] # get the surf object from WriteDMS import writeDMS writeDMS(surf, args.dms_out) # write DMS
# run with ## chimera --nogui olfr1392_1u19_noH.pdb writedms.py ## chimera --nogui pdb:3D7F_withoutLigand writedms.py # chimera --nogui Q9I8C1_27_noH.pdb writedms.py # where this py file is named writedms.py # it would run chimera without gui on the file 3D7F_withoutLigand.pdb # and it would output to a file called 3D7F_without_ligand.dms from chimera import runCommand, openModels, MSMSModel # generate surface using 'surf' command runCommand("surf") # get the surf object surf = openModels.list(modelTypes=[MSMSModel])[0] # write DMS from WriteDMS import writeDMS #writeDMS(surf, "3D7F_rec_noH.dms") #writeDMS(surf, "olfr1392_1u19_noH.dms") #writeDMS(surf, "Q9I8C1_27_aligned_noH.dms") writeDMS(surf, "rec.dms")
import optparse parser = optparse.OptionParser() parser.add_option('--pdb_in', default=None, help='Input PDB file') parser.add_option('--dms_out', default=None, help='Output dms file') (args, options) = parser.parse_args() import os if not os.path.exists(args.pdb_in): raise Exception(args.pdb_in + ' does not exist') print 'Processing ' + args.pdb_in import chimera chimera.openModels.open(args.pdb_in) # Molecular surface from chimera import runCommand, openModels, MSMSModel chimera.runCommand("surf") # generate surface using 'surf' command surf = openModels.list(modelTypes=[MSMSModel])[0] # get the surf object from WriteDMS import writeDMS writeDMS(surf, args.dms_out) # write DMS
import sys from chimera import runCommand, openModels, MSMSModel infile = sys.argv[1] probe_radius = sys.argv[2] dms_filename = sys.argv[3] runCommand("open %s" % infile) runCommand("surface probeRadius %s" % probe_radius) surf = openModels.list(modelTypes=[MSMSModel])[0] from WriteDMS import writeDMS writeDMS(surf, dms_filename)
import chimera import sys import re from DockPrep import prep from DockPrep import AddH from WriteMol2 import writeMol2 # ref: http://mailman.docking.org/pipermail/dock-fans/2007-May/001043.html models = chimera.openModels.list(modelTypes=[chimera.Molecule]) prep(models, addHFunc=AddH.hbondAddHydrogens) root = models[0].name.replace(".pdb", "") if len(sys.argv) == 2: d = re.sub("/$", "", sys.argv[1]) + "/" else: d = "" writeMol2(models, d + root + "_prepped.mol2") # ref: http://plato.cgl.ucsf.edu/pipermail/chimera-users/2011-March/006134.html chimera.runCommand("surf") surf = chimera.openModels.list(modelTypes=[chimera.MSMSModel])[0] from WriteDMS import writeDMS writeDMS(surf, d + root + ".dms")
#!/usr/bin/env python """ use chimera to generate a receptor surface file example usage: >> chimera --nogui --script "/home/kmckiern/scripts/clc/dock/gen_surf.py \ receptor.pdb" """ import os from chimera import runCommand as rc from chimera import openModels, MSMSModel from WriteDMS import writeDMS import sys fn = sys.argv[1] pref = fn.split('.')[0] rc('open ' + fn) rc("surf") surf = openModels.list(modelTypes=[MSMSModel])[0] writeDMS(surf, pref + '.dms') rc('close all') rc('stop now')