def create_restraints(): print os.getcwd() os.chdir('TEMPLATES') files = glob.glob('template_*.pdb') for f in files: name = '{}restraints'.format(f[0:-3]) print name,f create_constraints.main(fi=f,fo=name) os.chdir('..') print os.getcwd()
def generate_pairs(match,system): print system.seq print system.ss print system.sse os.chdir('TEMPLATES') #want to keep in order of importance: c0+c0 is more important than c0+c3. Have to do fair for all #pairings that lead to this Fragment (123 --> 1+23 and 12+3 --> the c0+c0 has to be first for both k = 0 for i in range(numb_cl): for j in range(numb_cl): for (f1,f2) in match: print i,j,f1,f2 s1 = 'h%s.cluster%i' % (f1,i) s2 = 'h%s.cluster%i' % (f2,j) print s1,s2 (tmp1,end,ty) = system.sse[int(str(f1)[-1])-1] if int(str(f1)[0]) == 1: tmp1 = 0 else: tmp1 = tmp1-2 (start,tmp2,ty) = system.sse[int(str(f2)[0])-1] print tmp1,end,ty,start,tmp2,ty #The numbering is amber like, starts at 1. For beggining of loop (end of first fragment) #we would do -1 and +1 to select the first "." instead of "H" or "E", so keep same number #For the end of loop, we should do -1 and -1; since the [ini:fin] is a [:) f(x), only do -1 loop = str(system.seq)[end:start-1] print loop renumb = str(system.seq)[tmp1:start-1] print renumb #Since there is overlap of one residue to superimpose, correct by 1 offset = len(renumb) - 1 print "offset: ",offset assemble.make_assembly(first_sse=s1,sec_sse=s2,loop_aa=loop,output_name='template_%i.pdb' % k) fo = open('template_%i.restraints' % k,'w') create_constraints.main(fi=s1,fo=fo,offset=0) create_constraints.main(fi=s2,fo=fo,offset=offset) k += 1 os.chdir('..')