Commit 200ae057 by Chloe Dequeker

bugfix : checking if conformation really exists

parent 2afdb9b4
...@@ -286,6 +286,11 @@ int main(int argc, char** argv){ ...@@ -286,6 +286,11 @@ int main(int argc, char** argv){
}else{ /* For all conformations */ }else{ /* For all conformations */
for(i=1;i<dock_res->nbConf;i++){ for(i=1;i<dock_res->nbConf;i++){
if(dock_res->t_conf[i] == 0){
/* No conformation was found for this index */
continue;
}
/* compute the rotation angles dalpha, dbeta and dgamma /* compute the rotation angles dalpha, dbeta and dgamma
* from the angles alpha and beta of the CA 1 and the * from the angles alpha and beta of the CA 1 and the
* angle gamma computed after rotation of alpha and beta * angle gamma computed after rotation of alpha and beta
......
...@@ -21,6 +21,7 @@ void freeDock(struct docking_results* dock_res){ ...@@ -21,6 +21,7 @@ void freeDock(struct docking_results* dock_res){
free(dock_res->alpha); free(dock_res->alpha);
free(dock_res->beta); free(dock_res->beta);
free(dock_res->gamma); free(dock_res->gamma);
free(dock_res->t_conf);
free(dock_res); free(dock_res);
dock_res = NULL; dock_res = NULL;
} }
...@@ -45,6 +46,7 @@ struct docking_results* allocate_dockingResults(int nbConf){ ...@@ -45,6 +46,7 @@ struct docking_results* allocate_dockingResults(int nbConf){
dock_res->alpha = NULL; dock_res->alpha = NULL;
dock_res->beta = NULL; dock_res->beta = NULL;
dock_res->gamma = NULL; dock_res->gamma = NULL;
dock_res->t_conf = NULL;
dock_res->listEner = malloc((2*nbConf)*sizeof(float)); dock_res->listEner = malloc((2*nbConf)*sizeof(float));
if(dock_res->listEner == NULL){ if(dock_res->listEner == NULL){
...@@ -82,6 +84,12 @@ struct docking_results* allocate_dockingResults(int nbConf){ ...@@ -82,6 +84,12 @@ struct docking_results* allocate_dockingResults(int nbConf){
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
dock_res->t_conf = malloc((2*nbConf)*sizeof(int));
if(dock_res->t_conf == NULL){
perror("malloc");
exit(EXIT_FAILURE);
}
for(i=0;i<nbConf;i++){ for(i=0;i<nbConf;i++){
dock_res->listEner[i] = 0; dock_res->listEner[i] = 0;
dock_res->distCenters[i] = 0; dock_res->distCenters[i] = 0;
...@@ -90,6 +98,7 @@ struct docking_results* allocate_dockingResults(int nbConf){ ...@@ -90,6 +98,7 @@ struct docking_results* allocate_dockingResults(int nbConf){
dock_res->alpha[i] = 0; dock_res->alpha[i] = 0;
dock_res->beta[i] = 0; dock_res->beta[i] = 0;
dock_res->gamma[i] = 0; dock_res->gamma[i] = 0;
dock_res->t_conf[i] = 0;
} }
......
...@@ -54,6 +54,9 @@ struct docking_results* getDataForComplex(){ ...@@ -54,6 +54,9 @@ struct docking_results* getDataForComplex(){
rc = fscanf(condFile_stream,"%d %d",&idConf,&buf4); rc = fscanf(condFile_stream,"%d %d",&idConf,&buf4);
} }
/* We confirm that this conformation exists in the MAXDo file */
dock_res->t_conf[idConf] = 1;
/* This happens when we arrive on the last line */ /* This happens when we arrive on the last line */
if(prevID == idConf){ if(prevID == idConf){
break; break;
......
...@@ -69,10 +69,11 @@ struct docking_results { ...@@ -69,10 +69,11 @@ struct docking_results {
float* distCenters; /* Distance between the center of the receptor and of the ligand */ float* distCenters; /* Distance between the center of the receptor and of the ligand */
float* theta; /* theta angle for the center of the ligand */ float* theta; /* theta angle for the center of the ligand */
float* phi; /* phi angle for the center of the ligand */ float* phi; /* phi angle for the center of the ligand */
float* alpha; /* */ float* alpha; /* alpha angle */
float* beta; float* beta; /* beta angle */
float* gamma; float* gamma; /* Gamma angle */
int nbConf; int* t_conf; /* 1 for a conformation position if it exists, 0 otherwise */
int nbConf; /* Number of conformations */
}; };
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment