Commit f0001e8b by Chloe Dequeker

Output PDB file now has the trailer string present in the original file

parent 6645f615
...@@ -170,7 +170,7 @@ struct pdb_values* readPDB(char* protein) { ...@@ -170,7 +170,7 @@ struct pdb_values* readPDB(char* protein) {
* The structure filled is of type struct pdb_values. It is * The structure filled is of type struct pdb_values. It is
* allocated and a pointer to this structure is returned at the end * allocated and a pointer to this structure is returned at the end
*/ */
int i = 0, j = 0; int i = 0, j = 0, strSize = 0;
int rc = 0, nbRes = 0, numCA = 0; int rc = 0, nbRes = 0, numCA = 0;
int curRes = 0, curAtom = 0, firstLine = 1; int curRes = 0, curAtom = 0, firstLine = 1;
size_t len = 2000; size_t len = 2000;
...@@ -289,6 +289,13 @@ struct pdb_values* readPDB(char* protein) { ...@@ -289,6 +289,13 @@ struct pdb_values* readPDB(char* protein) {
buf2[8] = '\0'; buf2[8] = '\0';
pdb_prot->residues[curRes].z[curAtom] = atof(buf2); pdb_prot->residues[curRes].z[curAtom] = atof(buf2);
/* Copy the trailer string coming after the coordinates
* This includes Occupancy, temperature and other values
*/
strcpy(pdb_prot->residues[curRes].trailerString[curAtom],buf+54);
strSize = strlen(pdb_prot->residues[curRes].trailerString[curAtom]);
pdb_prot->residues[curRes].trailerString[curAtom][strSize-1] = '\0';
/* If we encounter the first or fifth CA, we note their coordinates /* If we encounter the first or fifth CA, we note their coordinates
* specifically. We need them for the rotation * specifically. We need them for the rotation
*/ */
...@@ -346,13 +353,15 @@ void writePDB(struct pdb_values* pdb, char* protName, int nConf){ ...@@ -346,13 +353,15 @@ void writePDB(struct pdb_values* pdb, char* protName, int nConf){
for(j=0;j<pdb->residues[i].nbAtom;j++){ for(j=0;j<pdb->residues[i].nbAtom;j++){
fprintf(fw,FORMAT_LINE_PDB_HET,pdb->residues[i].idAtom[j], fprintf(fw,FORMAT_LINE_PDB_HET,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],
pdb->residues[i].trailerString[j]);
} }
}else{ }else{
for(j=0;j<pdb->residues[i].nbAtom;j++){ for(j=0;j<pdb->residues[i].nbAtom;j++){
fprintf(fw,FORMAT_LINE_PDB_ATM,pdb->residues[i].idAtom[j], fprintf(fw,FORMAT_LINE_PDB_ATM,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],
pdb->residues[i].trailerString[j]);
} }
} }
} }
......
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
#define NB_HEADER_LINE_ZDOCK 5 /* Number of header lines at the top of a ZDOCK docking file */ #define NB_HEADER_LINE_ZDOCK 5 /* Number of header lines at the top of a ZDOCK docking file */
/* This is the format of a line in a PDB file */ /* This is the format of a line in a PDB file */
#define FORMAT_LINE_PDB_ATM "ATOM %5d %3s %3s %c%5s %8.3f%8.3f%8.3f\n" #define FORMAT_LINE_PDB_ATM "ATOM %5d %3s %3s %c%5s %8.3f%8.3f%8.3f%s\n"
#define FORMAT_LINE_PDB_HET "HETATM%5d %3s %3s %c%5s %8.3f%8.3f%8.3f\n" #define FORMAT_LINE_PDB_HET "HETATM%5d %3s %3s %c%5s %8.3f%8.3f%8.3f%s\n"
int verbose; /* 1 if we are in verbose mode */ int verbose; /* 1 if we are in verbose mode */
int constructPDB; /* 1 if we should build the PDB */ int constructPDB; /* 1 if we should build the PDB */
...@@ -86,18 +86,19 @@ struct pdb_values { ...@@ -86,18 +86,19 @@ struct pdb_values {
/* Structure that contains all the informations we need for a residue */ /* Structure that contains all the informations we need for a residue */
struct residue { struct residue {
char idRes[10]; /* ID of the residue */ char idRes[10]; /* ID of the residue */
char chain; /* Chain to which the residue belongs */ char chain; /* Chain to which the residue belongs */
char resName[10]; /* Name of the residue */ char resName[10]; /* Name of the residue */
float x[NB_MAX_ATOM_PER_RES]; /* Array containing the x for each of its atom */ float x[NB_MAX_ATOM_PER_RES]; /* Array containing the x for each of its atom */
float y[NB_MAX_ATOM_PER_RES]; /* Array containing the y for each of its atom */ float y[NB_MAX_ATOM_PER_RES]; /* Array containing the y for each of its atom */
float z[NB_MAX_ATOM_PER_RES]; /* Array containing the z for each of its atom */ float z[NB_MAX_ATOM_PER_RES]; /* Array containing the z for each of its atom */
char atomType[NB_MAX_ATOM_PER_RES][10]; /* Array containing the type of atom */ char atomType[NB_MAX_ATOM_PER_RES][10]; /* Array containing the type of atom */
int idAtom[NB_MAX_ATOM_PER_RES]; /* ID of the atom */ char trailerString[NB_MAX_ATOM_PER_RES][50]; /* Array containing the trailer string for the line */
int idAtom[NB_MAX_ATOM_PER_RES]; /* ID of the atom */
int isHET; int isHET;
int nbAtom; /* Number of atom for this residue */ int nbAtom; /* Number of atom for this residue */
int isCandidate; /* 1 if this residue belongs to the docking interface */ int isCandidate; /* 1 if this residue belongs to the docking interface */
int isAtomCandidate[NB_MAX_ATOM_PER_RES]; /* 1 if the atom belongs to the docking interface */ int isAtomCandidate[NB_MAX_ATOM_PER_RES]; /* 1 if the atom belongs to the docking interface */
}; };
struct docking_results { struct docking_results {
......
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