def setWorkingDirectory(self): newWorkDir = tkFileDialog.askdirectory( title='Set working directory', initialdir='', parent=self.parent) cmd.cd(newWorkDir) cwd.set(newWorkDir) message("Working directory changed to: " + newWorkDir); return
def setWorkingDirectory(self): newWorkDir = tkFileDialog.askdirectory(title='Set working directory', initialdir='', parent=self.parent) cmd.cd(newWorkDir) self.cwd.set(newWorkDir) message("Working directory changed to: " + newWorkDir) return
def testCdLsPwd(self): with testing.mkdtemp() as path: cmd.cd(path) self.assertEqual(os.getcwd(), os.path.realpath(path)) touch('foo1.txt') touch('foo2.txt') touch('foo3.bin') cmd.feedback("disable", "python", "output") cmd.pwd() # no test of output possible cmd.ls('*.txt')
# Count counts = pd.Series(0, index=RADS) for a, b in product(internal_coords, all_coords): es = euclid_step(a, b) if es is not None: counts.loc[es] += 1 counts = counts.cumsum() # Mean per center atom meancounts = counts / N # Normalize to density volumina = pd.Series(4 / 3.0 * sp.pi * (RADS ** 3), index=RADS) density = meancounts / volumina # Correct for center density -= 1 / (4/3 * sp.pi * RADS ** 3) # Results counts.index = ["{}_correctcount".format(i) for i in counts.index] density.index = ["{}_density".format(i) for i in density.index] return pd.concat(([counts, density])) cmd.cd(PATH) result = [] pdbs = [] for pdb in os.listdir("."): if not pdb.endswith(".pdb"): continue pdbs.append(pdb) result.append(slowpacking(pdb)) #break result = pd.DataFrame(result, index=pdbs) result.to_csv("packing.csv")
def pymol_chdir(outdir): cmd.cd(outdir)
from pymol import cmd from chempy.models import Indexed from chempy import Bond, Atom from pymol import cmd if not os.path.exists("../data/clusters"): cmd.cd("$pymol_scripts") filename = './modules/rgb.py' exec(compile(open(filename, "rb").read(), filename, 'exec')) def create_bond(model, a1, a2): # one-based atom serial numbers b = Bond() b.index = [a1 - 1, a2 - 1] # zero-based indices! model.bond.append(b) def create_spheres(name, spheres, links, frame): cmd.delete(name) model = Indexed() for i in (range(len(spheres) / 4)): ai = i * 4 r = spheres[ai + 3] cluster = int(name[7:10]) if r <> 0.5: a=Atom() a.name = "X" + str(i) a.resi = str(cluster) a.vdw = spheres[ai + 3] a.coord = [spheres[ai], spheres[ai + 1], spheres[ai + 2]] model.atom.append(a)
from pymol import cmd if not os.path.exists("../data/clusters_timeless"): cmd.cd("$pymol_scripts") cmd.cd("modules") import caver cmd.cd("..") filename = './modules/rgb.py' exec(compile(open(filename, "rb").read(), filename, 'exec')) color = 1 list = os.listdir("../data/clusters_timeless") list.sort() name = '' for fn in list: old_name = name name = fn if color < 1000 and caver.new_cluster(old_name, name): color += 1 cmd.load('../data/clusters_timeless/' + fn, name) cmd.color('caver' + str(color), name) cmd.alter(name, 'vdw=b') cmd.do('set all_states,1') cmd.set('two_sided_lighting', 'on') cmd.set('transparency', '0.2')
# [proposed] use CNS to do simulated annealing on models and tidy them up (like in Morph) # <minimize powell> is the command (from morph_dist.inp) ## # Tell PyMOL to launch quiet (-q), and with no GUI (-c) # Make sure PyMOL has finished to launch before using any PyMOL modules. # Beware - many of the numbers here may have to be tweaked for your application # for example, Cys max accessible area is 30 ang^2 # would be different for other residues # different structures may require other convergence parameters __main__.pymol_argv = [ 'pymol', '-qc' ] pymol.finish_launching() wd = os.path.expanduser('~') #working directory == home directory. Messy. cmd.cd(wd) #prepare logfile for results only logfile = "log_" + datetime.now().strftime("%y%m%d-%H%M%S") + ".txt" header = "PDB_file, probe, C666SG_dist, C666_access, C666_clashes, all_clashes, fract_COM, BD_L2, AC_L2, del_dimer_COM\n".replace(", ","\t") l = open(logfile, 'w+') l.write(header) l.close() #fixed parameters source = "LBD_tet" residue_bury = 666 perp_axis = [0, 1, 0] #y?? para_axis = [1, 0, 0] #x?? dimer_one_subs = ["A", "D"] dimer_two_subs = ["C", "B"]
from pymol import cmd from pymol import preset from pymol import util from glob import glob import sys import os path = "" params = [] basepath = os.getcwd() try: path = sys.argv[len(sys.argv) - 1] print path cmd.cd(path) #index = sys.argv.index("--") #params = sys.argv[index:] #if(len(params) == 2): #path = params[1] #cmd.cd(path) #else: #print "No Path specified" except ValueError: print "No Path specified" for file in glob("*.pdb"): print "file: ", file listname = file.split(".") name = listname[0] cmd.load(file, name)
from pymol import cmd from pymol import preset from pymol import util from glob import glob import sys import os path = "" params = [] basepath = os.getcwd() try: path = sys.argv[len(sys.argv) - 1] print path cmd.cd(path) #index = sys.argv.index("--") #params = sys.argv[index:] #if(len(params) == 2): #path = params[1] #cmd.cd(path) #else: #print "No Path specified" except ValueError: print "No Path specified" for file in glob("*.pdb"): print "file: ", file listname = file.split(".") name = listname[0]; cmd.load(file, name)