Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
INTBuilder
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chloe Dequeker
INTBuilder
Commits
0f097225
Commit
0f097225
authored
May 30, 2017
by
Chloe Dequeker
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
separating getDataForComplex functions for each docking algorithm
parent
9686c2b0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
302 additions
and
47 deletions
+302
-47
fileIO.c
src/fileIO.c
+302
-47
No files found.
src/fileIO.c
View file @
0f097225
...
...
@@ -26,12 +26,12 @@ char* deblank(char* input){
}
struct
docking_results
*
getDataForComplex_ATTRACT
(){
const
int
MAXSIZE_LINE
=
100000
;
FILE
*
condFile_stream
=
NULL
;
int
numberOfConf
=
0
,
rc
=
0
;
int
i
dConf
=
0
,
i
=
0
;
int
numberOfConf
=
0
;
int
i
=
0
;
int
line
=
1
,
auto_pivot
=
0
;
struct
docking_results
*
dock_res
=
NULL
;
const
int
MAXSIZE_LINE
=
100000
;
char
buf
[
MAXSIZE_LINE
]
=
""
;
int
nr
=
0
;
float
pivot
[
2
][
3
]
=
{{
0
,
0
,
0
},{
0
,
0
,
0
}};
...
...
@@ -107,6 +107,10 @@ struct docking_results* getDataForComplex_ATTRACT(){
break
;
}
/* The pivot has been read, now we need to check if any protein is
* centered
*/
int
centered_R
=
-
1
,
centered_L
=
-
1
;
/* Check if the receptor is centered or not */
...
...
@@ -247,96 +251,276 @@ struct docking_results* getDataForComplex_ATTRACT(){
return
dock_res
;
}
struct
docking_results
*
getDataForComplex
(){
struct
docking_results
*
getDataForComplex
_ZDOCK
(){
char
*
buf
=
NULL
;
char
buf2
[
100
]
=
""
;
FILE
*
condFile_stream
=
NULL
;
int
numberOfConf
=
0
,
rc
=
0
;
int
idConf
=
0
,
buf4
=
0
,
i
=
0
;
int
idConf
=
0
,
i
=
0
;
float
buf3
=
0
;
size_t
len
=
2000
;
struct
docking_results
*
dock_res
=
NULL
;
condFile_stream
=
fopen
(
dockingFile
,
"r"
);
if
(
HEX
){
for
(
i
=
0
;
i
<
NB_HEADER_LINE_HEX
;
i
++
){
rc
=
getline
(
&
buf
,
&
len
,
condFile_stream
);
}
}
if
(
ZDOCK
){
rc
=
fscanf
(
condFile_stream
,
"%d %f %d"
,
&
ZDOCK_GRID_SIZE
,
&
ZDOCK_GRID_UNIT
,
&
ZDOCK_PROT_FIXED
);
rc
=
fscanf
(
condFile_stream
,
"%f %f %f"
,
&
ZDOCK_REC_A_ROT
,
&
ZDOCK_REC_B_ROT
,
&
ZDOCK_REC_G_ROT
);
rc
=
fscanf
(
condFile_stream
,
"%f %f %f"
,
&
ZDOCK_LIG_A_ROT
,
&
ZDOCK_LIG_B_ROT
,
&
ZDOCK_LIG_G_ROT
);
rc
=
fscanf
(
condFile_stream
,
"%s %f %f %f"
,
buf2
,
&
ZDOCK_REC_X_TRANS
,
&
ZDOCK_REC_Y_TRANS
,
&
ZDOCK_REC_Z_TRANS
);
rc
=
fscanf
(
condFile_stream
,
"%s %f %f %f"
,
buf2
,
&
ZDOCK_LIG_X_TRANS
,
&
ZDOCK_LIG_Y_TRANS
,
&
ZDOCK_LIG_Z_TRANS
);
}
/* Get the number of conformations */
if
(
HEX
){
rc
=
fscanf
(
condFile_stream
,
"%f %f"
,
&
buf3
,
&
buf3
);
}
else
{
rc
=
getline
(
&
buf
,
&
len
,
condFile_stream
);
/* Get rid of the rest of the line */
}
if
(
ZDOCK
){
numberOfConf
++
;
}
else
if
(
buf3
>
numberOfConf
){
numberOfConf
=
(
int
)
buf3
;
}
while
(
!
feof
(
condFile_stream
)){
if
(
HEX
){
rc
=
fscanf
(
condFile_stream
,
"%f %f"
,
&
buf3
,
&
buf3
);
}
else
{
rc
=
fscanf
(
condFile_stream
,
"%f"
,
&
buf3
);
}
rc
=
getline
(
&
buf
,
&
len
,
condFile_stream
);
/* Get rid of the rest of the line */
if
(
ZDOCK
){
if
(
feof
(
condFile_stream
)){
break
;
}
numberOfConf
++
;
}
else
if
(
buf3
>
numberOfConf
)
numberOfConf
=
(
int
)
buf3
;
}
if
(
ZDOCK
)
numberOfConf
--
;
rewind
(
condFile_stream
);
/* This is with the first MAXDo format */
if
(
MAXDo
){
rc
=
getline
(
&
buf
,
&
len
,
condFile_stream
);
/* Get rid of the first line */
}
else
if
(
ZDOCK
){
for
(
i
=
0
;
i
<
NB_HEADER_LINE_ZDOCK
;
i
++
)
rc
=
getline
(
&
buf
,
&
len
,
condFile_stream
);
}
else
if
(
HEX
){
/* Now that we know how many conformations we are dealing with
* allocate a structure large enough
*/
dock_res
=
allocate_dockingResults
(
numberOfConf
);
while
(
!
feof
(
condFile_stream
)){
idConf
++
;
/* 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 */
if
(
feof
(
condFile_stream
)){
break
;
}
rc
=
fscanf
(
condFile_stream
,
"%f %f %f %f %f %f"
,
&
dock_res
->
alpha
[
idConf
],
&
dock_res
->
beta
[
idConf
],
&
dock_res
->
gamma
[
idConf
],
&
dock_res
->
trans_X
[
idConf
],
&
dock_res
->
trans_Y
[
idConf
],
&
dock_res
->
trans_Z
[
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
*/
/* This happens when we arrive on the last line */
if
(
feof
(
condFile_stream
)){
break
;
}
}
dock_res
->
nbConf
=
numberOfConf
;
fclose
(
condFile_stream
);
free
(
buf
);
return
dock_res
;
}
struct
docking_results
*
getDataForComplex_HEX
(){
char
*
buf
=
NULL
;
FILE
*
condFile_stream
=
NULL
;
int
numberOfConf
=
0
,
rc
=
0
;
int
idConf
=
0
,
buf4
=
0
,
i
=
0
;
float
buf3
=
0
;
size_t
len
=
2000
;
struct
docking_results
*
dock_res
=
NULL
;
condFile_stream
=
fopen
(
dockingFile
,
"r"
);
if
(
HEX
){
for
(
i
=
0
;
i
<
NB_HEADER_LINE_HEX
;
i
++
){
rc
=
getline
(
&
buf
,
&
len
,
condFile_stream
);
}
}
/* Get the number of conformations */
rc
=
fscanf
(
condFile_stream
,
"%f %f"
,
&
buf3
,
&
buf3
);
if
(
buf3
>
numberOfConf
){
numberOfConf
=
(
int
)
buf3
;
}
while
(
!
feof
(
condFile_stream
)){
rc
=
fscanf
(
condFile_stream
,
"%f %f"
,
&
buf3
,
&
buf3
);
rc
=
getline
(
&
buf
,
&
len
,
condFile_stream
);
/* Get rid of the rest of the line */
if
(
buf3
>
numberOfConf
)
numberOfConf
=
(
int
)
buf3
;
}
rewind
(
condFile_stream
);
/* This is with the first MAXDo format */
for
(
i
=
0
;
i
<
NB_HEADER_LINE_HEX
;
i
++
){
rc
=
getline
(
&
buf
,
&
len
,
condFile_stream
);
}
/* Now that we know how many conformations we are dealing with
* allocate a structure large enough
*/
dock_res
=
allocate_dockingResults
(
numberOfConf
);
while
(
!
feof
(
condFile_stream
)){
rc
=
fscanf
(
condFile_stream
,
"%d %d %f %f"
,
&
buf4
,
&
idConf
,
&
buf3
,
&
buf3
);
/* 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 */
if
(
feof
(
condFile_stream
)){
break
;
}
rc
=
fscanf
(
condFile_stream
,
"%f %f %f %f %f %f"
,
&
dock_res
->
trans_X
[
idConf
],
&
dock_res
->
trans_Y
[
idConf
],
&
dock_res
->
trans_Z
[
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
*/
/* This happens when we arrive on the last line */
if
(
feof
(
condFile_stream
)){
break
;
}
}
dock_res
->
nbConf
=
numberOfConf
;
fclose
(
condFile_stream
);
free
(
buf
);
return
dock_res
;
}
struct
docking_results
*
getDataForComplex_MAXDO
(){
char
*
buf
=
NULL
;
char
buf2
[
100
]
=
""
;
FILE
*
condFile_stream
=
NULL
;
int
numberOfConf
=
0
,
rc
=
0
;
int
idConf
=
0
,
buf4
=
0
,
i
=
0
;
float
buf3
=
0
;
size_t
len
=
2000
;
struct
docking_results
*
dock_res
=
NULL
;
condFile_stream
=
fopen
(
dockingFile
,
"r"
);
/* Get the number of conformations */
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
;
}
rewind
(
condFile_stream
);
/* This is with the first MAXDo format */
rc
=
getline
(
&
buf
,
&
len
,
condFile_stream
);
/* Get rid of the first line */
if
(
MAXDo
){
/* First MAXDo format */
/* Now that we know how many conformations we are dealing with
* allocate a structure large enough
*/
dock_res
=
allocate_dockingResults
(
numberOfConf
);
while
(
!
feof
(
condFile_stream
)){
rc
=
fscanf
(
condFile_stream
,
"%d %d"
,
&
idConf
,
&
buf4
);
}
else
if
(
HEX
){
rc
=
fscanf
(
condFile_stream
,
"%d %d %f %f"
,
&
buf4
,
&
idConf
,
&
buf3
,
&
buf3
);
}
else
if
(
ZDOCK
){
idConf
++
;
}
else
{
/* Else, that means that we have a format where
/* 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 */
if
(
feof
(
condFile_stream
)){
break
;
}
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]*COEF_DEGREE_TO_RADIAN;
//dock_res->phi[idConf] = dock_res->phi[idConf]*COEF_DEGREE_TO_RADIAN;
/* MAXDo will output the values of alpha, beta and gamma in degrees.
* We need to convert those to radian for the rest of the program
*/
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
;
/* This happens when we arrive on the last line */
if
(
feof
(
condFile_stream
)){
break
;
}
}
dock_res
->
nbConf
=
numberOfConf
;
fclose
(
condFile_stream
);
free
(
buf
);
return
dock_res
;
}
struct
docking_results
*
getDataForComplex_HCMD2
(){
char
*
buf
=
NULL
;
char
buf2
[
100
]
=
""
;
FILE
*
condFile_stream
=
NULL
;
int
numberOfConf
=
0
,
rc
=
0
;
int
idConf
=
0
,
buf4
=
0
,
i
=
0
;
float
buf3
=
0
;
size_t
len
=
2000
;
struct
docking_results
*
dock_res
=
NULL
;
condFile_stream
=
fopen
(
dockingFile
,
"r"
);
/* Get the number of conformations */
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
;
}
rewind
(
condFile_stream
);
/* Now that we know how many conformations we are dealing with
* allocate a structure large enough
*/
dock_res
=
allocate_dockingResults
(
numberOfConf
);
while
(
!
feof
(
condFile_stream
)){
/* that means that we have a format where
* values for distance between center follows directly
* the ID of the conformation.
*/
rc
=
fscanf
(
condFile_stream
,
"%d"
,
&
idConf
);
}
/* We confirm that this conformation exists in the MAXDo file */
dock_res
->
t_conf
[
idConf
]
=
1
;
...
...
@@ -346,13 +530,7 @@ struct docking_results* getDataForComplex(){
break
;
}
if
(
HEX
){
rc
=
fscanf
(
condFile_stream
,
"%f %f %f %f %f %f"
,
&
dock_res
->
trans_X
[
idConf
],
&
dock_res
->
trans_Y
[
idConf
],
&
dock_res
->
trans_Z
[
idConf
],
&
dock_res
->
alpha
[
idConf
],
&
dock_res
->
beta
[
idConf
],
&
dock_res
->
gamma
[
idConf
]);
}
else
if
(
ZDOCK
){
rc
=
fscanf
(
condFile_stream
,
"%f %f %f %f %f %f"
,
&
dock_res
->
alpha
[
idConf
],
&
dock_res
->
beta
[
idConf
],
&
dock_res
->
gamma
[
idConf
],
&
dock_res
->
trans_X
[
idConf
],
&
dock_res
->
trans_Y
[
idConf
],
&
dock_res
->
trans_Z
[
idConf
]);
}
else
{
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 */
...
...
@@ -366,11 +544,72 @@ struct docking_results* getDataForComplex(){
/* MAXDo will output the values of alpha, beta and gamma in degrees.
* We need to convert those to radian for the rest of the program
*/
if
(
HCMD2
||
MAXDo
){
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
;
/* This happens when we arrive on the last line */
if
(
feof
(
condFile_stream
)){
break
;
}
}
dock_res
->
nbConf
=
numberOfConf
;
fclose
(
condFile_stream
);
free
(
buf
);
return
dock_res
;
}
struct
docking_results
*
getDataForComplex_DEFAULT
(){
char
*
buf
=
NULL
;
char
buf2
[
100
]
=
""
;
FILE
*
condFile_stream
=
NULL
;
int
numberOfConf
=
0
,
rc
=
0
;
int
idConf
=
0
,
buf4
=
0
,
i
=
0
;
float
buf3
=
0
;
size_t
len
=
2000
;
struct
docking_results
*
dock_res
=
NULL
;
condFile_stream
=
fopen
(
dockingFile
,
"r"
);
/* Get the number of conformations */
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
;
}
rewind
(
condFile_stream
);
/* Now that we know how many conformations we are dealing with
* allocate a structure large enough
*/
dock_res
=
allocate_dockingResults
(
numberOfConf
);
while
(
!
feof
(
condFile_stream
)){
/* That means that we have a format where
* values for distance between center follows directly
* the ID of the conformation.
*/
rc
=
fscanf
(
condFile_stream
,
"%d"
,
&
idConf
);
/* 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 */
if
(
feof
(
condFile_stream
)){
break
;
}
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 */
/* This happens when we arrive on the last line */
if
(
feof
(
condFile_stream
)){
...
...
@@ -385,6 +624,22 @@ struct docking_results* getDataForComplex(){
return
dock_res
;
}
struct
docking_results
*
getDataForComplex
(){
if
(
MAXDo
){
return
getDataForComplex_MAXDO
();
}
else
if
(
HCMD2
){
return
getDataForComplex_HCMD2
();
}
else
if
(
HEX
){
return
getDataForComplex_HEX
();
}
else
if
(
ZDOCK
){
return
getDataForComplex_ZDOCK
();
}
else
if
(
ATTRACT
){
return
getDataForComplex_ATTRACT
();
}
else
{
return
getDataForComplex_DEFAULT
();
}
}
struct
pdb_values
*
readPDB
(
char
*
protein
)
{
/* This function reads a PDB file and fills a structure
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment