1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 """Module for creating PDB records.
24
25 This module currently used the PDB format version 3.30 from July, 2011 U{http://www.wwpdb.org/documentation/format33/v3.3.html}.
26 """
27
28
29 from textwrap import wrap
30
31
32 from lib.errors import RelaxError
33
34
36 """Auxiliary function for handling values of None.
37
38 @param value: The value to convert.
39 @type value: anything
40 @return: If the value is None, then an empty string. Otherwise the original value is returned.
41 @rtype: anything
42 """
43
44
45 if value == None:
46 return ''
47
48
49 return value
50
51
52 -def _handle_text(text):
53 """Auxiliary function for handling text values.
54
55 This will convert None to empty strings and make sure everything is capitalised.
56
57
58 @param text: The text to convert.
59 @type text: anything
60 @return: If the text is None, then an empty string. All text will be capitalised.
61 @rtype: anything
62 """
63
64
65 if text == None:
66 return ''
67
68
69 return text.upper()
70
71
73 """Check that the record is ok.
74
75 @param record: The PDB record as text.
76 @type record: str
77 @raises RelaxError: If the record is not exactly 80 characters long.
78 """
79
80
81 if len(record) != 80:
82 if len(record) < 80:
83 raise RelaxError("The PDB record '%s' is too short." % record)
84 else:
85 raise RelaxError("The PDB record '%s' is too long." % record)
86
87
88 -def atom(file, serial='', name='', alt_loc='', res_name='', chain_id='', res_seq='', icode='', x='', y='', z='', occupancy='', temp_factor='', element='', charge=''):
89 """Generate the ATOM record.
90
91 The following is the PDB v3.3 documentation U{http://www.wwpdb.org/documentation/format33/sect9.html#ATOM}.
92
93 ATOM
94 ====
95
96 Overview
97 --------
98
99 The ATOM records present the atomic coordinates for standard amino acids and nucleotides. They also present the occupancy and temperature factor for each atom. Non-polymer chemical coordinates use the HETATM record type. The element symbol is always present on each ATOM record; charge is optional.
100
101 Changes in ATOM/HETATM records result from the standardization atom and residue nomenclature. This nomenclature is described in the Chemical Component Dictionary (U{ftp://ftp.wwpdb.org/pub/pdb/data/monomers}).
102
103
104 Record Format
105 -------------
106
107 The format is::
108 __________________________________________________________________________________________
109 | | | | |
110 | Columns | Data type | Field | Definition |
111 |_________|______________|______________|________________________________________________|
112 | | | | |
113 | 1 - 6 | Record name | "ATOM" | |
114 | 7 - 11 | Integer | serial | Atom serial number. |
115 | 13 - 16 | Atom | name | Atom name. |
116 | 17 | Character | altLoc | Alternate location indicator. |
117 | 18 - 20 | Residue name | resName | Residue name. |
118 | 22 | Character | chainID | Chain identifier. |
119 | 23 - 26 | Integer | resSeq | Residue sequence number. |
120 | 27 | AChar | iCode | Code for insertion of residues. |
121 | 31 - 38 | Real(8.3) | x | Orthogonal coordinates for X in Angstroms. |
122 | 39 - 46 | Real(8.3) | y | Orthogonal coordinates for Y in Angstroms. |
123 | 47 - 54 | Real(8.3) | z | Orthogonal coordinates for Z in Angstroms. |
124 | 55 - 60 | Real(6.2) | occupancy | Occupancy. |
125 | 61 - 66 | Real(6.2) | tempFactor | Temperature factor. |
126 | 77 - 78 | LString(2) | element | Element symbol, right-justified. |
127 | 79 - 80 | LString(2) | charge | Charge on the atom. |
128 |_________|______________|______________|________________________________________________|
129
130
131 Details
132 -------
133
134 ATOM records for proteins are listed from amino to carboxyl terminus.
135
136 Nucleic acid residues are listed from the 5' to the 3' terminus.
137
138 Alignment of one-letter atom name such as C starts at column 14, while two-letter atom name such as FE starts at column 13.
139
140 Atom nomenclature begins with atom type.
141
142 No ordering is specified for polysaccharides.
143
144 Non-blank alphanumerical character is used for chain identifier.
145
146 The list of ATOM records in a chain is terminated by a TER record.
147
148 If more than one model is present in the entry, each model is delimited by MODEL and ENDMDL records.
149
150 AltLoc is the place holder to indicate alternate conformation. The alternate conformation can be in the entire polymer chain, or several residues or partial residue (several atoms within one residue). If an atom is provided in more than one position, then a non-blank alternate location indicator must be used for each of the atomic positions. Within a residue, all atoms that are associated with each other in a given conformation are assigned the same alternate position indicator. There are two ways of representing alternate conformation- either at atom level or at residue level (see examples).
151
152 For atoms that are in alternate sites indicated by the alternate site indicator, sorting of atoms in the ATOM/HETATM list uses the following general rules:
153
154 - In the simple case that involves a few atoms or a few residues with alternate sites, the coordinates occur one after the other in the entry.
155 - In the case of a large heterogen groups which are disordered, the atoms for each conformer are listed together.
156
157 Alphabet letters are commonly used for insertion code. The insertion code is used when two residues have the same numbering. The combination of residue numbering and insertion code defines the unique residue.
158
159 If the depositor provides the data, then the isotropic B value is given for the temperature factor.
160
161 If there are neither isotropic B values from the depositor, nor anisotropic temperature factors in ANISOU, then the default value of 0.0 is used for the temperature factor.
162
163 Columns 79 - 80 indicate any charge on the atom, e.g., 2+, 1-. In most cases, these are blank.
164
165 For refinements with program REFMAC prior 5.5.0042 which use TLS refinement, the values of B may include only the TLS contribution to the isotropic temperature factor rather than the full isotropic value.
166
167
168 Verification/Validation/Value Authority Control
169 -----------------------------------------------
170
171 The ATOM/HETATM records are checked for PDB file format, sequence information, and packing.
172
173
174 Relationships to Other Record Types
175 -----------------------------------
176
177 The ATOM records are compared to the corresponding sequence database. Sequence discrepancies appear in the SEQADV record. Missing atoms are annotated in the remarks. HETATM records are formatted in the same way as ATOM records. The sequence implied by ATOM records must be identical to that given in SEQRES, with the exception that residues that have no coordinates, e.g., due to disorder, must appear in SEQRES.
178
179
180 Example
181 -------
182
183 Example 1::
184
185 1 2 3 4 5 6 7 8
186 12345678901234567890123456789012345678901234567890123456789012345678901234567890
187 ATOM 32 N AARG A -3 11.281 86.699 94.383 0.50 35.88 N
188 ATOM 33 N BARG A -3 11.296 86.721 94.521 0.50 35.60 N
189 ATOM 34 CA AARG A -3 12.353 85.696 94.456 0.50 36.67 C
190 ATOM 35 CA BARG A -3 12.333 85.862 95.041 0.50 36.42 C
191 ATOM 36 C AARG A -3 13.559 86.257 95.222 0.50 37.37 C
192 ATOM 37 C BARG A -3 12.759 86.530 96.365 0.50 36.39 C
193 ATOM 38 O AARG A -3 13.753 87.471 95.270 0.50 37.74 O
194 ATOM 39 O BARG A -3 12.924 87.757 96.420 0.50 37.26 O
195 ATOM 40 CB AARG A -3 12.774 85.306 93.039 0.50 37.25 C
196 ATOM 41 CB BARG A -3 13.428 85.746 93.980 0.50 36.60 C
197 ATOM 42 CG AARG A -3 11.754 84.432 92.321 0.50 38.44 C
198 ATOM 43 CG BARG A -3 12.866 85.172 92.651 0.50 37.31 C
199 ATOM 44 CD AARG A -3 11.698 84.678 90.815 0.50 38.51 C
200 ATOM 45 CD BARG A -3 13.374 85.886 91.406 0.50 37.66 C
201 ATOM 46 NE AARG A -3 12.984 84.447 90.163 0.50 39.94 N
202 ATOM 47 NE BARG A -3 12.644 85.487 90.195 0.50 38.24 N
203 ATOM 48 CZ AARG A -3 13.202 84.534 88.850 0.50 40.03 C
204 ATOM 49 CZ BARG A -3 13.114 85.582 88.947 0.50 39.55 C
205 ATOM 50 NH1AARG A -3 12.218 84.840 88.007 0.50 40.76 N
206 ATOM 51 NH1BARG A -3 14.338 86.056 88.706 0.50 40.23 N
207 ATOM 52 NH2AARG A -3 14.421 84.308 88.373 0.50 40.45 N
208
209 Example 2::
210
211 1 2 3 4 5 6 7 8
212 12345678901234567890123456789012345678901234567890123456789012345678901234567890
213 ATOM 32 N AARG A -3 11.281 86.699 94.383 0.50 35.88 N
214 ATOM 33 CA AARG A -3 12.353 85.696 94.456 0.50 36.67 C
215 ATOM 34 C AARG A -3 13.559 86.257 95.222 0.50 37.37 C
216 ATOM 35 O AARG A -3 13.753 87.471 95.270 0.50 37.74 O
217 ATOM 36 CB AARG A -3 12.774 85.306 93.039 0.50 37.25 C
218 ATOM 37 CG AARG A -3 11.754 84.432 92.321 0.50 38.44 C
219 ATOM 38 CD AARG A -3 11.698 84.678 90.815 0.50 38.51 C
220 ATOM 39 NE AARG A -3 12.984 84.447 90.163 0.50 39.94 N
221 ATOM 40 CZ AARG A -3 13.202 84.534 88.850 0.50 40.03 C
222 ATOM 41 NH1AARG A -3 12.218 84.840 88.007 0.50 40.76 N
223 ATOM 42 NH2AARG A -3 14.421 84.308 88.373 0.50 40.45 N
224 ATOM 43 N BARG A -3 11.296 86.721 94.521 0.50 35.60 N
225 ATOM 44 CA BARG A -3 12.333 85.862 95.041 0.50 36.42 C
226 ATOM 45 C BARG A -3 12.759 86.530 96.365 0.50 36.39 C
227 ATOM 46 O BARG A -3 12.924 87.757 96.420 0.50 37.26 O
228 ATOM 47 CB BARG A -3 13.428 85.746 93.980 0.50 36.60 C
229 ATOM 48 CG BARG A -3 12.866 85.172 92.651 0.50 37.31 C
230 ATOM 49 CD BARG A -3 13.374 85.886 91.406 0.50 37.66 C
231 ATOM 50 NE BARG A -3 12.644 85.487 90.195 0.50 38.24 N
232 ATOM 51 CZ BARG A -3 13.114 85.582 88.947 0.50 39.55 C
233 ATOM 52 NH1BARG A -3 14.338 86.056 88.706 0.50 40.23 N
234
235
236 @param file: The file to write the record to.
237 @type file: file object
238 @keyword serial: The atom serial number.
239 @type serial: int
240 @keyword name: The atom name.
241 @type name: str
242 @keyword alt_loc: The alternate location indicator.
243 @type alt_loc: str
244 @keyword res_name: The residue name.
245 @type res_name: str
246 @keyword chain_id: The chain identifier.
247 @type chain_id: str
248 @keyword res_seq: The sequence number.
249 @type res_seq: int
250 @keyword icode: The insertion code.
251 @type icode: str
252 @keyword x: Orthogonal coordinates for X in Angstroms.
253 @type x: float
254 @keyword y: Orthogonal coordinates for Y in Angstroms.
255 @type y: float
256 @keyword z: Orthogonal coordinates for Z in Angstroms.
257 @type z: float
258 @keyword occupancy: Occupancy.
259 @type occupancy: float
260 @keyword temp_factor: Temperature factor.
261 @type temp_factor: float
262 @keyword element: Element symbol.
263 @type element: str
264 @keyword charge: Charge on the atom.
265 @type charge: int
266 """
267
268
269 text = "%-6s%5s %-4s%1s%3s %1s%4s%1s %8.3f%8.3f%8.3f%6.2f%6.2f %2s%2s" % (
270 'ATOM',
271 _handle_none(serial),
272 _handle_none(name),
273 _handle_none(alt_loc),
274 _handle_none(res_name),
275 _handle_none(chain_id),
276 _handle_none(res_seq),
277 _handle_none(icode),
278 _handle_none(x),
279 _handle_none(y),
280 _handle_none(z),
281 _handle_none(occupancy),
282 _handle_none(temp_factor),
283 _handle_none(element),
284 _handle_none(charge)
285 )
286
287
288 _record_validate(text)
289
290
291 file.write(text)
292 file.write('\n')
293
294
295 -def conect(file, serial='', bonded1='', bonded2='', bonded3='', bonded4=''):
296 """Generate the CONECT record.
297
298 The following is the PDB v3.3 documentation U{http://www.wwpdb.org/documentation/format33/sect10.html#CONECT}.
299
300 CONECT
301 ======
302
303 Overview
304 --------
305
306 The CONECT records specify connectivity between atoms for which coordinates are supplied. The connectivity is described using the atom serial number as shown in the entry. CONECT records are mandatory for HET groups (excluding water) and for other bonds not specified in the standard residue connectivity table. These records are generated automatically.
307
308 Record Format
309 -------------
310
311 The format is::
312 ______________________________________________________________________________________________
313 | | | | |
314 | Columns | Data type | Field | Definition |
315 |_________|______________|______________|____________________________________________________|
316 | | | | |
317 | 1 - 6 | Record name | "CONECT" | |
318 | 7 - 11 | Integer | serial | Atom serial number |
319 | 12 - 16 | Integer | serial | Serial number of bonded atom |
320 | 17 - 21 | Integer | serial | Serial number of bonded atom |
321 | 22 - 26 | Integer | serial | Serial number of bonded atom |
322 | 27 - 31 | Integer | serial | Serial number of bonded atom |
323 |_________|______________|______________|____________________________________________________|
324
325
326 Details
327 -------
328
329 CONECT records are present for:
330
331 - Intra-residue connectivity within non-standard (HET) residues (excluding water).
332 - Inter-residue connectivity of HET groups to standard groups (including water) or to other HET groups.
333 - Disulfide bridges specified in the SSBOND records have corresponding records.
334
335 No differentiation is made between atoms with delocalized charges (excess negative or positive charge).
336
337 Atoms specified in the CONECT records have the same numbers as given in the coordinate section.
338
339 All atoms connected to the atom with serial number in columns 7 - 11 are listed in the remaining fields of the record.
340
341 If more than four fields are required for non-hydrogen and non-salt bridges, a second CONECT record with the same atom serial number in columns 7 - 11 will be used.
342
343 These CONECT records occur in increasing order of the atom serial numbers they carry in columns 7 - 11. The target-atom serial numbers carried on these records also occur in increasing order.
344
345 The connectivity list given here is redundant in that each bond indicated is given twice, once with each of the two atoms involved specified in columns 7 - 11.
346
347 For hydrogen bonds, when the hydrogen atom is present in the coordinates, a CONECT record between the hydrogen atom and its acceptor atom is generated.
348
349 For NMR entries, CONECT records for one model are generated describing heterogen connectivity and others for LINK records assuming that all models are homogeneous models.
350
351
352 Verification/Validation/Value Authority Control
353 -----------------------------------------------
354
355 Connectivity is checked for unusual bond lengths.
356
357
358 Relationships to Other Record Types
359 -----------------------------------
360
361 CONECT records must be present in an entry that contains either non-standard groups or disulfide bonds.
362
363
364 Example
365 -------
366
367 Example 1::
368
369 1 2 3 4 5 6 7 8
370 12345678901234567890123456789012345678901234567890123456789012345678901234567890
371 CONECT 1179 746 1184 1195 1203
372 CONECT 1179 1211 1222
373 CONECT 1021 544 1017 1020 1022
374
375
376 Known Problems
377 --------------
378
379 CONECT records involving atoms for which the coordinates are not present in the entry (e.g., symmetry-generated) are not given.
380
381 CONECT records involving atoms for which the coordinates are missing due to disorder, are also not provided.
382
383
384 @param file: The file to write the record to.
385 @type file: file object
386 @keyword serial: The atom serial number.
387 @type serial: int
388 @keyword bonded1: The serial number of the bonded atom.
389 @type bonded1: int
390 @keyword bonded2: The serial number of the bonded atom.
391 @type bonded2: int
392 @keyword bonded3: The serial number of the bonded atom.
393 @type bonded3: int
394 @keyword bonded4: The serial number of the bonded atom.
395 @type bonded4: int
396 """
397
398
399 text = "%-6s%5s%5s%5s%5s%5s%49s" % (
400 'CONECT',
401 _handle_none(serial),
402 _handle_none(bonded1),
403 _handle_none(bonded2),
404 _handle_none(bonded3),
405 _handle_none(bonded4),
406 ''
407 )
408
409
410 _record_validate(text)
411
412
413 file.write(text)
414 file.write('\n')
415
416
418 """Generate the END record.
419
420 The following is the PDB v3.3 documentation U{http://www.wwpdb.org/documentation/format33/sect11.html#END}.
421
422 END
423 ===
424
425 Overview
426 --------
427
428 The END record marks the end of the PDB file.
429
430
431 Record Format
432 -------------
433
434 The format is::
435 ______________________________________________________________________________________________
436 | | | | |
437 | Columns | Data type | Field | Definition |
438 |_________|______________|______________|____________________________________________________|
439 | | | | |
440 | 1 - 6 | Record name | "END " | |
441 |_________|______________|______________|____________________________________________________|
442
443
444 Details
445 -------
446
447 END is the final record of a coordinate entry.
448
449
450 Verification/Validation/Value Authority Control
451 -----------------------------------------------
452
453 END must appear in every coordinate entry.
454
455
456 Relationships to Other Record Types
457 -----------------------------------
458
459 This is the final record in the entry.
460
461
462 Example
463 -------
464
465 Example 1::
466
467 1 2 3 4 5 6 7 8
468 12345678901234567890123456789012345678901234567890123456789012345678901234567890
469 END
470
471
472 @param file: The file to write the record to.
473 @type file: file object
474 """
475
476
477 text = "END" + ' '*77
478
479
480 _record_validate(text)
481
482
483 file.write(text)
484 file.write('\n')
485
486
488 """Generate the ENDMDL record.
489
490 The following is the PDB v3.3 documentation U{http://www.wwpdb.org/documentation/format33/v3.3.html}.
491
492 ENDMDL
493 ======
494
495 Overview
496 --------
497
498 The ENDMDL records are paired with MODEL records to group individual structures found in a coordinate entry.
499
500
501 Record Format
502 -------------
503
504 The format is::
505 ______________________________________________________________________________________________
506 | | | | |
507 | Columns | Data type | Field | Definition |
508 |_________|______________|______________|____________________________________________________|
509 | | | | |
510 | 1 - 6 | Record name | "ENDMDL" | |
511 |_________|______________|______________|____________________________________________________|
512
513
514 Details
515 -------
516
517 MODEL/ENDMDL records are used only when more than one structure is presented in the entry, as is often the case with NMR entries.
518
519 All the models in a multi-model entry must represent the same structure.
520
521 Every MODEL record has an associated ENDMDL record.
522
523
524 Verification/Validation/Value Authority Control
525 -----------------------------------------------
526
527 Entries with multiple structures in the NUMMDL record are checked for corresponding pairs of MODEL/ ENDMDL records, and for consecutively numbered models.
528
529
530 Relationships to Other Record Types
531 -----------------------------------
532
533 There must be a corresponding MODEL record.
534
535 In the case of an NMR entry, the NUMMDL record states the number of model structures that are present in the individual entry.
536
537
538 Example
539 -------
540
541 Example 1::
542
543 1 2 3 4 5 6 7 8
544 12345678901234567890123456789012345678901234567890123456789012345678901234567890
545 ...
546 ...
547 ATOM 14550 1HG GLU 122 -14.364 14.787 -14.258 1.00 0.00 H
548 ATOM 14551 2HG GLU 122 -13.794 13.738 -12.961 1.00 0.00 H
549 TER 14552 GLU 122
550 ENDMDL
551 MODEL 9
552 ATOM 14553 N SER 1 -28.280 1.567 12.004 1.00 0.00 N
553 ATOM 14554 CA SER 1 -27.749 0.392 11.256 1.00 0.00 C
554 ...
555 ...
556 ATOM 16369 1HG GLU 122 -3.757 18.546 -8.439 1.00 0.00 H
557 ATOM 16370 2HG GLU 122 -3.066 17.166 -7.584 1.00 0.00 H
558 TER 16371 GLU 122
559 ENDMDL
560
561
562 @param file: The file to write the record to.
563 @type file: file object
564 """
565
566
567 text = 'ENDMDL' + ' '*74
568
569
570 _record_validate(text)
571
572
573 file.write(text)
574 file.write('\n')
575
576
687
688
689 -def helix(file, ser_num='', helix_id='', init_res_name='', init_chain_id='', init_seq_num='', init_icode='', end_res_name='', end_chain_id='', end_seq_num='', end_icode='', helix_class='', comment='', length=''):
690 """Generate the HELIX record.
691
692 The following is the PDB v3.3 documentation U{http://www.wwpdb.org/documentation/format33/sect5.html#HELIX}.
693
694 HELIX
695 =====
696
697 Overview
698 --------
699
700 HELIX records are used to identify the position of helices in the molecule. Helices are named, numbered, and classified by type. The residues where the helix begins and ends are noted, as well as the total length.
701
702
703 Record Format
704 -------------
705
706 The format is::
707 ______________________________________________________________________________________________
708 | | | | |
709 | Columns | Data type | Field | Definition |
710 |_________|______________|______________|____________________________________________________|
711 | | | | |
712 | 1 - 6 | Record name | "HELIX " | |
713 | 8 - 10 | Integer | serNum | Serial number of the helix. This starts at 1 and |
714 | | | | increases incrementally. |
715 | 12 - 14 | LString(3) | helixID | Helix identifier. In addition to a serial number, |
716 | | | | each helix is given an alphanumeric character |
717 | | | | helix identifier. |
718 | 16 - 18 | Residue name | initResName | Name of the initial residue. |
719 | 20 | Character | initChainID | Chain identifier for the chain containing this |
720 | | | | helix. |
721 | 22 - 25 | Integer | initSeqNum | Sequence number of the initial residue. |
722 | 26 | AChar | initICode | Insertion code of the initial residue. |
723 | 28 - 30 | Residue name | endResName | Name of the terminal residue of the helix. |
724 | 32 | Character | endChainID | Chain identifier for the chain containing this |
725 | | | | helix. |
726 | 34 - 37 | Integer | endSeqNum | Sequence number of the terminal residue. |
727 | 38 | AChar | endICode | Insertion code of the terminal residue. |
728 | 39 - 40 | Integer | helixClass | Helix class (see below). |
729 | 41 - 70 | String | comment | Comment about this helix. |
730 | 72 - 76 | Integer | length | Length of this helix. |
731 |_________|______________|______________|____________________________________________________|
732
733
734 Details
735 -------
736
737 Additional HELIX records with different serial numbers and identifiers occur if more than one helix is present.
738
739 The initial residue of the helix is the N-terminal residue.
740
741 Helices are classified as follows::
742
743 _____________________________________________________
744 | | CLASS NUMBER |
745 | TYPE OF HELIX | (COLUMNS 39 - 40) |
746 |_______________________________|___________________|
747 | | |
748 | Right-handed alpha (default) | 1 |
749 | Right-handed omega | 2 |
750 | Right-handed pi | 3 |
751 | Right-handed gamma | 4 |
752 | Right-handed 3 - 10 | 5 |
753 | Left-handed alpha | 6 |
754 | Left-handed omega | 7 |
755 | Left-handed gamma | 8 |
756 | 2 - 7 ribbon/helix | 9 |
757 | Polyproline | 10 |
758 |_______________________________|___________________|
759
760
761 Relationships to Other Record Types
762 -----------------------------------
763
764 There may be related information in the REMARKs.
765
766
767 Example
768 -------
769
770 Example 1::
771
772 1 2 3 4 5 6 7 8
773 12345678901234567890123456789012345678901234567890123456789012345678901234567890
774 HELIX 1 HA GLY A 86 GLY A 94 1 9
775 HELIX 2 HB GLY B 86 GLY B 94 1 9
776
777 HELIX 21 21 PRO J 385 LEU J 388 5 4
778 HELIX 22 22 PHE J 397 PHE J 402 5 6
779
780
781 @param file: The file to write the record to.
782 @type file: file object
783 @keyword ser_num: The helix serial number
784 @type ser_num: int
785 @keyword helix_id: The helix identifier
786 @type helix_id: str
787 @keyword init_res_name: The name of the initial residue
788 @type init_res_name: str
789 @keyword init_chain_id: The chain identifier
790 @type init_chain_id: str
791 @keyword init_seq_num: The sequence number of the initial residue
792 @type init_seq_num: int
793 @keyword init_icode: The insertion code of the initial residue
794 @type init_icode: str
795 @keyword end_res_name: The name of the terminal residue
796 @type end_res_name: str
797 @keyword end_chain_id: The chain identifier
798 @type end_chain_id: str
799 @keyword end_seq_num: The sequence number of the terminal residue
800 @type end_seq_num: int
801 @keyword end_icode: The insertion code of the terminal residue
802 @type end_icode: str
803 @keyword helix_class: The helix class
804 @type helix_class: int
805 @keyword comment: The comment
806 @type comment: str
807 @keyword length: The helix length.
808 @type length: int
809 """
810
811
812 text = "%-6s %3s %3s %3s %1s %4s%1s %3s %1s %4s%1s%2s%30s %5s " % (
813 'HELIX',
814 _handle_none(ser_num),
815 _handle_none(helix_id),
816 _handle_none(init_res_name),
817 _handle_none(init_chain_id),
818 _handle_none(init_seq_num),
819 _handle_none(init_icode),
820 _handle_none(end_res_name),
821 _handle_none(end_chain_id),
822 _handle_none(end_seq_num),
823 _handle_none(end_icode),
824 _handle_none(helix_class),
825 _handle_none(comment),
826 _handle_none(length)
827 )
828
829
830 _record_validate(text)
831
832
833 file.write(text)
834 file.write('\n')
835
836
837 -def het(file, het_id='', chain_id='', seq_num='', icode='', num_het_atoms='', text=''):
838 """Generate the HET record.
839
840 The following is the PDB v3.3 documentation U{http://www.wwpdb.org/documentation/format33/sect4.html#HET}.
841
842 HET
843 ===
844
845 Overview
846 --------
847
848 HET records are used to describe non-standard residues, such as prosthetic groups, inhibitors, solvent molecules, and ions for which coordinates are supplied. Groups are considered HET if they are not part of a biological polymer described in SEQRES and considered to be a molecule bound to the polymer, or they are a chemical species that constitute part of a biological polymer and is not one of the following:
849
850 - standard amino acids, or
851 - standard nucleic acids (C, G, A, U, I, DC, DG, DA, DU, DT and DI), or
852 - unknown amino acid (UNK) or nucleic acid (N) where UNK and N are used to indicate the unknown residue name.
853
854 HET records also describe chemical components for which the chemical identity is unknown, in which case the group is assigned the hetID UNL (Unknown Ligand).
855
856 The heterogen section of a PDB formatted file contains the complete description of non-standard residues in the entry.
857
858
859 Record Format
860 -------------
861
862 The format is::
863 ______________________________________________________________________________________________
864 | | | | |
865 | Columns | Data type | Field | Definition |
866 |_________|______________|______________|____________________________________________________|
867 | | | | |
868 | 1 - 6 | Record name | "HET " | |
869 | 8 - 10 | LString(3) | hetID | Het identifier, right-justified. |
870 | 13 | Character | ChainID | Chain identifier. |
871 | 14 - 17 | Integer | seqNum | Sequence number. |
872 | 18 | AChar | iCode | Insertion code. |
873 | 21 - 25 | Integer | numHetAtoms | Number of HETATM records for the group present in |
874 | | | | the entry. |
875 | 31 - 70 | String | text | Text describing Het group. |
876 |_________|______________|______________|____________________________________________________|
877
878
879 Details
880 -------
881
882 Each HET group is assigned a hetID of not more than three (3) alphanumeric characters. The sequence number, chain identifier, insertion code, and number of coordinate records are given for each occurrence of the HET group in the entry. The chemical name of the HET group is given in the HETNAM record and synonyms for the chemical name are given in the HETSYN records, see U{ftp://ftp.wwpdb.org/pub/pdb/data/monomers}.
883
884 There is a separate HET record for each occurrence of the HET group in an entry.
885
886 A particular HET group is represented in the PDB archive with a unique hetID.
887
888 PDB entries do not have HET records for water molecules, deuterated water, or methanol (when used as solvent).
889
890 Unknown atoms or ions will be represented as UNX with the chemical formula X1. Unknown ligands are UNL; unknown amino acids are UNK.
891
892
893 Verification/Validation/Value Authority Control
894 -----------------------------------------------
895
896 For each het group that appears in the entry, the wwPDB checks that the corresponding HET, HETNAM, HETSYN, FORMUL, HETATM, and CONECT records appear, if applicable. The HET record is generated automatically using the Chemical Component Dictionary and information from the HETATM records.
897
898 Each unique hetID represents a unique molecule.
899
900
901 Relationships to Other Record Types
902 -----------------------------------
903
904 For each het group that appears in the entry, there must be corresponding HET, HETNAM, HETSYN, FORMUL,HETATM, and CONECT records. LINK records may also be created.
905
906
907 Example
908 -------
909
910 Example 1::
911
912 1 2 3 4 5 6 7 8
913 12345678901234567890123456789012345678901234567890123456789012345678901234567890
914 HET TRS B 975 8
915
916 HET UDP A1457 25
917 HET B3P A1458 19
918
919 HET NAG Y 3 15
920 HET FUC Y 4 10
921 HET NON Y 5 12
922 HET UNK A 161 1
923
924
925 @param file: The file to write the record to.
926 @type file: file object
927 @keyword het_id: The Het identifier.
928 @type het_id: str
929 @keyword chain_id: The chain identifier.
930 @type chain_id: str
931 @keyword seq_num: The sequence number.
932 @type seq_num: int
933 @keyword icode: The insertion code.
934 @type icode: str
935 @keyword num_het_atoms: The number of HETATM records for the group present in the entry.
936 @type num_het_atoms: int
937 @keyword text: Text describing the Het group.
938 @type text: str
939 """
940
941
942 text = "%-6s %3s %1s%4s%1s %5s %-40s%10s" % (
943 'HET',
944 _handle_none(het_id),
945 _handle_none(chain_id),
946 _handle_none(seq_num),
947 _handle_none(icode),
948 _handle_none(num_het_atoms),
949 _handle_text(text),
950 ''
951 )
952
953
954 _record_validate(text)
955
956
957 file.write(text)
958 file.write('\n')
959
960
961 -def hetatm(file, serial='', name='', alt_loc='', res_name='', chain_id='', res_seq='', icode='', x='', y='', z='', occupancy='', temp_factor='', element='', charge=''):
962 """Generate the HETATM record.
963
964 The following is the PDB v3.3 documentation U{http://www.wwpdb.org/documentation/format33/sect9.html#HETATM}.
965
966 HETATM
967 ======
968
969 Overview
970 --------
971
972 Non-polymer or other "non-standard" chemical coordinates, such as water molecules or atoms presented in HET groups use the HETATM record type. They also present the occupancy and temperature factor for each atom. The ATOM records present the atomic coordinates for standard residues. The element symbol is always present on each HETATM record; charge is optional.
973
974 Changes in ATOM/HETATM records will require standardization in atom and residue nomenclature. This nomenclature is described in the Chemical Component Dictionary, U{ftp://ftp.wwpdb.org/pub/pdb/data/monomers}.
975
976
977 Record Format
978 -------------
979
980 The format is::
981 ______________________________________________________________________________________________
982 | | | | |
983 | Columns | Data type | Field | Definition |
984 |_________|______________|______________|____________________________________________________|
985 | | | | |
986 | 1 - 6 | Record name | "HETATM" | |
987 | 7 - 11 | Integer | serial | Atom serial number. |
988 | 13 - 16 | Atom | name | Atom name. |
989 | 17 | Character | altLoc | Alternate location indicator. |
990 | 18 - 20 | Residue name | resName | Residue name. |
991 | 22 | Character | chainID | Chain identifier. |
992 | 23 - 26 | Integer | resSeq | Residue sequence number. |
993 | 27 | AChar | iCode | Code for insertion of residues. |
994 | 31 - 38 | Real(8.3) | x | Orthogonal coordinates for X. |
995 | 39 - 46 | Real(8.3) | y | Orthogonal coordinates for Y. |
996 | 47 - 54 | Real(8.3) | z | Orthogonal coordinates for Z. |
997 | 55 - 60 | Real(6.2) | occupancy | Occupancy. |
998 | 61 - 66 | Real(6.2) | tempFactor | Temperature factor. |
999 | 77 - 78 | LString(2) | element | Element symbol; right-justified. |
1000 | 79 - 80 | LString(2) | charge | Charge on the atom. |
1001 |_________|______________|______________|____________________________________________________|
1002
1003
1004 Details
1005 -------
1006
1007 The x, y, z coordinates are in Angstrom units.
1008
1009 No ordering is specified for polysaccharides.
1010
1011 See the HET section of this document regarding naming of heterogens. See the Chemical Component Dictionary for residue names, formulas, and topology of the HET groups that have appeared so far in the PDB (see U{ftp://ftp.wwpdb.org/pub/pdb/data/monomers}).
1012
1013 If the depositor provides the data, then the isotropic B value is given for the temperature factor.
1014
1015 If there are neither isotropic B values provided by the depositor, nor anisotropic temperature factors in ANISOU, then the default value of 0.0 is used for the temperature factor.
1016
1017 Insertion codes and element naming are fully described in the ATOM section of this document.
1018
1019
1020 Verification/Validation/Value Authority Control
1021 -----------------------------------------------
1022
1023 Processing programs check ATOM/HETATM records for PDB file format, sequence information, and packing.
1024
1025
1026 Relationships to Other Record Types
1027 -----------------------------------
1028
1029 HETATM records must have corresponding HET, HETNAM, FORMUL and CONECT records, except for waters.
1030
1031
1032 Example
1033 -------
1034
1035 Example 1::
1036
1037 1 2 3 4 5 6 7 8
1038 12345678901234567890123456789012345678901234567890123456789012345678901234567890
1039 HETATM 8237 MG MG A1001 13.872 -2.555 -29.045 1.00 27.36 MG
1040
1041 HETATM 3835 FE HEM A 1 17.140 3.115 15.066 1.00 14.14 FE
1042 HETATM 8238 S SO4 A2001 10.885 -15.746 -14.404 1.00 47.84 S
1043 HETATM 8239 O1 SO4 A2001 11.191 -14.833 -15.531 1.00 50.12 O
1044 HETATM 8240 O2 SO4 A2001 9.576 -16.338 -14.706 1.00 48.55 O
1045 HETATM 8241 O3 SO4 A2001 11.995 -16.703 -14.431 1.00 49.88 O
1046 HETATM 8242 O4 SO4 A2001 10.932 -15.073 -13.100 1.00 49.91 O
1047
1048
1049 @param file: The file to write the record to.
1050 @type file: file object
1051 @keyword serial: The atom serial number.
1052 @type serial: int
1053 @keyword name: The atom name.
1054 @type name: str
1055 @keyword alt_loc: The alternate location indicator.
1056 @type alt_loc: str
1057 @keyword res_name: The residue name.
1058 @type res_name: str
1059 @keyword chain_id: The chain identifier.
1060 @type chain_id: str
1061 @keyword res_seq: The sequence number.
1062 @type res_seq: int
1063 @keyword icode: The insertion code.
1064 @type icode: str
1065 @keyword x: Orthogonal coordinates for X in Angstroms.
1066 @type x: float
1067 @keyword y: Orthogonal coordinates for Y in Angstroms.
1068 @type y: float
1069 @keyword z: Orthogonal coordinates for Z in Angstroms.
1070 @type z: float
1071 @keyword occupancy: Occupancy.
1072 @type occupancy: float
1073 @keyword temp_factor: Temperature factor.
1074 @type temp_factor: float
1075 @keyword element: Element symbol.
1076 @type element: str
1077 @keyword charge: Charge on the atom.
1078 @type charge: int
1079 """
1080
1081
1082 text = "%-6s%5s %4s%1s%3s %1s%4s%1s %8.3f%8.3f%8.3f%6.2f%6.2f %2s%2s" % (
1083 'HETATM',
1084 _handle_none(serial),
1085 _handle_none(name),
1086 _handle_none(alt_loc),
1087 _handle_none(res_name),
1088 _handle_none(chain_id),
1089 _handle_none(res_seq),
1090 _handle_none(icode),
1091 _handle_none(x),
1092 _handle_none(y),
1093 _handle_none(z),
1094 _handle_none(occupancy),
1095 _handle_none(temp_factor),
1096 _handle_none(element),
1097 _handle_none(charge)
1098 )
1099
1100
1101 _record_validate(text)
1102
1103
1104 file.write(text)
1105 file.write('\n')
1106
1107
1108 -def hetnam(file, continuation='', het_id='', text=''):
1109 """Generate the HETNAM record.
1110
1111 The following is the PDB v3.3 documentation U{http://www.wwpdb.org/documentation/format33/sect4.html#HETNAM}.
1112
1113 HETNAM
1114 ======
1115
1116 Overview
1117 --------
1118
1119 This record gives the chemical name of the compound with the given hetID.
1120
1121
1122 Record Format
1123 -------------
1124
1125 The format is::
1126 ______________________________________________________________________________________________
1127 | | | | |
1128 | Columns | Data type | Field | Definition |
1129 |_________|______________|______________|____________________________________________________|
1130 | | | | |
1131 | 1 - 6 | Record name | "HETNAM" | |
1132 | 9 - 10 | Continuation | continuation | Allows concatenation of multiple records. |
1133 | 12 - 14 | LString(3) | hetID | Het identifier, right-justified. |
1134 | 16 - 70 | String | text | Chemical name. |
1135 |_________|______________|______________|____________________________________________________|
1136
1137
1138 Details
1139 -------
1140
1141 Each hetID is assigned a unique chemical name for the HETNAM record, see U{ftp://ftp.wwpdb.org/pub/pdb/data/monomers}.
1142
1143 Other names for the group are given on HETSYN records.
1144
1145 PDB entries follow IUPAC/IUB naming conventions to describe groups systematically.
1146
1147 The special character "~" is used to indicate superscript in a heterogen name. For example: N6 will be listed in the HETNAM section as N~6~, with the ~ character indicating both the start and end of the superscript in the name, e.g.:
1148
1149 - N-(BENZYLSULFONYL)SERYL-N~1~-{4-[AMINO(IMINO)METHYL]BENZYL}GLYCINAMIDE
1150
1151 Continuation of chemical names onto subsequent records is allowed.
1152
1153 Only one HETNAM record is included for a given hetID, even if the same hetID appears on more than one HET record.
1154
1155
1156 Verification/Validation/Value Authority Control
1157 -----------------------------------------------
1158
1159 For each het group that appears in the entry, the corresponding HET, HETNAM, FORMUL, HETATM, and CONECT records must appear. The HETNAM record is generated automatically using the Chemical Component Dictionary and information from HETATM records.
1160
1161
1162 Relationships to Other Record Types
1163 -----------------------------------
1164
1165 For each het group that appears in the entry, there must be corresponding HET, HETNAM, FORMUL, HETATM, and CONECT records. HETSYN and LINK records may also be created.
1166
1167
1168 Example
1169 -------
1170
1171 Example 1::
1172
1173 1 2 3 4 5 6 7 8
1174 12345678901234567890123456789012345678901234567890123456789012345678901234567890
1175 HETNAM NAG N-ACETYL-D-GLUCOSAMINE
1176 HETNAM SAD BETA-METHYLENE SELENAZOLE-4-CARBOXAMIDE ADENINE
1177 HETNAM 2 SAD DINUCLEOTIDE
1178
1179 HETNAM UDP URIDINE-5'-DIPHOSPHATE
1180
1181 HETNAM UNX UNKNOWN ATOM OR ION
1182 HETNAM UNL UNKNOWN LIGAND
1183
1184 HETNAM B3P 2-[3-(2-HYDROXY-1,1-DIHYDROXYMETHYL-ETHYLAMINO)-
1185 HETNAM 2 B3P PROPYLAMINO]-2-HYDROXYMETHYL-PROPANE-1,3-DIOL
1186
1187
1188 @param file: The file to write the record to.
1189 @type file: file object
1190 @keyword continuation: Allows concatenation of multiple records.
1191 @type continuation: int
1192 @keyword het_id: The Het identifier.
1193 @type het_id: str
1194 @keyword text: The chemical name.
1195 @type text: str
1196 """
1197
1198
1199 text = "%-6s %2s %3s %-55s%10s" % (
1200 'HETNAM',
1201 _handle_none(continuation),
1202 _handle_none(het_id),
1203 _handle_text(text),
1204 ''
1205 )
1206
1207
1208 _record_validate(text)
1209
1210
1211 file.write(text)
1212 file.write('\n')
1213
1214
1215 -def master(file, num_remark=0, num_het=0, num_helix=0, num_sheet=0, num_turn=0, num_site=0, num_xform=0, num_coord=0, num_ter=0, num_conect=0, num_seq=0):
1216 """Generate the MASTER record.
1217
1218 The following is the PDB v3.3 documentation U{http://www.wwpdb.org/documentation/format33/sect11.html#MASTER}.
1219
1220 MASTER
1221 ======
1222
1223 Overview
1224 --------
1225
1226 The MASTER record is a control record for bookkeeping. It lists the number of lines in the coordinate entry or file for selected record types. MASTER records only the first model when there are multiple models in the coordinates.
1227
1228
1229 Record Format
1230 -------------
1231
1232 The format is::
1233 ______________________________________________________________________________________________
1234 | | | | |
1235 | Columns | Data type | Field | Definition |
1236 |_________|______________|______________|____________________________________________________|
1237 | | | | |
1238 | 1 - 6 | Record name | "MASTER" | |
1239 | 11 - 15 | Integer | numRemark | Number of REMARK records |
1240 | 16 - 20 | Integer | "0" | |
1241 | 21 - 25 | Integer | numHet | Number of HET records |
1242 | 26 - 30 | Integer | numHelix | Number of HELIX records |
1243 | 31 - 35 | Integer | numSheet | Number of SHEET records |
1244 | 36 - 40 | Integer | numTurn | deprecated |
1245 | 41 - 45 | Integer | numSite | Number of SITE records |
1246 | 46 - 50 | Integer | numXform | Number of coordinate transformation records |
1247 | | | | (ORIGX+SCALE+MTRIX) |
1248 | 51 - 55 | Integer | numCoord | Number of atomic coordinate records (ATOM+HETATM) |
1249 | 56 - 60 | Integer | numTer | Number of TER records |
1250 | 61 - 65 | Integer | numConect | Number of CONECT records |
1251 | 66 - 70 | Integer | numSeq | Number of SEQRES records |
1252 |_________|______________|______________|____________________________________________________|
1253
1254
1255 Details
1256 -------
1257
1258 MASTER gives checksums of the number of records in the entry, for selected record types.
1259
1260 MASTER records only the first model when there are multiple models in the coordinates.
1261
1262
1263 Verification/Validation/Value Authority Control
1264 -----------------------------------------------
1265
1266 The MASTER line is automatically generated.
1267
1268
1269 Relationships to Other Record Types
1270 -----------------------------------
1271
1272 MASTER presents a checksum of the lines present for each of the record types listed above.
1273
1274
1275 Example
1276 -------
1277
1278 Example 1::
1279
1280 1 2 3 4 5 6 7 8
1281 12345678901234567890123456789012345678901234567890123456789012345678901234567890
1282 MASTER 40 0 0 0 0 0 0 6 2930 2 0 29
1283
1284
1285 @param file: The file to write the record to.
1286 @type file: file object
1287 @keyword num_remark: The number of REMARK records.
1288 @type num_remark: int
1289 @keyword num_het: The number of HET records.
1290 @type num_het: int
1291 @keyword num_helix: The number of HELIX records.
1292 @type num_helix: int
1293 @keyword num_sheet: The number of SHEET records.
1294 @type num_sheet: int
1295 @keyword num_turn: Depreciated.
1296 @type num_turn: int
1297 @keyword num_site: The number of SITE records.
1298 @type num_site: int
1299 @keyword num_xform: The number of coordinate transformation records (ORIGX+SCALE+MTRIX).
1300 @type num_xform: int
1301 @keyword num_coord: The number of atomic coordinate records (ATOM+HETATM).
1302 @type num_coord: int
1303 @keyword num_ter: The number of TER records.
1304 @type num_ter: int
1305 @keyword num_conect: The number of CONECT records.
1306 @type num_conect: int
1307 @keyword num_seq The number of SEQRES records.
1308 @type num_seq int
1309 """
1310
1311
1312 text = "%-6s %5s%5s%5s%5s%5s%5s%5s%5s%5s%5s%5s%5s%10s" % (
1313 'MASTER',
1314 _handle_none(num_remark),
1315 0,
1316 _handle_none(num_het),
1317 _handle_none(num_helix),
1318 _handle_none(num_sheet),
1319 _handle_none(num_turn),
1320 _handle_none(num_site),
1321 _handle_none(num_xform),
1322 _handle_none(num_coord),
1323 _handle_none(num_ter),
1324 _handle_none(num_conect),
1325 _handle_none(num_seq),
1326 ''
1327 )
1328
1329
1330 _record_validate(text)
1331
1332
1333 file.write(text)
1334 file.write('\n')
1335
1336
1337 -def model(file, serial=''):
1338 """Generate the MODEL record.
1339
1340 The following is the PDB v3.3 documentation U{http://www.wwpdb.org/documentation/format33/sect9.html#MODEL}.
1341
1342 MODEL
1343 =====
1344
1345 Overview
1346 --------
1347
1348 The MODEL record specifies the model serial number when multiple models of the same structure are presented in a single coordinate entry, as is often the case with structures determined by NMR.
1349
1350
1351 Record Format
1352 -------------
1353
1354 The format is::
1355 ______________________________________________________________________________________________
1356 | | | | |
1357 | Columns | Data type | Field | Definition |
1358 |_________|______________|______________|____________________________________________________|
1359 | | | | |
1360 | 1 - 6 | Record name | "MODEL " | |
1361 | 11 - 14 | Integer | serial | Model serial number. |
1362 |_________|______________|______________|____________________________________________________|
1363
1364
1365 Details
1366 -------
1367
1368 This record is used only when more than one model appears in an entry. Generally, it is employed mainly for NMR structures. The chemical connectivity should be the same for each model. ATOM, HETATM, ANISOU, and TER records for each model structure and are interspersed as needed between MODEL and ENDMDL records.
1369
1370 The numbering of models is sequential, beginning with 1.
1371
1372 All models in a deposition should be superimposed in an appropriate author determined manner and only one superposition method should be used. Structures from different experiments, or different domains of a structure should not be superimposed and deposited as models of a deposition.
1373
1374 All models in an NMR ensemble should be homogeneous - each model should have the exact same atoms (hydrogen and heavy atoms), sequence and chemistry.
1375
1376 All models in an NMR entry should have hydrogen atoms.
1377
1378 Deposition of minimized average structure must be accompanied with ensemble and must be homogeneous with ensemble.
1379
1380 A model cannot have more than 99,999 atoms. Where the entry does not contain an ensemble of models, then the entry cannot have more than 99,999 atoms. Entries that go beyond this atom limit must be split into multiple entries, each containing no more than the limits specified above.
1381
1382
1383 Verification/Validation/Value Authority Control
1384 -----------------------------------------------
1385
1386 Entries with multiple models in the NUMMDL record are checked for corresponding pairs of MODEL/ ENDMDL records, and for consecutively numbered models.
1387
1388
1389 Relationships to Other Record Types
1390 -----------------------------------
1391
1392 Each MODEL must have a corresponding ENDMDL record.
1393
1394
1395 Examples
1396 --------
1397
1398 Example 1::
1399
1400 1 2 3 4 5 6 7 8
1401 12345678901234567890123456789012345678901234567890123456789012345678901234567890
1402 MODEL 1
1403 ATOM 1 N ALA A 1 11.104 6.134 -6.504 1.00 0.00 N
1404 ATOM 2 CA ALA A 1 11.639 6.071 -5.147 1.00 0.00 C
1405 ...
1406 ...
1407 ...
1408 ATOM 293 1HG GLU A 18 -14.861 -4.847 0.361 1.00 0.00 H
1409 ATOM 294 2HG GLU A 18 -13.518 -3.769 0.084 1.00 0.00 H
1410 TER 295 GLU A 18
1411 ENDMDL
1412 MODEL 2
1413 ATOM 296 N ALA A 1 10.883 6.779 -6.464 1.00 0.00 N
1414 ATOM 297 CA ALA A 1 11.451 6.531 -5.142 1.00 0.00 C
1415 ...
1416 ...
1417 ATOM 588 1HG GLU A 18 -13.363 -4.163 -2.372 1.00 0.00 H
1418 ATOM 589 2HG GLU A 18 -12.634 -3.023 -3.475 1.00 0.00 H
1419 TER 590 GLU A 18
1420 ENDMDL
1421
1422 Example 2::
1423
1424 1 2 3 4 5 6 7 8
1425 12345678901234567890123456789012345678901234567890123456789012345678901234567890
1426 MODEL 1
1427 ATOM 1 N AALA A 1 72.883 57.697 56.410 0.50 83.80 N
1428 ATOM 2 CA AALA A 1 73.796 56.531 56.644 0.50 84.78 C
1429 ATOM 3 C AALA A 1 74.549 56.551 57.997 0.50 85.05 C
1430 ATOM 4 O AALA A 1 73.951 56.413 59.075 0.50 84.77 O
1431 ...
1432 ...
1433 ...
1434 HETATM37900 O AHOH 490 -24.915 147.513 36.413 0.50 41.86 O
1435 HETATM37901 O AHOH 491 -28.699 130.471 22.248 0.50 36.06 O
1436 HETATM37902 O AHOH 492 -33.309 184.488 26.176 0.50 15.00 O
1437 ENDMDL
1438 MODEL 2
1439 ATOM 1 N BALA A 1 72.883 57.697 56.410 0.50 83.80 N
1440 ATOM 2 CA BALA A 1 73.796 56.531 56.644 0.50 84.78 C
1441 ATOM 3 C BALA A 1 74.549 56.551 57.997 0.50 85.05 C
1442 ATOM 4 O BALA A 1 73.951 56.413 59.075 0.50 84.77 O
1443 ATOM 5 CB BALA A 1 74.804 56.369 55.453 0.50 84.29 C
1444 ATOM 6 N BASP A 2 75.872 56.703 57.905 0.50 85.59 N
1445 ATOM 7 CA BASP A 2 76.801 56.651 59.048 0.50 85.67 C
1446 ATOM 8 C BASP A 2 76.283 57.361 60.309 0.50 84.80 C
1447 ...
1448
1449
1450 @param file: The file to write the record to.
1451 @type file: file object
1452 @keyword serial: The model serial number.
1453 @type serial: int
1454 """
1455
1456
1457 text = "%-6s %4i%66s" % (
1458 'MODEL',
1459 _handle_none(serial),
1460 ''
1461 )
1462
1463
1464 _record_validate(text)
1465
1466
1467 file.write(text)
1468 file.write('\n')
1469
1470
1472 """Generate the REMARK record.
1473
1474 The following is the PDB v3.3 documentation U{http://www.wwpdb.org/documentation/format33/remarks.html}.
1475
1476 REMARK
1477 ======
1478
1479 Overview
1480 --------
1481
1482 REMARK records present experimental details, annotations, comments, and information not included in other records. In a number of cases, REMARKs are used to expand the contents of other record types. A new level of structure is being used for some REMARK records. This is expected to facilitate searching and will assist in the conversion to a relational database.
1483
1484 The very first line of every set of REMARK records is used as a spacer to aid in reading::
1485
1486 ______________________________________________________________________________________________
1487 | | | | |
1488 | Columns | Data type | Field | Definition |
1489 |_________|_____________|_____________|______________________________________________________|
1490 | | | | |
1491 | 1 - 6 | Record name | "REMARK" | |
1492 | 8 - 10 | Integer | remarkNum | Remark number. It is not an error for remark n to |
1493 | | | | exist in an entry when remark n-1 does not. |
1494 | 12 - 79 | LString | empty | Left as white space in first line of each new |
1495 | | | | remark. |
1496 |_________|_____________|_____________|______________________________________________________|
1497
1498
1499 @param file: The file to write the record to.
1500 @type file: file object
1501 @keyword num: The remarkNum value.
1502 @type num: int
1503 @keyword remark: The remark.
1504 @type remark: str
1505 """
1506
1507
1508 lines = []
1509
1510
1511 if remark == None:
1512 lines.append("%-6s %3s %-68s " % ("REMARK", num, ''))
1513
1514
1515 else:
1516 for line in wrap(remark, 68):
1517 lines.append("%-6s %3s %-68s " % ("REMARK", num, line.upper()))
1518
1519
1520 for text in lines:
1521
1522 _record_validate(text)
1523
1524
1525 file.write(text)
1526 file.write('\n')
1527
1528
1529 -def sheet(file, strand='', sheet_id='', num_strands='', init_res_name='', init_chain_id='', init_seq_num='', init_icode='', end_res_name='', end_chain_id='', end_seq_num='', end_icode='', sense='', cur_atom='', cur_res_name='', cur_chain_id='', cur_res_seq='', cur_icode='', prev_atom='', prev_res_name='', prev_chain_id='', prev_res_seq='', prev_icode=''):
1530 """Generate the SHEET record.
1531
1532 The following is the PDB v3.3 documentation U{http://www.wwpdb.org/documentation/format33/sect5.html#SHEET}.
1533
1534 SHEET
1535 =====
1536
1537 Overview
1538 --------
1539
1540 SHEET records are used to identify the position of sheets in the molecule. Sheets are both named and numbered. The residues where the sheet begins and ends are noted.
1541
1542
1543 Record Format
1544 -------------
1545
1546 The format is::
1547 ______________________________________________________________________________________________
1548 | | | | |
1549 | Columns | Data type | Field | Definition |
1550 |_________|______________|______________|____________________________________________________|
1551 | | | | |
1552 | 1 - 6 | Record name | "SHEET " | |
1553 | 8 - 10 | Integer | strand | Strand number which starts at 1 for each strand |
1554 | | | | within a sheet and increases by one. |
1555 | 12 - 14 | LString(3) | sheetID | Sheet identifier. |
1556 | 15 - 16 | Integer | numStrands | Number of strands in sheet. |
1557 | 18 - 20 | Residue name | initResName | Residue name of initial residue. |
1558 | 22 | Character | initChainID | Chain identifier of initial residue in strand. |
1559 | 23 - 26 | Integer | initSeqNum | Sequence number of initial residue in strand. |
1560 | 27 | AChar | initICode | Insertion code of initial residue in strand. |
1561 | 29 - 31 | Residue name | endResName | Residue name of terminal residue. |
1562 | 33 | Character | endChainID | Chain identifier of terminal residue. |
1563 | 34 - 37 | Integer | endSeqNum | Sequence number of terminal residue. |
1564 | 38 | AChar | endICode | Insertion code of terminal residue. |
1565 | 39 - 40 | Integer | sense | Sense of strand with respect to previous strand in |
1566 | | | | the sheet. 0 if first strand, 1 if parallel, and |
1567 | | | | -1 if anti-parallel. |
1568 | 42 - 45 | Atom | curAtom | Registration. Atom name in current strand. |
1569 | 46 - 48 | Residue name | curResName | Registration. Residue name in current strand. |
1570 | 50 | Character | curChainId | Registration. Chain identifier in current strand. |
1571 | 51 - 54 | Integer | curResSeq | Registration. Residue sequence number in current |
1572 | | | | strand. |
1573 | 55 | AChar | curICode | Registration. Insertion code in current strand. |
1574 | 57 - 60 | Atom | prevAtom | Registration. Atom name in previous strand. |
1575 | 61 - 63 | Residue name | prevResName | Registration. Residue name in previous strand. |
1576 | 65 | Character | prevChainId | Registration. Chain identifier in previous strand.|
1577 | 66 - 69 | Integer | prevResSeq | Registration. Residue sequence number in previous |
1578 | | | | strand. |
1579 | 70 | AChar | prevICode | Registration. Insertion code in previous strand. |
1580 |_________|______________|______________|____________________________________________________|
1581
1582
1583 Details
1584 -------
1585
1586 The initial residue for a strand is its N-terminus. Strand registration information is provided in columns 39 - 70. Strands are listed starting with one edge of the sheet and continuing to the spatially adjacent strand.
1587
1588 The sense in columns 39 - 40 indicates whether strand n is parallel (sense = 1) or anti-parallel (sense = -1) to strand n-1. Sense is equal to zero (0) for the first strand of a sheet.
1589
1590 The registration (columns 42 - 70) of strand n to strand n-1 may be specified by one hydrogen bond between each such pair of strands. This is done by providing the hydrogen bonding between the current and previous strands. No register information should be provided for the first strand.
1591
1592 Split strands, or strands with two or more runs of residues from discontinuous parts of the amino acid sequence, are explicitly listed. Detail description can be included in the REMARK 700.
1593
1594
1595 Relationships to Other Record Types
1596 -----------------------------------
1597
1598 If the entry contains bifurcated sheets or beta-barrels, the relevant REMARK 700 records must be provided. See the REMARK section for details.
1599
1600
1601 Examples
1602 --------
1603
1604 Example 1::
1605
1606 1 2 3 4 5 6 7 8
1607 12345678901234567890123456789012345678901234567890123456789012345678901234567890
1608 SHEET 1 A 5 THR A 107 ARG A 110 0
1609 SHEET 2 A 5 ILE A 96 THR A 99 -1 N LYS A 98 O THR A 107
1610 SHEET 3 A 5 ARG A 87 SER A 91 -1 N LEU A 89 O TYR A 97
1611 SHEET 4 A 5 TRP A 71 ASP A 75 -1 N ALA A 74 O ILE A 88
1612 SHEET 5 A 5 GLY A 52 PHE A 56 -1 N PHE A 56 O TRP A 71
1613 SHEET 1 B 5 THR B 107 ARG B 110 0
1614 SHEET 2 B 5 ILE B 96 THR B 99 -1 N LYS B 98 O THR B 107
1615 SHEET 3 B 5 ARG B 87 SER B 91 -1 N LEU B 89 O TYR B 97
1616 SHEET 4 B 5 TRP B 71 ASP B 75 -1 N ALA B 74 O ILE B 88
1617 SHEET 5 B 5 GLY B 52 ILE B 55 -1 N ASP B 54 O GLU B 73
1618
1619 The sheet presented as BS1 below is an eight-stranded beta-barrel. This is represented by a nine-stranded sheet in which the first and last strands are identical::
1620
1621 SHEET 1 BS1 9 VAL 13 ILE 17 0
1622 SHEET 2 BS1 9 ALA 70 ILE 73 1 O TRP 72 N ILE 17
1623 SHEET 3 BS1 9 LYS 127 PHE 132 1 O ILE 129 N ILE 73
1624 SHEET 4 BS1 9 GLY 221 ASP 225 1 O GLY 221 N ILE 130
1625 SHEET 5 BS1 9 VAL 248 GLU 253 1 O PHE 249 N ILE 222
1626 SHEET 6 BS1 9 LEU 276 ASP 278 1 N LEU 277 O GLY 252
1627 SHEET 7 BS1 9 TYR 310 THR 318 1 O VAL 317 N ASP 278
1628 SHEET 8 BS1 9 VAL 351 TYR 356 1 O VAL 351 N THR 318
1629 SHEET 9 BS1 9 VAL 13 ILE 17 1 N VAL 14 O PRO 352
1630
1631 The sheet structure of this example is bifurcated. In order to represent this feature, two sheets are defined. Strands 2 and 3 of BS7 and BS8 are identical::
1632
1633 SHEET 1 BS7 3 HIS 662 THR 665 0
1634 SHEET 2 BS7 3 LYS 639 LYS 648 -1 N PHE 643 O HIS 662
1635 SHEET 3 BS7 3 ASN 596 VAL 600 -1 N TYR 598 O ILE 646
1636 SHEET 1 BS8 3 ASN 653 TRP 656 0
1637 SHEET 2 BS8 3 LYS 639 LYS 648 -1 N LYS 647 O THR 655
1638 SHEET 3 BS8 3 ASN 596 VAL 600 -1 N TYR 598 O ILE 646
1639
1640
1641 @param file: The file to write the record to.
1642 @type file: file object
1643 @keyword strand: The strand number.
1644 @type strand: int
1645 @keyword sheet_id: The sheet identifier.
1646 @type sheet_id: str
1647 @keyword num_strands: The number of strands in sheet.
1648 @type num_strands: int
1649 @keyword init_res_name: The residue name of initial residue.
1650 @type init_res_name: str
1651 @keyword init_chain_id: The chain identifier of initial residue in strand.
1652 @type init_chain_id: str
1653 @keyword init_seq_num: The sequence number of initial residue in strand.
1654 @type init_seq_num: int
1655 @keyword init_icode: The insertion code of initial residue in strand.
1656 @type init_icode: str
1657 @keyword end_res_name: The residue name of terminal residue.
1658 @type end_res_name: str
1659 @keyword end_chain_id: The chain identifier of terminal residue.
1660 @type end_chain_id: str
1661 @keyword end_seq_num: The sequence number of terminal residue.
1662 @type end_seq_num: int
1663 @keyword end_icode: The insertion code of terminal residue.
1664 @type end_icode: str
1665 @keyword sense: The sense of strand with respect to previous strand.
1666 @type sense: int
1667 @keyword cur_atom: The atom name in current strand.
1668 @type cur_atom: str
1669 @keyword cur_res_name: The residue name in current strand.
1670 @type cur_res_name: str
1671 @keyword cur_chain_id: The chain identifier in current strand.
1672 @type cur_chain_id: str
1673 @keyword cur_res_seq: The residue sequence number in current strand.
1674 @type cur_res_seq: int
1675 @keyword cur_icode: The insertion code in current strand.
1676 @type cur_icode: str
1677 @keyword prev_atom: The atom name in previous strand.
1678 @type prev_atom: str
1679 @keyword prev_res_name: The residue name in previous strand.
1680 @type prev_res_name: str
1681 @keyword prev_chain_id: The chain identifier in previous strand.
1682 @type prev_chain_id: str
1683 @keyword prev_res_seq: The residue sequence number in previous strand.
1684 @type prev_res_seq: int
1685 @keyword prev_icode: The insertion code in previous strand.
1686 @type prev_icode: str
1687 """
1688
1689
1690 text = "%-6s %3s %3s%2s %3s %1s%4s%1s %3s %1s%4s%1s%2s %4s%3s %1s%4s%1s %4s%3s %1s%4s%1s%10s" % (
1691 'SHEET',
1692 _handle_none(strand),
1693 _handle_none(sheet_id),
1694 _handle_none(num_strands),
1695 _handle_none(init_res_name),
1696 _handle_none(init_chain_id),
1697 _handle_none(init_seq_num),
1698 _handle_none(init_icode),
1699 _handle_none(end_res_name),
1700 _handle_none(end_chain_id),
1701 _handle_none(end_seq_num),
1702 _handle_none(end_icode),
1703 _handle_none(sense),
1704 _handle_none(cur_atom),
1705 _handle_none(cur_res_name),
1706 _handle_none(cur_chain_id),
1707 _handle_none(cur_res_seq),
1708 _handle_none(cur_icode),
1709 _handle_none(prev_atom),
1710 _handle_none(prev_res_name),
1711 _handle_none(prev_chain_id),
1712 _handle_none(prev_res_seq),
1713 _handle_none(prev_icode),
1714 ''
1715 )
1716
1717
1718 _record_validate(text)
1719
1720
1721 file.write(text)
1722 file.write('\n')
1723
1724
1725 -def ter(file, serial='', res_name='', chain_id='', res_seq='', icode=''):
1726 """Generate the TER record.
1727
1728 The following is the PDB v3.3 documentation U{http://www.wwpdb.org/documentation/format33/sect9.html#TER}.
1729
1730 TER
1731 ===
1732
1733 Overview
1734 --------
1735
1736 The TER record indicates the end of a list of ATOM/HETATM records for a chain.
1737
1738
1739 Record Format
1740 -------------
1741
1742 The format is::
1743 ______________________________________________________________________________________________
1744 | | | | |
1745 | Columns | Data type | Field | Definition |
1746 |_________|______________|______________|____________________________________________________|
1747 | | | | |
1748 | 1 - 6 | Record name | "TER " | |
1749 | 7 - 11 | Integer | serial | Serial number. |
1750 | 18 - 20 | Residue name | resName | Residue name. |
1751 | 22 | Character | chainID | Chain identifier. |
1752 | 23 - 26 | Integer | resSeq | Residue sequence number. |
1753 | 27 | AChar | iCode | Insertion code. |
1754 |_________|______________|______________|____________________________________________________|
1755
1756
1757 Details
1758 -------
1759
1760 Every chain of ATOM/HETATM records presented on SEQRES records is terminated with a TER record.
1761
1762 The TER records occur in the coordinate section of the entry, and indicate the last residue presented for each polypeptide and/or nucleic acid chain for which there are determined coordinates. For proteins, the residue defined on the TER record is the carboxy-terminal residue; for nucleic acids it is the 3'-terminal residue.
1763
1764 For a cyclic molecule, the choice of termini is arbitrary.
1765
1766 Terminal oxygen atoms are presented as OXT for proteins, and as O5' or OP3 for nucleic acids. These atoms are present only if the last residue in the polymer is truly the last residue in the SEQRES.
1767
1768 The TER record has the same residue name, chain identifier, sequence number and insertion code as the terminal residue. The serial number of the TER record is one number greater than the serial number of the ATOM/HETATM preceding the TER.
1769
1770
1771 Verification/Validation/Value Authority Control
1772 -----------------------------------------------
1773
1774 TER must appear at the terminal carboxyl end or 3' end of a chain. For proteins, there is usually a terminal oxygen, labeled OXT. The validation program checks for the occurrence of TER and OXT records.
1775
1776
1777 Relationships to Other Record Types
1778 -----------------------------------
1779
1780 The residue name appearing on the TER record must be the same as the residue name of the immediately preceding ATOM or non-water HETATM record.
1781
1782
1783 Example
1784 -------
1785
1786 Example 1::
1787
1788 1 2 3 4 5 6 7 8
1789 12345678901234567890123456789012345678901234567890123456789012345678901234567890
1790 ATOM 601 N LEU A 75 -17.070 -16.002 2.409 1.00 55.63 N
1791 ATOM 602 CA LEU A 75 -16.343 -16.746 3.444 1.00 55.50 C
1792 ATOM 603 C LEU A 75 -16.499 -18.263 3.300 1.00 55.55 C
1793 ATOM 604 O LEU A 75 -16.645 -18.789 2.195 1.00 55.50 O
1794 ATOM 605 CB LEU A 75 -16.776 -16.283 4.844 1.00 55.51 C
1795 TER 606 LEU A 75
1796 ...
1797 ATOM 1185 O LEU B 75 26.292 -4.310 16.940 1.00 55.45 O
1798 ATOM 1186 CB LEU B 75 23.881 -1.551 16.797 1.00 55.32 C
1799 TER 1187 LEU B 75
1800 HETATM 1188 H2 SRT A1076 -17.263 11.260 28.634 1.00 59.62 H
1801 HETATM 1189 HA SRT A1076 -19.347 11.519 28.341 1.00 59.42 H
1802 HETATM 1190 H3 SRT A1076 -17.157 14.303 28.677 1.00 58.00 H
1803 HETATM 1191 HB SRT A1076 -15.110 13.610 28.816 1.00 57.77 H
1804 HETATM 1192 O1 SRT A1076 -17.028 11.281 31.131 1.00 62.63 O
1805
1806 ATOM 295 HB2 ALA A 18 4.601 -9.393 7.275 1.00 0.00 H
1807 ATOM 296 HB3 ALA A 18 3.340 -9.147 6.043 1.00 0.00 H
1808 TER 297 ALA A 18
1809 ENDMDL
1810
1811
1812 @param file: The file to write the record to.
1813 @type file: file object
1814 @keyword serial: The atom serial number.
1815 @type serial: int
1816 @keyword res_name: The residue name.
1817 @type res_name: str
1818 @keyword chain_id: The chain identifier.
1819 @type chain_id: str
1820 @keyword res_seq: The sequence number.
1821 @type res_seq: int
1822 @keyword icode: The insertion code.
1823 @type icode: str
1824 """
1825
1826
1827 text = "%-6s%5s %3s %1s%4s%1s%53s" % (
1828 'TER',
1829 _handle_none(serial),
1830 _handle_none(res_name),
1831 _handle_none(chain_id),
1832 _handle_none(res_seq),
1833 _handle_none(icode),
1834 ''
1835 )
1836
1837
1838 _record_validate(text)
1839
1840
1841 file.write(text)
1842 file.write('\n')
1843