biotite 0.39.0__cp312-cp312-win_amd64.whl → 0.41.0__cp312-cp312-win_amd64.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 +256 -235
- biotite/sequence/align/banded.cp312-win_amd64.pyd +0 -0
- biotite/sequence/align/cigar.py +60 -15
- biotite/sequence/align/kmeralphabet.c +241 -220
- biotite/sequence/align/kmeralphabet.cp312-win_amd64.pyd +0 -0
- biotite/sequence/align/kmersimilarity.c +213 -194
- biotite/sequence/align/kmersimilarity.cp312-win_amd64.pyd +0 -0
- biotite/sequence/align/kmertable.cp312-win_amd64.pyd +0 -0
- biotite/sequence/align/kmertable.cpp +231 -203
- biotite/sequence/align/localgapped.c +256 -235
- biotite/sequence/align/localgapped.cp312-win_amd64.pyd +0 -0
- biotite/sequence/align/localungapped.c +233 -212
- biotite/sequence/align/localungapped.cp312-win_amd64.pyd +0 -0
- biotite/sequence/align/multiple.c +253 -232
- biotite/sequence/align/multiple.cp312-win_amd64.pyd +0 -0
- biotite/sequence/align/pairwise.c +272 -251
- biotite/sequence/align/pairwise.cp312-win_amd64.pyd +0 -0
- biotite/sequence/align/permutation.c +213 -194
- biotite/sequence/align/permutation.cp312-win_amd64.pyd +0 -0
- biotite/sequence/align/selector.c +215 -195
- biotite/sequence/align/selector.cp312-win_amd64.pyd +0 -0
- biotite/sequence/align/tracetable.c +213 -193
- biotite/sequence/align/tracetable.cp312-win_amd64.pyd +0 -0
- biotite/sequence/annotation.py +2 -2
- biotite/sequence/codec.c +233 -212
- biotite/sequence/codec.cp312-win_amd64.pyd +0 -0
- biotite/sequence/io/fasta/convert.py +27 -24
- biotite/sequence/phylo/nj.c +213 -194
- biotite/sequence/phylo/nj.cp312-win_amd64.pyd +0 -0
- biotite/sequence/phylo/tree.c +225 -200
- biotite/sequence/phylo/tree.cp312-win_amd64.pyd +0 -0
- biotite/sequence/phylo/upgma.c +213 -194
- biotite/sequence/phylo/upgma.cp312-win_amd64.pyd +0 -0
- biotite/structure/__init__.py +2 -0
- biotite/structure/basepairs.py +7 -12
- biotite/structure/bonds.c +1435 -1277
- biotite/structure/bonds.cp312-win_amd64.pyd +0 -0
- biotite/structure/celllist.c +215 -195
- biotite/structure/celllist.cp312-win_amd64.pyd +0 -0
- biotite/structure/charges.c +1050 -1099
- biotite/structure/charges.cp312-win_amd64.pyd +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 +217 -196
- biotite/structure/io/mmtf/convertarray.cp312-win_amd64.pyd +0 -0
- biotite/structure/io/mmtf/convertfile.c +215 -195
- biotite/structure/io/mmtf/convertfile.cp312-win_amd64.pyd +0 -0
- biotite/structure/io/mmtf/decode.c +223 -202
- biotite/structure/io/mmtf/decode.cp312-win_amd64.pyd +0 -0
- biotite/structure/io/mmtf/encode.c +213 -194
- biotite/structure/io/mmtf/encode.cp312-win_amd64.pyd +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.cp312-win_amd64.pyd +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 +112803 -0
- biotite/structure/io/pdbx/encoding.cp312-win_amd64.pyd +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 +213 -194
- biotite/structure/sasa.cp312-win_amd64.pyd +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
|
@@ -0,0 +1,246 @@
|
|
|
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
|
+
"""
|
|
6
|
+
This module contains internally abstract classes for representing parts
|
|
7
|
+
of CIF/BinaryCIF files, such as categories and columns.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
__name__ = "biotite.structure.io.pdbx"
|
|
11
|
+
__author__ = "Patrick Kunzmann"
|
|
12
|
+
__all__ = ["MaskValue"]
|
|
13
|
+
|
|
14
|
+
from enum import IntEnum
|
|
15
|
+
from abc import ABCMeta, abstractmethod
|
|
16
|
+
from collections.abc import MutableMapping
|
|
17
|
+
from ....file import SerializationError, DeserializationError
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
class MaskValue(IntEnum):
|
|
21
|
+
"""
|
|
22
|
+
This enum type represents the possible values of a mask array.
|
|
23
|
+
|
|
24
|
+
- `PRESENT` : A value is present.
|
|
25
|
+
- `INAPPLICABLE` : For this row no value is applicable or
|
|
26
|
+
inappropriate (``.`` in *CIF*).
|
|
27
|
+
In some cases it may also refer to a default value for the
|
|
28
|
+
respective column.
|
|
29
|
+
- `MISSING` : For this row the value is missing or unknown
|
|
30
|
+
(``?`` in *CIF*).
|
|
31
|
+
"""
|
|
32
|
+
PRESENT = 0
|
|
33
|
+
INAPPLICABLE = 1
|
|
34
|
+
MISSING = 2
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class _Component(metaclass=ABCMeta):
|
|
38
|
+
"""
|
|
39
|
+
Base class for all components in a CIF/BinaryCIF file.
|
|
40
|
+
"""
|
|
41
|
+
|
|
42
|
+
@staticmethod
|
|
43
|
+
def subcomponent_class():
|
|
44
|
+
"""
|
|
45
|
+
Get the class of the components that are stored in this component.
|
|
46
|
+
|
|
47
|
+
Returns
|
|
48
|
+
-------
|
|
49
|
+
subcomponent_class : type
|
|
50
|
+
The class of the subcomponent.
|
|
51
|
+
If this component already represents the lowest level, i.e.
|
|
52
|
+
it does not contain subcomponents, ``None`` is
|
|
53
|
+
returned.
|
|
54
|
+
"""
|
|
55
|
+
return None
|
|
56
|
+
|
|
57
|
+
@staticmethod
|
|
58
|
+
def supercomponent_class():
|
|
59
|
+
"""
|
|
60
|
+
Get the class of the component that contains this component.
|
|
61
|
+
|
|
62
|
+
Returns
|
|
63
|
+
-------
|
|
64
|
+
supercomponent_class : type
|
|
65
|
+
The class of the supercomponent.
|
|
66
|
+
If this component present already the highest level, i.e.
|
|
67
|
+
it is not contained in another component, ``None`` is
|
|
68
|
+
returned.
|
|
69
|
+
"""
|
|
70
|
+
return None
|
|
71
|
+
|
|
72
|
+
@staticmethod
|
|
73
|
+
@abstractmethod
|
|
74
|
+
def deserialize(content):
|
|
75
|
+
"""
|
|
76
|
+
Create this component by deserializing the given content.
|
|
77
|
+
|
|
78
|
+
Parameters
|
|
79
|
+
----------
|
|
80
|
+
content : str or dict
|
|
81
|
+
The content to be deserialized.
|
|
82
|
+
The type of this parameter depends on the file format.
|
|
83
|
+
In case of *CIF* files, this is the text of the lines
|
|
84
|
+
that represent this component.
|
|
85
|
+
In case of *BinaryCIF* files, this is a dictionary
|
|
86
|
+
parsed from the *MessagePack* data.
|
|
87
|
+
"""
|
|
88
|
+
raise NotImplementedError()
|
|
89
|
+
|
|
90
|
+
@abstractmethod
|
|
91
|
+
def serialize(self):
|
|
92
|
+
"""
|
|
93
|
+
Convert this component into a Python object that can be written
|
|
94
|
+
to a file.
|
|
95
|
+
|
|
96
|
+
Returns
|
|
97
|
+
-------
|
|
98
|
+
content : str or dict
|
|
99
|
+
The content to be serialized.
|
|
100
|
+
The type of this return value depends on the file format.
|
|
101
|
+
In case of *CIF* files, this is the text of the lines
|
|
102
|
+
that represent this component.
|
|
103
|
+
In case of *BinaryCIF* files, this is a dictionary
|
|
104
|
+
that can be encoded into *MessagePack*.
|
|
105
|
+
"""
|
|
106
|
+
raise NotImplementedError()
|
|
107
|
+
|
|
108
|
+
def __str__(self):
|
|
109
|
+
return str(self.serialize())
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
class _HierarchicalContainer(_Component, MutableMapping,
|
|
113
|
+
metaclass=ABCMeta):
|
|
114
|
+
"""
|
|
115
|
+
A container for hierarchical data in BinaryCIF files.
|
|
116
|
+
For example, the file contains multiple blocks, each block contains
|
|
117
|
+
multiple categories and each category contains multiple columns.
|
|
118
|
+
|
|
119
|
+
It uses lazy deserialization:
|
|
120
|
+
A component is only deserialized from the serialized data, if it
|
|
121
|
+
is accessed.
|
|
122
|
+
The deserialized component is then cached in the container.
|
|
123
|
+
"""
|
|
124
|
+
|
|
125
|
+
def __init__(self, elements=None):
|
|
126
|
+
if elements is None:
|
|
127
|
+
elements = {}
|
|
128
|
+
for element in elements.values():
|
|
129
|
+
if not isinstance(element, (dict, self.subcomponent_class())):
|
|
130
|
+
raise TypeError(
|
|
131
|
+
f"Expected '{self.subcomponent_class().__name__}', "
|
|
132
|
+
f"but got '{type(element).__name__}'"
|
|
133
|
+
)
|
|
134
|
+
self._elements = elements
|
|
135
|
+
|
|
136
|
+
@staticmethod
|
|
137
|
+
def _deserialize_elements(content, take_key_from):
|
|
138
|
+
"""
|
|
139
|
+
Lazily deserialize the elements of this container.
|
|
140
|
+
|
|
141
|
+
Parameters
|
|
142
|
+
----------
|
|
143
|
+
content : dict
|
|
144
|
+
The serialized content describing the elements for this
|
|
145
|
+
container.
|
|
146
|
+
take_key_from : str
|
|
147
|
+
The key in each element of `content`, whose value is used as
|
|
148
|
+
the key for the respective element.
|
|
149
|
+
|
|
150
|
+
Returns
|
|
151
|
+
-------
|
|
152
|
+
elements : dict
|
|
153
|
+
The elements that should be stored in this container.
|
|
154
|
+
This return value can be given to the constructor.
|
|
155
|
+
"""
|
|
156
|
+
elements = {}
|
|
157
|
+
for serialized_element in content:
|
|
158
|
+
key = serialized_element[take_key_from]
|
|
159
|
+
# Lazy deserialization
|
|
160
|
+
# -> keep serialized for now and deserialize later if needed
|
|
161
|
+
elements[key] = serialized_element
|
|
162
|
+
return elements
|
|
163
|
+
|
|
164
|
+
def _serialize_elements(self, store_key_in=None):
|
|
165
|
+
"""
|
|
166
|
+
Serialize the elements that are stored in this container.
|
|
167
|
+
|
|
168
|
+
Each element that is still serialized (due to lazy
|
|
169
|
+
deserialization), is kept as it is.
|
|
170
|
+
|
|
171
|
+
Parameters
|
|
172
|
+
----------
|
|
173
|
+
store_key_in: str, optional
|
|
174
|
+
If given, the key of each element is stored as value in the
|
|
175
|
+
serialized element.
|
|
176
|
+
This is basically the reverse operation of `take_key_from` in
|
|
177
|
+
:meth:`_deserialize_elements()`.
|
|
178
|
+
"""
|
|
179
|
+
serialized_elements = []
|
|
180
|
+
for key, element in self._elements.items():
|
|
181
|
+
if isinstance(element, self.subcomponent_class()):
|
|
182
|
+
try:
|
|
183
|
+
serialized_element = element.serialize()
|
|
184
|
+
except:
|
|
185
|
+
raise SerializationError(
|
|
186
|
+
f"Failed to serialize element '{key}'"
|
|
187
|
+
)
|
|
188
|
+
else:
|
|
189
|
+
# Element is already stored in serialized form
|
|
190
|
+
serialized_element = element
|
|
191
|
+
if store_key_in is not None:
|
|
192
|
+
serialized_element[store_key_in] = key
|
|
193
|
+
serialized_elements.append(serialized_element)
|
|
194
|
+
return serialized_elements
|
|
195
|
+
|
|
196
|
+
def __getitem__(self, key):
|
|
197
|
+
element = self._elements[key]
|
|
198
|
+
if not isinstance(element, self.subcomponent_class()):
|
|
199
|
+
# Element is stored in serialized form
|
|
200
|
+
# -> must be deserialized first
|
|
201
|
+
try:
|
|
202
|
+
element = self.subcomponent_class().deserialize(element)
|
|
203
|
+
except:
|
|
204
|
+
raise DeserializationError(
|
|
205
|
+
f"Failed to deserialize element '{key}'"
|
|
206
|
+
)
|
|
207
|
+
# Update container with deserialized object
|
|
208
|
+
self._elements[key] = element
|
|
209
|
+
return element
|
|
210
|
+
|
|
211
|
+
def __setitem__(self, key, element):
|
|
212
|
+
if isinstance(element, self.subcomponent_class()):
|
|
213
|
+
pass
|
|
214
|
+
elif isinstance(element, _HierarchicalContainer):
|
|
215
|
+
# A common mistake may be to use the wrong container type
|
|
216
|
+
raise TypeError(
|
|
217
|
+
f"Expected '{self.subcomponent_class().__name__}', "
|
|
218
|
+
f"but got '{type(element).__name__}'"
|
|
219
|
+
)
|
|
220
|
+
else:
|
|
221
|
+
try:
|
|
222
|
+
element = self.subcomponent_class().deserialize(element)
|
|
223
|
+
except:
|
|
224
|
+
raise DeserializationError(
|
|
225
|
+
f"Failed to deserialize given value"
|
|
226
|
+
)
|
|
227
|
+
self._elements[key] = element
|
|
228
|
+
|
|
229
|
+
def __delitem__(self, key):
|
|
230
|
+
del self._elements[key]
|
|
231
|
+
|
|
232
|
+
def __iter__(self):
|
|
233
|
+
return iter(self._elements)
|
|
234
|
+
|
|
235
|
+
def __len__(self):
|
|
236
|
+
return len(self._elements)
|
|
237
|
+
|
|
238
|
+
def __eq__(self, other):
|
|
239
|
+
if not isinstance(other, type(self)):
|
|
240
|
+
return False
|
|
241
|
+
if set(self.keys()) != set(other.keys()):
|
|
242
|
+
return False
|
|
243
|
+
for key in self.keys():
|
|
244
|
+
if self[key] != other[key]:
|
|
245
|
+
return False
|
|
246
|
+
return True
|