#include <PDBData.h>
Inheritance diagram for PDBData:

Public Types | |
| enum | PDBType { HEADER, OBSLTE, COMPND, SOURCE, EXPDTA, AUTHOR, REVDAT, SPRSDE, JRNL, REMARK, SEQRES, FTNOTE, HET, FORMUL, HELIX, SHEET, TURN, SSBOND, SITE, CRYST1, ORIGX, SCALE, MTRIX, TVECT, MODEL, ATOM, HETATM, SIGATM, ANISOU, SIGUIJ, TER, ENDMDL, CONECT, MASTER, END, UNKNOWN } |
| enum | PDBFormatStyle { COLUMNS, FIELDS } |
Public Member Functions | |
| PDBData (PDBType newtype) | |
| virtual | ~PDBData (void) |
| PDBType | type (void) |
| virtual void | sprint (char *s, PDBFormatStyle usestyle=COLUMNS) |
Static Public Attributes | |
| const char * | PDBNames [UNKNOWN+1] |
Static Protected Member Functions | |
| void | scan (const char *data, int len, int start, int size, int *ans, int defalt) |
| void | scan (const char *data, int len, int start, int size, BigReal *ans, BigReal defalt) |
| void | scan (const char *data, int len, int start, int size, char *ans) |
| void | field (const char *data, int fld, char *result) |
| void | sprintcol (char *s, int start, int len, const char *val) |
| void | sprintcol (char *s, int start, int len, int val) |
| *** provide a simple way to print to a specific column | |
| void | sprintcol (char *s, int start, int len, int prec, BigReal val) |
Definition at line 33 of file PDBData.h.
|
|
Definition at line 48 of file PDBData.h. 00048 { COLUMNS, FIELDS }; // used to specify if the
|
|
|
Definition at line 42 of file PDBData.h. 00042 {HEADER, OBSLTE, COMPND, SOURCE, EXPDTA, AUTHOR,
00043 REVDAT, SPRSDE, JRNL, REMARK, SEQRES, FTNOTE, HET, FORMUL,
00044 HELIX, SHEET, TURN, SSBOND, SITE, CRYST1, ORIGX, SCALE,
00045 MTRIX, TVECT, MODEL, ATOM, HETATM, SIGATM, ANISOU, SIGUIJ,
00046 TER, ENDMDL, CONECT, MASTER, END, UNKNOWN};
|
|
|
Definition at line 90 of file PDBData.h. 00090 {
00091 mytype = newtype;
00092 }
|
|
|
Definition at line 93 of file PDBData.h. 00093 {
00094 }
|
|
||||||||||||||||
|
Definition at line 133 of file PDBData.C. References Bool. Referenced by PDBAtom::parse(). 00134 {
00135 int i;
00136
00137 Bool onword = FALSE;
00138 if (fld<=0) { // ask a stupid question, get a stupid answer
00139 result[0]='#';
00140 result[1]=0;
00141 return;
00142 }
00143 for (i=0; data[i]; i++)
00144 if (!onword && data[i] != ' ' && data[i] != '\t') { // if I found a field
00145 onword = TRUE; // mark that I'm on it
00146 if (--fld <= 0) // am I done?
00147 break;
00148 } else {
00149 if (onword && (data[i] == ' ' || data[i] == '\t')) { // left a field
00150 onword = FALSE; // mark that I left
00151 }
00152 }
00153 if (fld>0) { // oh no, didn't find the field!
00154 result[0] = '#';
00155 result[1] = 0;
00156 return;
00157 }
00158
00159 int cpy=0; // copy the field to the output
00160 while (data[i] != ' ' && data[i] != '\t' && data[i])
00161 result[cpy++] = data[i++];
00162 result[cpy] = 0; // terminate and I'm done
00163 }
|
|
||||||||||||||||||||||||
|
Definition at line 81 of file PDBData.C. 00082 {
00083 if (length < start) { // check if the string is long enough
00084 ans[0] = 0;
00085 return;
00086 }
00087 strncpy(ans, data + start - 1, size);
00088 ans[size]=0;
00089 // fix up leading and trailing spaces
00090 int i,j;
00091 for (i=0,j=0; ans[i]; i++) // all this does is strip out _all_ the
00092 if (ans[i]!=' ' && ans[i]!='\t') // spaces -- this is important because I
00093 ans[j++]=ans[i]; // check that a string is empty by looking to see if
00094 ans[j]=0; // [0] == 0 instead of checking to see if all the elements are spaces
00095 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 97 of file PDBData.C. 00099 {
00100 char tempbuffer[200];
00101 if (length < start) { // check if the string is long enough
00102 *ans = defalt; // return the default
00103 return;
00104 }
00105 if (size>199) // make sure I won't overflow my array
00106 size=199;
00107 strncpy(tempbuffer, data + start - 1, size);// convert the string to a BigReal
00108 tempbuffer[size]= 0;
00109 int flg=0;
00110 for (int i=strlen(tempbuffer)-1; i>=0; i--) { // see if this is a blank string
00111 if (tempbuffer[i]>' ') {
00112 flg = 1;
00113 break;
00114 }
00115 }
00116 if (flg != 1) { // then it was a blank string
00117 *ans = defalt;
00118 } else {
00119 *ans = atof(tempbuffer); // WARNING : ASSUMES BigReal <= double!!!
00120 }
00121 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 53 of file PDBData.C. 00055 {
00056 char tempbuffer[200]; // temp. string buffer
00057 if (length < start) { // check if the string is long enough
00058 *ans = defalt; // return the default
00059 return;
00060 }
00061 if (size>199) // make sure I won't overflow my array
00062 size=199;
00063 strncpy(tempbuffer, data + start-1, size); // convert the string to an int
00064 tempbuffer[size]= 0;
00065 int flg=0;
00066 for (int i=strlen(tempbuffer)-1; i>=0; i--) { // see if this is a blank string
00067 if (tempbuffer[i]>' ') {
00068 flg = 1;
00069 break;
00070 }
00071 }
00072 if (flg != 1) { // then it was a blank string
00073 *ans = defalt;
00074 } else {
00075 *ans = atoi(tempbuffer);
00076 }
00077 }
|
|
||||||||||||
|
Reimplemented in PDBUnknown, and PDBAtom. Definition at line 99 of file PDBData.h. 00099 {
00100 if (usestyle == COLUMNS) // get rid of warning
00101 strcpy(s, "REMARK (undefined remark - this is a bug)");
00102 else
00103 strcpy(s, "REMARK (undefined remark - this is a bug)");
00104 }
|
|
||||||||||||||||||||||||
|
Definition at line 176 of file PDBData.C. References sprintcol(). 00177 {
00178 char temps[100];
00179 sprintf(temps, "%*.*f", len, prec, val);
00180 sprintcol( s, start, len, temps); // copy to the output string
00181 }
|
|
||||||||||||||||||||
|
*** provide a simple way to print to a specific column
Definition at line 169 of file PDBData.C. References sprintcol(). 00170 {
00171 char temps[100];
00172 sprintf(temps, "%*d", len, val); // convert the int to a string
00173 sprintcol( s, start, len, temps); // copy to the output string
00174 }
|
|
||||||||||||||||||||
|
Definition at line 183 of file PDBData.C. Referenced by sprintcol(). 00184 {
00185 s+=start-1;
00186 while (len-- >0 && *val) // copy string up to end of string or len
00187 *s++ = *val++;
00188 }
|
|
|
Definition at line 95 of file PDBData.h. 00095 {
00096 return mytype;
00097 }
|
|
|
Initial value: {
"HEADER", "OBSLTE", "COMPND",
"SOURCE", "EXPDTA", "AUTHOR", "REVDAT", "SPRSDE", "JRNL",
"REMARK", "SEQRES", "FTNOTE", "HET", "FORMUL", "HELIX",
"SHEET", "TURN", "SSBOND", "SITE", "CRYST1", "ORIGX",
"SCALE", "MTRIX", "TVECT", "MODEL", "ATOM", "HETATM",
"SIGATM", "ANISOU", "SIGUIJ", "TER", "ENDMDL", "CONECT",
"MASTER", "END", "UNKNOWN"}
|
1.3.9.1