biotite 0.41.1__cp312-cp312-win_amd64.whl → 1.0.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 +2 -3
- biotite/application/__init__.py +36 -10
- biotite/application/application.py +22 -11
- biotite/application/autodock/__init__.py +1 -1
- biotite/application/autodock/app.py +74 -79
- biotite/application/blast/__init__.py +1 -1
- biotite/application/blast/alignment.py +19 -10
- biotite/application/blast/webapp.py +92 -85
- biotite/application/clustalo/__init__.py +1 -1
- biotite/application/clustalo/app.py +46 -61
- biotite/application/dssp/__init__.py +1 -1
- biotite/application/dssp/app.py +8 -11
- biotite/application/localapp.py +62 -60
- biotite/application/mafft/__init__.py +1 -1
- biotite/application/mafft/app.py +16 -22
- biotite/application/msaapp.py +78 -89
- biotite/application/muscle/__init__.py +1 -1
- biotite/application/muscle/app3.py +50 -64
- biotite/application/muscle/app5.py +23 -31
- biotite/application/sra/__init__.py +1 -1
- biotite/application/sra/app.py +64 -68
- biotite/application/tantan/__init__.py +1 -1
- biotite/application/tantan/app.py +22 -45
- biotite/application/util.py +7 -9
- biotite/application/viennarna/rnaalifold.py +34 -28
- biotite/application/viennarna/rnafold.py +24 -39
- biotite/application/viennarna/rnaplot.py +36 -21
- biotite/application/viennarna/util.py +17 -12
- biotite/application/webapp.py +13 -14
- biotite/copyable.py +13 -13
- biotite/database/__init__.py +1 -1
- biotite/database/entrez/__init__.py +1 -1
- biotite/database/entrez/check.py +2 -3
- biotite/database/entrez/dbnames.py +7 -5
- biotite/database/entrez/download.py +55 -49
- biotite/database/entrez/key.py +1 -1
- biotite/database/entrez/query.py +62 -23
- biotite/database/error.py +2 -1
- biotite/database/pubchem/__init__.py +1 -1
- biotite/database/pubchem/download.py +43 -45
- biotite/database/pubchem/error.py +2 -2
- biotite/database/pubchem/query.py +34 -31
- biotite/database/pubchem/throttle.py +3 -4
- biotite/database/rcsb/__init__.py +1 -1
- biotite/database/rcsb/download.py +44 -52
- biotite/database/rcsb/query.py +85 -80
- biotite/database/uniprot/check.py +6 -3
- biotite/database/uniprot/download.py +6 -11
- biotite/database/uniprot/query.py +115 -31
- biotite/file.py +12 -31
- biotite/sequence/__init__.py +16 -5
- biotite/sequence/align/__init__.py +160 -6
- biotite/sequence/align/alignment.py +99 -90
- biotite/sequence/align/banded.cp312-win_amd64.pyd +0 -0
- biotite/sequence/align/buckets.py +12 -10
- biotite/sequence/align/cigar.py +43 -52
- biotite/sequence/align/kmeralphabet.cp312-win_amd64.pyd +0 -0
- biotite/sequence/align/kmeralphabet.pyx +55 -51
- biotite/sequence/align/kmersimilarity.cp312-win_amd64.pyd +0 -0
- biotite/sequence/align/kmertable.cp312-win_amd64.pyd +0 -0
- biotite/sequence/align/kmertable.pyx +3 -2
- biotite/sequence/align/localgapped.cp312-win_amd64.pyd +0 -0
- biotite/sequence/align/localungapped.cp312-win_amd64.pyd +0 -0
- biotite/sequence/align/matrix.py +81 -82
- biotite/sequence/align/multiple.cp312-win_amd64.pyd +0 -0
- biotite/sequence/align/multiple.pyx +35 -35
- biotite/sequence/align/pairwise.cp312-win_amd64.pyd +0 -0
- biotite/sequence/align/permutation.cp312-win_amd64.pyd +0 -0
- biotite/sequence/align/permutation.pyx +12 -4
- biotite/sequence/align/selector.cp312-win_amd64.pyd +0 -0
- biotite/sequence/align/selector.pyx +52 -54
- biotite/sequence/align/statistics.py +32 -33
- biotite/sequence/align/tracetable.cp312-win_amd64.pyd +0 -0
- biotite/sequence/alphabet.py +112 -126
- biotite/sequence/annotation.py +78 -77
- biotite/sequence/codec.cp312-win_amd64.pyd +0 -0
- biotite/sequence/codon.py +90 -79
- biotite/sequence/graphics/__init__.py +1 -1
- biotite/sequence/graphics/alignment.py +184 -103
- biotite/sequence/graphics/colorschemes.py +10 -12
- biotite/sequence/graphics/dendrogram.py +79 -34
- biotite/sequence/graphics/features.py +133 -99
- biotite/sequence/graphics/logo.py +22 -28
- biotite/sequence/graphics/plasmid.py +229 -178
- biotite/sequence/io/fasta/__init__.py +1 -1
- biotite/sequence/io/fasta/convert.py +44 -33
- biotite/sequence/io/fasta/file.py +42 -55
- biotite/sequence/io/fastq/__init__.py +1 -1
- biotite/sequence/io/fastq/convert.py +11 -14
- biotite/sequence/io/fastq/file.py +68 -112
- biotite/sequence/io/genbank/__init__.py +2 -2
- biotite/sequence/io/genbank/annotation.py +12 -20
- biotite/sequence/io/genbank/file.py +74 -76
- biotite/sequence/io/genbank/metadata.py +74 -62
- biotite/sequence/io/genbank/sequence.py +13 -14
- biotite/sequence/io/general.py +39 -30
- biotite/sequence/io/gff/__init__.py +2 -2
- biotite/sequence/io/gff/convert.py +10 -15
- biotite/sequence/io/gff/file.py +81 -65
- biotite/sequence/phylo/__init__.py +1 -1
- biotite/sequence/phylo/nj.cp312-win_amd64.pyd +0 -0
- biotite/sequence/phylo/tree.cp312-win_amd64.pyd +0 -0
- biotite/sequence/phylo/upgma.cp312-win_amd64.pyd +0 -0
- biotite/sequence/profile.py +57 -28
- biotite/sequence/search.py +17 -15
- biotite/sequence/seqtypes.py +200 -164
- biotite/sequence/sequence.py +64 -64
- biotite/structure/__init__.py +3 -3
- biotite/structure/atoms.py +226 -240
- biotite/structure/basepairs.py +260 -271
- biotite/structure/bonds.cp312-win_amd64.pyd +0 -0
- biotite/structure/bonds.pyx +88 -100
- biotite/structure/box.py +67 -71
- biotite/structure/celllist.cp312-win_amd64.pyd +0 -0
- biotite/structure/chains.py +55 -39
- biotite/structure/charges.cp312-win_amd64.pyd +0 -0
- biotite/structure/compare.py +32 -32
- biotite/structure/density.py +13 -18
- biotite/structure/dotbracket.py +20 -22
- biotite/structure/error.py +10 -2
- biotite/structure/filter.py +82 -77
- biotite/structure/geometry.py +130 -119
- biotite/structure/graphics/atoms.py +60 -43
- biotite/structure/graphics/rna.py +81 -68
- biotite/structure/hbond.py +112 -93
- biotite/structure/info/__init__.py +0 -2
- biotite/structure/info/atoms.py +10 -11
- biotite/structure/info/bonds.py +41 -43
- biotite/structure/info/ccd.py +21 -7
- biotite/structure/info/groups.py +10 -15
- biotite/structure/info/masses.py +5 -10
- biotite/structure/info/misc.py +1 -1
- biotite/structure/info/radii.py +20 -20
- biotite/structure/info/standardize.py +15 -26
- biotite/structure/integrity.py +18 -71
- biotite/structure/io/__init__.py +3 -4
- biotite/structure/io/dcd/__init__.py +1 -1
- biotite/structure/io/dcd/file.py +22 -20
- biotite/structure/io/general.py +47 -61
- biotite/structure/io/gro/__init__.py +1 -1
- biotite/structure/io/gro/file.py +73 -72
- biotite/structure/io/mol/__init__.py +1 -1
- biotite/structure/io/mol/convert.py +8 -11
- biotite/structure/io/mol/ctab.py +37 -36
- biotite/structure/io/mol/header.py +14 -10
- biotite/structure/io/mol/mol.py +9 -53
- biotite/structure/io/mol/sdf.py +47 -50
- biotite/structure/io/netcdf/__init__.py +1 -1
- biotite/structure/io/netcdf/file.py +24 -23
- biotite/structure/io/pdb/__init__.py +1 -1
- biotite/structure/io/pdb/convert.py +32 -20
- biotite/structure/io/pdb/file.py +151 -172
- biotite/structure/io/pdb/hybrid36.cp312-win_amd64.pyd +0 -0
- biotite/structure/io/pdbqt/__init__.py +1 -1
- biotite/structure/io/pdbqt/convert.py +17 -11
- biotite/structure/io/pdbqt/file.py +128 -80
- biotite/structure/io/pdbx/__init__.py +1 -2
- biotite/structure/io/pdbx/bcif.py +36 -52
- biotite/structure/io/pdbx/cif.py +64 -62
- biotite/structure/io/pdbx/component.py +10 -16
- biotite/structure/io/pdbx/convert.py +235 -246
- biotite/structure/io/pdbx/encoding.cp312-win_amd64.pyd +0 -0
- biotite/structure/io/trajfile.py +76 -93
- biotite/structure/io/trr/__init__.py +1 -1
- biotite/structure/io/trr/file.py +12 -15
- biotite/structure/io/xtc/__init__.py +1 -1
- biotite/structure/io/xtc/file.py +11 -14
- biotite/structure/mechanics.py +9 -11
- biotite/structure/molecules.py +3 -4
- biotite/structure/pseudoknots.py +53 -67
- biotite/structure/rdf.py +23 -21
- biotite/structure/repair.py +137 -86
- biotite/structure/residues.py +26 -16
- biotite/structure/sasa.cp312-win_amd64.pyd +0 -0
- biotite/structure/{resutil.py → segments.py} +24 -23
- biotite/structure/sequence.py +10 -11
- biotite/structure/sse.py +100 -119
- biotite/structure/superimpose.py +39 -77
- biotite/structure/transform.py +97 -71
- biotite/structure/util.py +11 -13
- biotite/version.py +2 -2
- biotite/visualize.py +69 -55
- {biotite-0.41.1.dist-info → biotite-1.0.0.dist-info}/METADATA +6 -6
- biotite-1.0.0.dist-info/RECORD +322 -0
- {biotite-0.41.1.dist-info → biotite-1.0.0.dist-info}/WHEEL +1 -1
- biotite/structure/io/ctab.py +0 -72
- biotite/structure/io/mmtf/__init__.py +0 -21
- biotite/structure/io/mmtf/assembly.py +0 -214
- biotite/structure/io/mmtf/convertarray.cp312-win_amd64.pyd +0 -0
- biotite/structure/io/mmtf/convertarray.pyx +0 -341
- biotite/structure/io/mmtf/convertfile.cp312-win_amd64.pyd +0 -0
- biotite/structure/io/mmtf/convertfile.pyx +0 -501
- biotite/structure/io/mmtf/decode.cp312-win_amd64.pyd +0 -0
- biotite/structure/io/mmtf/decode.pyx +0 -152
- biotite/structure/io/mmtf/encode.cp312-win_amd64.pyd +0 -0
- biotite/structure/io/mmtf/encode.pyx +0 -183
- biotite/structure/io/mmtf/file.py +0 -233
- biotite/structure/io/npz/__init__.py +0 -20
- biotite/structure/io/npz/file.py +0 -152
- biotite/structure/io/pdbx/legacy.py +0 -267
- biotite/structure/io/tng/__init__.py +0 -13
- biotite/structure/io/tng/file.py +0 -46
- biotite/temp.py +0 -86
- biotite-0.41.1.dist-info/RECORD +0 -340
- {biotite-0.41.1.dist-info → biotite-1.0.0.dist-info}/licenses/LICENSE.rst +0 -0
|
@@ -1,501 +0,0 @@
|
|
|
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.mmtf"
|
|
6
|
-
__author__ = "Patrick Kunzmann"
|
|
7
|
-
__all__ = ["get_model_count", "get_structure"]
|
|
8
|
-
|
|
9
|
-
cimport cython
|
|
10
|
-
cimport numpy as np
|
|
11
|
-
|
|
12
|
-
import numpy as np
|
|
13
|
-
from .file import MMTFFile
|
|
14
|
-
from ...atoms import Atom, AtomArray, AtomArrayStack
|
|
15
|
-
from ...bonds import BondList
|
|
16
|
-
from ...error import BadStructureError
|
|
17
|
-
from ...filter import filter_first_altloc, filter_highest_occupancy_altloc
|
|
18
|
-
from ...residues import get_residue_starts
|
|
19
|
-
from ...box import vectors_from_unitcell
|
|
20
|
-
from ....file import InvalidFileError
|
|
21
|
-
|
|
22
|
-
ctypedef np.int8_t int8
|
|
23
|
-
ctypedef np.int16_t int16
|
|
24
|
-
ctypedef np.int32_t int32
|
|
25
|
-
ctypedef np.uint8_t uint8
|
|
26
|
-
ctypedef np.uint16_t uint16
|
|
27
|
-
ctypedef np.uint32_t uint32
|
|
28
|
-
ctypedef np.uint64_t uint64
|
|
29
|
-
ctypedef np.float32_t float32
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
def get_model_count(file):
|
|
33
|
-
"""
|
|
34
|
-
Get the number of models contained in a MMTF file.
|
|
35
|
-
|
|
36
|
-
Parameters
|
|
37
|
-
----------
|
|
38
|
-
file : MMTFFile
|
|
39
|
-
The file object.
|
|
40
|
-
|
|
41
|
-
Returns
|
|
42
|
-
-------
|
|
43
|
-
model_count : int
|
|
44
|
-
The number of models.
|
|
45
|
-
"""
|
|
46
|
-
return file["numModels"]
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
def get_structure(file, model=None, altloc="first",
|
|
50
|
-
extra_fields=[], include_bonds=False):
|
|
51
|
-
"""
|
|
52
|
-
get_structure(file, model=None, altloc=[], extra_fields=[],
|
|
53
|
-
include_bonds=False)
|
|
54
|
-
|
|
55
|
-
Get an :class:`AtomArray` or :class:`AtomArrayStack` from the MMTF file.
|
|
56
|
-
|
|
57
|
-
Parameters
|
|
58
|
-
----------
|
|
59
|
-
file : MMTFFile
|
|
60
|
-
The file object.
|
|
61
|
-
model : int, optional
|
|
62
|
-
If this parameter is given, the function will return an
|
|
63
|
-
:class:`AtomArray` from the atoms corresponding to the given
|
|
64
|
-
model number (starting at 1).
|
|
65
|
-
Negative values are used to index models starting from the last
|
|
66
|
-
model insted of the first model.
|
|
67
|
-
If this parameter is omitted, an :class:`AtomArrayStack`
|
|
68
|
-
containing all models will be returned, even if the structure
|
|
69
|
-
contains only one model.
|
|
70
|
-
altloc : {'first', 'occupancy', 'all'}
|
|
71
|
-
This parameter defines how *altloc* IDs are handled:
|
|
72
|
-
- ``'first'`` - Use atoms that have the first *altloc* ID
|
|
73
|
-
appearing in a residue.
|
|
74
|
-
- ``'occupancy'`` - Use atoms that have the *altloc* ID
|
|
75
|
-
with the highest occupancy for a residue.
|
|
76
|
-
- ``'all'`` - Use all atoms.
|
|
77
|
-
Note that this leads to duplicate atoms.
|
|
78
|
-
When this option is chosen, the ``altloc_id`` annotation
|
|
79
|
-
array is added to the returned structure.
|
|
80
|
-
extra_fields : list of str, optional
|
|
81
|
-
The strings in the list are optional annotation categories
|
|
82
|
-
that should be stored in the output array or stack.
|
|
83
|
-
These are valid values:
|
|
84
|
-
``'atom_id'``, ``'b_factor'``, ``'occupancy'`` and ``'charge'``.
|
|
85
|
-
include_bonds : bool, optional
|
|
86
|
-
If set to true, a :class:`BondList` will be created for the
|
|
87
|
-
resulting :class:`AtomArray` containing the bond information
|
|
88
|
-
from the file.
|
|
89
|
-
|
|
90
|
-
Returns
|
|
91
|
-
-------
|
|
92
|
-
array : AtomArray or AtomArrayStack
|
|
93
|
-
The return type depends on the `model` parameter.
|
|
94
|
-
|
|
95
|
-
Examples
|
|
96
|
-
--------
|
|
97
|
-
|
|
98
|
-
>>> import os.path
|
|
99
|
-
>>> file = MMTFFile.read(os.path.join(path_to_structures, "1l2y.mmtf"))
|
|
100
|
-
>>> array = get_structure(file, model=1)
|
|
101
|
-
>>> print(array.array_length())
|
|
102
|
-
304
|
|
103
|
-
>>> stack = get_structure(file)
|
|
104
|
-
>>> print(stack.stack_depth(), stack.array_length())
|
|
105
|
-
38 304
|
|
106
|
-
"""
|
|
107
|
-
cdef int i, j, m
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
# Obtain (and potentially decode) required arrays/values from file
|
|
111
|
-
cdef int atom_count = file["numAtoms"]
|
|
112
|
-
cdef int model_count = file["numModels"]
|
|
113
|
-
cdef np.ndarray chain_names = file["chainNameList"]
|
|
114
|
-
cdef int32[:] chains_per_model = np.array(file["chainsPerModel"], np.int32)
|
|
115
|
-
cdef int32[:] res_per_chain = np.array(file["groupsPerChain"], np.int32)
|
|
116
|
-
cdef int32[:] res_type_i = file["groupTypeList"]
|
|
117
|
-
cdef np.ndarray index_list = file["groupIdList"]
|
|
118
|
-
cdef int32[:] res_ids = index_list
|
|
119
|
-
cdef np.ndarray x_coord = file["xCoordList"]
|
|
120
|
-
cdef np.ndarray y_coord = file["yCoordList"]
|
|
121
|
-
cdef np.ndarray z_coord = file["zCoordList"]
|
|
122
|
-
cdef np.ndarray occupancy = file.get("occupancyList")
|
|
123
|
-
cdef np.ndarray b_factor
|
|
124
|
-
if "b_factor" in extra_fields:
|
|
125
|
-
b_factor = file["bFactorList"]
|
|
126
|
-
cdef np.ndarray atom_ids
|
|
127
|
-
if "atom_id" in extra_fields:
|
|
128
|
-
atom_ids = file["atomIdList"]
|
|
129
|
-
cdef np.ndarray all_altloc_ids
|
|
130
|
-
cdef np.ndarray inscode
|
|
131
|
-
all_altloc_ids = file.get("altLocList")
|
|
132
|
-
inscode = file.get("insCodeList")
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
# Create arrays from 'groupList' list of dictionaries
|
|
136
|
-
cdef list group_list = file["groupList"]
|
|
137
|
-
cdef list non_hetero_list = ["L-PEPTIDE LINKING", "PEPTIDE LINKING",
|
|
138
|
-
"DNA LINKING", "RNA LINKING"]
|
|
139
|
-
# Determine per-residue-count and maximum count
|
|
140
|
-
# of atoms in each residue
|
|
141
|
-
cdef np.ndarray atoms_per_res = np.zeros(len(group_list), dtype=np.int32)
|
|
142
|
-
for i in range(len(group_list)):
|
|
143
|
-
atoms_per_res[i] = len(group_list[i]["atomNameList"])
|
|
144
|
-
cdef int32 max_atoms_per_res = np.max(atoms_per_res)
|
|
145
|
-
# Create the arrays
|
|
146
|
-
cdef np.ndarray res_names = np.zeros(len(group_list), dtype="U5")
|
|
147
|
-
cdef np.ndarray hetero_res = np.zeros(len(group_list), dtype=bool)
|
|
148
|
-
cdef np.ndarray atom_names = np.zeros((len(group_list), max_atoms_per_res),
|
|
149
|
-
dtype="U6")
|
|
150
|
-
cdef np.ndarray elements = np.zeros((len(group_list), max_atoms_per_res),
|
|
151
|
-
dtype="U2")
|
|
152
|
-
cdef np.ndarray charges = np.zeros((len(group_list), max_atoms_per_res),
|
|
153
|
-
dtype=np.int32)
|
|
154
|
-
# Fill the arrays
|
|
155
|
-
for i in range(len(group_list)):
|
|
156
|
-
residue = group_list[i]
|
|
157
|
-
res_names[i] = residue["groupName"]
|
|
158
|
-
hetero_res[i] = (residue["chemCompType"] not in non_hetero_list)
|
|
159
|
-
atom_names[i, :atoms_per_res[i]] = residue["atomNameList"]
|
|
160
|
-
elements[i, :atoms_per_res[i]] = residue["elementList"]
|
|
161
|
-
charges[i, :atoms_per_res[i]] = residue["formalChargeList"]
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
# Create the atom array (stack)
|
|
165
|
-
cdef int depth, length
|
|
166
|
-
cdef int start_i, stop_i
|
|
167
|
-
cdef bint extra_charge
|
|
168
|
-
cdef np.ndarray altloc_ids
|
|
169
|
-
cdef np.ndarray inscode_array
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
if model == None:
|
|
173
|
-
lengths = _get_model_lengths(res_type_i, chains_per_model,
|
|
174
|
-
res_per_chain, atoms_per_res)
|
|
175
|
-
# Check if each model has the same amount of atoms
|
|
176
|
-
# If not, raise exception
|
|
177
|
-
if (lengths != lengths[0]).any():
|
|
178
|
-
raise InvalidFileError("The models in the file have unequal "
|
|
179
|
-
"amount of atoms, give an explicit "
|
|
180
|
-
"model instead")
|
|
181
|
-
length = lengths[0]
|
|
182
|
-
|
|
183
|
-
depth = model_count
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
array = AtomArrayStack(depth, length)
|
|
187
|
-
array.coord = np.stack(
|
|
188
|
-
[x_coord,
|
|
189
|
-
y_coord,
|
|
190
|
-
z_coord],
|
|
191
|
-
axis=1
|
|
192
|
-
).reshape(depth, length, 3)
|
|
193
|
-
|
|
194
|
-
# Create altloc array for the final filtering
|
|
195
|
-
if all_altloc_ids is not None:
|
|
196
|
-
altloc_ids = all_altloc_ids[:length]
|
|
197
|
-
else:
|
|
198
|
-
altloc_ids = None
|
|
199
|
-
|
|
200
|
-
extra_charge = False
|
|
201
|
-
if "ins_code" in extra_fields:
|
|
202
|
-
extra_inscode = True
|
|
203
|
-
array.add_annotation("ins_code", "U1")
|
|
204
|
-
if "charge" in extra_fields:
|
|
205
|
-
extra_charge = True
|
|
206
|
-
array.add_annotation("charge", int)
|
|
207
|
-
if "atom_id" in extra_fields:
|
|
208
|
-
array.set_annotation("atom_id", atom_ids[:length])
|
|
209
|
-
if "b_factor" in extra_fields:
|
|
210
|
-
array.set_annotation("b_factor", b_factor[:length])
|
|
211
|
-
if "occupancy" in extra_fields:
|
|
212
|
-
array.set_annotation("occupancy", occupancy[:length])
|
|
213
|
-
|
|
214
|
-
_fill_annotations(1, array, extra_charge,
|
|
215
|
-
chain_names, chains_per_model, res_per_chain,
|
|
216
|
-
res_type_i, res_ids, inscode, atoms_per_res,
|
|
217
|
-
res_names, hetero_res, atom_names, elements, charges)
|
|
218
|
-
|
|
219
|
-
if include_bonds:
|
|
220
|
-
array.bonds = _create_bond_list(
|
|
221
|
-
1, file["bondAtomList"], file["bondOrderList"],
|
|
222
|
-
0, length, file["numAtoms"], group_list, res_type_i,
|
|
223
|
-
atoms_per_res, res_per_chain, chains_per_model
|
|
224
|
-
)
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
else:
|
|
228
|
-
lengths = _get_model_lengths(res_type_i, chains_per_model,
|
|
229
|
-
res_per_chain, atoms_per_res)
|
|
230
|
-
if model == 0:
|
|
231
|
-
raise ValueError("The model index must not be 0")
|
|
232
|
-
# Negative models mean model index starting from last model
|
|
233
|
-
model = len(lengths) + model + 1 if model < 0 else model
|
|
234
|
-
if model > len(lengths):
|
|
235
|
-
raise ValueError(
|
|
236
|
-
f"The file has {len(lengths)} models, "
|
|
237
|
-
f"the given model {model} does not exist"
|
|
238
|
-
)
|
|
239
|
-
|
|
240
|
-
length = lengths[model-1]
|
|
241
|
-
# Indices to filter coords and some annotations
|
|
242
|
-
# for the specified model
|
|
243
|
-
start_i = np.sum(lengths[:model-1])
|
|
244
|
-
stop_i = start_i + length
|
|
245
|
-
|
|
246
|
-
array = AtomArray(length)
|
|
247
|
-
array.coord[:,0] = x_coord[start_i : stop_i]
|
|
248
|
-
array.coord[:,1] = y_coord[start_i : stop_i]
|
|
249
|
-
array.coord[:,2] = z_coord[start_i : stop_i]
|
|
250
|
-
|
|
251
|
-
# Create altloc array for the final filtering
|
|
252
|
-
if all_altloc_ids is not None:
|
|
253
|
-
altloc_ids = np.array(all_altloc_ids[start_i : stop_i], dtype="U1")
|
|
254
|
-
else:
|
|
255
|
-
altloc_ids = None
|
|
256
|
-
|
|
257
|
-
extra_charge = False
|
|
258
|
-
if "charge" in extra_fields:
|
|
259
|
-
extra_charge = True
|
|
260
|
-
array.add_annotation("charge", int)
|
|
261
|
-
if "atom_id" in extra_fields:
|
|
262
|
-
array.set_annotation("atom_id", atom_ids[start_i : stop_i])
|
|
263
|
-
if "b_factor" in extra_fields:
|
|
264
|
-
array.set_annotation("b_factor", b_factor[start_i : stop_i])
|
|
265
|
-
if "occupancy" in extra_fields:
|
|
266
|
-
array.set_annotation("occupancy", occupancy[start_i : stop_i])
|
|
267
|
-
|
|
268
|
-
_fill_annotations(model, array, extra_charge,
|
|
269
|
-
chain_names, chains_per_model, res_per_chain,
|
|
270
|
-
res_type_i, res_ids, inscode, atoms_per_res,
|
|
271
|
-
res_names, hetero_res, atom_names, elements, charges)
|
|
272
|
-
|
|
273
|
-
if include_bonds:
|
|
274
|
-
array.bonds = _create_bond_list(
|
|
275
|
-
model, file["bondAtomList"], file["bondOrderList"],
|
|
276
|
-
start_i, stop_i, file["numAtoms"], group_list, res_type_i,
|
|
277
|
-
atoms_per_res, res_per_chain, chains_per_model
|
|
278
|
-
)
|
|
279
|
-
|
|
280
|
-
# Get box
|
|
281
|
-
if "unitCell" in file:
|
|
282
|
-
a_len, b_len, c_len, alpha, beta, gamma = file["unitCell"]
|
|
283
|
-
alpha = np.deg2rad(alpha)
|
|
284
|
-
beta = np.deg2rad(beta )
|
|
285
|
-
gamma = np.deg2rad(gamma)
|
|
286
|
-
box = vectors_from_unitcell(
|
|
287
|
-
a_len, b_len, c_len, alpha, beta, gamma
|
|
288
|
-
)
|
|
289
|
-
if isinstance(array, AtomArrayStack):
|
|
290
|
-
array.box = np.repeat(
|
|
291
|
-
box[np.newaxis, ...], array.stack_depth(), axis=0
|
|
292
|
-
)
|
|
293
|
-
else:
|
|
294
|
-
# AtomArray
|
|
295
|
-
array.box = box
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
# Filter altloc IDs and return
|
|
299
|
-
if altloc_ids is None:
|
|
300
|
-
return array
|
|
301
|
-
elif altloc == "occupancy" and occupancy is not None:
|
|
302
|
-
return array[
|
|
303
|
-
...,
|
|
304
|
-
filter_highest_occupancy_altloc(array, altloc_ids, occupancy)
|
|
305
|
-
]
|
|
306
|
-
# 'first' is also fallback if file has no occupancy information
|
|
307
|
-
elif altloc == "first":
|
|
308
|
-
return array[..., filter_first_altloc(array, altloc_ids)]
|
|
309
|
-
elif altloc == "all":
|
|
310
|
-
array.set_annotation("altloc_id", altloc_ids)
|
|
311
|
-
return array
|
|
312
|
-
else:
|
|
313
|
-
raise ValueError(f"'{altloc}' is not a valid 'altloc' option")
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
def _get_model_lengths(int32[:] res_type_i,
|
|
317
|
-
int32[:] chains_per_model,
|
|
318
|
-
int32[:] res_per_chain,
|
|
319
|
-
int32[:] atoms_per_res):
|
|
320
|
-
cdef int[:] model_lengths = np.zeros(len(chains_per_model), np.int32)
|
|
321
|
-
cdef int atom_count = 0
|
|
322
|
-
cdef int model_i = 0
|
|
323
|
-
cdef int chain_i = 0
|
|
324
|
-
cdef int res_i
|
|
325
|
-
cdef int res_count_in_chain = 0
|
|
326
|
-
cdef int chain_count_in_model = 0
|
|
327
|
-
# The length of 'res_type_i'
|
|
328
|
-
# is equal to the total number of residues
|
|
329
|
-
for res_i in range(res_type_i.shape[0]):
|
|
330
|
-
atom_count += atoms_per_res[res_type_i[res_i]]
|
|
331
|
-
res_count_in_chain += 1
|
|
332
|
-
if res_count_in_chain == res_per_chain[chain_i]:
|
|
333
|
-
# Chain is full -> Bump chain index and reset residue count
|
|
334
|
-
res_count_in_chain = 0
|
|
335
|
-
chain_i += 1
|
|
336
|
-
chain_count_in_model += 1
|
|
337
|
-
if chain_count_in_model == chains_per_model[model_i]:
|
|
338
|
-
# Model is full -> Bump model index and reset chain count
|
|
339
|
-
chain_count_in_model = 0
|
|
340
|
-
model_lengths[model_i] = atom_count
|
|
341
|
-
# Restart counting for the next model
|
|
342
|
-
atom_count = 0
|
|
343
|
-
model_i += 1
|
|
344
|
-
return np.asarray(model_lengths)
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
def _fill_annotations(int model, array,
|
|
348
|
-
bint extra_charge,
|
|
349
|
-
np.ndarray chain_names,
|
|
350
|
-
int32[:] chains_per_model,
|
|
351
|
-
int32[:] res_per_chain,
|
|
352
|
-
int32[:] res_type_i,
|
|
353
|
-
int32[:] res_ids,
|
|
354
|
-
np.ndarray res_inscodes,
|
|
355
|
-
np.ndarray atoms_per_res,
|
|
356
|
-
np.ndarray res_names,
|
|
357
|
-
np.ndarray hetero_res,
|
|
358
|
-
np.ndarray atom_names,
|
|
359
|
-
np.ndarray elements,
|
|
360
|
-
np.ndarray charges):
|
|
361
|
-
# Get annotation arrays from atom array (stack)
|
|
362
|
-
cdef np.ndarray chain_id = array.chain_id
|
|
363
|
-
cdef np.ndarray res_id = array.res_id
|
|
364
|
-
cdef np.ndarray ins_code = array.ins_code
|
|
365
|
-
cdef np.ndarray res_name = array.res_name
|
|
366
|
-
cdef np.ndarray hetero = array.hetero
|
|
367
|
-
cdef np.ndarray atom_name = array.atom_name
|
|
368
|
-
cdef np.ndarray element = array.element
|
|
369
|
-
if extra_charge:
|
|
370
|
-
charge = array.charge
|
|
371
|
-
|
|
372
|
-
cdef int model_i = 0
|
|
373
|
-
cdef int chain_i = 0
|
|
374
|
-
cdef int res_i
|
|
375
|
-
cdef int atom_i = 0
|
|
376
|
-
cdef int res_count_in_chain = 0
|
|
377
|
-
cdef int chain_count_in_model = 0
|
|
378
|
-
cdef int atom_index_in_res
|
|
379
|
-
|
|
380
|
-
cdef chain_id_for_chain
|
|
381
|
-
cdef res_name_for_res
|
|
382
|
-
cdef inscode_for_res
|
|
383
|
-
cdef bint hetero_for_res
|
|
384
|
-
cdef int res_id_for_res
|
|
385
|
-
cdef int type_i
|
|
386
|
-
|
|
387
|
-
# The length of 'res_type_i'
|
|
388
|
-
# is equal to the total number of residues
|
|
389
|
-
for res_i in range(res_type_i.shape[0]):
|
|
390
|
-
# Wait for the data of the given model
|
|
391
|
-
if model_i == model-1:
|
|
392
|
-
chain_id_for_chain = chain_names[chain_i]
|
|
393
|
-
res_id_for_res = res_ids[res_i]
|
|
394
|
-
if res_inscodes is not None:
|
|
395
|
-
inscode_for_res = res_inscodes[res_i]
|
|
396
|
-
type_i = res_type_i[res_i]
|
|
397
|
-
res_name_for_res = res_names[type_i]
|
|
398
|
-
hetero_for_res = hetero_res[type_i]
|
|
399
|
-
|
|
400
|
-
for atom_index_in_res in range(atoms_per_res[type_i]):
|
|
401
|
-
chain_id[atom_i] = chain_id_for_chain
|
|
402
|
-
res_id[atom_i] = res_id_for_res
|
|
403
|
-
ins_code[atom_i] = inscode_for_res
|
|
404
|
-
hetero[atom_i] = hetero_for_res
|
|
405
|
-
res_name[atom_i] = res_name_for_res
|
|
406
|
-
atom_name[atom_i] = atom_names[type_i][atom_index_in_res]
|
|
407
|
-
element[atom_i] = elements[type_i][atom_index_in_res].upper()
|
|
408
|
-
if extra_charge:
|
|
409
|
-
charge[atom_i] = charges[type_i][atom_index_in_res]
|
|
410
|
-
atom_i += 1
|
|
411
|
-
|
|
412
|
-
elif model_i > model-1:
|
|
413
|
-
# The given model has already been parsed
|
|
414
|
-
# -> parsing is finished
|
|
415
|
-
break
|
|
416
|
-
|
|
417
|
-
res_count_in_chain += 1
|
|
418
|
-
if res_count_in_chain == res_per_chain[chain_i]:
|
|
419
|
-
# Chain is full -> Bump chain index and reset residue count
|
|
420
|
-
res_count_in_chain = 0
|
|
421
|
-
chain_i += 1
|
|
422
|
-
chain_count_in_model += 1
|
|
423
|
-
if chain_count_in_model == chains_per_model[model_i]:
|
|
424
|
-
# Model is full -> Bump model index and reset chain count
|
|
425
|
-
chain_count_in_model = 0
|
|
426
|
-
model_i += 1
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
def _create_bond_list(int model, np.ndarray bonds, np.ndarray bond_types,
|
|
430
|
-
int model_start, int model_stop, int atom_count,
|
|
431
|
-
list group_list, int32[:] res_type_i,
|
|
432
|
-
int32[:] atoms_per_res,
|
|
433
|
-
int32[:] res_per_chain, int32[:] chains_per_model):
|
|
434
|
-
cdef int i=0, j=0
|
|
435
|
-
|
|
436
|
-
# Determine per-residue-count and maximum count
|
|
437
|
-
# of bonds in each residue
|
|
438
|
-
cdef int32[:] bonds_per_res = np.zeros(len(group_list), dtype=np.int32)
|
|
439
|
-
for i in range(len(group_list)):
|
|
440
|
-
bonds_per_res[i] = len(group_list[i]["bondOrderList"])
|
|
441
|
-
cdef int32 max_bonds_per_res = np.max(bonds_per_res)
|
|
442
|
-
|
|
443
|
-
# Create arrays for intra-residue bonds and bond types
|
|
444
|
-
cdef np.ndarray intra_bonds = np.zeros(
|
|
445
|
-
(len(group_list), max_bonds_per_res, 3), dtype=np.uint32
|
|
446
|
-
)
|
|
447
|
-
# Dictionary for groupList entry
|
|
448
|
-
cdef dict residue
|
|
449
|
-
# Fill the array
|
|
450
|
-
for i in range(len(group_list)):
|
|
451
|
-
residue = group_list[i]
|
|
452
|
-
bonds_in_residue = np.array(residue["bondAtomList"], dtype=np.uint32)
|
|
453
|
-
intra_bonds[i, :bonds_per_res[i], :2] = \
|
|
454
|
-
np.array(residue["bondAtomList"], dtype=np.uint32).reshape((-1, 2))
|
|
455
|
-
intra_bonds[i, :bonds_per_res[i], 2] = residue["bondOrderList"]
|
|
456
|
-
|
|
457
|
-
# Unify intra-residue bonds to one BondList
|
|
458
|
-
cdef int model_i = 0
|
|
459
|
-
cdef int chain_i = 0
|
|
460
|
-
cdef int res_i
|
|
461
|
-
cdef int res_count_in_chain = 0
|
|
462
|
-
cdef int chain_count_in_model = 0
|
|
463
|
-
cdef int type_i
|
|
464
|
-
intra_bond_list = BondList(0)
|
|
465
|
-
# The length of 'res_type_i'
|
|
466
|
-
# is equal to the total number of residues
|
|
467
|
-
for res_i in range(res_type_i.shape[0]):
|
|
468
|
-
# Wait for the data of the given model
|
|
469
|
-
if model_i == model-1:
|
|
470
|
-
type_i = res_type_i[res_i]
|
|
471
|
-
bond_list_per_res = BondList(
|
|
472
|
-
atoms_per_res[type_i],
|
|
473
|
-
intra_bonds[type_i, :bonds_per_res[type_i]]
|
|
474
|
-
)
|
|
475
|
-
intra_bond_list += bond_list_per_res
|
|
476
|
-
|
|
477
|
-
elif model_i > model-1:
|
|
478
|
-
# The given model has already been parsed
|
|
479
|
-
# -> parsing is finished
|
|
480
|
-
break
|
|
481
|
-
|
|
482
|
-
res_count_in_chain += 1
|
|
483
|
-
if res_count_in_chain == res_per_chain[chain_i]:
|
|
484
|
-
# Chain is full -> Bump chain index and reset residue count
|
|
485
|
-
res_count_in_chain = 0
|
|
486
|
-
chain_i += 1
|
|
487
|
-
chain_count_in_model += 1
|
|
488
|
-
if chain_count_in_model == chains_per_model[model_i]:
|
|
489
|
-
# Model is full -> Bump model index and reset chain count
|
|
490
|
-
chain_count_in_model = 0
|
|
491
|
-
model_i += 1
|
|
492
|
-
|
|
493
|
-
# Add inter-residue bonds to BondList
|
|
494
|
-
cdef np.ndarray inter_bonds = np.zeros((len(bond_types), 3),
|
|
495
|
-
dtype=np.uint32)
|
|
496
|
-
inter_bonds[:,:2] = bonds.reshape((len(bond_types), 2))
|
|
497
|
-
inter_bonds[:,2] = bond_types
|
|
498
|
-
inter_bond_list = BondList(atom_count, inter_bonds)
|
|
499
|
-
inter_bond_list = inter_bond_list[model_start : model_stop]
|
|
500
|
-
global_bond_list = inter_bond_list.merge(intra_bond_list)
|
|
501
|
-
return global_bond_list
|
|
Binary file
|
|
@@ -1,152 +0,0 @@
|
|
|
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.mmtf"
|
|
6
|
-
__author__ = "Patrick Kunzmann"
|
|
7
|
-
__all__ = ["decode_array"]
|
|
8
|
-
|
|
9
|
-
cimport cython
|
|
10
|
-
cimport numpy as np
|
|
11
|
-
|
|
12
|
-
import numpy as np
|
|
13
|
-
|
|
14
|
-
ctypedef np.int8_t int8
|
|
15
|
-
ctypedef np.int16_t int16
|
|
16
|
-
ctypedef np.int32_t int32
|
|
17
|
-
ctypedef np.uint8_t uint8
|
|
18
|
-
ctypedef np.uint16_t uint16
|
|
19
|
-
ctypedef np.uint32_t uint32
|
|
20
|
-
ctypedef np.uint64_t uint64
|
|
21
|
-
ctypedef np.float32_t float32
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
def decode_array(int codec, bytes raw_bytes, int param):
|
|
25
|
-
cdef np.ndarray array
|
|
26
|
-
# Pass-through: 32-bit floating-point number array
|
|
27
|
-
if codec == 1:
|
|
28
|
-
array = np.frombuffer(raw_bytes, dtype=">f4").astype(np.float32)
|
|
29
|
-
return array
|
|
30
|
-
# Pass-through: 8-bit signed integer array
|
|
31
|
-
elif codec == 2:
|
|
32
|
-
array = np.frombuffer(raw_bytes, dtype=">i1").astype(np.int8)
|
|
33
|
-
return array
|
|
34
|
-
# Pass-through: 16-bit signed integer array
|
|
35
|
-
elif codec == 3:
|
|
36
|
-
array = np.frombuffer(raw_bytes, dtype=">i2").astype(np.int16)
|
|
37
|
-
return array
|
|
38
|
-
# Pass-through: 32-bit signed integer array
|
|
39
|
-
elif codec == 4:
|
|
40
|
-
array = np.frombuffer(raw_bytes, dtype=">i4").astype(np.int32)
|
|
41
|
-
return array
|
|
42
|
-
# UTF8/ASCII fixed-length string array
|
|
43
|
-
elif codec == 5:
|
|
44
|
-
array = np.frombuffer(raw_bytes, np.dtype("S" + str(param)))
|
|
45
|
-
return array.astype(np.dtype("U" + str(param)))
|
|
46
|
-
# Run-length encoded character array
|
|
47
|
-
elif codec == 6:
|
|
48
|
-
array = np.frombuffer(raw_bytes, dtype=">i4").astype(np.int32)
|
|
49
|
-
return np.frombuffer(_decode_run_length(array), dtype="U1")
|
|
50
|
-
# Run-length encoded 32-bit signed integer array
|
|
51
|
-
elif codec == 7:
|
|
52
|
-
array = np.frombuffer(raw_bytes, dtype=">i4").astype(np.int32)
|
|
53
|
-
return _decode_run_length(array)
|
|
54
|
-
# Delta & run-length encoded 32-bit signed integer array
|
|
55
|
-
elif codec == 8:
|
|
56
|
-
array = np.frombuffer(raw_bytes, dtype=">i4").astype(np.int32)
|
|
57
|
-
return _decode_delta(
|
|
58
|
-
_decode_run_length(array))
|
|
59
|
-
# Integer & run-length encoded 32-bit floating-point number array
|
|
60
|
-
elif codec == 9:
|
|
61
|
-
array = np.frombuffer(raw_bytes, dtype=">i4").astype(np.int32)
|
|
62
|
-
return _decode_integer(param,
|
|
63
|
-
_decode_run_length(array))
|
|
64
|
-
# Integer & delta encoded
|
|
65
|
-
# & two-byte-packed 32-bit floating-point number array
|
|
66
|
-
elif codec == 10:
|
|
67
|
-
array = np.frombuffer(raw_bytes, dtype=">i2").astype(np.int16)
|
|
68
|
-
return _decode_integer(param,
|
|
69
|
-
_decode_delta(
|
|
70
|
-
_decode_packed(array)))
|
|
71
|
-
# Integer encoded 32-bit floating-point number array
|
|
72
|
-
elif codec == 11:
|
|
73
|
-
array = np.frombuffer(raw_bytes, dtype=">i2").astype(np.int16)
|
|
74
|
-
return _decode_integer(param, array)
|
|
75
|
-
# Integer & two-byte-packed 32-bit floating-point number array
|
|
76
|
-
elif codec == 12:
|
|
77
|
-
array = np.frombuffer(raw_bytes, dtype=">i2").astype(np.int16)
|
|
78
|
-
return _decode_integer(param,
|
|
79
|
-
_decode_packed(array))
|
|
80
|
-
# Integer & one-byte-packed 32-bit floating-point number array
|
|
81
|
-
elif codec == 13:
|
|
82
|
-
array = np.frombuffer(raw_bytes, dtype=">i1").astype(np.int8)
|
|
83
|
-
return _decode_integer(param,
|
|
84
|
-
_decode_packed(array))
|
|
85
|
-
# Two-byte-packed 32-bit signed integer array
|
|
86
|
-
elif codec == 14:
|
|
87
|
-
array = np.frombuffer(raw_bytes, dtype=">i2").astype(np.int16)
|
|
88
|
-
return _decode_packed(array)
|
|
89
|
-
# One-byte-packed 32-bit signed integer array
|
|
90
|
-
elif codec == 15:
|
|
91
|
-
array = np.frombuffer(raw_bytes, dtype=">i1").astype(np.int8)
|
|
92
|
-
return _decode_packed(array)
|
|
93
|
-
else:
|
|
94
|
-
raise ValueError("Unknown codec with ID {codec}")
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
def _decode_delta(np.ndarray array):
|
|
98
|
-
return np.cumsum(array, dtype=np.int32)
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
def _decode_run_length(int32[:] array):
|
|
102
|
-
cdef int length = 0
|
|
103
|
-
cdef int i, j
|
|
104
|
-
cdef int value, repeat
|
|
105
|
-
# Determine length of output array by summing the run lengths
|
|
106
|
-
for i in range(1, array.shape[0], 2):
|
|
107
|
-
length += array[i]
|
|
108
|
-
cdef int32[:] output = np.zeros(length, dtype=np.int32)
|
|
109
|
-
# Fill output array
|
|
110
|
-
j = 0
|
|
111
|
-
for i in range(0, array.shape[0], 2):
|
|
112
|
-
value = array[i]
|
|
113
|
-
repeat = array[i+1]
|
|
114
|
-
output[j : j+repeat] = value
|
|
115
|
-
j += repeat
|
|
116
|
-
return np.asarray(output)
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
ctypedef fused PackedType:
|
|
120
|
-
int8
|
|
121
|
-
int16
|
|
122
|
-
def _decode_packed(PackedType[:] array):
|
|
123
|
-
cdef int min_val, max_val
|
|
124
|
-
if PackedType is int8:
|
|
125
|
-
min_val = np.iinfo(np.int8).min
|
|
126
|
-
max_val = np.iinfo(np.int8).max
|
|
127
|
-
else:
|
|
128
|
-
min_val = np.iinfo(np.int16).min
|
|
129
|
-
max_val = np.iinfo(np.int16).max
|
|
130
|
-
cdef int i, j
|
|
131
|
-
cdef int packed_val, unpacked_val
|
|
132
|
-
# Pessimistic size assumption:
|
|
133
|
-
# The maximum output array length is the input array length
|
|
134
|
-
# in case all values are within the type limits
|
|
135
|
-
cdef int32[:] output = np.zeros(array.shape[0], dtype=np.int32)
|
|
136
|
-
j = 0
|
|
137
|
-
unpacked_val = 0
|
|
138
|
-
for i in range(array.shape[0]):
|
|
139
|
-
packed_val = array[i]
|
|
140
|
-
if packed_val == max_val or packed_val == min_val:
|
|
141
|
-
unpacked_val += packed_val
|
|
142
|
-
else:
|
|
143
|
-
unpacked_val += packed_val
|
|
144
|
-
output[j] = unpacked_val
|
|
145
|
-
unpacked_val = 0
|
|
146
|
-
j += 1
|
|
147
|
-
# Trim to correct size and return
|
|
148
|
-
return np.asarray(output[:j])
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
def _decode_integer(int divisor, np.ndarray array):
|
|
152
|
-
return np.divide(array, divisor, dtype=np.float32)
|
|
Binary file
|