biotite 0.38.0__cp311-cp311-macosx_11_0_arm64.whl → 0.40.0__cp311-cp311-macosx_11_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of biotite might be problematic. Click here for more details.
- biotite/__init__.py +3 -3
- biotite/application/application.py +33 -28
- biotite/application/dssp/app.py +18 -18
- biotite/application/sra/__init__.py +5 -0
- biotite/application/sra/app.py +337 -55
- biotite/database/entrez/__init__.py +2 -1
- biotite/database/entrez/check.py +14 -3
- biotite/database/entrez/download.py +20 -13
- biotite/database/entrez/key.py +44 -0
- biotite/database/entrez/query.py +38 -34
- biotite/database/pubchem/query.py +44 -44
- biotite/database/rcsb/download.py +19 -14
- biotite/database/rcsb/query.py +46 -46
- biotite/sequence/align/__init__.py +5 -1
- biotite/sequence/align/banded.c +1408 -1025
- biotite/sequence/align/banded.cpython-311-darwin.so +0 -0
- biotite/sequence/align/buckets.py +69 -0
- biotite/sequence/align/cigar.py +389 -0
- biotite/sequence/align/kmeralphabet.c +3220 -2850
- biotite/sequence/align/kmeralphabet.cpython-311-darwin.so +0 -0
- biotite/sequence/align/kmersimilarity.c +713 -663
- biotite/sequence/align/kmersimilarity.cpython-311-darwin.so +0 -0
- biotite/sequence/align/kmertable.cpp +68398 -0
- biotite/sequence/align/kmertable.cpython-311-darwin.so +0 -0
- biotite/sequence/align/localgapped.c +1507 -1074
- biotite/sequence/align/localgapped.cpython-311-darwin.so +0 -0
- biotite/sequence/align/localungapped.c +1143 -833
- biotite/sequence/align/localungapped.cpython-311-darwin.so +0 -0
- biotite/sequence/align/multiple.c +1569 -1092
- biotite/sequence/align/multiple.cpython-311-darwin.so +0 -0
- biotite/sequence/align/pairwise.c +1612 -1212
- biotite/sequence/align/pairwise.cpython-311-darwin.so +0 -0
- biotite/sequence/align/permutation.c +33259 -0
- biotite/sequence/align/permutation.cpython-311-darwin.so +0 -0
- biotite/sequence/align/primes.txt +821 -0
- biotite/sequence/align/{kmertable.c → selector.c} +9129 -16497
- biotite/sequence/align/selector.cpython-311-darwin.so +0 -0
- biotite/sequence/align/tracetable.c +685 -646
- biotite/sequence/align/tracetable.cpython-311-darwin.so +0 -0
- biotite/sequence/codec.c +1159 -841
- biotite/sequence/codec.cpython-311-darwin.so +0 -0
- biotite/sequence/graphics/alignment.py +212 -2
- biotite/sequence/io/genbank/annotation.py +11 -11
- biotite/sequence/phylo/nj.c +684 -636
- biotite/sequence/phylo/nj.cpython-311-darwin.so +0 -0
- biotite/sequence/phylo/tree.c +970 -673
- biotite/sequence/phylo/tree.cpython-311-darwin.so +0 -0
- biotite/sequence/phylo/upgma.c +672 -626
- biotite/sequence/phylo/upgma.cpython-311-darwin.so +0 -0
- biotite/structure/__init__.py +1 -1
- biotite/structure/atoms.py +1 -1
- biotite/structure/basepairs.py +7 -12
- biotite/structure/bonds.c +3861 -3749
- biotite/structure/bonds.cpython-311-darwin.so +0 -0
- biotite/structure/celllist.c +727 -707
- biotite/structure/celllist.cpython-311-darwin.so +0 -0
- biotite/structure/charges.c +1561 -1560
- biotite/structure/charges.cpython-311-darwin.so +0 -0
- biotite/structure/filter.py +30 -37
- biotite/structure/info/__init__.py +5 -8
- biotite/structure/info/atoms.py +25 -67
- biotite/structure/info/bonds.py +46 -100
- biotite/structure/info/ccd/README.rst +8 -0
- biotite/structure/info/ccd/amino_acids.txt +1646 -0
- biotite/structure/info/ccd/carbohydrates.txt +1133 -0
- biotite/structure/info/ccd/components.bcif +0 -0
- biotite/structure/info/ccd/nucleotides.txt +797 -0
- biotite/structure/info/ccd.py +95 -0
- biotite/structure/info/groups.py +90 -0
- biotite/structure/info/masses.py +21 -20
- biotite/structure/info/misc.py +11 -22
- biotite/structure/info/standardize.py +17 -12
- biotite/structure/io/__init__.py +2 -4
- biotite/structure/io/ctab.py +1 -1
- biotite/structure/io/general.py +37 -43
- biotite/structure/io/mmtf/__init__.py +3 -0
- biotite/structure/io/mmtf/convertarray.c +528 -365
- biotite/structure/io/mmtf/convertarray.cpython-311-darwin.so +0 -0
- biotite/structure/io/mmtf/convertfile.c +725 -676
- biotite/structure/io/mmtf/convertfile.cpython-311-darwin.so +0 -0
- biotite/structure/io/mmtf/decode.c +1070 -754
- biotite/structure/io/mmtf/decode.cpython-311-darwin.so +0 -0
- biotite/structure/io/mmtf/encode.c +727 -677
- biotite/structure/io/mmtf/encode.cpython-311-darwin.so +0 -0
- biotite/structure/io/mmtf/file.py +34 -26
- biotite/structure/io/npz/__init__.py +3 -0
- biotite/structure/io/npz/file.py +21 -18
- biotite/structure/io/pdb/__init__.py +3 -3
- biotite/structure/io/pdb/file.py +72 -70
- biotite/structure/io/pdb/hybrid36.c +540 -478
- biotite/structure/io/pdb/hybrid36.cpython-311-darwin.so +0 -0
- biotite/structure/io/pdbqt/file.py +82 -68
- biotite/structure/io/pdbx/__init__.py +13 -6
- biotite/structure/io/pdbx/bcif.py +649 -0
- biotite/structure/io/pdbx/cif.py +1028 -0
- biotite/structure/io/pdbx/component.py +243 -0
- biotite/structure/io/pdbx/convert.py +707 -359
- biotite/structure/io/pdbx/encoding.c +112813 -0
- biotite/structure/io/pdbx/encoding.cpython-311-darwin.so +0 -0
- biotite/structure/io/pdbx/error.py +14 -0
- biotite/structure/io/pdbx/legacy.py +267 -0
- biotite/structure/molecules.py +151 -151
- biotite/structure/residues.py +40 -40
- biotite/structure/sasa.c +713 -644
- biotite/structure/sasa.cpython-311-darwin.so +0 -0
- biotite/structure/superimpose.py +158 -115
- biotite/visualize.py +9 -11
- {biotite-0.38.0.dist-info → biotite-0.40.0.dist-info}/METADATA +2 -2
- {biotite-0.38.0.dist-info → biotite-0.40.0.dist-info}/RECORD +112 -102
- {biotite-0.38.0.dist-info → biotite-0.40.0.dist-info}/WHEEL +1 -1
- biotite/structure/info/amino_acids.json +0 -1556
- biotite/structure/info/amino_acids.py +0 -42
- biotite/structure/info/carbohydrates.json +0 -1122
- biotite/structure/info/carbohydrates.py +0 -39
- biotite/structure/info/intra_bonds.msgpack +0 -0
- biotite/structure/info/link_types.msgpack +0 -1
- biotite/structure/info/nucleotides.json +0 -772
- biotite/structure/info/nucleotides.py +0 -39
- biotite/structure/info/residue_masses.msgpack +0 -0
- biotite/structure/info/residue_names.msgpack +0 -3
- biotite/structure/info/residues.msgpack +0 -0
- biotite/structure/io/pdbx/file.py +0 -652
- {biotite-0.38.0.dist-info → biotite-0.40.0.dist-info}/LICENSE.rst +0 -0
- {biotite-0.38.0.dist-info → biotite-0.40.0.dist-info}/top_level.txt +0 -0
biotite/structure/io/pdb/file.py
CHANGED
|
@@ -52,23 +52,25 @@ _gamma = slice(47, 54)
|
|
|
52
52
|
class PDBFile(TextFile):
|
|
53
53
|
r"""
|
|
54
54
|
This class represents a PDB file.
|
|
55
|
-
|
|
56
|
-
The usage of
|
|
57
|
-
|
|
55
|
+
|
|
56
|
+
The usage of :mod:`biotite.structure.io.pdbx` is encouraged in favor
|
|
57
|
+
of this class.
|
|
58
|
+
|
|
58
59
|
This class only provides support for reading/writing the pure atom
|
|
59
60
|
information (*ATOM*, *HETATM*, *MODEL* and *ENDMDL* records). *TER*
|
|
60
61
|
records cannot be written.
|
|
61
62
|
Additionally, *REMARK* records can be read
|
|
62
|
-
|
|
63
|
+
|
|
63
64
|
See also
|
|
64
65
|
--------
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
CIFFile
|
|
67
|
+
BinaryCIFFile
|
|
68
|
+
|
|
67
69
|
Examples
|
|
68
70
|
--------
|
|
69
71
|
Load a `\\*.pdb` file, modify the structure and save the new
|
|
70
72
|
structure into a new file:
|
|
71
|
-
|
|
73
|
+
|
|
72
74
|
>>> import os.path
|
|
73
75
|
>>> file = PDBFile.read(os.path.join(path_to_structures, "1l2y.pdb"))
|
|
74
76
|
>>> array_stack = file.get_structure()
|
|
@@ -85,7 +87,7 @@ class PDBFile(TextFile):
|
|
|
85
87
|
file.lines = [line.ljust(80) for line in file.lines]
|
|
86
88
|
file._index_models_and_atoms()
|
|
87
89
|
return file
|
|
88
|
-
|
|
90
|
+
|
|
89
91
|
|
|
90
92
|
def get_remark(self, number):
|
|
91
93
|
r"""
|
|
@@ -96,7 +98,7 @@ class PDBFile(TextFile):
|
|
|
96
98
|
----------
|
|
97
99
|
number : int
|
|
98
100
|
The *REMARK* number, i.e. the `XXX` in ``REMARK XXX``.
|
|
99
|
-
|
|
101
|
+
|
|
100
102
|
Returns
|
|
101
103
|
-------
|
|
102
104
|
remark_lines : None or list of str
|
|
@@ -115,11 +117,11 @@ class PDBFile(TextFile):
|
|
|
115
117
|
>>> file = PDBFile.read(os.path.join(path_to_structures, "1l2y.pdb"))
|
|
116
118
|
>>> remarks = file.get_remark(900)
|
|
117
119
|
>>> print("\n".join(remarks))
|
|
118
|
-
RELATED ENTRIES
|
|
119
|
-
RELATED ID: 5292 RELATED DB: BMRB
|
|
120
|
-
BMRB 5292 IS CHEMICAL SHIFTS FOR TC5B IN BUFFER AND BUFFER
|
|
121
|
-
CONTAINING 30 VOL-% TFE.
|
|
122
|
-
RELATED ID: 1JRJ RELATED DB: PDB
|
|
120
|
+
RELATED ENTRIES
|
|
121
|
+
RELATED ID: 5292 RELATED DB: BMRB
|
|
122
|
+
BMRB 5292 IS CHEMICAL SHIFTS FOR TC5B IN BUFFER AND BUFFER
|
|
123
|
+
CONTAINING 30 VOL-% TFE.
|
|
124
|
+
RELATED ID: 1JRJ RELATED DB: PDB
|
|
123
125
|
1JRJ IS AN ANALAGOUS C-TERMINAL STRUCTURE.
|
|
124
126
|
>>> nonexistent_remark = file.get_remark(999)
|
|
125
127
|
>>> print(nonexistent_remark)
|
|
@@ -131,7 +133,7 @@ class PDBFile(TextFile):
|
|
|
131
133
|
number = int(number)
|
|
132
134
|
if number < 0 or number > 999:
|
|
133
135
|
raise ValueError("The number must be in range 0-999")
|
|
134
|
-
|
|
136
|
+
|
|
135
137
|
remark_string = f"REMARK {number:>3d}"
|
|
136
138
|
# Find lines and omit ``REMARK XXX `` part
|
|
137
139
|
remark_lines = [
|
|
@@ -155,12 +157,12 @@ class PDBFile(TextFile):
|
|
|
155
157
|
The number of models.
|
|
156
158
|
"""
|
|
157
159
|
return len(self._model_start_i)
|
|
158
|
-
|
|
160
|
+
|
|
159
161
|
|
|
160
162
|
def get_coord(self, model=None):
|
|
161
163
|
"""
|
|
162
164
|
Get only the coordinates from the PDB file.
|
|
163
|
-
|
|
165
|
+
|
|
164
166
|
Parameters
|
|
165
167
|
----------
|
|
166
168
|
model : int, optional
|
|
@@ -172,13 +174,13 @@ class PDBFile(TextFile):
|
|
|
172
174
|
If this parameter is omitted, an 3D coordinate array
|
|
173
175
|
containing all models will be returned, even if
|
|
174
176
|
the structure contains only one model.
|
|
175
|
-
|
|
177
|
+
|
|
176
178
|
Returns
|
|
177
179
|
-------
|
|
178
180
|
coord : ndarray, shape=(m,n,3) or shape=(n,3), dtype=float
|
|
179
181
|
The coordinates read from the ATOM and HETATM records of the
|
|
180
182
|
file.
|
|
181
|
-
|
|
183
|
+
|
|
182
184
|
Notes
|
|
183
185
|
-----
|
|
184
186
|
Note that :func:`get_coord()` may output more coordinates than
|
|
@@ -186,18 +188,18 @@ class PDBFile(TextFile):
|
|
|
186
188
|
:func:`get_structure()` call has.
|
|
187
189
|
The reason for this is, that :func:`get_structure()` filters
|
|
188
190
|
*altloc* IDs, while `get_coord()` does not.
|
|
189
|
-
|
|
191
|
+
|
|
190
192
|
Examples
|
|
191
193
|
--------
|
|
192
194
|
Read an :class:`AtomArrayStack` from multiple PDB files, where
|
|
193
195
|
each PDB file contains the same atoms but different positions.
|
|
194
196
|
This is an efficient approach when a trajectory is spread into
|
|
195
197
|
multiple PDB files, as done e.g. by the *Rosetta* modeling
|
|
196
|
-
software.
|
|
198
|
+
software.
|
|
197
199
|
|
|
198
200
|
For the purpose of this example, the PDB files are created from
|
|
199
201
|
an existing :class:`AtomArrayStack`.
|
|
200
|
-
|
|
202
|
+
|
|
201
203
|
>>> import os.path
|
|
202
204
|
>>> from tempfile import gettempdir
|
|
203
205
|
>>> file_names = []
|
|
@@ -251,7 +253,7 @@ class PDBFile(TextFile):
|
|
|
251
253
|
coord[m,i,2] = float(line[_coord_z])
|
|
252
254
|
i += 1
|
|
253
255
|
return coord
|
|
254
|
-
|
|
256
|
+
|
|
255
257
|
else:
|
|
256
258
|
coord_i = self._get_atom_record_indices_for_model(model)
|
|
257
259
|
coord = np.zeros((len(coord_i), 3), dtype=np.float32)
|
|
@@ -261,12 +263,12 @@ class PDBFile(TextFile):
|
|
|
261
263
|
coord[i,1] = float(line[_coord_y])
|
|
262
264
|
coord[i,2] = float(line[_coord_z])
|
|
263
265
|
return coord
|
|
264
|
-
|
|
266
|
+
|
|
265
267
|
|
|
266
268
|
def get_b_factor(self, model=None):
|
|
267
269
|
"""
|
|
268
270
|
Get only the B-factors from the PDB file.
|
|
269
|
-
|
|
271
|
+
|
|
270
272
|
Parameters
|
|
271
273
|
----------
|
|
272
274
|
model : int, optional
|
|
@@ -278,13 +280,13 @@ class PDBFile(TextFile):
|
|
|
278
280
|
If this parameter is omitted, an 2D B-factor array
|
|
279
281
|
containing all models will be returned, even if
|
|
280
282
|
the structure contains only one model.
|
|
281
|
-
|
|
283
|
+
|
|
282
284
|
Returns
|
|
283
285
|
-------
|
|
284
286
|
b_factor : ndarray, shape=(m,n) or shape=(n,), dtype=float
|
|
285
287
|
The B-factors read from the ATOM and HETATM records of the
|
|
286
288
|
file.
|
|
287
|
-
|
|
289
|
+
|
|
288
290
|
Notes
|
|
289
291
|
-----
|
|
290
292
|
Note that :func:`get_b_factor()` may output more B-factors
|
|
@@ -311,7 +313,7 @@ class PDBFile(TextFile):
|
|
|
311
313
|
b_factor[m,i] = float(line[_temp_f])
|
|
312
314
|
i += 1
|
|
313
315
|
return b_factor
|
|
314
|
-
|
|
316
|
+
|
|
315
317
|
else:
|
|
316
318
|
b_factor_i = self._get_atom_record_indices_for_model(model)
|
|
317
319
|
b_factor = np.zeros(len(b_factor_i), dtype=np.float32)
|
|
@@ -325,10 +327,10 @@ class PDBFile(TextFile):
|
|
|
325
327
|
include_bonds=False):
|
|
326
328
|
"""
|
|
327
329
|
Get an :class:`AtomArray` or :class:`AtomArrayStack` from the PDB file.
|
|
328
|
-
|
|
330
|
+
|
|
329
331
|
This function parses standard base-10 PDB files as well as
|
|
330
332
|
hybrid-36 PDB.
|
|
331
|
-
|
|
333
|
+
|
|
332
334
|
Parameters
|
|
333
335
|
----------
|
|
334
336
|
model : int, optional
|
|
@@ -365,7 +367,7 @@ class PDBFile(TextFile):
|
|
|
365
367
|
(e.g. especially inter-residue bonds),
|
|
366
368
|
have :attr:`BondType.ANY`, since the PDB format itself does
|
|
367
369
|
not support bond orders.
|
|
368
|
-
|
|
370
|
+
|
|
369
371
|
Returns
|
|
370
372
|
-------
|
|
371
373
|
array : AtomArray or AtomArrayStack
|
|
@@ -380,11 +382,11 @@ class PDBFile(TextFile):
|
|
|
380
382
|
annot_i = self._get_atom_record_indices_for_model(1)
|
|
381
383
|
# Record indices for coordinate determination
|
|
382
384
|
coord_i = self._atom_line_i
|
|
383
|
-
|
|
385
|
+
|
|
384
386
|
else:
|
|
385
387
|
annot_i = coord_i = self._get_atom_record_indices_for_model(model)
|
|
386
388
|
array = AtomArray(len(coord_i))
|
|
387
|
-
|
|
389
|
+
|
|
388
390
|
# Create mandatory and optional annotation arrays
|
|
389
391
|
chain_id = np.zeros(array.array_length(), array.chain_id.dtype)
|
|
390
392
|
res_id = np.zeros(array.array_length(), array.res_id.dtype)
|
|
@@ -416,10 +418,10 @@ class PDBFile(TextFile):
|
|
|
416
418
|
if line[_charge][0] in "+-":
|
|
417
419
|
charge_raw[i] = line[_charge]
|
|
418
420
|
else:
|
|
419
|
-
charge_raw[i] = line[_charge][::-1]
|
|
421
|
+
charge_raw[i] = line[_charge][::-1]
|
|
420
422
|
occupancy[i] = float(line[_occupancy].strip())
|
|
421
423
|
b_factor[i] = float(line[_temp_f].strip())
|
|
422
|
-
|
|
424
|
+
|
|
423
425
|
if include_bonds or \
|
|
424
426
|
(extra_fields is not None and "atom_id" in extra_fields):
|
|
425
427
|
# The atom IDs are only required in these two cases
|
|
@@ -429,7 +431,7 @@ class PDBFile(TextFile):
|
|
|
429
431
|
)
|
|
430
432
|
else:
|
|
431
433
|
atom_id = None
|
|
432
|
-
|
|
434
|
+
|
|
433
435
|
# Add annotation arrays to atom array (stack)
|
|
434
436
|
array.chain_id = chain_id
|
|
435
437
|
array.res_id = res_id
|
|
@@ -441,7 +443,7 @@ class PDBFile(TextFile):
|
|
|
441
443
|
|
|
442
444
|
for field in (extra_fields if extra_fields is not None else []):
|
|
443
445
|
if field == "atom_id":
|
|
444
|
-
# Copy is necessary to avoid double masking in
|
|
446
|
+
# Copy is necessary to avoid double masking in
|
|
445
447
|
# later altloc ID filtering
|
|
446
448
|
array.set_annotation("atom_id", atom_id.copy())
|
|
447
449
|
elif field == "charge":
|
|
@@ -468,7 +470,7 @@ class PDBFile(TextFile):
|
|
|
468
470
|
warnings.warn(
|
|
469
471
|
"{} elements were guessed from atom_name.".format(rep_num)
|
|
470
472
|
)
|
|
471
|
-
|
|
473
|
+
|
|
472
474
|
# Fill in coordinates
|
|
473
475
|
if isinstance(array, AtomArray):
|
|
474
476
|
for i, line_i in enumerate(coord_i):
|
|
@@ -476,7 +478,7 @@ class PDBFile(TextFile):
|
|
|
476
478
|
array.coord[i, 0] = float(line[_coord_x])
|
|
477
479
|
array.coord[i, 1] = float(line[_coord_y])
|
|
478
480
|
array.coord[i, 2] = float(line[_coord_z])
|
|
479
|
-
|
|
481
|
+
|
|
480
482
|
elif isinstance(array, AtomArrayStack):
|
|
481
483
|
m = 0
|
|
482
484
|
i = 0
|
|
@@ -510,7 +512,7 @@ class PDBFile(TextFile):
|
|
|
510
512
|
warnings.warn(
|
|
511
513
|
"File contains invalid 'CRYST1' record, box is ignored"
|
|
512
514
|
)
|
|
513
|
-
|
|
515
|
+
break
|
|
514
516
|
|
|
515
517
|
if isinstance(array, AtomArray):
|
|
516
518
|
array.box = box
|
|
@@ -518,7 +520,7 @@ class PDBFile(TextFile):
|
|
|
518
520
|
array.box = np.repeat(
|
|
519
521
|
box[np.newaxis, ...], array.stack_depth(), axis=0
|
|
520
522
|
)
|
|
521
|
-
break
|
|
523
|
+
break
|
|
522
524
|
|
|
523
525
|
# Filter altloc IDs
|
|
524
526
|
if altloc == "occupancy":
|
|
@@ -535,13 +537,13 @@ class PDBFile(TextFile):
|
|
|
535
537
|
array.set_annotation("altloc_id", altloc_id)
|
|
536
538
|
else:
|
|
537
539
|
raise ValueError(f"'{altloc}' is not a valid 'altloc' option")
|
|
538
|
-
|
|
540
|
+
|
|
539
541
|
# Read bonds
|
|
540
542
|
if include_bonds:
|
|
541
543
|
bond_list = self._get_bonds(atom_id)
|
|
542
544
|
bond_list = bond_list.merge(connect_via_residue_names(array))
|
|
543
545
|
array.bonds = bond_list
|
|
544
|
-
|
|
546
|
+
|
|
545
547
|
return array
|
|
546
548
|
|
|
547
549
|
|
|
@@ -549,13 +551,13 @@ class PDBFile(TextFile):
|
|
|
549
551
|
"""
|
|
550
552
|
Set the :class:`AtomArray` or :class:`AtomArrayStack` for the
|
|
551
553
|
file.
|
|
552
|
-
|
|
554
|
+
|
|
553
555
|
This makes also use of the optional annotation arrays
|
|
554
556
|
``'atom_id'``, ``'b_factor'``, ``'occupancy'`` and ``'charge'``.
|
|
555
557
|
If the atom array (stack) contains the annotation ``'atom_id'``,
|
|
556
558
|
these values will be used for atom numbering instead of
|
|
557
559
|
continuous numbering.
|
|
558
|
-
|
|
560
|
+
|
|
559
561
|
Parameters
|
|
560
562
|
----------
|
|
561
563
|
array : AtomArray or AtomArrayStack
|
|
@@ -565,7 +567,7 @@ class PDBFile(TextFile):
|
|
|
565
567
|
hybrid36: bool, optional
|
|
566
568
|
Defines wether the file should be written in hybrid-36
|
|
567
569
|
format.
|
|
568
|
-
|
|
570
|
+
|
|
569
571
|
Notes
|
|
570
572
|
-----
|
|
571
573
|
If `array` has an associated :class:`BondList`, ``CONECT``
|
|
@@ -608,13 +610,13 @@ class PDBFile(TextFile):
|
|
|
608
610
|
if (array.res_id > max_residues).any():
|
|
609
611
|
warnings.warn(f"Residue IDs exceed {max_residues:,}")
|
|
610
612
|
if np.isnan(array.coord).any():
|
|
611
|
-
raise
|
|
613
|
+
raise BadStructureError("Coordinates contain 'NaN' values")
|
|
612
614
|
if any([len(name) > 1 for name in array.chain_id]):
|
|
613
|
-
raise
|
|
615
|
+
raise BadStructureError("Some chain IDs exceed 1 character")
|
|
614
616
|
if any([len(name) > 3 for name in array.res_name]):
|
|
615
|
-
raise
|
|
617
|
+
raise BadStructureError("Some residue names exceed 3 characters")
|
|
616
618
|
if any([len(name) > 4 for name in array.atom_name]):
|
|
617
|
-
raise
|
|
619
|
+
raise BadStructureError("Some atom names exceed 4 characters")
|
|
618
620
|
|
|
619
621
|
if hybrid36:
|
|
620
622
|
pdb_atom_id = np.char.array(
|
|
@@ -638,7 +640,7 @@ class PDBFile(TextFile):
|
|
|
638
640
|
((array.res_id - 1) % 9999) + 1,
|
|
639
641
|
array.res_id
|
|
640
642
|
).astype(str))
|
|
641
|
-
|
|
643
|
+
|
|
642
644
|
names = np.char.array(
|
|
643
645
|
[f" {atm}" if len(elem) == 1 and len(atm) < 4 else atm
|
|
644
646
|
for atm, elem in zip(array.atom_name, array.element)]
|
|
@@ -666,7 +668,7 @@ class PDBFile(TextFile):
|
|
|
666
668
|
coords = array.coord
|
|
667
669
|
if coords.ndim == 2:
|
|
668
670
|
coords = coords[np.newaxis, ...]
|
|
669
|
-
|
|
671
|
+
|
|
670
672
|
self.lines = []
|
|
671
673
|
# Prepend a single CRYST1 record if we have box information
|
|
672
674
|
if array.box is not None:
|
|
@@ -693,7 +695,7 @@ class PDBFile(TextFile):
|
|
|
693
695
|
)
|
|
694
696
|
if is_stack:
|
|
695
697
|
self.lines.append("ENDMDL")
|
|
696
|
-
|
|
698
|
+
|
|
697
699
|
# Add CONECT records if bonds are present
|
|
698
700
|
if array.bonds is not None:
|
|
699
701
|
# Only non-water hetero records and connections between
|
|
@@ -709,9 +711,9 @@ class PDBFile(TextFile):
|
|
|
709
711
|
self._set_bonds(
|
|
710
712
|
BondList(array.array_length(), bond_array), pdb_atom_id
|
|
711
713
|
)
|
|
712
|
-
|
|
714
|
+
|
|
713
715
|
self._index_models_and_atoms()
|
|
714
|
-
|
|
716
|
+
|
|
715
717
|
|
|
716
718
|
def list_assemblies(self):
|
|
717
719
|
"""
|
|
@@ -726,7 +728,7 @@ class PDBFile(TextFile):
|
|
|
726
728
|
-------
|
|
727
729
|
assemblies : list of str
|
|
728
730
|
A list that contains the available assembly IDs.
|
|
729
|
-
|
|
731
|
+
|
|
730
732
|
Examples
|
|
731
733
|
--------
|
|
732
734
|
>>> import os.path
|
|
@@ -741,11 +743,11 @@ class PDBFile(TextFile):
|
|
|
741
743
|
"File does not contain assembly information (REMARK 300)"
|
|
742
744
|
)
|
|
743
745
|
return [
|
|
744
|
-
assembly_id.strip()
|
|
746
|
+
assembly_id.strip()
|
|
745
747
|
for assembly_id in remark_lines[0][12:].split(",")
|
|
746
748
|
]
|
|
747
|
-
|
|
748
|
-
|
|
749
|
+
|
|
750
|
+
|
|
749
751
|
def get_assembly(self, assembly_id=None, model=None, altloc="first",
|
|
750
752
|
extra_fields=[], include_bonds=False):
|
|
751
753
|
"""
|
|
@@ -801,7 +803,7 @@ class PDBFile(TextFile):
|
|
|
801
803
|
assembly : AtomArray or AtomArrayStack
|
|
802
804
|
The assembly.
|
|
803
805
|
The return type depends on the `model` parameter.
|
|
804
|
-
|
|
806
|
+
|
|
805
807
|
Examples
|
|
806
808
|
--------
|
|
807
809
|
|
|
@@ -869,7 +871,7 @@ class PDBFile(TextFile):
|
|
|
869
871
|
if line.startswith("APPLY THE FOLLOWING TO CHAINS:") or \
|
|
870
872
|
line.startswith(" AND CHAINS:"):
|
|
871
873
|
affected_chain_ids += [
|
|
872
|
-
chain_id.strip()
|
|
874
|
+
chain_id.strip()
|
|
873
875
|
for chain_id in line[30:].split(",")
|
|
874
876
|
]
|
|
875
877
|
else:
|
|
@@ -900,7 +902,7 @@ class PDBFile(TextFile):
|
|
|
900
902
|
assembly += sub_assembly
|
|
901
903
|
|
|
902
904
|
return assembly
|
|
903
|
-
|
|
905
|
+
|
|
904
906
|
|
|
905
907
|
def get_symmetry_mates(self, model=None, altloc="first",
|
|
906
908
|
extra_fields=[], include_bonds=False):
|
|
@@ -956,13 +958,13 @@ class PDBFile(TextFile):
|
|
|
956
958
|
symmetry_mates : AtomArray or AtomArrayStack
|
|
957
959
|
All atoms within a single unit cell.
|
|
958
960
|
The return type depends on the `model` parameter.
|
|
959
|
-
|
|
961
|
+
|
|
960
962
|
Notes
|
|
961
963
|
-----
|
|
962
964
|
To expand the structure beyond a single unit cell, use
|
|
963
965
|
:func:`repeat_box()` with the return value as its
|
|
964
966
|
input.
|
|
965
|
-
|
|
967
|
+
|
|
966
968
|
Examples
|
|
967
969
|
--------
|
|
968
970
|
|
|
@@ -993,7 +995,7 @@ class PDBFile(TextFile):
|
|
|
993
995
|
return _apply_transformations(
|
|
994
996
|
structure, rotations, translations
|
|
995
997
|
)
|
|
996
|
-
|
|
998
|
+
|
|
997
999
|
|
|
998
1000
|
|
|
999
1001
|
|
|
@@ -1014,7 +1016,7 @@ class PDBFile(TextFile):
|
|
|
1014
1016
|
# Single model
|
|
1015
1017
|
self._model_start_i = np.array([0])
|
|
1016
1018
|
break
|
|
1017
|
-
|
|
1019
|
+
|
|
1018
1020
|
# Line indices with ATOM or HETATM records
|
|
1019
1021
|
self._atom_line_i = np.array(
|
|
1020
1022
|
[
|
|
@@ -1075,7 +1077,7 @@ class PDBFile(TextFile):
|
|
|
1075
1077
|
def _get_bonds(self, atom_ids):
|
|
1076
1078
|
conect_lines = [line for line in self.lines
|
|
1077
1079
|
if line.startswith("CONECT")]
|
|
1078
|
-
|
|
1080
|
+
|
|
1079
1081
|
# Mapping from atom ids to indices in an AtomArray
|
|
1080
1082
|
atom_id_to_index = np.zeros(atom_ids[-1]+1, dtype=int)
|
|
1081
1083
|
try:
|
|
@@ -1097,7 +1099,7 @@ class PDBFile(TextFile):
|
|
|
1097
1099
|
# String is empty -> no further IDs
|
|
1098
1100
|
break
|
|
1099
1101
|
bonds.append((center_id, id))
|
|
1100
|
-
|
|
1102
|
+
|
|
1101
1103
|
# The length of the 'atom_ids' array
|
|
1102
1104
|
# is equal to the length of the AtomArray
|
|
1103
1105
|
return BondList(len(atom_ids), np.array(bonds, dtype=np.uint32))
|
|
@@ -1158,10 +1160,10 @@ def _parse_transformations(lines):
|
|
|
1158
1160
|
component_i += 1
|
|
1159
1161
|
if component_i == 3:
|
|
1160
1162
|
# All (x,y,z) components were parsed
|
|
1161
|
-
# -> head to the next transformation
|
|
1163
|
+
# -> head to the next transformation
|
|
1162
1164
|
transformation_i += 1
|
|
1163
1165
|
component_i = 0
|
|
1164
|
-
|
|
1166
|
+
|
|
1165
1167
|
return rotations, translations
|
|
1166
1168
|
|
|
1167
1169
|
|