Commit 9686c2b0 by Chloe Dequeker

end rotation ATTRACT

parent f8f9c388
......@@ -68,19 +68,86 @@ 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){
/* This function aims at rotating a protein using the ATTRACT output format (DOF file).
* The rotation will only consider a docking using two proteins, and will not consider the
* normal modes that could have been included for a conformation
*
* A parameter 'isRec' is set, as to know if we are considering the receptor or the ligand in the
* 'pdb' parameter. Different rotations and translations may apply.
*/
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;
float rot_mat[9];
float xx = 0, yy = 0, zz = 0;
float cp = 0, cs = 0, cr = 0, sp = 0, ss = 0, sr = 0;
float pivot_X = 0, pivot_Y = 0, pivot_Z = 0;
float trans_X = 0, trans_Y = 0, trans_Z = 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));
/* Now set the different values depending if we are considering
* the receptor or the ligand
*/
if(isRec){
cp = cos(dock_res->phi_R[target_conf]);
cs = cos(dock_res->ssi_R[target_conf]);
cr = cos(dock_res->rot_R[target_conf]);
sp = sin(dock_res->phi_R[target_conf]);
ss = sin(dock_res->ssi_R[target_conf]);
sr = sin(dock_res->rot_R[target_conf]);
/* If the receptor is centered, we need to substract the
* pivot from all of its atoms
*/
if(dock_res->auto_pivot){
pivot_X = newPDB->centerX;
pivot_Y = newPDB->centerY;
pivot_Z = newPDB->centerZ;
}else{
pivot_X = dock_res->pivot_X_R;
pivot_Y = dock_res->pivot_Y_R;
pivot_Z = dock_res->pivot_Z_R;
}
if(dock_res->centered_R){
trans_X = dock_res->trans_X_R[i] - pivot_X;
trans_Y = dock_res->trans_Y_R[i] - pivot_Y;
trans_Z = dock_res->trans_Z_R[i] - pivot_Z;
}
}else{
cp = cos(dock_res->phi_L[target_conf]);
cs = cos(dock_res->ssi_L[target_conf]);
cr = cos(dock_res->rot_L[target_conf]);
sp = sin(dock_res->phi_L[target_conf]);
ss = sin(dock_res->ssi_L[target_conf]);
sr = sin(dock_res->rot_L[target_conf]);
/* If the ligand is centered, we need to substract the
* pivot
*/
if(dock_res->auto_pivot){
pivot_X = newPDB->centerX;
pivot_Y = newPDB->centerY;
pivot_Z = newPDB->centerZ;
}else{
pivot_X = dock_res->pivot_X_L;
pivot_Y = dock_res->pivot_Y_L;
pivot_Z = dock_res->pivot_Z_L;
}
if(dock_res->centered_L){
trans_X = dock_res->trans_X_L[i] - pivot_X;
trans_Y = dock_res->trans_Y_L[i] - pivot_Y;
trans_Z = dock_res->trans_Z_L[i] - pivot_Z;
}
}
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;
......@@ -98,25 +165,6 @@ struct pdb_values* rotate_R_ATTRACT(struct pdb_values* pdb, struct pdb_values* n
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];
......@@ -127,54 +175,15 @@ struct pdb_values* rotate_R_ATTRACT(struct pdb_values* pdb, struct pdb_values* n
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;
newPDB->residues[i].x[j] = newPDB->residues[i].x[j] + dock_res->trans_X_R[target_conf] + pivot_X;
newPDB->residues[i].y[j] = newPDB->residues[i].y[j] + dock_res->trans_Y_R[target_conf] + pivot_Y;
newPDB->residues[i].z[j] = newPDB->residues[i].z[j] + dock_res->trans_Z_R[target_conf] + pivot_Z;
}
}
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
......
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