예제 #1
0
# contact potential
condbins = [0.01, 0.02, 0.05, 0.1, 0.2, 0.5, 1]
priR_list = [x.strip() for x in open(args.conpot).readlines()]
assert len(priR_list) == len(condbins) -1
conpots = {}
for priR_file in priR_list:
    conpots[priR_file] = np.loadtxt('/u/fzheng/home/searchDB/statistics/' + priR_file)

pid = General.removePath(args.s).split('.')[0]
for i in range(1, len(residues)-1):
    res = residues[i]
    resid = res.getChid() + str(res.getResnum())

    selfFreedom = freedom[resid]
    self_freebin = mustpress.determineBin(freedom_bins, selfFreedom)
    selfphi, selfpsi = phipsi[resid]
    self_phibin, self_psibin = mustpress.determineBin(pp_bins, selfphi, na = True), mustpress.determineBin(pp_bins, selfpsi, na = True)

    E_env = np.ravel(freedom_pots[self_freebin, :])
    E_pp = np.ravel(pp_pots[self_phibin, self_psibin, :])

    # backbone term
    E_bb = np.array([0.0 for x in range(20)])
    for con1 in contacts1[resid]:
        countf = dirbb + pid + '_' + resid + '_' + con1 + '.' + args.ext[0]
        if not os.path.isfile(countf):
            continue
        with open(countf) as cf:
            cfcsv = csv.DictReader(cf, delimiter= '\t')
            for row in cfcsv:
예제 #2
0
			if args.conR:
				out.write('\t')
				out.write('\t'.join(['contact', 'total_con', 'count_wt_bg', 'count_mt_bg', 'wt_bg_exp', 'mt_bg_exp']))
			out.write('\n')
		wtc, mtc, wt_exp, mt_exp = [0.0 for x in range(4)]
		if args.conR:
			total_con, wtc_bg, mtc_bg, wt_bg_exp, mt_bg_exp = [0.0 for x in range(5)]


		for i in range(len(aacol)):
			aa1 = PDB.t2s(aacol[i])
			### background model
			if args.env != None:
				if fdcol[i] == 'NA':
					continue
				target_fdbin = mustpress.determineBin(ebins, float(fdcol[i]))
				denom = np.exp(-epots[target_fdbin, :] -bgpots[:]).sum()
				proaa_wt = exp(-epots[target_fdbin, aaindex[args.wt]]-bgpots[aaindex[args.wt]]) / denom
				proaa_mt = exp(-epots[target_fdbin, aaindex[mut]]-bgpots[aaindex[mut]]) / denom
				# denom = epots[target_fdbin, :].sum()
				# proaa_wt = epots[target_fdbin, aaindex[args.wt]] /denom
				# proaa_mt = epots[target_fdbin, aaindex[mut]] /denom

				if args.conR:
					if fdcol2[i] == 'NA':
						continue
					target_fdbin2 = mustpress.determineBin(ebins, float(fdcol2[i]))
					denom = np.exp(-epots[target_fdbin2, :] -bgpots[:]).sum()
					proaa_con = exp(-epots[target_fdbin2, aaindex[cres]]-bgpots[aaindex[cres]]) / denom
					# denom = epots[target_fdbin2, :].sum()
					# proaa_con = epots[target_fdbin2, aaindex[cres]] /denom
예제 #3
0
aaclass.update( {x : 'charge' for x in ['R', 'H', 'K', 'D', 'E']} )
aaclass.update( {x : 'polar' for x in ['S', 'T', 'N', 'Q']} )
aaclass.update( {x : 'other' for x in ['C', 'G', 'P', 'A']} )
mass = {'G':57, 'A':71, 'S':87, 'P':97, 'V':99, 'T':101, 'C':103, 'I':113, 'L':113, 'N':114, 'D':115,
'K':128, 'Q':128, 'E':129, 'M':131, 'H':137, 'F':147, 'R':156, 'Y':163, 'W':186}

for tabl in tabf:
	if tabl.startswith('#'):
		continue
	tabl = tabl.strip()
	# print tabl
	mut = mustpress.getMutation(tabl)
	selfcon, selfcrd = mustpress.getSelfEnvironment(mut.p, mut.c, mut.n, args.sdir)
	selfFreedom, phi, psi = mustpress.getSelfFreedom(mut.p, mut.c, mut.n, args.sdir)
	if len(args.e) == 2:
		self_crdbin = mustpress.determineBin(ebins[0, :], selfcrd)
		self_conbin = mustpress.determineBin(ebins[self_crdbin + 1, :], selfcon)
		p_self_w = epots[self_crdbin, self_conbin, aaindex[mut.w]]
		p_self_m = epots[self_crdbin, self_conbin, aaindex[mut.m]]
	else:# freedom
		self_freebin = mustpress.determineBin(freedom_bins, selfFreedom)
		p_self_w = freedom_pots[self_freebin, freedom_aaindex[mut.w]]
		p_self_m = freedom_pots[self_freebin, freedom_aaindex[mut.m]]

	# phi, psi potential
	self_phibin, self_psibin = mustpress.determineBin(pp_bins, phi, na = True), mustpress.determineBin(pp_bins, psi, na = True)
	if self_phibin == 'NA' or self_psibin == 'NA':
		p_pp_w, p_pp_m = 0, 0
	else:
		p_pp_w = pp_pots[self_phibin, self_psibin, pp_aaindex[mut.w]]
		p_pp_m = pp_pots[self_phibin, self_psibin, pp_aaindex[mut.m]]