OSDN Git Service

a8076c1787b8880dbf2c6743dd8891551bbdb6ad
[eos/optional.git] / doc / Objects / pdbFile.html
1 <H4> Update Time 02/03/13---05:39:39 </H4>
2 <H1> pdbFile </H1>
3
4 <UL>
5         <LI> Structure  <DL>
6         <DT> pdbFile
7                 <DD> This structure is used to treat a pdb File.
8                 <DD> pdbFile pdb;
9                 <DD> 
10                 <DD> pdb.PDB->ResidueSequenceNumber
11                 <DD> pdb.PDB->Coord.x
12                 <DD> pdb.PDB->Coord.y
13         </DL>
14         <LI> File  <UL>
15                 <LI> pdbFileRead (fpt, &pdb)
16                 <LI> pdbFileWrite(fpt, &pdb)
17         </UL>
18         <LI> Check <UL>
19                 <LI> pdbFileIsAtom
20                         <DD> if(pdbFileIsAtom(&pdb)) { }
21                 <LI> pdbFileIsCA
22                         <DD> if(pdbFileIsCA(&pdb)) { }
23                 <LI> pdbFileIsEndLine
24                         <DD> if(pdbFileIsEndLine(&pdb)) { }
25                 <LI> pdbRecordisNearby : Adjacent Residue or not
26                         <DD> if(pdbRecordisNearby(&pdbRecord, &pdbRecord)) { }
27                 <LI> pdbFileIsHelix
28                         <DD> if(pdbFileIsHelix(&pdb)) { }
29                 <LI> pdbFileIsSheet
30                         <DD> if(pdbFileIsSheet(&pdb)) { }
31                 <LI> pdbFileIsTurn
32                         <DD> if(pdbFileIsTurn(&pdb)) { }
33                 <LI> pdbFileIsNegative
34                         <DD> if(pdbFileIsNegative(&pdb)) { }
35                 <LI> pdbFileIsPositive
36                         <DD> if(pdbFileIsPositive(&pdb)) { }
37                 <LI> pdbFileIsCharge
38                         <DD> if(pdbFileIsCharge(&pdb)) { }
39         </UL>
40         <LI> Check2 <UL>
41                 <LI> lpdbDistanceCheck : mode 0: Near 1: Far ; compare the distance between pdb->current with p v.s. distance
42                         <DD> if(lpdbDistanceCheck(&pdb, p, distance, mode)) {
43                 <LI> lpdbDistanceNear
44                         <DD> if(lpdbDistanceNear(&pdb, p, distance, mode)) {
45                 <LI> lpdbDistanceFar
46                         <DD> if(lpdbDistanceFar(&pdb, p, distance, mode)) {
47         </UL>
48         <LI> Get and Set  <UL>
49                 <p><B>Get</B>
50                 <LI> pdbFileCoordGet(&pdb, &x, &y, &z)
51                 <LI> unsigned char pdbFileChainIdentifierGet(&pdb)
52                 <LI> pdbFileResidueSequenceNumberGet(&pdb)
53                 <LI> char* pdbFileResidueNameGet(&pdb,mode)
54                 <p><B>Set</B>
55                 <LI> pdbFileCoordSet(&pdb, x, y, z)
56                 <LI> pdbFileChainIdentifierSetAll(&pdb, c)
57                 <LI> pdbFileChainIdentifierSet(&pdb, c)
58                 <LI> pdbFileTemperatureFactorSet(&pdb, (double)temp)
59         </UL>
60         <LI> Seeking <UL>
61                 <LI> pdbFileTop(&pdb)
62                 <LI> pdbFileNext(&pdb)
63                 <LI> pdbFileNextAtom(&pdb)
64                 <LI> pdbFileNextCA(&pdb)
65                 <LI> pdbFileNextProtein(&pdb)
66                 <LI> pdbFileEnd(&pdb)
67         </UL>
68         <LI> New, append etc. <UL>
69                 <LI> pdbFileNew(&pdb)
70                 <LI> pdbFileAppend(&pdb)
71                 <LI> pdbFileFree(&pdb)
72         </UL>
73         <LI> Print  <UL>
74                 <LI> pdbFilePrint(fpt, &pdb); 
75                 <LI> pdbFileRecordPrint(fpt, &pdb); 
76                 <LI> pdbFileRecordTablePrint(fpt, &pdb); 
77         </UL>
78         <LI> Copy <UL>
79                 <LI> pdbFileOneRecordCopy(&pdb, &src)
80                 <LI> pdbFileCAOnlyCopyAll(&pdb, &src)
81                 <LI> pdbFileCopyAll(&pdb, &src)
82                 <LI> pdbFileOneProteinCopy(&pdb, &src, num)  
83                 <LI> pdbFileCAOnlyCopyAll(&pdb, &src)
84         </UL>
85         <LI> Translation and rotation <UL>
86                 <LI> pdbTrans
87                 <LI> pdbMatrixFileRead
88                 <LI> pdbMatrixFileWrite
89                 <LI> pdbMatrixFileFormat
90         </UL>
91         <LI> Transform <UL>
92                 <LI> lpdb2mrc3d
93                         <DD> lpdb2mrc3d(&mrc, &pdb, &linfo, mode)
94         </UL>
95 </UL>
96 <HR>
97 <A NAME="Information">
98 <H2>Information from source codes</H2>
99 </A>
100 <PRE>
101 ../src/lpdb2mrc2d.c:
102
103 ../src/lpdb2mrc3d.c:
104
105 ../src/lpdbCoord.c:
106
107 ../src/lpdbCoordInfo.c:
108
109 ../src/lpdbSelectedAtom.c:
110
111 ../src/lpdbSurface.c:
112
113 ../src/pdbFileRead.c:
114
115 ../src/pdbFileWrite.c:
116
117 ../src/pdbGet.c:
118
119 ../src/pdbInfoGet.c:
120
121 ../src/pdbRotation.c:
122
123 ../src/pdbSecondaryStructure.c:
124
125 ../src/pdbSet.c:
126
127 ../src/pdbTrans.c:
128
129 ../src/pdbUtil.c:
130 </PRE>
131 <HR>
132 <A NAME="include">
133 <H2>pdbFile.h</H2>
134 </A>
135 <PRE>
136 #ifndef PDB_FILE_H
137 #define PDB_FILE_H
138 /*
139 # %M% %Y% %I%
140 # The latest update : %G% at %U%
141 #
142 #%Z% pdbFile.h ver %I%
143 #%Z% Created by tacyas
144 #%Z%
145 #%Z% Usage : pdbFile.h 
146 #%Z% Attention
147 #%Z%
148 */
149 #include <stdio.h>
150 #include "Matrix3D.h"
151 #include "mrcImage.h"
152
153 /* constant begin */
154 #define PDB_FILE_RECORD_FULL_LENGTH (80)
155 #define PDB_FILE_RECORD_START       (0)
156 #define PDB_FILE_RECORD_LENGTH      (6)
157 #define PDB_FILE_ATOM_NUMBER_START  (6)
158 #define PDB_FILE_ATOM_NUMBER_LENGTH (5)
159 #define PDB_FILE_ATOM_NAME_START    (12)
160 #define PDB_FILE_ATOM_NAME_LENGTH   (4)
161 #define PDB_FILE_LOCATION_START     (16)
162 #define PDB_FILE_LOCATION_LENGTH    (1)
163 #define PDB_FILE_RESIDUE_START      (17)
164 #define PDB_FILE_RESIDUE_LENGTH     (3)
165 #define PDB_FILE_CHAIN_IDENT_START  (21)
166 #define PDB_FILE_CHAIN_IDENT_LENGTH (1)
167 #define PDB_FILE_RESNUM_START       (22)
168 #define PDB_FILE_RESNUM_LENGTH      (4)
169 #define PDB_FILE_INSERTION_START    (26)
170 #define PDB_FILE_INSERTION_LENGTH   (1)
171 #define PDB_FILE_X_START            (30)
172 #define PDB_FILE_X_LENGTH           (8)
173 #define PDB_FILE_Y_START            (38)
174 #define PDB_FILE_Y_LENGTH           (8)
175 #define PDB_FILE_Z_START            (46)
176 #define PDB_FILE_Z_LENGTH           (8)
177 #define PDB_FILE_OCCUPANCY_START    (54)
178 #define PDB_FILE_OCCUPANCY_LENGTH   (6)
179 #define PDB_FILE_TEMPERATURE_START  (60)
180 #define PDB_FILE_TEMPERATURE_LENGTH (6)
181 #define PDB_FILE_FOOT_START         (67)
182 #define PDB_FILE_FOOT_LENGTH        (3)
183 #define PDB_FILE_FOOTNOTE_START     (70)
184 #define PDB_FILE_FOOTNOTE_LENGTH    (10)
185 #define MAX_RESIDUE_NUMBER          (20)
186 #define RESIDUE_ONECHAR_MODE        (1)
187 #define RESIDUE_THREECHAR_MODE      (3)
188 #define pdbRecordAtom       ("ATOM  ")
189 #define pdbRecordHeteroAtom ("HETATM")
190 #define pdbRecordHelix      ("HELIX ")
191 #define pdbRecordSheet      ("SHEET ")
192 #define pdbRecordTurn       ("TURN  ")
193 #define pdbRecordEnd        ("END   ")
194
195 /* constant end */
196
197 /* struct begin */
198 typedef char  pdbFileParaTypeCharacter;
199 typedef long  pdbFileParaTypeInteger;
200 typedef float pdbFileParaTypeReal;
201
202 typedef struct residueName {
203   char residueName3[4];
204   char residueName1[2];
205 } residueName;
206
207 typedef struct pdbCoord {
208   pdbFileParaTypeReal x;
209   pdbFileParaTypeReal y;
210   pdbFileParaTypeReal z;
211 } pdbCoord;
212
213 typedef enum pdbSecondaryStructureHelixClass {
214         HelixClassRightHandedAlpha = 1,
215         HelixClassRightHandedOmega = 2,
216         HelixClassRightHandedPi    = 3,
217         HelixClassRightHandedGammda= 4,
218         HelixClassRightHanded310   = 5,
219         HelixClassLeftHandedAlpha  = 6,
220         HelixClassLeftHandedOmega  = 7,
221         HelixClassLeftHandedGammda = 9,
222         HelixClassPolyProline      = 10,
223 } pdbSecondaryStructureHelixClass;
224
225 typedef struct pdbSecondaryStructureHelix {
226         int  serNum;            /* Serial Number */
227         char* helixID;          /* HelixID : Three alpahnumeric characters */
228 /* informtion for the initial residue */
229         char* initResName;/* Name of the initial residue : Three alpahnumeric characters */ 
230         char initChainID;       /* Chain identifier */ 
231         int  initSeqNum;    /* Sequence number of the initial residue */
232         char initICode; 
233 /* informtion for the terminal residue */
234         char* endResName;/* Name of the initial residue : Three alpahnumeric characters */ 
235         char endChainID;        /* Chain identifier */ 
236         int  endSeqNum;    /* Sequence number of the initial residue */
237         char endICode; 
238
239         pdbSecondaryStructureHelixClass helixClass;
240         char* comment; 
241         int  length;
242 } pdbSecondaryStructureHelix;
243
244 typedef struct pdbSecondaryStructureSheet {
245         int  strand;            /* Strand number which starts 1 for eache strand wihtin a sheet and increases by one */  
246         char* sheetID;    /* Sheet ID */                        
247         int  numStrands;    /* Number of strands in sheet */
248
249 /* initial residue */
250         char* initResName;/* Name of the initial residue : Three alpahnumeric characters */ 
251         char initChainID;       /* Chain identifier */ 
252         int  initSeqNum;    /* Sequence number of the initial residue */
253         char initICode; 
254
255 /* informtion for the terminal residue */
256         char* endResName;/* Name of the initial residue : Three alpahnumeric characters */ 
257         char endChainID;        /* Chain identifier */ 
258         int  endSeqNum;    /* Sequence number of the initial residue */
259         char endICode; 
260
261         int sense;  /* 0: first strand, 1: parallel, -1: anti-paralle */ 
262
263         char* curAtom; /* Registration. Atom name in current strand */
264         char* curResName; /* Registration. Residue name in current strand */
265         char curChainID; /* Registration. Chain ID in current strand */
266         int  curResSeq;  /* Registration. Res sequence in current strand */
267         char curICode;  /* Registration. Insertion code in current strand */
268
269         char* prevAtom; /* Registration. Atom name in current strand */
270         char* prevResName; /* Registration. Residue name in current strand */
271         char prevChainID; /* Registration. Chain ID in current strand */
272         int prevResSeq;  /* Registration. Res sequence in current strand */
273         char prevICode;  /* Registration. Insertion code in current strand */
274 }pdbSecondaryStructureSheet;
275
276
277 typedef struct pdbSecondaryStructureTurn {
278         int  serNum;            /* Serial Number */
279         char* turnID;           /* Turn ID : Three alpahnumeric characters */
280 /* informtion for the initial residue */
281         char* initResName;/* Name of the initial residue : Three alpahnumeric characters */ 
282         char initChainID;       /* Chain identifier */ 
283         int  initSeqNum;    /* Sequence number of the initial residue */
284         char initICode; 
285 /* informtion for the terminal residue */
286         char* endResName;/* Name of the initial residue : Three alpahnumeric characters */ 
287         char endChainID;        /* Chain identifier */ 
288         int  endSeqNum;    /* Sequence number of the initial residue */
289         char endICode; 
290
291         char* comment; 
292 }pdbSecondaryStructureTurn;
293
294 typedef struct pdbSecondaryStructureNo {
295         int   serNum;           /* Serial Number */
296         char* noID;         /* Turn ID : Three alpahnumeric characters */
297 /* informtion for the initial residue */
298         char* initResName;/* Name of the initial residue : Three alpahnumeric characters */ 
299         char initChainID;       /* Chain identifier */ 
300         int  initSeqNum;    /* Sequence number of the initial residue */
301         char initICode; 
302 /* informtion for the terminal residue */
303         char* endResName;/* Name of the initial residue : Three alpahnumeric characters */ 
304         char endChainID;        /* Chain identifier */ 
305         int  endSeqNum;    /* Sequence number of the initial residue */
306         char endICode; 
307
308         char* comment; 
309 }pdbSecondaryStructureNo;
310
311 typedef enum pdbFileSecondaryStructureMode {
312         pdbFileSecondaryStructureModeNo    = 0,
313         pdbFileSecondaryStructureModeHelix = 1,
314         pdbFileSecondaryStructureModeSheet = 2,
315         pdbFileSecondaryStructureModeTurn  = 3
316 } pdbFileSecondaryStructureMode;
317
318 typedef struct pdbFileSecondaryStructureRecord pdbFileSecondaryStructureRecord; 
319 struct pdbFileSecondaryStructureRecord {
320         pdbFileSecondaryStructureMode mode;
321         pdbSecondaryStructureHelix*   helix;
322         pdbSecondaryStructureSheet*   sheet;
323         pdbSecondaryStructureTurn*    turn;
324         pdbSecondaryStructureNo*      no;
325
326         pdbFileSecondaryStructureRecord* prev;
327         pdbFileSecondaryStructureRecord* next;
328 };
329
330 typedef struct pdbFileSecondaryStructure {
331         int nSecondaryStructure;
332         pdbFileSecondaryStructureRecord* top;
333         pdbFileSecondaryStructureRecord* SecondaryStructure; 
334 } pdbFileSecondaryStructure;
335
336 typedef struct pdbRecord pdbRecord;
337
338 struct pdbRecord {
339   pdbFileParaTypeCharacter FullRecord[PDB_FILE_RECORD_FULL_LENGTH+1];
340
341   pdbFileParaTypeCharacter Record[PDB_FILE_RECORD_LENGTH+1];
342
343 /* ATOM and HETATM Record */
344   pdbFileParaTypeInteger   AtomSerialNumber;
345   pdbFileParaTypeCharacter AtomName[PDB_FILE_ATOM_NAME_LENGTH+1];
346   pdbFileParaTypeCharacter LocationIndicator;
347   pdbFileParaTypeCharacter ResidueName[PDB_FILE_RESIDUE_LENGTH+1];
348   pdbFileParaTypeCharacter ChainIdentifier;
349   pdbFileParaTypeInteger   ResidueSequenceNumber;
350   pdbFileParaTypeCharacter InsertionCode;
351   pdbCoord                 Coord;
352   pdbFileParaTypeReal      Occupancy;
353   pdbFileParaTypeReal      TemperatureFactor;
354   pdbFileParaTypeInteger   FootnoteNumber;
355   pdbFileParaTypeCharacter Footnote[PDB_FILE_FOOTNOTE_LENGTH+1];
356
357   pdbRecord*               prev;
358   pdbRecord*               next;
359
360 };
361
362 typedef struct pdbFile {
363   pdbRecord* top;
364   pdbRecord* PDB;
365   pdbFileParaTypeInteger nAtom;
366   pdbFileSecondaryStructure second;
367 } pdbFile;
368 /* struct end */
369
370 #ifdef __cplusplus
371 extern "C" {
372 #endif
373
374 /* prototype begin */
375 /* in pdbFileRead.c */
376 extern void pdbFileRead(FILE* fpt, pdbFile* pdb);
377 /* in pdbFileWrite.c */
378 extern void pdbFileWrite(FILE* fpt, pdbFile* pdb);
379 extern void pdbFileWriteCoord(FILE* fpt, pdbFile* pdb);
380 /*werewolf presents*/
381 extern void pdbFileTableWrite(FILE* fpt, pdbFile* pdb); 
382 extern void pdbFileWriteSecondaryStructure(FILE* fpt, pdbFileSecondaryStructure* second);
383
384
385 extern void pdbMatrixFileFormat(FILE* fpt);
386 extern void pdbMatrixFileRead(FILE* fpt, Matrix3D Matrix);
387 extern void pdbMatrixFileWrite(FILE* fpt, Matrix3D Matrix);
388 extern void pdbTrans(pdbFile* pdb, Matrix3D Matrix);
389
390 extern void pdbFileResidueSequenceNumberIncrementAll(pdbFile* pdb, int n);
391 extern void pdbFileResidueSequenceNumberIncrement(pdbFile* pdb, int n);
392
393 extern void pdbFileChainIdentifierSetAll(pdbFile* pdb, unsigned char c);
394 extern void pdbFileChainIdentifierSet(pdbFile* pdb, unsigned char c);
395 extern unsigned char pdbFileChainIdentifierGet(pdbFile* pdb);
396
397 extern pdbFileParaTypeReal pdbFileTemperatureFactorGet(pdbFile* pdb);
398 extern void pdbFileTemperatureFactorSet(pdbFile* pdb, double temp);
399
400 extern pdbFileParaTypeReal pdbFileOccupancyGet(pdbFile* pdb);
401 extern void pdbFileOccupancySet(pdbFile* pdb, double temp);
402
403 extern long pdbFileCoordSet(pdbFile* pdb, pdbFileParaTypeReal x, pdbFileParaTypeReal y, pdbFileParaTypeReal z);
404
405 extern long pdbFileCoordGet(pdbFile* pdb, pdbFileParaTypeReal* x, pdbFileParaTypeReal* y, pdbFileParaTypeReal* z);
406 extern long pdbFileResidueSequenceNumberGet(pdbFile* pdb);
407 extern char* pdbFileResidueNameGet(pdbFile* pdb,int mode);
408
409 extern pdbRecord* pdbFileTop(pdbFile* pdb);
410 extern pdbRecord* pdbFileTopPointer(pdbFile* pdb);
411 extern pdbRecord* pdbFileNext(pdbFile* pdb);
412 extern pdbRecord* pdbFileNextAtom(pdbFile* pdb);
413 extern pdbRecord* pdbFileNextCA(pdbFile* pdb);
414 extern pdbRecord* pdbFilePrev(pdbFile* pdb);
415 extern pdbRecord* pdbFilePrevAtom(pdbFile* pdb);
416 extern pdbRecord* pdbFilePrevCA(pdbFile* pdb);
417 extern long pdbFileEnd(pdbFile* pdb);
418 extern long pdbFileGoToEnd(pdbFile* pdb);
419 extern long pdbFileIsEndLine(pdbFile* pdb);
420 extern long pdbFileIsAtom(pdbFile* pdb);
421 extern long pdbRecordIsNearby(pdbRecord record1,pdbRecord record2);
422 extern long pdbFileIsCA(pdbFile* pdb);
423 extern long pdbFileIsNegative(pdbFile* pdb);
424 extern long pdbFileIsPositive(pdbFile* pdb);
425 extern long pdbFileIsCharge(pdbFile* pdb);
426 extern long pdbFileIsSecondaryStructure(pdbFile* pdb);
427 extern long pdbFileIsHelix(pdbFile* pdb);
428 extern long pdbFileIsSheet(pdbFile* pdb);
429 extern long pdbFileIsTurn(pdbFile* pdb);
430 extern pdbRecord* pdbFileNew(pdbFile* pdb);
431 extern pdbRecord* pdbFileAppend(pdbFile* pdb);
432 extern pdbRecord* pdbFileFree(pdbFile* pdb);
433 extern pdbRecord* pdbFileRecordPrint(FILE* fpt, pdbFile* pdb);
434
435 extern pdbFileParaTypeInteger pdbZValueGet(pdbFile* pdb);
436 /*werewolf presented*/
437 extern pdbRecord* pdbFileRecordTablePrint(FILE* fpt, pdbFile* pdb);
438
439 extern pdbFileSecondaryStructureRecord* pdbFileSecondaryStructureRecordPrint(FILE* fpt, pdbFileSecondaryStructureRecord* second);
440 extern pdbRecord* pdbFileCAOnlyCopy(pdbFile* pdb, pdbFile* src);
441 extern void pdbFileCAOnlyCopyAll(pdbFile* pdb, pdbFile* src);
442 extern void pdbFileCopyAll(pdbFile* dst, pdbFile* src);
443 extern void pdbFileAppendAll(pdbFile* dst, pdbFile* src);
444 extern pdbRecord* pdbFileOneRecordCopy(pdbFile* dst, pdbFile* src);
445 extern void pdbFileOneProteinCopy(pdbFile* dst, pdbFile* src, long num);
446
447
448 extern void pdbRotationFollowingEulerAngle(pdbFile* pdb, char Mode[4], pdbFileParaTypeReal rot1, pdbFileParaTypeReal rot2, pdbFileParaTypeReal rot3);
449 extern void pdbRotationFollowingEulerAngleInverse(pdbFile* pdb, char Mode[4], pdbFileParaTypeReal rot1, pdbFileParaTypeReal rot2, pdbFileParaTypeReal rot3);
450 extern void pdbRotationXYZ(pdbFile* pdb, pdbFileParaTypeReal rotx, pdbFileParaTypeReal roty, pdbFileParaTypeReal rotz);
451 extern void pdbRotationZYX(pdbFile* pdb, pdbFileParaTypeReal rotx, pdbFileParaTypeReal roty, pdbFileParaTypeReal rotz);
452 extern void pdbRotationZXY(pdbFile* pdb, pdbFileParaTypeReal rotx, pdbFileParaTypeReal roty, pdbFileParaTypeReal rotz);
453 extern void pdbRotationYXZ(pdbFile* pdb, pdbFileParaTypeReal rotx, pdbFileParaTypeReal roty, pdbFileParaTypeReal rotz);
454
455 extern int pdbSecondaryStructureSetFromPDB(pdbFile* pdb, pdbFileSecondaryStructure* second);
456 extern int pdbNoSecondaryStructureSetFromPDB(pdbFile* pdb, pdbFileSecondaryStructure* second);
457 extern int pdbSecondaryStructureAppend(pdbFileSecondaryStructure* second);
458 extern pdbFileSecondaryStructureMode pdbFileWithSecondaryStructure(pdbFile* pdb, pdbFileSecondaryStructure* second);
459
460 /* prototype end */
461
462 #ifdef __cplusplus
463 }
464 #endif
465 #endif /* PDB_FILE_H */
466 </PRE>