Commit edb7375b by Chloe Dequeker

adaptation to HCMD2 format. Modif of writePDB function (takes the num of the conformation)

parent 54033ab7
...@@ -93,7 +93,7 @@ void getCandidatesForP1(struct pdb_values* pdb2, struct residue** t_candid1, str ...@@ -93,7 +93,7 @@ void getCandidatesForP1(struct pdb_values* pdb2, struct residue** t_candid1, str
} }
} }
void getInterface(struct pdb_values* pdbR, struct pdb_values* pdbL, int numConf){ void getInterface(struct pdb_values* pdbR, struct pdb_values* pdbL){
int i = 0, j = 0, k = 0, l = 0; int i = 0, j = 0, k = 0, l = 0;
int oldCandL = -1, oldCandR = -1; int oldCandL = -1, oldCandR = -1;
float x1 = 0, y1 = 0, z1 = 0; float x1 = 0, y1 = 0, z1 = 0;
...@@ -129,7 +129,18 @@ void getInterface(struct pdb_values* pdbR, struct pdb_values* pdbL, int numConf) ...@@ -129,7 +129,18 @@ void getInterface(struct pdb_values* pdbR, struct pdb_values* pdbL, int numConf)
oldCandL = nbCandL; oldCandL = nbCandL;
oldCandR = nbCandR; oldCandR = nbCandR;
getCandidatesForP1(pdbR,t_candidateL,t_candidateR,&nbCandL,&nbCandR); getCandidatesForP1(pdbR,t_candidateL,t_candidateR,&nbCandL,&nbCandR);
if(nbCandL == 0 || nbCandR == 0){
nbCandL = 0;
nbCandR = 0;
break;
}
getCandidatesForP1(pdbL,t_candidateR,t_candidateL,&nbCandR,&nbCandL); getCandidatesForP1(pdbL,t_candidateR,t_candidateL,&nbCandR,&nbCandL);
if(nbCandL == 0 || nbCandR == 0){
nbCandL = 0;
nbCandR = 0;
break;
}
} }
//printf("NB_ITER %d\n",k); //printf("NB_ITER %d\n",k);
...@@ -186,6 +197,79 @@ void getInterface(struct pdb_values* pdbR, struct pdb_values* pdbL, int numConf) ...@@ -186,6 +197,79 @@ void getInterface(struct pdb_values* pdbR, struct pdb_values* pdbL, int numConf)
} }
struct docking_results* getDataForComplex_HCMD2(){
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
*/
fprintf(stderr,"No such file : %s\n",dockingFile);
exit(EXIT_FAILURE);
}
condFile_stream = fopen(dockingFile,"r");
/* 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)){
/* 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;
}
dock_res->nbConf = numberOfConf;
fclose(condFile_stream);
free(buf);
return dock_res;
}
struct docking_results* getDataForComplex(){ struct docking_results* getDataForComplex(){
char* buf = NULL; char* buf = NULL;
...@@ -418,21 +502,20 @@ void removeSpace(char* string){ ...@@ -418,21 +502,20 @@ void removeSpace(char* string){
} }
} }
void writePDB(struct pdb_values* pdb, char* protName){ void writePDB(struct pdb_values* pdb, char* protName, int nConf){
int i = 0, j = 0; int i = 0, j = 0;
char buf[500]; char buf[500];
FILE* fw = NULL; FILE* fw = NULL;
sprintf(buf,"%s/%s.pdb",outputPDB,protName); sprintf(buf,"%s/%s_%d.pdb",outputPDB,protName,nConf);
fw = fopen(buf,"w"); fw = fopen(buf,"w");
if(fw == NULL){ if(fw == NULL){
perror("fopen"); perror("fopen");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
for(i=0;i<pdb->nbRes;i++){ for(i=0;i<pdb->nbRes;i++){
for(j=0;j<pdb->residues[i].nbAtom;j++){ for(j=0;j<pdb->residues[i].nbAtom;j++){
fprintf(fw,"ATOM %5d %3s %3s %c%5s %8.3f%8.3f%8.3f\n",pdb->residues[i].idAtom[j], fprintf(fw,FORMAT_LINE_PDB,pdb->residues[i].idAtom[j],
pdb->residues[i].atomType[j],pdb->residues[i].resName,pdb->residues[i].chain, pdb->residues[i].atomType[j],pdb->residues[i].resName,pdb->residues[i].chain,
pdb->residues[i].idRes,pdb->residues[i].x[j],pdb->residues[i].y[j],pdb->residues[i].z[j]); pdb->residues[i].idRes,pdb->residues[i].x[j],pdb->residues[i].y[j],pdb->residues[i].z[j]);
} }
...@@ -457,7 +540,11 @@ int main(int argc, char** argv){ ...@@ -457,7 +540,11 @@ int main(int argc, char** argv){
printf("Computing %s and %s ...",receptor,ligand); printf("Computing %s and %s ...",receptor,ligand);
fflush(stdout); fflush(stdout);
if(HCMD2){
dock_res = getDataForComplex_HCMD2();
}else{
dock_res = getDataForComplex(); dock_res = getDataForComplex();
}
pdbR = readPDB(receptor); pdbR = readPDB(receptor);
pdbL = readPDB(ligand); pdbL = readPDB(ligand);
...@@ -472,10 +559,10 @@ int main(int argc, char** argv){ ...@@ -472,10 +559,10 @@ int main(int argc, char** argv){
dock_res->theta[target_conf],dock_res->phi[target_conf], dock_res->theta[target_conf],dock_res->phi[target_conf],
dalpha,dbeta,dgamma,dock_res,target_conf); dalpha,dbeta,dgamma,dock_res,target_conf);
getInterface(pdbR,newPDB,target_conf); getInterface(pdbR,newPDB);
if(constructPDB){ if(constructPDB){
writePDB(newPDB, ligand); writePDB(newPDB, ligand,target_conf);
} }
freePDB(newPDB); freePDB(newPDB);
}else{ }else{
...@@ -491,12 +578,12 @@ int main(int argc, char** argv){ ...@@ -491,12 +578,12 @@ int main(int argc, char** argv){
fprintf(outputFile_lig,"%d ",i); fprintf(outputFile_lig,"%d ",i);
fprintf(outputFile_rec,"%d ",i); fprintf(outputFile_rec,"%d ",i);
getInterface(pdbR,newPDB,i); getInterface(pdbR,newPDB);
fprintf(outputFile_lig,"\n"); fprintf(outputFile_lig,"\n");
fprintf(outputFile_rec,"\n"); fprintf(outputFile_rec,"\n");
if(constructPDB){ if(constructPDB){
writePDB(newPDB, ligand); writePDB(newPDB, ligand,i);
} }
freePDB(newPDB); freePDB(newPDB);
} }
......
#include "struct.h"
#ifndef INTB_HEADER #ifndef INTB_HEADER
#define INTB_HEADER #define INTB_HEADER
void getCandidatesForP1(struct pdb_values* pdb2, struct residue** t_candid1, struct residue** t_candid2, int* nbCand1, int* nbCand2); void getCandidatesForP1(struct pdb_values* pdb2, struct residue** t_candid1, struct residue** t_candid2, int* nbCand1, int* nbCand2);
void getInterface(struct pdb_values* pdbR, struct pdb_values* pdbL, int numConf); void getInterface(struct pdb_values* pdbR, struct pdb_values* pdbL);
struct docking_results* getDataForComplex(); struct docking_results* getDataForComplex();
struct docking_results* getDataForComplex_HCMD2();
struct pdb_values* readPDB(char* protein) ; struct pdb_values* readPDB(char* protein) ;
void removeSpace(char* string); void removeSpace(char* string);
void writePDB(struct pdb_values* pdb, char* protName); void writePDB(struct pdb_values* pdb, char* protName, int nbConf);
int main(int argc, char** argv); int main(int argc, char** argv);
#endif #endif
...@@ -35,6 +35,7 @@ struct argLine* parseLineOfArgument(int argc, char** argv){ ...@@ -35,6 +35,7 @@ struct argLine* parseLineOfArgument(int argc, char** argv){
verbose = 0; verbose = 0;
constructPDB = 0; constructPDB = 0;
target_conf = -1; target_conf = -1;
HCMD2 = 0;
outputDir = NULL; outputDir = NULL;
outputPDB = NULL; outputPDB = NULL;
verbose_file = NULL; verbose_file = NULL;
...@@ -99,6 +100,8 @@ struct argLine* parseLineOfArgument(int argc, char** argv){ ...@@ -99,6 +100,8 @@ struct argLine* parseLineOfArgument(int argc, char** argv){
fprintf(stderr,"Specific conformation not valid\n"); fprintf(stderr,"Specific conformation not valid\n");
exit(EXIT_SUCCESS); exit(EXIT_SUCCESS);
} }
}else if(strcmp(argv[i],"-HCMD2") == 0){
HCMD2 = 1;
}else if(strcmp(argv[i],"-h") == 0 || }else if(strcmp(argv[i],"-h") == 0 ||
strcmp(argv[i],"--help") == 0){ strcmp(argv[i],"--help") == 0){
print_help = 1; print_help = 1;
......
...@@ -13,6 +13,7 @@ int nbThreads; ...@@ -13,6 +13,7 @@ int nbThreads;
int verbose; int verbose;
int constructPDB; int constructPDB;
int target_conf; int target_conf;
int HCMD2;
FILE* verbose_file; FILE* verbose_file;
char* pdbDir; char* pdbDir;
char* receptor; char* receptor;
...@@ -25,6 +26,7 @@ FILE* outputFile_lig; ...@@ -25,6 +26,7 @@ FILE* outputFile_lig;
#define CDR 0.017453293 #define CDR 0.017453293
#define NB_MAX_ATOM_PER_RES 20 #define NB_MAX_ATOM_PER_RES 20
#define DIST_FOR_CONTACT 10 #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