Commit f8f9c388 by Chloe Dequeker

advancements for ATTRACT, rotate rec OK

parent 7b543ddb
......@@ -176,9 +176,10 @@ struct docking_results* getDataForComplex_ATTRACT(){
dock_res->pivot_X_L = pivot[1][0];
dock_res->pivot_Y_L = pivot[1][1];
dock_res->pivot_Z_L = pivot[1][2];
dock_res->centered_R = centered_R;
dock_res->centered_L = centered_L;
}
dock_res->centered_R = centered_R;
dock_res->centered_L = centered_L;
dock_res->auto_pivot = auto_pivot;
int curConf = 0;
int mode = 0;
......
......@@ -43,6 +43,8 @@ void print_usage() {
"<-HEX>.............Means that the docking file is in the HEX format\n"
"OR\n"
"<-ZDOCK>...........Means that the docking file is in the ZDOCK format\n"
"OR\n"
"<-ATTRACT>.........Means that the docking file is in the ATTRACT format\n"
);
}
......@@ -62,6 +64,7 @@ struct argLine* parseLineOfArgument(int argc, char** argv){
constructPDB = 0;
HCMD2 = 0;
MAXDo = 0;
ATTRACT = 0;
HEX = 0;
ZDOCK = 0;
complexPDB = 0;
......@@ -156,6 +159,8 @@ struct argLine* parseLineOfArgument(int argc, char** argv){
HCMD2 = 1;
}else if(strcmp(argv[i],"-MAXDo") == 0){
MAXDo = 1;
}else if(strcmp(argv[i],"-ATTRACT") == 0){
ATTRACT = 1;
}else if(strcmp(argv[i],"-ZDOCK") == 0){
ZDOCK = 1;
}else if(strcmp(argv[i],"-HEX") == 0){
......@@ -179,8 +184,8 @@ struct argLine* parseLineOfArgument(int argc, char** argv){
}
}
if(MAXDo + HCMD2 + HEX + ZDOCK > 1){
fprintf(stderr,"You must choose only one mode out of the three 'MAXDo', 'HCMD2' and 'HEX'\n");
if(ATTRACT + MAXDo + HCMD2 + HEX + ZDOCK > 1){
fprintf(stderr,"You must choose only one mode out of 'ATTRACT', 'MAXDo', 'HCMD2' and 'HEX'\n");
if(!print_help)
print_usage();
exit(EXIT_SUCCESS);
......
......@@ -68,6 +68,113 @@ void sphericToxyz(float *x, float *y, float *z, float x0, float y0, float z0, fl
*z = z0 + R * cos(theta);
}
struct pdb_values* rotate_R_ATTRACT(struct pdb_values* pdb, struct pdb_values* newPDB, struct docking_results* dock_res, int target_conf){
int i = 0, j = 0;
float rot_mat[9];
float xx = 0, yy = 0, zz = 0;
float pivot_X_R, pivot_Y_R, pivot_Z_R;
float cp = cos(dock_res->phi_R[target_conf]);
float cs = cos(dock_res->ssi_R[target_conf]);
float cr = cos(dock_res->rot_R[target_conf]);
float sp = sin(dock_res->phi_R[target_conf]);
float ss = sin(dock_res->ssi_R[target_conf]);
float sr = sin(dock_res->rot_R[target_conf]);
float cscp = cs * cp;
float cssp = cs * sp;
float sscp = ss * cp;
float sssp = ss * sp;
rot_mat[0] = cr * cscp + sr * sp;
rot_mat[1] = sr * cscp - cr * sp;
rot_mat[2] = sscp;
rot_mat[3] = cr * cssp - sr * cp;
rot_mat[4] = sr * cssp + cr * cp;
rot_mat[5] = sssp;
rot_mat[6] = -cr * ss;
rot_mat[7] = -sr * ss;
rot_mat[8] = cs;
/* If the receptor is centered, we need to substract the
* pivot from all of its atoms
*/
if(dock_res->auto_pivot){
pivot_X_R = newPDB->centerX;
pivot_Y_R = newPDB->centerY;
pivot_Z_R = newPDB->centerZ;
}else{
pivot_X_R = dock_res->pivot_X_R;
pivot_Y_R = dock_res->pivot_Y_R;
pivot_Z_R = dock_res->pivot_Z_R;
}
if(dock_res->centered_R){
dock_res->trans_X_R[i] -= pivot_X_R;
dock_res->trans_Y_R[i] -= pivot_Y_R;
dock_res->trans_Z_R[i] -= pivot_Z_R;
}
for(i=0;i<newPDB->nbRes;i++){
for(j=0;i<newPDB->residues[i].nbAtom;j++){
xx = newPDB->residues[i].x[j];
yy = newPDB->residues[i].y[j];
zz = newPDB->residues[i].z[j];
newPDB->residues[i].x[j] = xx * rot_mat[0] + yy * rot_mat[1] + zz * rot_mat[2];
newPDB->residues[i].y[j] = xx * rot_mat[3] + yy * rot_mat[4] + zz * rot_mat[5];
newPDB->residues[i].z[j] = xx * rot_mat[6] + yy * rot_mat[7] + zz * rot_mat[8];
newPDB->residues[i].x[j] = newPDB->residues[i].x[j] + dock_res->trans_X_R[target_conf] + pivot_X_R;
newPDB->residues[i].y[j] = newPDB->residues[i].y[j] + dock_res->trans_Y_R[target_conf] + pivot_Y_R;
newPDB->residues[i].z[j] = newPDB->residues[i].z[j] + dock_res->trans_Z_R[target_conf] + pivot_Z_R;
}
}
return newPDB;
}
struct pdb_values* rotate_ATTRACT(struct pdb_values* pdb, struct pdb_values* newPDB, struct docking_results* dock_res, int target_conf, int isRec){
int i = 0, j = 0;
/* Copy the pdb into newPDB (which will be returned */
if(newPDB == NULL){
newPDB = allocate_pdb(pdb->nbRes);
newPDB->nbAtom = pdb->nbAtom;
}
memcpy(newPDB->residues,pdb->residues,pdb->nbRes*sizeof(struct residue));
if(isRec){
/* If the receptor is centered, we need to substract the
* pivot from all of its atoms
*/
if(dock_res->centered_R){
for(i=0;i<newPDB->nbRes;i++){
for(j=0;j<newPDB->residues[i].nbAtom;j++){
newPDB->residues[i].x[j] -= dock_res->pivot_X_R;
newPDB->residues[i].y[j] -= dock_res->pivot_Y_R;
newPDB->residues[i].z[j] -= dock_res->pivot_Z_R;
}
}
}
}else{
/* Same thing for the ligand */
if(dock_res->centered_L){
for(i=0;i<newPDB->nbRes;i++){
for(j=0;j<newPDB->residues[i].nbAtom;j++){
newPDB->residues[i].x[j] -= dock_res->pivot_X_R;
newPDB->residues[i].y[j] -= dock_res->pivot_Y_R;
newPDB->residues[i].z[j] -= dock_res->pivot_Z_R;
}
}
}
}
return newPDB;
}
struct pdb_values* rotate_ZDOCK(struct pdb_values* pdb, struct pdb_values* newPDB, float trans_X, float trans_Y, float trans_Z, float alpha, float beta, float gamma){
/* This function aims at rotating the pdb parameter and gets its new coordinates
......
......@@ -27,6 +27,7 @@ int constructPDB; /* 1 if we should build the PDB */
int target_conf; /* 1 if we are specific to one conformation */
int HCMD2; /* 1 if this is HCMD2 format */
int MAXDo; /* 1 if this is MAXDo format */
int ATTRACT; /* 1 if this is ATTRACT format */
int HEX; /* 1 if this is HEX format */
int ZDOCK; /* 1 if this is ZDOCK format */
int complexPDB; /* 1 if we are computing the interface of a given complex */
......@@ -135,6 +136,7 @@ struct docking_results {
float* trans_Z_L;
int centered_R;
int centered_L;
int auto_pivot;
};
#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