# ============================================================================ # # This script prepares the file used for clustering of the multiple "fits" # # ======================= Maya Topf, 19 Dec 2008 ============================ import shutil import sys, os, os.path import string import math os.system("grep -A 6 --regexp={\"prot name\",\"RMS_1 RMS_2\",\"37 EM density\",\"25 Phi/Psi\"} run_score.log | grep --regexp={prot,Bond,Stereochemical,Soft,Phi,EM} | grep -v runcmd > score.txt ") os.system("rm -f *.MRC") #reading scores: score_list=[] f = open('score.txt','r') for line in f.read().split('\n'): score_list.append(line) f.close() score=[] stereo=0 stereonb=0 energy=0 CCF=0 rest="" f = open('score_sum.txt','w') score_name = ("name\tE_total\tstereo\tstereo-nb\tnb\tCCF") for score_line in score_list: if score_line== "": break elif score_line.split(': ')[0] == 'prot name': prot_name = score_line.split(': ')[1] f.write("%s\n" %score_line) f.write("restraint_type\tscore\n") stereo=0 stereonb=0 energy=0 else: print (score_line.split(':')[0]).split()[0] rest=score_line.split(':')[0] score.append(float((score_line.split(':')[1]).split()[5])) f.write('%s\t%.2f\n' % (rest, score[-1])) if int(rest.split()[0])<=4: stereo=stereo+score[-1] stereonb=stereonb+score[-1] energy=energy+score[-1] elif int(rest.split()[0])==25: stereo=stereo+score[-1] stereonb=stereonb+score[-1] energy=energy+score[-1] elif int(rest.split()[0])==5: stereonb=stereonb+score[-1] energy=energy+score[-1] nb = score[-1] else: CCF=score[-1] energy=energy+score[-1] f.write('%s\n' % score_name) f.write('%s\t%.2f\t%2.f\t%2.f\t%.2f\t%.2f\n' % (prot_name, energy, stereo, stereonb, nb, CCF)) f.close() os.system("grep -A 1 total score_sum.txt | grep -v --regexp={total,\-\-} > list_pdb_score")