Compare commits

..

7 Commits

Author SHA1 Message Date
xvlaurent
08480cca17 Fix overflow in pocket file writing. 2026-03-09 10:32:58 +00:00
Peter Schmidtke
6c7c55dfdd Merge pull request #157 from Discngine/issue-151
issue-151 fix of chain reading atoms in read_mmcif & descriptor outpu…
2024-09-09 14:20:23 +02:00
Peter Schmidtke
fdd5a7d14e issue-151 fix of chain reading atoms in read_mmcif & descriptor output writing 2024-09-09 12:14:06 +00:00
Peter Schmidtke
9fdba19dd7 Merge pull request #154 from Discngine/issue-151
Bugfix of wrong atom_site parsing
2024-09-04 10:02:25 +02:00
Peter Schmidtke
4810330d32 fixes in molfile abi version 2024-07-23 15:01:04 +00:00
pschmidtke
c75e2d7f98 adding osx shared libraries 2024-07-23 10:00:35 +02:00
Peter Schmidtke
0e8b195945 issue-151 fix 2024-07-23 07:39:34 +00:00
8 changed files with 15 additions and 13 deletions

View File

@@ -81,8 +81,8 @@ typedef struct s_desc
characterChain2, /**< 0 if protein, 1 if nucl acid pocket, 2 if HETATM pocket*/
numResChain1, /**<number of resdiues on chain 1*/
numResChain2; /**<number of res on chain 2*/
char nameChain1[2], /**<name of the first chain in contact with the pocket*/
nameChain2[2]; /**<name of the second chain in contact with the pocket, if there is*/
char nameChain1[255], /**<name of the first chain in contact with the pocket*/
nameChain2[255]; /**<name of the second chain in contact with the pocket, if there is*/
char ligTag[8]; /**<het atom tag of ligands situated in the pocket*/
} s_desc ;

View File

@@ -65,7 +65,6 @@ s_desc* allocate_s_desc(void)
s_desc *desc = (s_desc*)my_malloc(sizeof(s_desc)) ;
reset_desc(desc) ;
return desc ;
}
@@ -364,7 +363,7 @@ void set_atom_based_descriptors(s_atm **atoms, int natoms, s_desc *desc,s_atm *a
nb_res_ids = 0 ; /* Current number of residus */
int nb_polar_atm = 0 ;
char curChainName[2];
char *curChainName = (char*)my_malloc(255*sizeof(char));
if(atoms && natoms>1){
firstatom=atoms[0];
@@ -373,8 +372,8 @@ void set_atom_based_descriptors(s_atm **atoms, int natoms, s_desc *desc,s_atm *a
if(element_in_std_res(firstatom->res_name)) desc->characterChain1=0;
else if(element_in_nucl_acid(firstatom->res_name)) desc->characterChain1=1;
else if(element_in_kept_res(firstatom->res_name)) desc->characterChain1=2;
strncpy(desc->nameChain1,firstatom->chain,2);
strncpy(curChainName,firstatom->chain,2);
strcpy(desc->nameChain1,firstatom->chain);
strcpy(curChainName,firstatom->chain);
desc->numResChain1 = countResidues(all_atoms,all_natoms,firstatom->chain);
for(i = 0 ; i < natoms ; i++) {
@@ -384,7 +383,7 @@ void set_atom_based_descriptors(s_atm **atoms, int natoms, s_desc *desc,s_atm *a
desc->interChain = 1;
if(!desc->numResChain2){
desc->numResChain2 = countResidues(all_atoms,all_natoms,curatom->chain);
strncpy(curChainName,curatom->chain,1);
strcpy(curChainName,curatom->chain);
}
}

View File

@@ -124,9 +124,13 @@ s_pdb *open_mmcif(char *fpath, const char *ligan, const int keep_lig, int model_
if (par->xlig_resnumber > -1)
{
if (((is_ligand(par->chain_as_ligand, at_in[i].chain_auth,par->n_chains_as_ligand)) || (par->xlig_chain_code !=NULL && at_in[i].chain_auth[0] == par->xlig_chain_code[0] && at_in[i].resid_auth == par->xlig_resnumber && par->xlig_resname[0] == at_in[i].resname[0] && par->xlig_resname[1] == at_in[i].resname[1] && par->xlig_resname[2] == at_in[i].resname[2]) || (par->xlig_chain_code!=NULL && at_in[i].chain_auth[0] == par->xlig_chain_code[0] && at_in[i].resid_auth == par->xlig_resnumber && par->xlig_resname[0] == at_in[i].resname[0] && par->xlig_resname[1] == at_in[i].resname[1] && par->xlig_resname[2] == at_in[i].resname[2])))
// if (((is_ligand(par->chain_as_ligand, at_in[i].chain_auth,par->n_chains_as_ligand)) || (par->xlig_chain_code !=NULL && at_in[i].chain_auth[0] == par->xlig_chain_code[0] && at_in[i].resid_auth == par->xlig_resnumber && par->xlig_resname[0] == at_in[i].resname[0] && par->xlig_resname[1] == at_in[i].resname[1] && par->xlig_resname[2] == at_in[i].resname[2]) || (par->xlig_chain_code!=NULL && at_in[i].chain_auth[0] == par->xlig_chain_code[0] && at_in[i].resid_auth == par->xlig_resnumber && par->xlig_resname[0] == at_in[i].resname[0] && par->xlig_resname[1] == at_in[i].resname[1] && par->xlig_resname[2] == at_in[i].resname[2])))
if (((is_ligand(par->chain_as_ligand, at_in[i].chain_auth,par->n_chains_as_ligand)) || (par->xlig_chain_code !=NULL && strcmp(at_in[i].chain_auth,par->xlig_chain_code)==0 && at_in[i].resid_auth == par->xlig_resnumber && par->xlig_resname[0] == at_in[i].resname[0] && par->xlig_resname[1] == at_in[i].resname[1] && par->xlig_resname[2] == at_in[i].resname[2]) || (par->xlig_chain_code!=NULL && at_in[i].chain_auth[0] == par->xlig_chain_code[0] && at_in[i].resid_auth == par->xlig_resnumber && par->xlig_resname[0] == at_in[i].resname[0] && par->xlig_resname[1] == at_in[i].resname[1] && par->xlig_resname[2] == at_in[i].resname[2])))
{
pdb->n_xlig_atoms++;
}
}
}
@@ -630,9 +634,8 @@ void read_mmcif(s_pdb *pdb, const char *ligan, const int keep_lig, int model_num
unsigned short is_chain_ligand=(is_ligand(params->chain_as_ligand, at_in[i].chain_auth,params->n_chains_as_ligand) && strncmp(at_in[i].resname, "HOH", 3) && strncmp(at_in[i].resname, "WAT", 3) && strncmp(at_in[i].resname, "TIP", 3));
if (is_chain_ligand || (params->xlig_chain_code !=NULL && at_in[i].chain_auth[0] == params->xlig_chain_code[0] && at_in[i].resid_auth == params->xlig_resnumber && params->xlig_resname[0] == at_in[i].resname[0] && params->xlig_resname[1] == at_in[i].resname[1] && params->xlig_resname[2] == at_in[i].resname[2]) || (params->xlig_chain_code!=NULL && at_in[i].chain_auth[0] == params->xlig_chain_code[0] && at_in[i].resid_auth == params->xlig_resnumber && params->xlig_resname[0] == at_in[i].resname[0] && params->xlig_resname[1] == at_in[i].resname[1] && params->xlig_resname[2] == at_in[i].resname[2]))
{
if (is_chain_ligand || (params->xlig_chain_code !=NULL && strcmp(at_in[i].chain_auth, params->xlig_chain_code)==0 && at_in[i].resid_auth == params->xlig_resnumber && params->xlig_resname[0] == at_in[i].resname[0] && params->xlig_resname[1] == at_in[i].resname[1] && params->xlig_resname[2] == at_in[i].resname[2]) || (params->xlig_chain_code!=NULL && strcmp(at_in[i].chain_auth, params->xlig_chain_code)==0 && at_in[i].resid_auth == params->xlig_resnumber && params->xlig_resname[0] == at_in[i].resname[0] && params->xlig_resname[1] == at_in[i].resname[1] && params->xlig_resname[2] == at_in[i].resname[2]))
{
*(pdb->xlig_x + i_explicit_ligand_atom) = ts_in.coords[3 * i];
*(pdb->xlig_y + i_explicit_ligand_atom) = ts_in.coords[(3 * i) + 1];
*(pdb->xlig_z + i_explicit_ligand_atom) = ts_in.coords[(3 * i) + 2];

View File

@@ -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 + 40];
out[0] = '\0';
node_pocket *pcur;
@@ -500,7 +500,7 @@ void write_mdpockets_concat_pqr(FILE *f, c_lst_pockets *pockets) {
*/
void write_each_pocket(const char out_path[], c_lst_pockets *pockets) {
int out_len = strlen(out_path);
char out[out_len + 20];
char out[out_len + 40];
out[0] = '\0';
node_pocket *pcur;