)
            idx += 1
            outfh.write(outstring)

            # it would be also nice to have permanent contact, but they are rare and probably captured by environment

    outfh.close()


dirs = [x for x in os.listdir(".") if os.path.isdir(x)]

tabfile = open(args.t)
count = 0
for line in tabfile:
    count += 1
    mut = mustpress.getMutation(line.strip())
    outf = args.outdir + "/" + mut.dir + "/" + mut.dir + mut.m + "." + args.ext
    if os.path.isfile(outf):
        continue

    verbosef = args.sdir + "/" + mut.p.lower() + ".clean.cmapv"
    if not os.path.isfile(verbosef):
        continue
    contacts, denominator_cons, denominator_cen = parseVerbose(verbosef, mut)

    if not os.path.isdir(args.outdir + "/" + mut.dir):
        os.makedirs(args.outdir + "/" + mut.dir)

    computeContacts(mut, contacts, denominator_cons, denominator_cen, outf)
    print str(count), "completed"
Esempio n. 2
0
par.add_argument('--uplimit', help = 'top n sequences to calculate')
par.add_argument('--wgap', help = 'if query is with gap, give a location to find intact fragments for query')
args = par.parse_args()
if args.wgap != None:
    args.wgap = General.absPath(args.wgap)

lines = open(args.tab).readlines()
odir = os.getcwd()
jobs = []
seen = {}
    
for line in lines:
    os.chdir(odir)
    if line.startswith('#'):
        continue
    mut = mustpress.getMutation(line)
    os.chdir(mut.dir)
    pdbs = glob.glob('*.pdb')
    pdbs.sort()

    for pdb in pdbs:
        base = General.getBase(pdb)
        matchf = args.head + '_' + base + '.match'
        if not os.path.isfile(matchf):
            continue
        outname = General.getBase(matchf) + '.' + args.o
        if os.path.isfile(outname):
            continue
        if outname in seen:
            continue
        seen[outname] = 1
Esempio n. 3
0
for nmrl in open(nmrf):
	nmrid = nmrl.strip().split()[0]
	nmrids.append(nmrid)
aaclass = {x : 'hydro' for x in ['V', 'I', 'L', 'M', 'F', 'Y', 'W'] }
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':