Commit e08ee47c by Chloe Dequeker

merge getDataForComplex HCMD2 and original MAXDo

parent 173a10b7
......@@ -232,10 +232,11 @@ void getInterface(struct pdb_values* pdbR, struct pdb_values* pdbL){
}
struct docking_results* getDataForComplex_HCMD2(){
struct docking_results* getDataForComplex(){
char* buf = NULL;
FILE* condFile_stream = NULL;
int numberOfConf = 0, rc;
int idConf = 0, buf4, prevID = -1;
float buf3 = 0;
size_t len = 2000;
struct docking_results* dock_res = NULL;
......@@ -257,88 +258,30 @@ struct docking_results* getDataForComplex_HCMD2(){
numberOfConf++;
rewind(condFile_stream);
dock_res = allocate_dockingResults(numberOfConf);
int idConf = 0, buf4, prevID = -1;
while(!feof(condFile_stream)){
/* We take the first value as it is the ID of the conformation */
rc = fscanf(condFile_stream,"%d %d %d %d",&idConf,&buf4, &buf4, &buf4);
if(prevID == idConf){
break;
}else{
prevID = idConf;
}
rc = fscanf(condFile_stream,"%f %f %f %f %f %f",&dock_res->distCenters[idConf],&dock_res->theta[idConf],&dock_res->phi[idConf],&dock_res->alpha[idConf],&dock_res->beta[idConf],&dock_res->gamma[idConf]);
/* printf("%d %f %f %f %f %f %f\n",idConf,dock_res->distCenters[idConf],dock_res->theta[idConf],dock_res->phi[idConf],dock_res->alpha[idConf],dock_res->beta[idConf],dock_res->gamma[idConf]); */
rc = getline(&buf,&len,condFile_stream); /* Get rid of the rest of the line */
//dock_res->theta[idConf] = dock_res->theta[idConf]*cdr;
//dock_res->phi[idConf] = dock_res->phi[idConf]*cdr;
dock_res->alpha[idConf] = dock_res->alpha[idConf]*CDR;
dock_res->beta[idConf] = dock_res->beta[idConf]*CDR;
dock_res->gamma[idConf] = dock_res->gamma[idConf]*CDR;
/* This is with the first MAXDo format */
if(!HCMD2){
rc = getline(&buf,&len,condFile_stream); /* Get rid of the first line */
}
dock_res->nbConf = numberOfConf;
fclose(condFile_stream);
free(buf);
return dock_res;
}
struct docking_results* getDataForComplex(){
char* buf = NULL;
char buf2[5];
FILE* condFile_stream = NULL;
int numberOfConf = 0, rc;
size_t len = 2000;
struct docking_results* dock_res = NULL;
strncpy(buf2,receptor,4);
buf2[4] = '\0';
//sprintf(totalFilePath,"%s/%s/Cond.%s.%s.UB.global.dat",dockingFile,buf2,receptor,ligand);
if(access(dockingFile,F_OK) == -1){
/* File does not exists, 4 file in this case
* Return NULL, which should be treated accordingly
/* Now that we know how many conformations we are dealing with
* allocate a structure large enough
*/
fprintf(stderr,"No such file : %s\n",dockingFile);
exit(EXIT_FAILURE);
}
condFile_stream = fopen(dockingFile,"r");
rc = getline(&buf,&len,condFile_stream); /* Get rid of first line */
/* Get the number of conformations */
float buf3 = 0;
rc = fscanf(condFile_stream,"%f",&buf3);
rc = getline(&buf,&len,condFile_stream); /* Get rid of the rest of the line */
if(buf3 > numberOfConf)
numberOfConf = (int) buf3;
while(!feof(condFile_stream)){
rc = fscanf(condFile_stream,"%f",&buf3);
rc = getline(&buf,&len,condFile_stream); /* Get rid of the rest of the line */
if(buf3 > numberOfConf)
numberOfConf = (int) buf3;
}
numberOfConf++;
rewind(condFile_stream);
rc = getline(&buf,&len,condFile_stream); /* Get rid of the first line */
dock_res = allocate_dockingResults(numberOfConf);
int idConf = 0, buf4, prevID = -1;
while(!feof(condFile_stream)){
/* HCMD2 format */
if(HCMD2){
/* We take the first value as it is the ID of the conformation
* The rest of the line doesn't interests us here
*/
rc = fscanf(condFile_stream,"%d %d %d %d",&idConf,&buf4, &buf4, &buf4);
}else{ /* First MAXDo format */
rc = fscanf(condFile_stream,"%d %d",&idConf,&buf4);
}
/* This happens when we arrive on the last line */
if(prevID == idConf){
break;
}else{
......@@ -348,13 +291,16 @@ struct docking_results* getDataForComplex(){
rc = fscanf(condFile_stream,"%f %f %f %f %f %f",&dock_res->distCenters[idConf],&dock_res->theta[idConf],&dock_res->phi[idConf],&dock_res->alpha[idConf],&dock_res->beta[idConf],&dock_res->gamma[idConf]);
rc = getline(&buf,&len,condFile_stream); /* Get rid of the rest of the line */
/* theta and phi angles are written in Radian already
* However that is not the case for alpha, beta and gamma angles
*/
//dock_res->theta[idConf] = dock_res->theta[idConf]*cdr;
//dock_res->phi[idConf] = dock_res->phi[idConf]*cdr;
//dock_res->theta[idConf] = dock_res->theta[idConf]*COEF_DEGREE_TO_RADIAN;
//dock_res->phi[idConf] = dock_res->phi[idConf]*COEF_DEGREE_TO_RADIAN;
dock_res->alpha[idConf] = dock_res->alpha[idConf]*CDR;
dock_res->beta[idConf] = dock_res->beta[idConf]*CDR;
dock_res->gamma[idConf] = dock_res->gamma[idConf]*CDR;
dock_res->alpha[idConf] = dock_res->alpha[idConf] * COEF_DEGREE_TO_RADIAN;
dock_res->beta[idConf] = dock_res->beta[idConf] * COEF_DEGREE_TO_RADIAN;
dock_res->gamma[idConf] = dock_res->gamma[idConf] * COEF_DEGREE_TO_RADIAN;
}
dock_res->nbConf = numberOfConf;
......@@ -364,6 +310,7 @@ struct docking_results* getDataForComplex(){
return dock_res;
}
struct pdb_values* readPDB(char* protein) {
int i = 0, j = 0;
int rc = 0, nbRes = 0, numCA = 0;
......
......@@ -23,7 +23,7 @@ char* outputDir;
char* outputPDB;
FILE* outputFile_rec;
FILE* outputFile_lig;
#define CDR 0.017453293
#define COEF_DEGREE_TO_RADIAN 0.017453293
#define NB_MAX_ATOM_PER_RES 20
#define DIST_FOR_CONTACT 10
#define FORMAT_LINE_PDB "ATOM %5d %3s %3s %c%5s %8.3f%8.3f%8.3f\n"
......
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