Go to the documentation of this file.
29 if(strcmp(
res,
"ALA") == 0) {
32 else if(strcmp(
res,
"CYS") == 0) {
35 else if(strcmp(
res,
"ASP") == 0) {
38 else if(strcmp(
res,
"GLU") == 0) {
41 else if(strcmp(
res,
"PHE") == 0) {
44 else if(strcmp(
res,
"GLY") == 0) {
47 else if(strcmp(
res,
"HIS") == 0) {
50 else if(strcmp(
res,
"ILE") == 0) {
53 else if(strcmp(
res,
"LYS") == 0) {
56 else if(strcmp(
res,
"LEU") == 0) {
59 else if(strcmp(
res,
"MET") == 0) {
62 else if(strcmp(
res,
"ASN") == 0) {
65 else if(strcmp(
res,
"PRO") == 0) {
68 else if(strcmp(
res,
"GLN") == 0) {
71 else if(strcmp(
res,
"ARG") == 0) {
74 else if(strcmp(
res,
"SER") == 0) {
77 else if(strcmp(
res,
"THR") == 0) {
80 else if(strcmp(
res,
"SCY") == 0) {
83 else if(strcmp(
res,
"VAL") == 0) {
86 else if(strcmp(
res,
"TRP") == 0) {
89 else if(strcmp(
res,
"TYR") == 0) {
109 for(
i=0;
i<
p->natoms;
i++) {
112 for(
i=0;
i<
p->nresidues;
i++) {
136 char aname[5] =
" \0";
138 char rname[4] =
" \0";
140 char oldchainid =
' ';
142 int oldRserial = -37;
157 int atoms=0, residues=0, cas=0, bbs=0, firstres=1;
162 while(fgets(line, 256, FPIN)) {
163 sscanf(line,
"%s ",linetype);
166 if(strstr(linetype,
"ATOM") !=
NULL) {
167 sscanf(line,
"%6s%5d%*1c%4c%1c%3c%*1c%1c%4d%1c%*3c%8lf%8lf%8lf%6lf%6lf %c\n",
168 linetype,&aserial,aname,&altLoc,rname,&chainid,&rserial,&icode,&
x,&
y,&
z,&opcy,&tmpt,&element);
169 sscanf(linetype,
" %s ",linetype);
170 sscanf(aname,
" %s ",aname);
171 sscanf(rname,
" %s ",rname);
177 oldRserial = rserial;
178 oldchainid = chainid;
182 if(oldRserial != rserial) {
184 oldRserial = rserial;
186 if(oldchainid != chainid) {
189 oldchainid = chainid;
191 if(strcmp(aname,
"CA") == 0) {
194 if(strcmp(aname,
"N") == 0 || strcmp(aname,
"CA") == 0 ||
195 strcmp(aname,
"C") == 0 || strcmp(aname,
"O") == 0) {
199 else if(strstr(linetype,
"ENDMDL") !=
NULL || strstr(linetype,
"END") !=
NULL || strstr(linetype,
"TER") !=
NULL) {
210 toFill->
resSeq = (
char *)
gk_malloc (residues*
sizeof(
char),
"residue seq");
216 res=0; firstres=1; cas=0; bbs=0;
i=0;
217 avgx = 0.0; avgy = 0.0; avgz = 0.0;
221 while(fgets(line, 256, FPIN)) {
222 sscanf(line,
"%s ",linetype);
225 if(strstr(linetype,
"ATOM") !=
NULL ) {
228 sscanf(line,
"%6s%5d%*1c%4c%1c%3c%*1c%1c%4d%1c%*3c%8lf%8lf%8lf%6lf%6lf %c\n",
229 linetype,&aserial,aname,&altLoc,rname,&chainid,&rserial,&icode,&
x,&
y,&
z,&opcy,&tmpt,&element);
230 sscanf(aname,
"%s",aname);
231 sscanf(rname,
"%s",rname);
236 oldRserial = rserial;
240 if(oldRserial != rserial) {
242 toFill->
cm[
res-1].
x = avgx/nresatoms;
243 toFill->
cm[
res-1].
y = avgy/nresatoms;
244 toFill->
cm[
res-1].
z = avgz/nresatoms;
245 avgx = 0.0; avgy = 0.0; avgz = 0.0;
252 oldRserial = rserial;
273 if(strcmp(aname,
"CA") == 0) {
277 if(strcmp(aname,
"N") == 0 || strcmp(aname,
"CA") == 0 || strcmp(aname,
"C") == 0 || strcmp(aname,
"O") == 0) {
283 else if(strstr(linetype,
"ENDMDL") !=
NULL || strstr(linetype,
"END") !=
NULL || strstr(linetype,
"TER") !=
NULL) {
288 toFill->
cm[
res-1].
x = avgx/nresatoms;
289 toFill->
cm[
res-1].
y = avgy/nresatoms;
290 toFill->
cm[
res-1].
z = avgz/nresatoms;
292 if(cas != residues) {
293 printf(
"Number of residues and CA coordinates differs by %d (!)\n",residues-cas);
297 else if(cas > residues) {
301 if(bbs < residues*4) {
304 else if(bbs > residues*4) {
331 fprintf(FPOUT,
"> %s\n",fname);
334 fprintf(FPOUT,
"%c",pb->
resSeq[
i]);
354 for(
i=0;
i<
p->nresidues;
i++) {
355 fprintf(FPIN,
"%-6s%5d %4s%1c%3s %1c%4d%1c %8.3lf%8.3lf%8.3lf%6.2f%6.2f\n",
356 "ATOM ",
i,
"CA",
' ',
p->threeresSeq[
i],
' ',
i,
' ',
p->cm[
i].x,
p->cm[
i].y,
p->cm[
i].z,1.0,-37.0);
375 for(
i=0;
i<
p->natoms;
i++) {
376 fprintf(FPIN,
"%-6s%5d %4s%1c%3s %1c%4d%1c %8.3lf%8.3lf%8.3lf%6.2f%6.2f\n",
377 "ATOM ",
p->atoms[
i].serial,
p->atoms[
i].name,
p->atoms[
i].altLoc,
p->atoms[
i].resname,
p->atoms[
i].chainid,
p->atoms[
i].rserial,
p->atoms[
i].icode,
p->atoms[
i].x,
p->atoms[
i].y,
p->atoms[
i].z,
p->atoms[
i].opcy,
p->atoms[
i].tmpt);
396 for(
i=0;
i<
p->nbbs;
i++) {
397 fprintf(FPIN,
"%-6s%5d %4s%1c%3s %1c%4d%1c %8.3lf%8.3lf%8.3lf%6.2f%6.2f\n",
398 "ATOM ",
p->bbs[
i]->serial,
p->bbs[
i]->name,
p->bbs[
i]->altLoc,
p->bbs[
i]->resname,
p->bbs[
i]->chainid,
p->bbs[
i]->rserial,
p->bbs[
i]->icode,
p->bbs[
i]->x,
p->bbs[
i]->y,
p->bbs[
i]->z,
p->bbs[
i]->opcy,
p->bbs[
i]->tmpt);
417 for(
i=0;
i<
p->ncas;
i++) {
418 fprintf(FPIN,
"%-6s%5d %4s%1c%3s %1c%4d%1c %8.3lf%8.3lf%8.3lf%6.2f%6.2f\n",
419 "ATOM ",
p->cas[
i]->serial,
p->cas[
i]->name,
p->cas[
i]->altLoc,
p->cas[
i]->resname,
p->cas[
i]->chainid,
p->cas[
i]->rserial,
p->cas[
i]->icode,
p->cas[
i]->x,
p->cas[
i]->y,
p->cas[
i]->z,
p->cas[
i]->opcy,
p->cas[
i]->tmpt);
436 int corruption =
p->corruption;
438 printf(
"Multiple coordinate sets for at least one atom\n");
440 printf(
"Missing coordiantes for at least one CA atom\n");
442 printf(
"Missing coordiantes for at least one backbone atom (N,CA,C,O)\n");
444 printf(
"File contains coordinates for multiple chains\n");
446 printf(
"Multiple CA atoms found for the same residue (could be alternate locators)\n");
448 printf(
"Multiple copies of backbone atoms found for the same residue (could be alternate locators)\n");
void gk_writefastafrompdb(pdbf *pb, char *fname)
Writes the sequence of residues from a pdb file.
char * gk_strdup(char *orgstr)
Duplicates a string.
void gk_free(void **ptr1,...)
set noclip points set clip one set noclip two set bar set border lt lw set xdata set ydata set zdata set x2data set y2data set boxwidth set dummy x
void gk_writecentersofmass(pdbf *p, char *fname)
Writes all centers of mass in pdb-format to file fname.
FILE * gk_fopen(char *, char *, const char *)
cout<< "Here is the matrix m:"<< endl<< m<< endl;Matrix< ptrdiff_t, 3, 1 > res
void gk_freepdbf(pdbf *p)
Frees the memory of a pdbf structure.
pdbf * gk_readpdbfile(char *fname)
Reads a pdb file into a pdbf structure.
void gk_writebackbone(pdbf *p, char *fname)
Writes out all the backbone atoms of a structure in pdb format.
char gk_threetoone(char *res)
Converts three-letter amino acid codes to one-leter codes.
void gk_writealphacarbons(pdbf *p, char *fname)
Writes out all the alpha carbon atoms of a structure.
void gk_writefullatom(pdbf *p, char *fname)
Writes all atoms in p in pdb-format to file fname.
void gk_showcorruption(pdbf *p)
Decodes the corruption bitswitch and prints any problems.
void * gk_malloc(size_t nbytes, char *msg)
gtsam
Author(s):
autogenerated on Sun Dec 22 2024 04:12:42