if (to_recompute): extractPDB(u_pdb_filepath, u_chain_filepath, u_chain_name) # construct unbound the mesh. u_regular_mesh, u_vertex_normals, u_vertices, u_names = \ ext_and_trg.msms_wrap(u_chain_filepath, to_recompute=to_recompute) u_vertex_hbond, u_vertex_hphobicity, u_vertex_charges = \ ext_and_trg.compute_features(u_chain_filepath_base, u_vertices, u_names, u_regular_mesh, to_recompute=to_recompute) # construct Complex the mesh. C_regular_mesh, C_vertex_normals, C_vertices, C_names = \ ext_and_trg.msms_wrap(C_pdb_filepath, to_recompute=to_recompute) # identify groundtruth iface = ext_and_trg.find_iface(C_regular_mesh, u_regular_mesh, ground_truth_cut_dist) # save results save_ply(ply_filepath, u_regular_mesh.vertices,\ u_regular_mesh.faces, normals=u_vertex_normals, charges=u_vertex_charges,\ normalize_charges=True, hbond=u_vertex_hbond, hphob=u_vertex_hphobicity,\ iface=iface) ext_and_trg.copy_tmp2dst(ply_filepath, masif_opts['ply_chain_dir']) #ext_and_trg.copy_tmp2dst(u_chain_filepath, masif_opts['pdb_chain_dir']) # clean the /tmp dir my.run_it(r'rm ' + os.path.dirname(u_chain_filepath_base) + r'/*' + u_pdb_name + r'*') my.run_it(r'rm ' + os.path.dirname(u_chain_filepath_base) + r'/*' + C_pdb_name + r'*')
mesh = pymesh.form_mesh(v3, f3) # I believe It is not necessary to regularize the full mesh. This can speed up things by a lot. full_regular_mesh = mesh # Find the vertices that are in the iface. v3 = full_regular_mesh.vertices # Find the distance between every vertex in regular_mesh.vertices and those in the full complex. kdt = KDTree(v3) d, r = kdt.query(regular_mesh.vertices) d = np.square( d) # Square d, because this is how it was in the pyflann version. assert (len(d) == len(regular_mesh.vertices)) iface_v = np.where(d >= 2.0)[0] iface[iface_v] = 1.0 # Convert to ply and save. save_ply(out_filename1+".ply", regular_mesh.vertices,\ regular_mesh.faces, normals=vertex_normal, charges=vertex_charges,\ normalize_charges=True, hbond=vertex_hbond, hphob=vertex_hphobicity,\ iface=iface) else: # Convert to ply and save. save_ply(out_filename1+".ply", regular_mesh.vertices,\ regular_mesh.faces, normals=vertex_normal, charges=vertex_charges,\ normalize_charges=True, hbond=vertex_hbond, hphob=vertex_hphobicity) if not os.path.exists(masif_opts['ply_chain_dir']): os.makedirs(masif_opts['ply_chain_dir']) if not os.path.exists(masif_opts['pdb_chain_dir']): os.makedirs(masif_opts['pdb_chain_dir']) shutil.copy(out_filename1 + '.ply', masif_opts['ply_chain_dir']) shutil.copy(out_filename1 + '.pdb', masif_opts['pdb_chain_dir'])