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
|
Binary file
|
|
@@ -12,6 +12,7 @@ import struct
|
|
|
12
12
|
import copy
|
|
13
13
|
import numpy as np
|
|
14
14
|
import msgpack
|
|
15
|
+
import warnings
|
|
15
16
|
from ....file import File, is_binary, is_open_compatible
|
|
16
17
|
from ...error import BadStructureError
|
|
17
18
|
from .decode import decode_array
|
|
@@ -21,7 +22,7 @@ from .encode import encode_array
|
|
|
21
22
|
class MMTFFile(File, MutableMapping):
|
|
22
23
|
"""
|
|
23
24
|
This class represents a MMTF file.
|
|
24
|
-
|
|
25
|
+
|
|
25
26
|
When reading a file, the *MessagePack* unpacker is used to create
|
|
26
27
|
a dictionary of the file content.
|
|
27
28
|
This dictionary is accessed by indexing the :class:`MMTFFile`
|
|
@@ -29,10 +30,13 @@ class MMTFFile(File, MutableMapping):
|
|
|
29
30
|
If the dictionary value is an encoded array, the value automatically
|
|
30
31
|
decoded.
|
|
31
32
|
Decoded arrays are always returned as :class:`ndarray` instances.
|
|
32
|
-
|
|
33
|
+
|
|
34
|
+
DEPRECATED: Use :class:`biotite.structure.io.pdbx.BinaryCIFFile`
|
|
35
|
+
instead.
|
|
36
|
+
|
|
33
37
|
Examples
|
|
34
38
|
--------
|
|
35
|
-
|
|
39
|
+
|
|
36
40
|
>>> import os.path
|
|
37
41
|
>>> mmtf_file = MMTFFile.read(os.path.join(path_to_structures, "1l2y.mmtf"))
|
|
38
42
|
>>> print(mmtf_file["title"])
|
|
@@ -42,24 +46,28 @@ class MMTFFile(File, MutableMapping):
|
|
|
42
46
|
'A' 'A' 'A' 'A' 'A' 'A' 'A' 'A' 'A' 'A' 'A' 'A' 'A' 'A' 'A' 'A' 'A' 'A'
|
|
43
47
|
'A' 'A']
|
|
44
48
|
"""
|
|
45
|
-
|
|
49
|
+
|
|
46
50
|
def __init__(self):
|
|
51
|
+
warnings.warn(
|
|
52
|
+
"'MMTFFile' is deprecated, use 'BinaryCIFFile' instead",
|
|
53
|
+
DeprecationWarning
|
|
54
|
+
)
|
|
47
55
|
super().__init__()
|
|
48
56
|
self._content = {}
|
|
49
57
|
self._content["mmtfVersion"] = "1.0.0"
|
|
50
58
|
self._content["mmtfProducer"] = "UNKNOWN"
|
|
51
|
-
|
|
59
|
+
|
|
52
60
|
@classmethod
|
|
53
61
|
def read(self, file):
|
|
54
62
|
"""
|
|
55
63
|
Read a MMTF file.
|
|
56
|
-
|
|
64
|
+
|
|
57
65
|
Parameters
|
|
58
66
|
----------
|
|
59
67
|
file : file-like object or str
|
|
60
68
|
The file to be read.
|
|
61
69
|
Alternatively a file path can be supplied.
|
|
62
|
-
|
|
70
|
+
|
|
63
71
|
Returns
|
|
64
72
|
-------
|
|
65
73
|
file_object : MMTFFile
|
|
@@ -80,11 +88,11 @@ class MMTFFile(File, MutableMapping):
|
|
|
80
88
|
file.read(), use_list=True, raw=False
|
|
81
89
|
)
|
|
82
90
|
return mmtf_file
|
|
83
|
-
|
|
91
|
+
|
|
84
92
|
def write(self, file):
|
|
85
93
|
"""
|
|
86
94
|
Write contents into a MMTF file.
|
|
87
|
-
|
|
95
|
+
|
|
88
96
|
Parameters
|
|
89
97
|
----------
|
|
90
98
|
file : file-like object or str
|
|
@@ -101,20 +109,20 @@ class MMTFFile(File, MutableMapping):
|
|
|
101
109
|
if not is_binary(file):
|
|
102
110
|
raise TypeError("A file opened in 'binary' mode is required")
|
|
103
111
|
file.write(packed_bytes)
|
|
104
|
-
|
|
112
|
+
|
|
105
113
|
def __copy_fill__(self, clone):
|
|
106
114
|
super().__copy_fill__(clone)
|
|
107
115
|
clone._content = copy.deepcopy(self._content)
|
|
108
|
-
|
|
116
|
+
|
|
109
117
|
def get_codec(self, key):
|
|
110
118
|
"""
|
|
111
119
|
Obtain the codec ID of an MMTF encoded value.
|
|
112
|
-
|
|
120
|
+
|
|
113
121
|
Parameters
|
|
114
122
|
----------
|
|
115
123
|
key : str
|
|
116
124
|
The key for the potentially encoded value.
|
|
117
|
-
|
|
125
|
+
|
|
118
126
|
Returns
|
|
119
127
|
-------
|
|
120
128
|
codec : int or None
|
|
@@ -126,16 +134,16 @@ class MMTFFile(File, MutableMapping):
|
|
|
126
134
|
return codec
|
|
127
135
|
else:
|
|
128
136
|
return None
|
|
129
|
-
|
|
137
|
+
|
|
130
138
|
def get_length(self, key):
|
|
131
139
|
"""
|
|
132
140
|
Obtain the length of an MMTF encoded value.
|
|
133
|
-
|
|
141
|
+
|
|
134
142
|
Parameters
|
|
135
143
|
----------
|
|
136
144
|
key : str
|
|
137
145
|
The key for the potentially encoded value.
|
|
138
|
-
|
|
146
|
+
|
|
139
147
|
Returns
|
|
140
148
|
-------
|
|
141
149
|
codec : int or None
|
|
@@ -148,16 +156,16 @@ class MMTFFile(File, MutableMapping):
|
|
|
148
156
|
return length
|
|
149
157
|
else:
|
|
150
158
|
return None
|
|
151
|
-
|
|
159
|
+
|
|
152
160
|
def get_param(self, key):
|
|
153
161
|
"""
|
|
154
162
|
Obtain the parameter of an MMTF encoded value.
|
|
155
|
-
|
|
163
|
+
|
|
156
164
|
Parameters
|
|
157
165
|
----------
|
|
158
166
|
key : str
|
|
159
167
|
The key for the potentially encoded value.
|
|
160
|
-
|
|
168
|
+
|
|
161
169
|
Returns
|
|
162
170
|
-------
|
|
163
171
|
codec : int or None
|
|
@@ -170,7 +178,7 @@ class MMTFFile(File, MutableMapping):
|
|
|
170
178
|
return param
|
|
171
179
|
else:
|
|
172
180
|
return None
|
|
173
|
-
|
|
181
|
+
|
|
174
182
|
def set_array(self, key, array, codec, param=0):
|
|
175
183
|
length = len(array)
|
|
176
184
|
raw_bytes = encode_array(array, codec, param)
|
|
@@ -179,7 +187,7 @@ class MMTFFile(File, MutableMapping):
|
|
|
179
187
|
+ struct.pack(">i", param) \
|
|
180
188
|
+ raw_bytes
|
|
181
189
|
self._content[key] = data
|
|
182
|
-
|
|
190
|
+
|
|
183
191
|
def __getitem__(self, key):
|
|
184
192
|
data = self._content[key]
|
|
185
193
|
if isinstance(data, bytes) and data[0] == 0:
|
|
@@ -191,22 +199,22 @@ class MMTFFile(File, MutableMapping):
|
|
|
191
199
|
return decode_array(codec, raw_bytes, param)
|
|
192
200
|
else:
|
|
193
201
|
return data
|
|
194
|
-
|
|
202
|
+
|
|
195
203
|
def __setitem__(self, key, item):
|
|
196
204
|
if isinstance(item, np.ndarray):
|
|
197
205
|
raise TypeError("Arrays that need to be encoded must be addeed "
|
|
198
206
|
"via 'set_array()'")
|
|
199
207
|
self._content[key] = item
|
|
200
|
-
|
|
208
|
+
|
|
201
209
|
def __delitem__(self, key):
|
|
202
210
|
del self._content[key]
|
|
203
|
-
|
|
211
|
+
|
|
204
212
|
def __iter__(self):
|
|
205
213
|
return self._content.__iter__()
|
|
206
|
-
|
|
214
|
+
|
|
207
215
|
def __len__(self):
|
|
208
216
|
return len(self._content)
|
|
209
|
-
|
|
217
|
+
|
|
210
218
|
def __contains__(self, item):
|
|
211
219
|
return item in self._content
|
|
212
220
|
|
|
@@ -6,10 +6,12 @@ __name__ = "biotite.structure.io.mol"
|
|
|
6
6
|
__author__ = "Patrick Kunzmann"
|
|
7
7
|
__all__ = ["get_structure", "set_structure"]
|
|
8
8
|
|
|
9
|
+
from .mol import MOLFile
|
|
10
|
+
from .sdf import SDFile, SDRecord
|
|
9
11
|
from ...bonds import BondType
|
|
10
12
|
|
|
11
13
|
|
|
12
|
-
def get_structure(mol_file):
|
|
14
|
+
def get_structure(mol_file, record_name=None):
|
|
13
15
|
"""
|
|
14
16
|
Get an :class:`AtomArray` from the MOL file.
|
|
15
17
|
|
|
@@ -18,8 +20,12 @@ def get_structure(mol_file):
|
|
|
18
20
|
|
|
19
21
|
Parameters
|
|
20
22
|
----------
|
|
21
|
-
mol_file : MOLFile
|
|
22
|
-
The
|
|
23
|
+
mol_file : MOLFile or SDFile or SDRecord
|
|
24
|
+
The file.
|
|
25
|
+
record_name : str, optional
|
|
26
|
+
Has only an effect when `mol_file` is a :class:`SDFile`.
|
|
27
|
+
The name of the record in the SD file.
|
|
28
|
+
By default, the first record is used.
|
|
23
29
|
|
|
24
30
|
Returns
|
|
25
31
|
-------
|
|
@@ -29,10 +35,12 @@ def get_structure(mol_file):
|
|
|
29
35
|
All other annotation categories, except ``element`` are
|
|
30
36
|
empty.
|
|
31
37
|
"""
|
|
32
|
-
|
|
38
|
+
record = _get_record(mol_file, record_name)
|
|
39
|
+
return record.get_structure()
|
|
33
40
|
|
|
34
41
|
|
|
35
|
-
def set_structure(mol_file, atoms, default_bond_type=BondType.ANY
|
|
42
|
+
def set_structure(mol_file, atoms, default_bond_type=BondType.ANY,
|
|
43
|
+
version=None, record_name=None):
|
|
36
44
|
"""
|
|
37
45
|
Set the :class:`AtomArray` for the MOL file.
|
|
38
46
|
|
|
@@ -46,6 +54,62 @@ def set_structure(mol_file, atoms, default_bond_type=BondType.ANY):
|
|
|
46
54
|
array : AtomArray
|
|
47
55
|
The array to be saved into this file.
|
|
48
56
|
Must have an associated :class:`BondList`.
|
|
49
|
-
|
|
57
|
+
Bond type fallback for the *Bond block*, if a
|
|
58
|
+
:class:`BondType` has no CTAB counterpart.
|
|
59
|
+
By default, each such bond is treated as
|
|
60
|
+
:attr:`BondType.ANY`.
|
|
61
|
+
default_bond_type : BondType, optional
|
|
62
|
+
Bond type fallback for the *Bond block*, if a :class:`BondType`
|
|
63
|
+
has no CTAB counterpart.
|
|
64
|
+
By default, each such bond is treated as :attr:`BondType.ANY`.
|
|
65
|
+
version : {"V2000", "V3000"}, optional
|
|
66
|
+
The version of the CTAB format.
|
|
67
|
+
``"V2000"`` uses the *Atom* and *Bond* block, while ``"V3000"``
|
|
68
|
+
uses the *Properties* block.
|
|
69
|
+
By default, ``"V2000"`` is used, unless the number of atoms or
|
|
70
|
+
bonds exceeds 999, in which case ``"V3000"`` is used.
|
|
71
|
+
record_name : str, optional
|
|
72
|
+
Has only an effect when `mol_file` is a :class:`SDFile`.
|
|
73
|
+
The name of the record.
|
|
74
|
+
Default is the first record of the file.
|
|
75
|
+
If the file is empty, a new record will be created.
|
|
50
76
|
"""
|
|
51
|
-
mol_file
|
|
77
|
+
record = _get_or_create_record(mol_file, record_name)
|
|
78
|
+
record.set_structure(atoms, default_bond_type, version)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def _get_record(file, record_name):
|
|
82
|
+
if isinstance(file, (MOLFile, SDRecord)):
|
|
83
|
+
return file
|
|
84
|
+
elif isinstance(file, SDFile):
|
|
85
|
+
# Determine record
|
|
86
|
+
if record_name is None:
|
|
87
|
+
return file.record
|
|
88
|
+
else:
|
|
89
|
+
return file[record_name]
|
|
90
|
+
else:
|
|
91
|
+
raise TypeError(
|
|
92
|
+
f"Unsupported file type '{type(file).__name__}'"
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def _get_or_create_record(file, record_name):
|
|
97
|
+
if isinstance(file, (MOLFile, SDRecord)):
|
|
98
|
+
return file
|
|
99
|
+
elif isinstance(file, SDFile):
|
|
100
|
+
if record_name is None:
|
|
101
|
+
if len(file) > 0:
|
|
102
|
+
# Choose first record by default
|
|
103
|
+
record_name = next(iter(file.keys()))
|
|
104
|
+
else:
|
|
105
|
+
# File is empty -> invent a new record name
|
|
106
|
+
record_name = "Molecule"
|
|
107
|
+
|
|
108
|
+
if record_name not in file:
|
|
109
|
+
record = SDRecord()
|
|
110
|
+
file[record_name] = record
|
|
111
|
+
return file[record_name]
|
|
112
|
+
else:
|
|
113
|
+
raise TypeError(
|
|
114
|
+
f"Unsupported file type '{type(file).__name__}'"
|
|
115
|
+
)
|