import os import sys from extract_pts import * import numpy PDB = sys.argv[1] list_name = sys.argv[2] PDB_list = list(open('../data/User/'+PDB+'.pdb')) key_res_list = list(open('../data/User/'+list_name)) out_file = open('../data/User/'+PDB+'_XXX.ptf','w') [ID_dict,all_pos, all_lines, all_atom_type, PDB_entries] = grab_PDB(PDB_list) chain = 'A' # in VISTA.pdb for example. We rename it to 1xxx.pdb because the FEATURE program assumes a 4 letter code for line in key_res_list: ele = line.split() res_no = int(ele[0]) res = ele[1] chain_ID=(chain,res_no) res_atoms = ID_dict[chain_ID] res_type = res_atoms[0].res get_position=get_position_dict(res_atoms) func_clusters = res_to_key_atom[res_type] for func_atoms in func_clusters: ctr = [] for func_atom in func_atoms: if func_atom in get_position.keys(): ctr.append(get_position[func_atom]) ctr = numpy.mean(ctr,axis=0) out_file.write(PDB+'\t'+str("%.2f" % ctr[0])+'\t'+str("%.2f" % ctr[1])+'\t'+str("%.2f" % ctr[2])+'\t'+'#'+'\t'+chain+'\t'+res_type+'\t'+str(res_no)+'\n')