biotite 0.39.0__cp310-cp310-macosx_11_0_arm64.whl → 0.41.0__cp310-cp310-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/dssp/app.py +18 -18
- biotite/database/pubchem/download.py +23 -23
- biotite/database/pubchem/query.py +7 -7
- biotite/database/rcsb/download.py +19 -14
- biotite/file.py +17 -9
- biotite/sequence/align/banded.c +258 -237
- biotite/sequence/align/banded.cpython-310-darwin.so +0 -0
- biotite/sequence/align/cigar.py +60 -15
- biotite/sequence/align/kmeralphabet.c +243 -222
- biotite/sequence/align/kmeralphabet.cpython-310-darwin.so +0 -0
- biotite/sequence/align/kmersimilarity.c +215 -196
- biotite/sequence/align/kmersimilarity.cpython-310-darwin.so +0 -0
- biotite/sequence/align/kmertable.cpp +233 -205
- biotite/sequence/align/kmertable.cpython-310-darwin.so +0 -0
- biotite/sequence/align/localgapped.c +258 -237
- biotite/sequence/align/localgapped.cpython-310-darwin.so +0 -0
- biotite/sequence/align/localungapped.c +235 -214
- biotite/sequence/align/localungapped.cpython-310-darwin.so +0 -0
- biotite/sequence/align/multiple.c +255 -234
- biotite/sequence/align/multiple.cpython-310-darwin.so +0 -0
- biotite/sequence/align/pairwise.c +274 -253
- biotite/sequence/align/pairwise.cpython-310-darwin.so +0 -0
- biotite/sequence/align/permutation.c +215 -196
- biotite/sequence/align/permutation.cpython-310-darwin.so +0 -0
- biotite/sequence/align/selector.c +217 -197
- biotite/sequence/align/selector.cpython-310-darwin.so +0 -0
- biotite/sequence/align/tracetable.c +215 -195
- biotite/sequence/align/tracetable.cpython-310-darwin.so +0 -0
- biotite/sequence/annotation.py +2 -2
- biotite/sequence/codec.c +235 -214
- biotite/sequence/codec.cpython-310-darwin.so +0 -0
- biotite/sequence/io/fasta/convert.py +27 -24
- biotite/sequence/phylo/nj.c +215 -196
- biotite/sequence/phylo/nj.cpython-310-darwin.so +0 -0
- biotite/sequence/phylo/tree.c +227 -202
- biotite/sequence/phylo/tree.cpython-310-darwin.so +0 -0
- biotite/sequence/phylo/upgma.c +215 -196
- biotite/sequence/phylo/upgma.cpython-310-darwin.so +0 -0
- biotite/structure/__init__.py +2 -0
- biotite/structure/basepairs.py +7 -12
- biotite/structure/bonds.c +1437 -1279
- biotite/structure/bonds.cpython-310-darwin.so +0 -0
- biotite/structure/celllist.c +217 -197
- biotite/structure/celllist.cpython-310-darwin.so +0 -0
- biotite/structure/charges.c +1052 -1101
- biotite/structure/charges.cpython-310-darwin.so +0 -0
- biotite/structure/dotbracket.py +2 -0
- biotite/structure/filter.py +30 -37
- biotite/structure/info/__init__.py +5 -8
- biotite/structure/info/atoms.py +31 -68
- biotite/structure/info/bonds.py +47 -101
- biotite/structure/info/ccd/README.rst +8 -0
- biotite/structure/info/ccd/amino_acids.txt +1663 -0
- biotite/structure/info/ccd/carbohydrates.txt +1135 -0
- biotite/structure/info/ccd/components.bcif +0 -0
- biotite/structure/info/ccd/nucleotides.txt +798 -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 +78 -25
- biotite/structure/info/standardize.py +17 -12
- biotite/structure/integrity.py +19 -70
- biotite/structure/io/__init__.py +2 -4
- biotite/structure/io/ctab.py +12 -106
- biotite/structure/io/general.py +167 -181
- biotite/structure/io/gro/file.py +16 -16
- biotite/structure/io/mmtf/__init__.py +3 -0
- biotite/structure/io/mmtf/convertarray.c +219 -198
- biotite/structure/io/mmtf/convertarray.cpython-310-darwin.so +0 -0
- biotite/structure/io/mmtf/convertfile.c +217 -197
- biotite/structure/io/mmtf/convertfile.cpython-310-darwin.so +0 -0
- biotite/structure/io/mmtf/decode.c +225 -204
- biotite/structure/io/mmtf/decode.cpython-310-darwin.so +0 -0
- biotite/structure/io/mmtf/encode.c +215 -196
- biotite/structure/io/mmtf/encode.cpython-310-darwin.so +0 -0
- biotite/structure/io/mmtf/file.py +34 -26
- biotite/structure/io/mol/__init__.py +4 -2
- biotite/structure/io/mol/convert.py +71 -7
- biotite/structure/io/mol/ctab.py +414 -0
- biotite/structure/io/mol/header.py +116 -0
- biotite/structure/io/mol/{file.py → mol.py} +69 -82
- biotite/structure/io/mol/sdf.py +909 -0
- 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 +89 -34
- biotite/structure/io/pdb/hybrid36.c +63 -43
- biotite/structure/io/pdb/hybrid36.cpython-310-darwin.so +0 -0
- biotite/structure/io/pdbqt/file.py +32 -32
- biotite/structure/io/pdbx/__init__.py +12 -6
- biotite/structure/io/pdbx/bcif.py +648 -0
- biotite/structure/io/pdbx/cif.py +1032 -0
- biotite/structure/io/pdbx/component.py +246 -0
- biotite/structure/io/pdbx/convert.py +858 -386
- biotite/structure/io/pdbx/encoding.c +112813 -0
- biotite/structure/io/pdbx/encoding.cpython-310-darwin.so +0 -0
- biotite/structure/io/pdbx/legacy.py +267 -0
- biotite/structure/molecules.py +151 -151
- biotite/structure/repair.py +253 -0
- biotite/structure/sasa.c +215 -196
- biotite/structure/sasa.cpython-310-darwin.so +0 -0
- biotite/structure/sequence.py +112 -0
- biotite/structure/superimpose.py +618 -116
- {biotite-0.39.0.dist-info → biotite-0.41.0.dist-info}/METADATA +3 -3
- {biotite-0.39.0.dist-info → biotite-0.41.0.dist-info}/RECORD +109 -103
- {biotite-0.39.0.dist-info → biotite-0.41.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.39.0.dist-info → biotite-0.41.0.dist-info}/LICENSE.rst +0 -0
- {biotite-0.39.0.dist-info → biotite-0.41.0.dist-info}/top_level.txt +0 -0
|
Binary file
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
# This source code is part of the Biotite package and is distributed
|
|
2
|
+
# under the 3-Clause BSD License. Please see 'LICENSE.rst' for further
|
|
3
|
+
# information.
|
|
4
|
+
|
|
5
|
+
__name__ = "biotite.structure.io.pdbx"
|
|
6
|
+
__author__ = "Patrick Kunzmann"
|
|
7
|
+
__all__ = ["PDBxFile"]
|
|
8
|
+
|
|
9
|
+
import copy
|
|
10
|
+
from collections.abc import MutableMapping
|
|
11
|
+
import warnings
|
|
12
|
+
from .cif import CIFFile, CIFBlock, CIFCategory, CIFColumn
|
|
13
|
+
from ....file import File, InvalidFileError
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class PDBxFile(File, MutableMapping):
|
|
17
|
+
"""
|
|
18
|
+
This class represents the legacy interface to CIF files.
|
|
19
|
+
|
|
20
|
+
The categories of the file can be accessed using the
|
|
21
|
+
:meth:`get_category()`/:meth:`set_category()` methods.
|
|
22
|
+
The content of each category is represented by a dictionary.
|
|
23
|
+
The dictionary contains the entry
|
|
24
|
+
(e.g. *label_entity_id* in *atom_site*) as key.
|
|
25
|
+
The corresponding values are either strings in *non-looped*
|
|
26
|
+
categories, or 1-D numpy arrays of string objects in case of
|
|
27
|
+
*looped* categories.
|
|
28
|
+
|
|
29
|
+
A category can be changed or added using :meth:`set_category()`:
|
|
30
|
+
If a string-valued dictionary is provided, a *non-looped* category
|
|
31
|
+
will be created; if an array-valued dictionary is given, a
|
|
32
|
+
*looped* category will be created. In case of arrays, it is
|
|
33
|
+
important that all arrays have the same size.
|
|
34
|
+
|
|
35
|
+
Alternatively, The content of this file can also be read/write
|
|
36
|
+
accessed using dictionary-like indexing:
|
|
37
|
+
You can either provide a data block and a category or only a
|
|
38
|
+
category, in which case the first data block is taken.
|
|
39
|
+
|
|
40
|
+
DEPRECATED: Use :class:`CIFFile` instead.
|
|
41
|
+
|
|
42
|
+
Notes
|
|
43
|
+
-----
|
|
44
|
+
This class is also able to detect and parse multiline entries in the
|
|
45
|
+
file. However, when writing a category no multiline values are used.
|
|
46
|
+
This could lead to long lines.
|
|
47
|
+
|
|
48
|
+
This class uses a lazy category dictionary creation: When reading
|
|
49
|
+
the file only the line positions of all categories are checked. The
|
|
50
|
+
time consuming task of dictionary creation is done when
|
|
51
|
+
:meth:`get_category()` is called.
|
|
52
|
+
|
|
53
|
+
Examples
|
|
54
|
+
--------
|
|
55
|
+
Read the file and get author names:
|
|
56
|
+
|
|
57
|
+
>>> import os.path
|
|
58
|
+
>>> file = PDBxFile.read(os.path.join(path_to_structures, "1l2y.cif"))
|
|
59
|
+
>>> author_dict = file.get_category("citation_author", block="1L2Y")
|
|
60
|
+
>>> print(author_dict["name"])
|
|
61
|
+
['Neidigh, J.W.' 'Fesinmeyer, R.M.' 'Andersen, N.H.']
|
|
62
|
+
|
|
63
|
+
Dictionary style indexing, no specification of data block:
|
|
64
|
+
|
|
65
|
+
>>> print(file["citation_author"]["name"])
|
|
66
|
+
['Neidigh, J.W.' 'Fesinmeyer, R.M.' 'Andersen, N.H.']
|
|
67
|
+
|
|
68
|
+
Get the structure from the file:
|
|
69
|
+
|
|
70
|
+
>>> arr = get_structure(file)
|
|
71
|
+
>>> print(type(arr).__name__)
|
|
72
|
+
AtomArrayStack
|
|
73
|
+
>>> arr = get_structure(file, model=1)
|
|
74
|
+
>>> print(type(arr).__name__)
|
|
75
|
+
AtomArray
|
|
76
|
+
|
|
77
|
+
Modify atom array and write it back into the file:
|
|
78
|
+
|
|
79
|
+
>>> arr_mod = rotate(arr, [1,2,3])
|
|
80
|
+
>>> set_structure(file, arr_mod)
|
|
81
|
+
>>> file.write(os.path.join(path_to_directory, "1l2y_mod.cif"))
|
|
82
|
+
"""
|
|
83
|
+
|
|
84
|
+
def __init__(self):
|
|
85
|
+
warnings.warn(
|
|
86
|
+
"'PDBxFile' is deprecated, use 'CIFFile' instead",
|
|
87
|
+
DeprecationWarning
|
|
88
|
+
)
|
|
89
|
+
super().__init__()
|
|
90
|
+
self._cif_file = CIFFile()
|
|
91
|
+
|
|
92
|
+
@property
|
|
93
|
+
def cif_file(self):
|
|
94
|
+
return self._cif_file
|
|
95
|
+
|
|
96
|
+
@property
|
|
97
|
+
def lines(self):
|
|
98
|
+
return self._cif_file.lines
|
|
99
|
+
|
|
100
|
+
@classmethod
|
|
101
|
+
def read(cls, file):
|
|
102
|
+
"""
|
|
103
|
+
Read a PDBx/mmCIF file.
|
|
104
|
+
|
|
105
|
+
Parameters
|
|
106
|
+
----------
|
|
107
|
+
file : file-like object or str
|
|
108
|
+
The file to be read.
|
|
109
|
+
Alternatively a file path can be supplied.
|
|
110
|
+
|
|
111
|
+
Returns
|
|
112
|
+
-------
|
|
113
|
+
file_object : PDBxFile
|
|
114
|
+
The parsed file.
|
|
115
|
+
"""
|
|
116
|
+
pdbx_file = PDBxFile()
|
|
117
|
+
pdbx_file._cif_file = CIFFile.read(file)
|
|
118
|
+
return pdbx_file
|
|
119
|
+
|
|
120
|
+
def write(self, file):
|
|
121
|
+
self._cif_file.write(file)
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
def get_block_names(self):
|
|
125
|
+
"""
|
|
126
|
+
Get the names of all data blocks in the file.
|
|
127
|
+
|
|
128
|
+
Returns
|
|
129
|
+
-------
|
|
130
|
+
blocks : list
|
|
131
|
+
List of data block names.
|
|
132
|
+
"""
|
|
133
|
+
return sorted(self._cif_file.keys())
|
|
134
|
+
|
|
135
|
+
def get_category(self, category, block=None, expect_looped=False):
|
|
136
|
+
"""
|
|
137
|
+
Get the dictionary for a given category.
|
|
138
|
+
|
|
139
|
+
Parameters
|
|
140
|
+
----------
|
|
141
|
+
category : string
|
|
142
|
+
The name of the category. The leading underscore is omitted.
|
|
143
|
+
block : string, optional
|
|
144
|
+
The name of the data block. Default is the first
|
|
145
|
+
(and most times only) data block of the file.
|
|
146
|
+
expect_looped : bool, optional
|
|
147
|
+
If set to true, the returned dictionary will always contain
|
|
148
|
+
arrays (only if the category exists):
|
|
149
|
+
If the category is *non-looped*, each array will contain
|
|
150
|
+
only one element.
|
|
151
|
+
|
|
152
|
+
Returns
|
|
153
|
+
-------
|
|
154
|
+
category_dict : dict of (str or ndarray, dtype=str) or None
|
|
155
|
+
A entry keyed dictionary. The corresponding values are
|
|
156
|
+
strings or array of strings for *non-looped* and
|
|
157
|
+
*looped* categories, respectively.
|
|
158
|
+
Returns None, if the data block does not contain the given
|
|
159
|
+
category.
|
|
160
|
+
"""
|
|
161
|
+
if block is None:
|
|
162
|
+
try:
|
|
163
|
+
block = self.get_block_names()[0]
|
|
164
|
+
except IndexError:
|
|
165
|
+
raise InvalidFileError("File is empty")
|
|
166
|
+
|
|
167
|
+
if category not in self._cif_file[block]:
|
|
168
|
+
return None
|
|
169
|
+
|
|
170
|
+
category_dict = {}
|
|
171
|
+
for column_name, column in self._cif_file[block][category].items():
|
|
172
|
+
if not expect_looped and len(column) == 1:
|
|
173
|
+
category_dict[column_name] = column.as_item()
|
|
174
|
+
else:
|
|
175
|
+
category_dict[column_name] = column.as_array()
|
|
176
|
+
return category_dict
|
|
177
|
+
|
|
178
|
+
def set_category(self, category, category_dict, block=None):
|
|
179
|
+
"""
|
|
180
|
+
Set the content of a category.
|
|
181
|
+
|
|
182
|
+
If the category is already existing, all lines corresponding
|
|
183
|
+
to the category are replaced. Otherwise a new category is
|
|
184
|
+
created and the lines are appended at the end of the data block.
|
|
185
|
+
|
|
186
|
+
Parameters
|
|
187
|
+
----------
|
|
188
|
+
category : string
|
|
189
|
+
The name of the category. The leading underscore is omitted.
|
|
190
|
+
category_dict : dict
|
|
191
|
+
The category content. The dictionary must have strings
|
|
192
|
+
(subcategories) as keys and strings or :class:`ndarray`
|
|
193
|
+
objects as values.
|
|
194
|
+
block : string, optional
|
|
195
|
+
The name of the data block. Default is the first
|
|
196
|
+
(and most times only) data block of the file. If the
|
|
197
|
+
block is not contained in the file yet, a new block is
|
|
198
|
+
appended at the end of the file.
|
|
199
|
+
"""
|
|
200
|
+
if block is None:
|
|
201
|
+
try:
|
|
202
|
+
block = self.get_block_names()[0]
|
|
203
|
+
except IndexError:
|
|
204
|
+
raise InvalidFileError(
|
|
205
|
+
"File is empty, give an explicit data block"
|
|
206
|
+
)
|
|
207
|
+
|
|
208
|
+
if block not in self._cif_file:
|
|
209
|
+
self._cif_file = CIFBlock()
|
|
210
|
+
self._cif_file[block][category] = CIFCategory({
|
|
211
|
+
column_name: CIFColumn(array)
|
|
212
|
+
for column_name, array in category_dict.items()
|
|
213
|
+
})
|
|
214
|
+
|
|
215
|
+
def __copy_fill__(self, clone):
|
|
216
|
+
super().__copy_fill__(clone)
|
|
217
|
+
clone._cif_file = copy.deepcopy(self._cif_file)
|
|
218
|
+
|
|
219
|
+
def __setitem__(self, index, item):
|
|
220
|
+
block, category_name = self._full_index(index)
|
|
221
|
+
self.set_category(category_name, item, block=block)
|
|
222
|
+
|
|
223
|
+
def __getitem__(self, index):
|
|
224
|
+
block, category_name = self._full_index(index)
|
|
225
|
+
return self.get_category(category_name, block=block)
|
|
226
|
+
|
|
227
|
+
def __delitem__(self, index):
|
|
228
|
+
block, category_name = self._full_index(index)
|
|
229
|
+
del self._cif_file[block][category_name]
|
|
230
|
+
|
|
231
|
+
def __contains__(self, index):
|
|
232
|
+
block, category_name = self._full_index(index)
|
|
233
|
+
return (block, category_name) in self._categories
|
|
234
|
+
|
|
235
|
+
def __iter__(self):
|
|
236
|
+
try:
|
|
237
|
+
block = self.get_block_names()[0]
|
|
238
|
+
except IndexError:
|
|
239
|
+
raise InvalidFileError(
|
|
240
|
+
"File is empty, give an explicit data block"
|
|
241
|
+
)
|
|
242
|
+
|
|
243
|
+
return iter(self._cif_file[block])
|
|
244
|
+
|
|
245
|
+
def __len__(self):
|
|
246
|
+
try:
|
|
247
|
+
block = self.get_block_names()[0]
|
|
248
|
+
except IndexError:
|
|
249
|
+
raise InvalidFileError(
|
|
250
|
+
"File is empty, give an explicit data block"
|
|
251
|
+
)
|
|
252
|
+
|
|
253
|
+
return len(self._cif_file[block])
|
|
254
|
+
|
|
255
|
+
def _full_index(self, index):
|
|
256
|
+
"""
|
|
257
|
+
Converts a an integer or tuple index into a block and a category
|
|
258
|
+
name.
|
|
259
|
+
"""
|
|
260
|
+
if isinstance(index, tuple):
|
|
261
|
+
return index[0], index[1]
|
|
262
|
+
elif isinstance(index, str):
|
|
263
|
+
return self.get_block_names()[0], index
|
|
264
|
+
else:
|
|
265
|
+
raise TypeError(
|
|
266
|
+
f"'{type(index).__name__}' is an invalid index type"
|
|
267
|
+
)
|
biotite/structure/molecules.py
CHANGED
|
@@ -30,7 +30,7 @@ def get_molecule_indices(array):
|
|
|
30
30
|
array : AtomArray or AtomArrayStack or BondList
|
|
31
31
|
The input structure with an associated :class:`BondList`.
|
|
32
32
|
Alternatively, the :class:`BondList` can be directly supplied.
|
|
33
|
-
|
|
33
|
+
|
|
34
34
|
Returns
|
|
35
35
|
-------
|
|
36
36
|
indices : list of ndarray, dtype=int
|
|
@@ -38,7 +38,7 @@ def get_molecule_indices(array):
|
|
|
38
38
|
atoms of a single molecule.
|
|
39
39
|
Consequently, the length of this list is equal to the number of
|
|
40
40
|
molecules in the input `array`.
|
|
41
|
-
|
|
41
|
+
|
|
42
42
|
See also
|
|
43
43
|
--------
|
|
44
44
|
get_molecule_masks
|
|
@@ -63,54 +63,54 @@ def get_molecule_indices(array):
|
|
|
63
63
|
>>> print(len(indices))
|
|
64
64
|
2
|
|
65
65
|
>>> print(atp[indices[0]])
|
|
66
|
-
HET 0 ATP PG P 1.200 -0.
|
|
67
|
-
HET 0 ATP O1G O 1.740 1.140 -6.
|
|
68
|
-
HET 0 ATP O2G O 2.
|
|
69
|
-
HET 0 ATP O3G O -0.
|
|
70
|
-
HET 0 ATP PB P 0.
|
|
71
|
-
HET 0 ATP O1B O 0.810 1.
|
|
72
|
-
HET 0 ATP O2B O -1.
|
|
73
|
-
HET 0 ATP O3B O 1.
|
|
74
|
-
HET 0 ATP PA P -0.
|
|
75
|
-
HET 0 ATP O1A O -2.
|
|
76
|
-
HET 0 ATP O2A O -0.
|
|
77
|
-
HET 0 ATP O3A O 0.
|
|
78
|
-
HET 0 ATP HOG2 H 2.100 -0.
|
|
79
|
-
HET 0 ATP HOG3 H -0.
|
|
80
|
-
HET 0 ATP HOB2 H -1.
|
|
81
|
-
HET 0 ATP HOA2 H 0.
|
|
66
|
+
HET 0 ATP PG P 1.200 -0.230 -6.850
|
|
67
|
+
HET 0 ATP O1G O 1.740 1.140 -6.670
|
|
68
|
+
HET 0 ATP O2G O 2.120 -1.040 -7.890
|
|
69
|
+
HET 0 ATP O3G O -0.300 -0.140 -7.420
|
|
70
|
+
HET 0 ATP PB P 0.260 -0.130 -4.450
|
|
71
|
+
HET 0 ATP O1B O 0.810 1.230 -4.300
|
|
72
|
+
HET 0 ATP O2B O -1.230 -0.040 -5.060
|
|
73
|
+
HET 0 ATP O3B O 1.190 -0.990 -5.430
|
|
74
|
+
HET 0 ATP PA P -0.740 0.070 -2.070
|
|
75
|
+
HET 0 ATP O1A O -2.100 0.140 -2.670
|
|
76
|
+
HET 0 ATP O2A O -0.120 1.550 -1.960
|
|
77
|
+
HET 0 ATP O3A O 0.200 -0.840 -3.000
|
|
78
|
+
HET 0 ATP HOG2 H 2.100 -0.550 -8.730
|
|
79
|
+
HET 0 ATP HOG3 H -0.620 -1.050 -7.520
|
|
80
|
+
HET 0 ATP HOB2 H -1.550 -0.950 -5.130
|
|
81
|
+
HET 0 ATP HOA2 H 0.750 1.460 -1.560
|
|
82
82
|
>>> print(atp[indices[1]])
|
|
83
|
-
HET 0 ATP O5' O -0.
|
|
84
|
-
HET 0 ATP C5' C -1.
|
|
85
|
-
HET 0 ATP C4' C -1.
|
|
86
|
-
HET 0 ATP O4' O -0.
|
|
87
|
-
HET 0 ATP C3' C -2.
|
|
88
|
-
HET 0 ATP O3' O -4.
|
|
89
|
-
HET 0 ATP C2' C -2.
|
|
90
|
-
HET 0 ATP O2' O -2.
|
|
91
|
-
HET 0 ATP C1' C -0.830 -0.
|
|
92
|
-
HET 0 ATP N9 N 0.
|
|
93
|
-
HET 0 ATP C8 C 1.
|
|
94
|
-
HET 0 ATP N7 N 2.
|
|
95
|
-
HET 0 ATP C5 C 1.
|
|
96
|
-
HET 0 ATP C6 C 2.
|
|
97
|
-
HET 0 ATP N6 N 3.
|
|
98
|
-
HET 0 ATP N1 N 1.
|
|
99
|
-
HET 0 ATP C2 C 0.
|
|
100
|
-
HET 0 ATP N3 N 0.
|
|
101
|
-
HET 0 ATP C4 C 0.
|
|
102
|
-
HET 0 ATP H5'1 H -2.
|
|
103
|
-
HET 0 ATP H5'2 H -1.
|
|
104
|
-
HET 0 ATP H4' H -2.
|
|
105
|
-
HET 0 ATP H3' H -2.
|
|
106
|
-
HET 0 ATP HO3' H -4.
|
|
107
|
-
HET 0 ATP H2' H -1.
|
|
108
|
-
HET 0 ATP HO2' H -3.
|
|
109
|
-
HET 0 ATP H1' H -1.
|
|
110
|
-
HET 0 ATP H8 H 1.
|
|
111
|
-
HET 0 ATP HN61 H 3.
|
|
112
|
-
HET 0 ATP HN62 H 4.
|
|
113
|
-
HET 0 ATP H2 H 0.
|
|
83
|
+
HET 0 ATP O5' O -0.840 -0.590 -0.600
|
|
84
|
+
HET 0 ATP C5' C -1.690 0.260 0.170
|
|
85
|
+
HET 0 ATP C4' C -1.830 -0.310 1.580
|
|
86
|
+
HET 0 ATP O4' O -0.540 -0.360 2.230
|
|
87
|
+
HET 0 ATP C3' C -2.680 0.630 2.460
|
|
88
|
+
HET 0 ATP O3' O -4.030 0.160 2.530
|
|
89
|
+
HET 0 ATP C2' C -2.010 0.560 3.860
|
|
90
|
+
HET 0 ATP O2' O -2.930 0.040 4.830
|
|
91
|
+
HET 0 ATP C1' C -0.830 -0.420 3.650
|
|
92
|
+
HET 0 ATP N9 N 0.330 0.020 4.430
|
|
93
|
+
HET 0 ATP C8 C 1.300 0.880 4.010
|
|
94
|
+
HET 0 ATP N7 N 2.180 1.040 4.960
|
|
95
|
+
HET 0 ATP C5 C 1.830 0.300 6.030
|
|
96
|
+
HET 0 ATP C6 C 2.390 0.080 7.300
|
|
97
|
+
HET 0 ATP N6 N 3.560 0.710 7.680
|
|
98
|
+
HET 0 ATP N1 N 1.760 -0.750 8.140
|
|
99
|
+
HET 0 ATP C2 C 0.640 -1.350 7.780
|
|
100
|
+
HET 0 ATP N3 N 0.090 -1.180 6.600
|
|
101
|
+
HET 0 ATP C4 C 0.640 -0.370 5.700
|
|
102
|
+
HET 0 ATP H5'1 H -2.680 0.310 -0.300
|
|
103
|
+
HET 0 ATP H5'2 H -1.260 1.260 0.220
|
|
104
|
+
HET 0 ATP H4' H -2.280 -1.300 1.550
|
|
105
|
+
HET 0 ATP H3' H -2.650 1.650 2.080
|
|
106
|
+
HET 0 ATP HO3' H -4.520 0.790 3.090
|
|
107
|
+
HET 0 ATP H2' H -1.650 1.540 4.160
|
|
108
|
+
HET 0 ATP HO2' H -3.670 0.660 4.870
|
|
109
|
+
HET 0 ATP H1' H -1.120 -1.430 3.930
|
|
110
|
+
HET 0 ATP H8 H 1.330 1.360 3.040
|
|
111
|
+
HET 0 ATP HN61 H 3.940 0.550 8.560
|
|
112
|
+
HET 0 ATP HN62 H 4.020 1.300 7.060
|
|
113
|
+
HET 0 ATP H2 H 0.170 -2.010 8.490
|
|
114
114
|
"""
|
|
115
115
|
if isinstance(array, BondList):
|
|
116
116
|
bonds = array
|
|
@@ -123,7 +123,7 @@ def get_molecule_indices(array):
|
|
|
123
123
|
f"Expected a 'BondList', 'AtomArray' or 'AtomArrayStack', "
|
|
124
124
|
f"not '{type(array).__name__}'"
|
|
125
125
|
)
|
|
126
|
-
|
|
126
|
+
|
|
127
127
|
molecule_indices = []
|
|
128
128
|
visited_mask = np.zeros(bonds.get_atom_count(), dtype=bool)
|
|
129
129
|
while not visited_mask.all():
|
|
@@ -148,15 +148,15 @@ def get_molecule_masks(array):
|
|
|
148
148
|
array : AtomArray, shape=(n,) or AtomArrayStack, shape=(m,n) or BondList
|
|
149
149
|
The input structure with an associated :class:`BondList`.
|
|
150
150
|
Alternatively, the :class:`BondList` can be directly supplied.
|
|
151
|
-
|
|
151
|
+
|
|
152
152
|
Returns
|
|
153
153
|
-------
|
|
154
|
-
masks : ndarray, shape=(k,n), dtype=bool,
|
|
154
|
+
masks : ndarray, shape=(k,n), dtype=bool,
|
|
155
155
|
Each element in the array is a boolean mask referring to the
|
|
156
156
|
atoms of a single molecule.
|
|
157
157
|
Consequently, the length of this list is equal to the number of
|
|
158
158
|
molecules in the input `array`.
|
|
159
|
-
|
|
159
|
+
|
|
160
160
|
See also
|
|
161
161
|
--------
|
|
162
162
|
get_molecule_indices
|
|
@@ -181,54 +181,54 @@ def get_molecule_masks(array):
|
|
|
181
181
|
>>> print(len(masks))
|
|
182
182
|
2
|
|
183
183
|
>>> print(atp[masks[0]])
|
|
184
|
-
HET 0 ATP PG P 1.200 -0.
|
|
185
|
-
HET 0 ATP O1G O 1.740 1.140 -6.
|
|
186
|
-
HET 0 ATP O2G O 2.
|
|
187
|
-
HET 0 ATP O3G O -0.
|
|
188
|
-
HET 0 ATP PB P 0.
|
|
189
|
-
HET 0 ATP O1B O 0.810 1.
|
|
190
|
-
HET 0 ATP O2B O -1.
|
|
191
|
-
HET 0 ATP O3B O 1.
|
|
192
|
-
HET 0 ATP PA P -0.
|
|
193
|
-
HET 0 ATP O1A O -2.
|
|
194
|
-
HET 0 ATP O2A O -0.
|
|
195
|
-
HET 0 ATP O3A O 0.
|
|
196
|
-
HET 0 ATP HOG2 H 2.100 -0.
|
|
197
|
-
HET 0 ATP HOG3 H -0.
|
|
198
|
-
HET 0 ATP HOB2 H -1.
|
|
199
|
-
HET 0 ATP HOA2 H 0.
|
|
184
|
+
HET 0 ATP PG P 1.200 -0.230 -6.850
|
|
185
|
+
HET 0 ATP O1G O 1.740 1.140 -6.670
|
|
186
|
+
HET 0 ATP O2G O 2.120 -1.040 -7.890
|
|
187
|
+
HET 0 ATP O3G O -0.300 -0.140 -7.420
|
|
188
|
+
HET 0 ATP PB P 0.260 -0.130 -4.450
|
|
189
|
+
HET 0 ATP O1B O 0.810 1.230 -4.300
|
|
190
|
+
HET 0 ATP O2B O -1.230 -0.040 -5.060
|
|
191
|
+
HET 0 ATP O3B O 1.190 -0.990 -5.430
|
|
192
|
+
HET 0 ATP PA P -0.740 0.070 -2.070
|
|
193
|
+
HET 0 ATP O1A O -2.100 0.140 -2.670
|
|
194
|
+
HET 0 ATP O2A O -0.120 1.550 -1.960
|
|
195
|
+
HET 0 ATP O3A O 0.200 -0.840 -3.000
|
|
196
|
+
HET 0 ATP HOG2 H 2.100 -0.550 -8.730
|
|
197
|
+
HET 0 ATP HOG3 H -0.620 -1.050 -7.520
|
|
198
|
+
HET 0 ATP HOB2 H -1.550 -0.950 -5.130
|
|
199
|
+
HET 0 ATP HOA2 H 0.750 1.460 -1.560
|
|
200
200
|
>>> print(atp[masks[1]])
|
|
201
|
-
HET 0 ATP O5' O -0.
|
|
202
|
-
HET 0 ATP C5' C -1.
|
|
203
|
-
HET 0 ATP C4' C -1.
|
|
204
|
-
HET 0 ATP O4' O -0.
|
|
205
|
-
HET 0 ATP C3' C -2.
|
|
206
|
-
HET 0 ATP O3' O -4.
|
|
207
|
-
HET 0 ATP C2' C -2.
|
|
208
|
-
HET 0 ATP O2' O -2.
|
|
209
|
-
HET 0 ATP C1' C -0.830 -0.
|
|
210
|
-
HET 0 ATP N9 N 0.
|
|
211
|
-
HET 0 ATP C8 C 1.
|
|
212
|
-
HET 0 ATP N7 N 2.
|
|
213
|
-
HET 0 ATP C5 C 1.
|
|
214
|
-
HET 0 ATP C6 C 2.
|
|
215
|
-
HET 0 ATP N6 N 3.
|
|
216
|
-
HET 0 ATP N1 N 1.
|
|
217
|
-
HET 0 ATP C2 C 0.
|
|
218
|
-
HET 0 ATP N3 N 0.
|
|
219
|
-
HET 0 ATP C4 C 0.
|
|
220
|
-
HET 0 ATP H5'1 H -2.
|
|
221
|
-
HET 0 ATP H5'2 H -1.
|
|
222
|
-
HET 0 ATP H4' H -2.
|
|
223
|
-
HET 0 ATP H3' H -2.
|
|
224
|
-
HET 0 ATP HO3' H -4.
|
|
225
|
-
HET 0 ATP H2' H -1.
|
|
226
|
-
HET 0 ATP HO2' H -3.
|
|
227
|
-
HET 0 ATP H1' H -1.
|
|
228
|
-
HET 0 ATP H8 H 1.
|
|
229
|
-
HET 0 ATP HN61 H 3.
|
|
230
|
-
HET 0 ATP HN62 H 4.
|
|
231
|
-
HET 0 ATP H2 H 0.
|
|
201
|
+
HET 0 ATP O5' O -0.840 -0.590 -0.600
|
|
202
|
+
HET 0 ATP C5' C -1.690 0.260 0.170
|
|
203
|
+
HET 0 ATP C4' C -1.830 -0.310 1.580
|
|
204
|
+
HET 0 ATP O4' O -0.540 -0.360 2.230
|
|
205
|
+
HET 0 ATP C3' C -2.680 0.630 2.460
|
|
206
|
+
HET 0 ATP O3' O -4.030 0.160 2.530
|
|
207
|
+
HET 0 ATP C2' C -2.010 0.560 3.860
|
|
208
|
+
HET 0 ATP O2' O -2.930 0.040 4.830
|
|
209
|
+
HET 0 ATP C1' C -0.830 -0.420 3.650
|
|
210
|
+
HET 0 ATP N9 N 0.330 0.020 4.430
|
|
211
|
+
HET 0 ATP C8 C 1.300 0.880 4.010
|
|
212
|
+
HET 0 ATP N7 N 2.180 1.040 4.960
|
|
213
|
+
HET 0 ATP C5 C 1.830 0.300 6.030
|
|
214
|
+
HET 0 ATP C6 C 2.390 0.080 7.300
|
|
215
|
+
HET 0 ATP N6 N 3.560 0.710 7.680
|
|
216
|
+
HET 0 ATP N1 N 1.760 -0.750 8.140
|
|
217
|
+
HET 0 ATP C2 C 0.640 -1.350 7.780
|
|
218
|
+
HET 0 ATP N3 N 0.090 -1.180 6.600
|
|
219
|
+
HET 0 ATP C4 C 0.640 -0.370 5.700
|
|
220
|
+
HET 0 ATP H5'1 H -2.680 0.310 -0.300
|
|
221
|
+
HET 0 ATP H5'2 H -1.260 1.260 0.220
|
|
222
|
+
HET 0 ATP H4' H -2.280 -1.300 1.550
|
|
223
|
+
HET 0 ATP H3' H -2.650 1.650 2.080
|
|
224
|
+
HET 0 ATP HO3' H -4.520 0.790 3.090
|
|
225
|
+
HET 0 ATP H2' H -1.650 1.540 4.160
|
|
226
|
+
HET 0 ATP HO2' H -3.670 0.660 4.870
|
|
227
|
+
HET 0 ATP H1' H -1.120 -1.430 3.930
|
|
228
|
+
HET 0 ATP H8 H 1.330 1.360 3.040
|
|
229
|
+
HET 0 ATP HN61 H 3.940 0.550 8.560
|
|
230
|
+
HET 0 ATP HN62 H 4.020 1.300 7.060
|
|
231
|
+
HET 0 ATP H2 H 0.170 -2.010 8.490
|
|
232
232
|
"""
|
|
233
233
|
if isinstance(array, BondList):
|
|
234
234
|
bonds = array
|
|
@@ -241,7 +241,7 @@ def get_molecule_masks(array):
|
|
|
241
241
|
f"Expected a 'BondList', 'AtomArray' or 'AtomArrayStack', "
|
|
242
242
|
f"not '{type(array).__name__}'"
|
|
243
243
|
)
|
|
244
|
-
|
|
244
|
+
|
|
245
245
|
molecule_indices = get_molecule_indices(bonds)
|
|
246
246
|
molecule_masks = np.zeros(
|
|
247
247
|
(len(molecule_indices), bonds.get_atom_count()),
|
|
@@ -265,12 +265,12 @@ def molecule_iter(array):
|
|
|
265
265
|
----------
|
|
266
266
|
array : AtomArray or AtomArrayStack
|
|
267
267
|
The input structure with an associated :class:`BondList`.
|
|
268
|
-
|
|
268
|
+
|
|
269
269
|
Yields
|
|
270
270
|
------
|
|
271
271
|
molecule : AtomArray or AtomArrayStack
|
|
272
272
|
A single molecule of the input `array`.
|
|
273
|
-
|
|
273
|
+
|
|
274
274
|
See also
|
|
275
275
|
--------
|
|
276
276
|
get_molecule_indices
|
|
@@ -289,61 +289,61 @@ def molecule_iter(array):
|
|
|
289
289
|
... print(molecule)
|
|
290
290
|
... print()
|
|
291
291
|
New molecule
|
|
292
|
-
HET 0 ATP PG P 1.200 -0.
|
|
293
|
-
HET 0 ATP O1G O 1.740 1.140 -6.
|
|
294
|
-
HET 0 ATP O2G O 2.
|
|
295
|
-
HET 0 ATP O3G O -0.
|
|
296
|
-
HET 0 ATP PB P 0.
|
|
297
|
-
HET 0 ATP O1B O 0.810 1.
|
|
298
|
-
HET 0 ATP O2B O -1.
|
|
299
|
-
HET 0 ATP O3B O 1.
|
|
300
|
-
HET 0 ATP PA P -0.
|
|
301
|
-
HET 0 ATP O1A O -2.
|
|
302
|
-
HET 0 ATP O2A O -0.
|
|
303
|
-
HET 0 ATP O3A O 0.
|
|
304
|
-
HET 0 ATP HOG2 H 2.100 -0.
|
|
305
|
-
HET 0 ATP HOG3 H -0.
|
|
306
|
-
HET 0 ATP HOB2 H -1.
|
|
307
|
-
HET 0 ATP HOA2 H 0.
|
|
292
|
+
HET 0 ATP PG P 1.200 -0.230 -6.850
|
|
293
|
+
HET 0 ATP O1G O 1.740 1.140 -6.670
|
|
294
|
+
HET 0 ATP O2G O 2.120 -1.040 -7.890
|
|
295
|
+
HET 0 ATP O3G O -0.300 -0.140 -7.420
|
|
296
|
+
HET 0 ATP PB P 0.260 -0.130 -4.450
|
|
297
|
+
HET 0 ATP O1B O 0.810 1.230 -4.300
|
|
298
|
+
HET 0 ATP O2B O -1.230 -0.040 -5.060
|
|
299
|
+
HET 0 ATP O3B O 1.190 -0.990 -5.430
|
|
300
|
+
HET 0 ATP PA P -0.740 0.070 -2.070
|
|
301
|
+
HET 0 ATP O1A O -2.100 0.140 -2.670
|
|
302
|
+
HET 0 ATP O2A O -0.120 1.550 -1.960
|
|
303
|
+
HET 0 ATP O3A O 0.200 -0.840 -3.000
|
|
304
|
+
HET 0 ATP HOG2 H 2.100 -0.550 -8.730
|
|
305
|
+
HET 0 ATP HOG3 H -0.620 -1.050 -7.520
|
|
306
|
+
HET 0 ATP HOB2 H -1.550 -0.950 -5.130
|
|
307
|
+
HET 0 ATP HOA2 H 0.750 1.460 -1.560
|
|
308
308
|
<BLANKLINE>
|
|
309
309
|
New molecule
|
|
310
|
-
HET 0 ATP O5' O -0.
|
|
311
|
-
HET 0 ATP C5' C -1.
|
|
312
|
-
HET 0 ATP C4' C -1.
|
|
313
|
-
HET 0 ATP O4' O -0.
|
|
314
|
-
HET 0 ATP C3' C -2.
|
|
315
|
-
HET 0 ATP O3' O -4.
|
|
316
|
-
HET 0 ATP C2' C -2.
|
|
317
|
-
HET 0 ATP O2' O -2.
|
|
318
|
-
HET 0 ATP C1' C -0.830 -0.
|
|
319
|
-
HET 0 ATP N9 N 0.
|
|
320
|
-
HET 0 ATP C8 C 1.
|
|
321
|
-
HET 0 ATP N7 N 2.
|
|
322
|
-
HET 0 ATP C5 C 1.
|
|
323
|
-
HET 0 ATP C6 C 2.
|
|
324
|
-
HET 0 ATP N6 N 3.
|
|
325
|
-
HET 0 ATP N1 N 1.
|
|
326
|
-
HET 0 ATP C2 C 0.
|
|
327
|
-
HET 0 ATP N3 N 0.
|
|
328
|
-
HET 0 ATP C4 C 0.
|
|
329
|
-
HET 0 ATP H5'1 H -2.
|
|
330
|
-
HET 0 ATP H5'2 H -1.
|
|
331
|
-
HET 0 ATP H4' H -2.
|
|
332
|
-
HET 0 ATP H3' H -2.
|
|
333
|
-
HET 0 ATP HO3' H -4.
|
|
334
|
-
HET 0 ATP H2' H -1.
|
|
335
|
-
HET 0 ATP HO2' H -3.
|
|
336
|
-
HET 0 ATP H1' H -1.
|
|
337
|
-
HET 0 ATP H8 H 1.
|
|
338
|
-
HET 0 ATP HN61 H 3.
|
|
339
|
-
HET 0 ATP HN62 H 4.
|
|
340
|
-
HET 0 ATP H2 H 0.
|
|
310
|
+
HET 0 ATP O5' O -0.840 -0.590 -0.600
|
|
311
|
+
HET 0 ATP C5' C -1.690 0.260 0.170
|
|
312
|
+
HET 0 ATP C4' C -1.830 -0.310 1.580
|
|
313
|
+
HET 0 ATP O4' O -0.540 -0.360 2.230
|
|
314
|
+
HET 0 ATP C3' C -2.680 0.630 2.460
|
|
315
|
+
HET 0 ATP O3' O -4.030 0.160 2.530
|
|
316
|
+
HET 0 ATP C2' C -2.010 0.560 3.860
|
|
317
|
+
HET 0 ATP O2' O -2.930 0.040 4.830
|
|
318
|
+
HET 0 ATP C1' C -0.830 -0.420 3.650
|
|
319
|
+
HET 0 ATP N9 N 0.330 0.020 4.430
|
|
320
|
+
HET 0 ATP C8 C 1.300 0.880 4.010
|
|
321
|
+
HET 0 ATP N7 N 2.180 1.040 4.960
|
|
322
|
+
HET 0 ATP C5 C 1.830 0.300 6.030
|
|
323
|
+
HET 0 ATP C6 C 2.390 0.080 7.300
|
|
324
|
+
HET 0 ATP N6 N 3.560 0.710 7.680
|
|
325
|
+
HET 0 ATP N1 N 1.760 -0.750 8.140
|
|
326
|
+
HET 0 ATP C2 C 0.640 -1.350 7.780
|
|
327
|
+
HET 0 ATP N3 N 0.090 -1.180 6.600
|
|
328
|
+
HET 0 ATP C4 C 0.640 -0.370 5.700
|
|
329
|
+
HET 0 ATP H5'1 H -2.680 0.310 -0.300
|
|
330
|
+
HET 0 ATP H5'2 H -1.260 1.260 0.220
|
|
331
|
+
HET 0 ATP H4' H -2.280 -1.300 1.550
|
|
332
|
+
HET 0 ATP H3' H -2.650 1.650 2.080
|
|
333
|
+
HET 0 ATP HO3' H -4.520 0.790 3.090
|
|
334
|
+
HET 0 ATP H2' H -1.650 1.540 4.160
|
|
335
|
+
HET 0 ATP HO2' H -3.670 0.660 4.870
|
|
336
|
+
HET 0 ATP H1' H -1.120 -1.430 3.930
|
|
337
|
+
HET 0 ATP H8 H 1.330 1.360 3.040
|
|
338
|
+
HET 0 ATP HN61 H 3.940 0.550 8.560
|
|
339
|
+
HET 0 ATP HN62 H 4.020 1.300 7.060
|
|
340
|
+
HET 0 ATP H2 H 0.170 -2.010 8.490
|
|
341
341
|
<BLANKLINE>
|
|
342
342
|
"""
|
|
343
343
|
if array.bonds is None:
|
|
344
344
|
raise ValueError("An associated BondList is required")
|
|
345
345
|
bonds = array.bonds
|
|
346
|
-
|
|
346
|
+
|
|
347
347
|
visited_mask = np.zeros(bonds.get_atom_count(), dtype=bool)
|
|
348
348
|
while not visited_mask.all():
|
|
349
349
|
# Take the first atom that has not been considered yet as root
|