#!/usr/bin/python import fpdb import sys, os traj = 'prod/traj.pdb' os.system("shift_lig.py") frame = next(fpdb.next_frame(traj)) with open("prod/a1.pdb", 'w') as ofp: for line in frame: ofp.write(line) with open("prod/rec.pdb", 'w') as ofp: for resi in fpdb.fPDB(frame).topology.get_protein_residues(): resi.write_pdb(ofp) n = 0 with open("runspa.bash", 'w') as ofp: ofp.write("#!/bin/bash\n") ofp.write("source ~/.bashrc\n") while True: if os.path.isdir("spa_%d" % n): os.system("cp prod/a1.pdb spa_%d" % n) os.system("cp prod/rec.pdb spa_%d" % n) os.system("cp lig_shift.pdb spa_%d/a1_lig.pdb" % n) os.system("cp %s/para/SPA.amoeba.para spa_%d/SPA.para" % (os.environ['SPAHOME'], n)) ofp.write("cd spa_%d\n" % n) ofp.write("%s/bin/SPA_main SPA.para\n" % os.environ['SPAHOME'])
import sys, os import fpdb import pickle import matplotlib.pyplot as plt infile = sys.argv[1] try: title = sys.argv[2] except: title = "RMSF" # load coords if True: coords = list() f1 = next(fpdb.next_frame(infile)) for line in f1: if len(line) > 54 and line[17:20] in fpdb.standard_protein_residues: coords.append(list()) print len(coords) n_frame = 0 for frame in fpdb.next_frame(infile): n = 0 for line in frame: if len(line ) > 54 and line[17:20] in fpdb.standard_protein_residues: x = float(line[30:38]) y = float(line[38:46]) z = float(line[46:54])
#!/usr/bin/python import sys, os import fpdb infile = sys.argv[1] a1_file = 'a1.pdb' lig_file = 'a1_lig.pdb' rec_file = 'rec.pdb' para_source = '/home/fuqiuyu/work/nmr_druggability/md/finished/1dhm/spa/SPA.para' para_file = 'SPA.para' print ">>>>> preparing SPA input files" for model in fpdb.next_frame(infile): pdb = fpdb.fPDB(model) pdb.write_pdb(a1_file) print "----- sys pdb done." ofp_rec = open(rec_file, 'w') for residue in pdb.topology.residues: if residue.name in fpdb.standard_protein_residues: residue.write_pdb(ofp_rec) print "----- rec pdb done." ofp_lig = open(lig_file, 'w') for line in open(rec_file): if len(line) >= 6 and line[:6] in ('ATOM ', 'HETATM'): if line[12:16].strip() not in ('C', 'O', 'N', 'CA'):
#!/usr/bin/python import sys, os import fpdb infile = sys.argv[1] N = int(sys.argv[2]) count = 0 for frame in fpdb.next_frame(infile): if count % N == 0: try: os.mkdir("spa_%d" % (count / N)) except: pass ofp = open("spa_%d/traj.pdb" % (count / N), 'w') print ">>>>> Traj splited %d" % (count / N) for line in frame: ofp.write(line) print "----- Frame %d" % count count += 1