# iterator of conDforMatches.py import os, sys, argparse, glob import General, PDB, Constants, mustpress from time import sleep selfbin = General.selfbin(sys.argv[0]) par = argparse.ArgumentParser() par.add_argument('--tab', required = True, help = 'a .tab file') par.add_argument('--head', required = True, help = 'head of .seq file') par.add_argument('--o', default = 'env', help = 'suffix of output file') 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()
if tems[m][0] == "#": continue tem = tems[m].split() (temp, peplen) = (tem[0], tem[5]) if int(peplen) < args.pepl: # peptide length in template is not long enough continue if not os.path.isfile(pepid + "/model" + str(m) + ".out/score.sc"): if args.psfix == "": tempdb = args.pdbbin + "/" + temp + ".pdb" else: tempdb = args.pdbbin + "/" + temp + "_" + args.psfix + ".pdb" cmd = [ "python", SELFBIN + "/fpd.py", "--p", General.absPath(args.p), "--range", " ".join(args.r), "--pname", pepid, "--pseq", " ".join(pep), "--m", tempdb, "--dname", "model" + str(m) + ".out", ] if not args.abinitio: # cmd.extend(['--flip']) cmd.extend(["--ab", "0"]) elif first == True:
import os, argparse, glob from math import sqrt import General par = argparse.ArgumentParser() par.add_argument('--head', required = True, help = 'head of .match files') par.add_argument('--o', required = True, help = 'suffix of the output file') par.add_argument('--local', required = True, help = 'location of local structure data') par.add_argument('--localh', required = True, help = 'the head of local .env files') par.add_argument('--env', nargs = 2, help = 'the suffix of the non-local and local .env files') args = par.parse_args() args.local = General.absPath(args.local) odir = os.getcwd() dirs = [x for x in os.listdir('.') if os.path.isdir(x)] dirs.sort() def calculateOverlap(list1, list2): # n_less = min(len(list1), len(list2)) # n_common = len(list(set(list1[0:n_less]).intersection(list2[0:n_less]))) # overlap = 0 # if n_less != 0: # overlap = float(n_common) / n_less # return overlap n_common = len( list( set(list1).intersection(list2) ) ) overlap = 0 if n_common != 0: overlap = float(n_common) / sqrt(len(list1) * len(list2)) return overlap for d in dirs: