From 2394d71dfdd90090a0be03552dc52d1b1593a9d0 Mon Sep 17 00:00:00 2001 From: radakb Date: Tue, 7 Oct 2025 12:42:48 -0500 Subject: [PATCH] Multiple bug fixes 1) Fix buffer overflow error in fpocket with the -d option The buffer for env_atm filenames was too short for systems with > 9 pockets. There's probably a better way to fix this than just increasing the buffer size but this does the trick for all cases where I encountered the error. 2) Correct amino acid labels in fpocket descriptor output The order of amino acid names in fpout.c did not match the hardcoded order in aa.h. I spent two days looking for a reason as to why different amino acids would be found by fpocket and dpocket (see bug 3), but it turns out it was just a labeling error. 3) Correct the dpocket ASA calculation for implicit pockets near the ligand The implicit pocket descriptors were being computed with `pdb_w_lig` which resulted in different areas from fpocket because they are influenced by nearby ligand atoms. There was no issue when no ligand was present bc the `pdb` and `pdb_w_lig` data structures are identical in that case. I could not find any reason why ligand information would NEED to be present in that part of set_descriptors(). The parts where explicit pocket information are useful (example overlap calculations) should be unchanged. Note that a similar issue seems to persist for explicit pocket definitions and this might explain why the drug score for explicit pockets is always zero (a bug reported elsewhere). I tested all of these changes by running fpocket and dpocket on the same complex and its synthetic "apo" pdb. I then diffed all descriptors in stdout from fpocket -d and in dpout_fpocketp.txt (only for the pocket with the largest overlap). The results were identical for atleast 10 random pdbs curated in the HiQBind data set. --- src/fpout.c | 2 +- src/pocket.c | 2 +- src/writepocket.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/fpout.c b/src/fpout.c index 26f501c1..6457676a 100644 --- a/src/fpout.c +++ b/src/fpout.c @@ -261,7 +261,7 @@ void write_descriptors_DB(c_lst_pockets *pockets, FILE *f) fprintf(f, "cav_id drug_score volume nb_asph inter_chain apol_asph_proportion mean_asph_radius " "as_density mean_asph_solv_acc mean_loc_hyd_dens flex hydrophobicity_score volume_score charge_score " "polarity_score a0_apol a0_pol af_apol af_pol n_abpa " - "ala cys asp glu phe gly his ile lys leu met asn pro gln arg ser thr val trp tyr " + "ala arg asn asp cys gln glu gly his ile leu lys met phe pro ser thr trp tyr val " "chain_1_type chain_2_type num_res_chain_1 " "num_res_chain_2 lig_het_tag name_chain_1 name_chain_2\n"); while (npcur) diff --git a/src/pocket.c b/src/pocket.c index c114d2e4..c0a93f25 100644 --- a/src/pocket.c +++ b/src/pocket.c @@ -614,7 +614,7 @@ void set_pockets_descriptors(c_lst_pockets *pockets,s_pdb *pdb,s_fparams *params /* Calculate descriptors*/ - set_descriptors(pocket_atoms, natms, tab_vert,pcur->v_lst->n_vertices, pcur->pdesc,niter,pdb_w_lig,params->flag_do_asa_and_volume_calculations) ; + set_descriptors(pocket_atoms, natms, tab_vert,pcur->v_lst->n_vertices, pcur->pdesc,niter,pdb,params->flag_do_asa_and_volume_calculations) ; my_free(pocket_atoms) ; diff --git a/src/writepocket.c b/src/writepocket.c index 8eca49f0..781b3c62 100644 --- a/src/writepocket.c +++ b/src/writepocket.c @@ -79,7 +79,7 @@ static const char atomSiteHeader[] = void write_each_pocket_for_DB(const char out_path[], c_lst_pockets *pockets, s_pdb *pdb) { int out_len = strlen(out_path); - char out[out_len + 20]; + char out[out_len + 22]; out[0] = '\0'; node_pocket *pcur;