__author__ = 'fanzheng' import sys from General import * import PDB par = argparse.ArgumentParser() par.add_argument('--p', nargs='+', help='input structures') par.add_argument('--o', help='a file of mutation as output') args = par.parse_args() outf = open(args.o, 'w') for p in args.p: resi = PDB.ConRes(p) renamep = getPath(p) + '/' + removePath(p).replace('_', '-') if renamep != p: os.system('cp ' + p + ' ' + renamep) for r in resi: chain, pos, wt = r.getChid(), r.getResnum(), r.getResname() outstr = [ removePath(getBase(renamep)), chain, PDB.t2s(wt), str(pos), 'A', '0' ] outstr = '\t'.join(outstr) outf.write(outstr + '\n') outf.close()
from General import * import PDB import scipy.io as sio par =argparse.ArgumentParser() par.add_argument('--p', required=True, help='input structure') par.add_argument('--m', required = True, help = 'the output of matlab') par.add_argument('--i', required = True, help = 'a residue file') par.add_argument('--ii', required = True, help = 'a contact file') par.add_argument('--o', required=True, help= 'output file') args = par.parse_args() vals = sio.loadmat(args.m)['currentParamsValues'] residueNames = {} residues = PDB.ConRes(args.p) for r in residues: rid = r.getChid() + str(r.getResnum()) rname = r.getResname() residueNames[rid] = rname tscore = 0 with open(args.o, 'w') as of, open(args.i) as rf, open(args.ii) as cf: rfl = rf.readlines() cfl = cf.readlines() for i in range(len(rfl)): rid = rfl[i].strip() rname = residueNames[rid] rind = PDB.aaindex[PDB.t2s(rname)] try: score = vals[i][0].flatten()[rind]