biotite 1.1.0__cp311-cp311-win_amd64.whl → 1.3.0__cp311-cp311-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/application/application.py +3 -3
- biotite/application/autodock/app.py +1 -1
- biotite/application/blast/webapp.py +1 -1
- biotite/application/clustalo/app.py +1 -1
- biotite/application/localapp.py +2 -2
- biotite/application/msaapp.py +10 -10
- biotite/application/muscle/app3.py +3 -3
- biotite/application/muscle/app5.py +3 -3
- biotite/application/sra/app.py +0 -5
- biotite/application/util.py +21 -1
- biotite/application/viennarna/rnaalifold.py +8 -8
- biotite/application/viennarna/rnaplot.py +10 -8
- biotite/application/viennarna/util.py +1 -1
- biotite/application/webapp.py +1 -1
- biotite/database/afdb/__init__.py +12 -0
- biotite/database/afdb/download.py +191 -0
- biotite/database/entrez/dbnames.py +10 -0
- biotite/database/entrez/download.py +9 -10
- biotite/database/entrez/key.py +1 -1
- biotite/database/entrez/query.py +5 -4
- biotite/database/pubchem/download.py +6 -6
- biotite/database/pubchem/error.py +10 -0
- biotite/database/pubchem/query.py +12 -23
- biotite/database/rcsb/download.py +3 -2
- biotite/database/rcsb/query.py +2 -3
- biotite/database/uniprot/check.py +2 -2
- biotite/database/uniprot/download.py +2 -5
- biotite/database/uniprot/query.py +3 -4
- biotite/file.py +14 -2
- biotite/interface/__init__.py +19 -0
- biotite/interface/openmm/__init__.py +20 -0
- biotite/interface/openmm/state.py +93 -0
- biotite/interface/openmm/system.py +227 -0
- biotite/interface/pymol/__init__.py +201 -0
- biotite/interface/pymol/cgo.py +346 -0
- biotite/interface/pymol/convert.py +185 -0
- biotite/interface/pymol/display.py +267 -0
- biotite/interface/pymol/object.py +1226 -0
- biotite/interface/pymol/shapes.py +178 -0
- biotite/interface/pymol/startup.py +169 -0
- biotite/interface/rdkit/__init__.py +19 -0
- biotite/interface/rdkit/mol.py +490 -0
- biotite/interface/version.py +94 -0
- biotite/interface/warning.py +19 -0
- biotite/sequence/align/__init__.py +0 -4
- biotite/sequence/align/alignment.py +33 -11
- biotite/sequence/align/banded.cp311-win_amd64.pyd +0 -0
- biotite/sequence/align/banded.pyx +22 -22
- biotite/sequence/align/cigar.py +2 -2
- biotite/sequence/align/kmeralphabet.cp311-win_amd64.pyd +0 -0
- biotite/sequence/align/kmeralphabet.pyx +2 -2
- biotite/sequence/align/kmersimilarity.cp311-win_amd64.pyd +0 -0
- biotite/sequence/align/kmertable.cp311-win_amd64.pyd +0 -0
- biotite/sequence/align/kmertable.pyx +6 -6
- biotite/sequence/align/localgapped.cp311-win_amd64.pyd +0 -0
- biotite/sequence/align/localgapped.pyx +47 -47
- biotite/sequence/align/localungapped.cp311-win_amd64.pyd +0 -0
- biotite/sequence/align/localungapped.pyx +10 -10
- biotite/sequence/align/matrix.py +12 -3
- biotite/sequence/align/multiple.cp311-win_amd64.pyd +0 -0
- biotite/sequence/align/multiple.pyx +1 -2
- biotite/sequence/align/pairwise.cp311-win_amd64.pyd +0 -0
- biotite/sequence/align/pairwise.pyx +37 -39
- biotite/sequence/align/permutation.cp311-win_amd64.pyd +0 -0
- biotite/sequence/align/selector.cp311-win_amd64.pyd +0 -0
- biotite/sequence/align/selector.pyx +2 -2
- biotite/sequence/align/statistics.py +1 -1
- biotite/sequence/align/tracetable.cp311-win_amd64.pyd +0 -0
- biotite/sequence/alphabet.py +2 -2
- biotite/sequence/annotation.py +19 -13
- biotite/sequence/codec.cp311-win_amd64.pyd +0 -0
- biotite/sequence/codon.py +1 -2
- biotite/sequence/graphics/alignment.py +25 -39
- biotite/sequence/graphics/dendrogram.py +4 -2
- biotite/sequence/graphics/features.py +2 -2
- biotite/sequence/graphics/logo.py +10 -12
- biotite/sequence/io/fasta/convert.py +1 -2
- biotite/sequence/io/fasta/file.py +1 -1
- biotite/sequence/io/fastq/file.py +3 -3
- biotite/sequence/io/genbank/file.py +3 -3
- biotite/sequence/io/genbank/sequence.py +2 -0
- biotite/sequence/io/gff/convert.py +1 -1
- biotite/sequence/io/gff/file.py +1 -2
- biotite/sequence/phylo/nj.cp311-win_amd64.pyd +0 -0
- biotite/sequence/phylo/tree.cp311-win_amd64.pyd +0 -0
- biotite/sequence/phylo/upgma.cp311-win_amd64.pyd +0 -0
- biotite/sequence/profile.py +19 -25
- biotite/sequence/search.py +0 -1
- biotite/sequence/seqtypes.py +12 -5
- biotite/sequence/sequence.py +1 -2
- biotite/structure/__init__.py +2 -0
- biotite/structure/alphabet/i3d.py +1 -2
- biotite/structure/alphabet/pb.py +1 -2
- biotite/structure/alphabet/unkerasify.py +8 -2
- biotite/structure/atoms.py +35 -27
- biotite/structure/basepairs.py +39 -40
- biotite/structure/bonds.cp311-win_amd64.pyd +0 -0
- biotite/structure/bonds.pyx +8 -5
- biotite/structure/box.py +159 -23
- biotite/structure/celllist.cp311-win_amd64.pyd +0 -0
- biotite/structure/celllist.pyx +83 -68
- biotite/structure/chains.py +17 -55
- biotite/structure/charges.cp311-win_amd64.pyd +0 -0
- biotite/structure/compare.py +420 -13
- biotite/structure/density.py +1 -1
- biotite/structure/dotbracket.py +31 -32
- biotite/structure/filter.py +8 -8
- biotite/structure/geometry.py +15 -15
- biotite/structure/graphics/rna.py +19 -16
- biotite/structure/hbond.py +18 -21
- biotite/structure/info/atoms.py +11 -2
- biotite/structure/info/ccd.py +0 -2
- biotite/structure/info/components.bcif +0 -0
- biotite/structure/info/groups.py +0 -3
- biotite/structure/info/misc.py +0 -1
- biotite/structure/info/radii.py +92 -22
- biotite/structure/info/standardize.py +1 -2
- biotite/structure/integrity.py +4 -6
- biotite/structure/io/general.py +2 -2
- biotite/structure/io/gro/file.py +8 -9
- biotite/structure/io/mol/convert.py +1 -1
- biotite/structure/io/mol/ctab.py +33 -28
- biotite/structure/io/mol/mol.py +1 -1
- biotite/structure/io/mol/sdf.py +39 -13
- biotite/structure/io/pdb/convert.py +86 -5
- biotite/structure/io/pdb/file.py +90 -24
- biotite/structure/io/pdb/hybrid36.cp311-win_amd64.pyd +0 -0
- biotite/structure/io/pdbqt/file.py +4 -4
- biotite/structure/io/pdbx/bcif.py +22 -7
- biotite/structure/io/pdbx/cif.py +20 -7
- biotite/structure/io/pdbx/component.py +6 -0
- biotite/structure/io/pdbx/compress.py +71 -34
- biotite/structure/io/pdbx/convert.py +429 -77
- biotite/structure/io/pdbx/encoding.cp311-win_amd64.pyd +0 -0
- biotite/structure/io/pdbx/encoding.pyx +39 -23
- biotite/structure/io/trajfile.py +9 -6
- biotite/structure/io/util.py +38 -0
- biotite/structure/mechanics.py +0 -1
- biotite/structure/molecules.py +0 -15
- biotite/structure/pseudoknots.py +13 -19
- biotite/structure/repair.py +2 -4
- biotite/structure/residues.py +20 -48
- biotite/structure/rings.py +335 -0
- biotite/structure/sasa.cp311-win_amd64.pyd +0 -0
- biotite/structure/sasa.pyx +30 -30
- biotite/structure/segments.py +123 -9
- biotite/structure/sequence.py +0 -1
- biotite/structure/spacegroups.json +1567 -0
- biotite/structure/spacegroups.license +26 -0
- biotite/structure/sse.py +0 -2
- biotite/structure/superimpose.py +75 -253
- biotite/structure/tm.py +581 -0
- biotite/structure/transform.py +232 -26
- biotite/structure/util.py +3 -3
- biotite/version.py +9 -4
- biotite/visualize.py +111 -1
- {biotite-1.1.0.dist-info → biotite-1.3.0.dist-info}/METADATA +8 -36
- {biotite-1.1.0.dist-info → biotite-1.3.0.dist-info}/RECORD +160 -138
- {biotite-1.1.0.dist-info → biotite-1.3.0.dist-info}/WHEEL +1 -1
- {biotite-1.1.0.dist-info → biotite-1.3.0.dist-info}/licenses/LICENSE.rst +0 -0
biotite/structure/segments.py
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
__name__ = "biotite.structure"
|
|
6
6
|
__author__ = "Patrick Kunzmann"
|
|
7
7
|
__all__ = [
|
|
8
|
+
"get_segment_starts",
|
|
8
9
|
"apply_segment_wise",
|
|
9
10
|
"spread_segment_wise",
|
|
10
11
|
"get_segment_masks",
|
|
@@ -16,6 +17,60 @@ __all__ = [
|
|
|
16
17
|
import numpy as np
|
|
17
18
|
|
|
18
19
|
|
|
20
|
+
def get_segment_starts(
|
|
21
|
+
array, add_exclusive_stop, continuous_categories=(), equal_categories=()
|
|
22
|
+
):
|
|
23
|
+
"""
|
|
24
|
+
Generalized version of :func:`get_residue_starts()` for residues and chains.
|
|
25
|
+
|
|
26
|
+
The starts are determined from value changes in the given annotations.
|
|
27
|
+
|
|
28
|
+
Parameters
|
|
29
|
+
----------
|
|
30
|
+
array : AtomArray or AtomArrayStack
|
|
31
|
+
The atom array (stack) to get the segment starts from.
|
|
32
|
+
add_exclusive_stop : bool, optional
|
|
33
|
+
If true, the exclusive stop of the input atom array,
|
|
34
|
+
i.e. ``array.array_length()``, is added to the returned array of start indices
|
|
35
|
+
as last element.
|
|
36
|
+
continuous_categories : tuple of str, optional
|
|
37
|
+
Annotation categories that are expected to be continuously increasing within a
|
|
38
|
+
segment.
|
|
39
|
+
This means if the value of such an annotation decreases from one atom to
|
|
40
|
+
another, a new segment is started.
|
|
41
|
+
equal_categories : tuple of str, optional
|
|
42
|
+
Annotation categories that are expected to be equal within a segment.
|
|
43
|
+
This means if the value of such an annotation changes from one atom to
|
|
44
|
+
another, a new segment is started.
|
|
45
|
+
|
|
46
|
+
Returns
|
|
47
|
+
-------
|
|
48
|
+
starts : ndarray, dtype=int
|
|
49
|
+
The start indices of segments in `array`.
|
|
50
|
+
"""
|
|
51
|
+
if array.array_length() == 0:
|
|
52
|
+
return np.array([], dtype=int)
|
|
53
|
+
|
|
54
|
+
segment_start_mask = np.zeros(array.array_length() - 1, dtype=bool)
|
|
55
|
+
for annot_name in continuous_categories:
|
|
56
|
+
annotation = array.get_annotation(annot_name)
|
|
57
|
+
segment_start_mask |= np.diff(annotation) < 0
|
|
58
|
+
for annot_name in equal_categories:
|
|
59
|
+
annotation = array.get_annotation(annot_name)
|
|
60
|
+
segment_start_mask |= annotation[1:] != annotation[:-1]
|
|
61
|
+
|
|
62
|
+
# Convert mask to indices
|
|
63
|
+
# Add 1, to shift the indices from the end of a segment
|
|
64
|
+
# to the start of a new segment
|
|
65
|
+
chain_starts = np.where(segment_start_mask)[0] + 1
|
|
66
|
+
|
|
67
|
+
# The first chain is not included yet -> Insert '[0]'
|
|
68
|
+
if add_exclusive_stop:
|
|
69
|
+
return np.concatenate(([0], chain_starts, [array.array_length()]))
|
|
70
|
+
else:
|
|
71
|
+
return np.concatenate(([0], chain_starts))
|
|
72
|
+
|
|
73
|
+
|
|
19
74
|
def apply_segment_wise(starts, data, function, axis=None):
|
|
20
75
|
"""
|
|
21
76
|
Generalized version of :func:`apply_residue_wise()` for
|
|
@@ -27,6 +82,22 @@ def apply_segment_wise(starts, data, function, axis=None):
|
|
|
27
82
|
The sorted start indices of segments.
|
|
28
83
|
Includes exclusive stop, i.e. the length of the corresponding
|
|
29
84
|
atom array.
|
|
85
|
+
data : ndarray
|
|
86
|
+
The data, whose intervals are the parameter for `function`.
|
|
87
|
+
Must have same length as `array`.
|
|
88
|
+
function : function
|
|
89
|
+
The `function` must have either the form *f(data)* or
|
|
90
|
+
*f(data, axis)* in case `axis` is given. Every `function` call
|
|
91
|
+
must return a value with the same shape and data type.
|
|
92
|
+
axis : int, optional
|
|
93
|
+
This value is given to the `axis` parameter of `function`.
|
|
94
|
+
|
|
95
|
+
Returns
|
|
96
|
+
-------
|
|
97
|
+
processed_data : ndarray
|
|
98
|
+
Segment-wise evaluation of `data` by `function`.
|
|
99
|
+
The size of the first dimension of this array is equal to the amount of
|
|
100
|
+
residues.
|
|
30
101
|
"""
|
|
31
102
|
# The result array
|
|
32
103
|
processed_data = None
|
|
@@ -65,13 +136,19 @@ def spread_segment_wise(starts, input_data):
|
|
|
65
136
|
The sorted start indices of segments.
|
|
66
137
|
Includes exclusive stop, i.e. the length of the corresponding
|
|
67
138
|
atom array.
|
|
139
|
+
input_data : ndarray
|
|
140
|
+
The data to be spread.
|
|
141
|
+
The length of the 0-th axis must be equal to the amount of different residue IDs
|
|
142
|
+
in `array`.
|
|
143
|
+
|
|
144
|
+
Returns
|
|
145
|
+
-------
|
|
146
|
+
output_data : ndarray
|
|
147
|
+
Segment-wise spread `input_data`.
|
|
148
|
+
Length is the same as `array_length()` of `array`.
|
|
68
149
|
"""
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
start = starts[i]
|
|
72
|
-
stop = starts[i + 1]
|
|
73
|
-
output_data[start:stop] = input_data[i]
|
|
74
|
-
return output_data
|
|
150
|
+
seg_lens = starts[1:] - starts[:-1]
|
|
151
|
+
return np.repeat(input_data, seg_lens, axis=0)
|
|
75
152
|
|
|
76
153
|
|
|
77
154
|
def get_segment_masks(starts, indices):
|
|
@@ -85,6 +162,17 @@ def get_segment_masks(starts, indices):
|
|
|
85
162
|
The sorted start indices of segments.
|
|
86
163
|
Includes exclusive stop, i.e. the length of the corresponding
|
|
87
164
|
atom array.
|
|
165
|
+
indices : ndarray, dtype=int, shape=(k,)
|
|
166
|
+
These indices indicate the atoms to get the corresponding
|
|
167
|
+
segments for.
|
|
168
|
+
Negative indices are not allowed.
|
|
169
|
+
|
|
170
|
+
Returns
|
|
171
|
+
-------
|
|
172
|
+
residues_masks : ndarray, dtype=bool, shape=(k,n)
|
|
173
|
+
Multiple boolean masks, one for each given index in `indices`.
|
|
174
|
+
Each array masks the atoms that belong to the same segment as
|
|
175
|
+
the atom at the given index.
|
|
88
176
|
"""
|
|
89
177
|
indices = np.asarray(indices)
|
|
90
178
|
length = starts[-1]
|
|
@@ -95,7 +183,7 @@ def get_segment_masks(starts, indices):
|
|
|
95
183
|
if (indices >= length).any():
|
|
96
184
|
index = np.min(np.where(indices >= length)[0])
|
|
97
185
|
raise ValueError(
|
|
98
|
-
f"Index {index} is out of range for
|
|
186
|
+
f"Index {index} is out of range for an atom array with length {length}"
|
|
99
187
|
)
|
|
100
188
|
|
|
101
189
|
insertion_points = np.searchsorted(starts, indices, side="right") - 1
|
|
@@ -116,6 +204,16 @@ def get_segment_starts_for(starts, indices):
|
|
|
116
204
|
The sorted start indices of segments.
|
|
117
205
|
Includes exclusive stop, i.e. the length of the corresponding
|
|
118
206
|
atom array.
|
|
207
|
+
indices : ndarray, dtype=int, shape=(k,)
|
|
208
|
+
These indices point to the atoms to get the corresponding
|
|
209
|
+
segment starts for.
|
|
210
|
+
Negative indices are not allowed.
|
|
211
|
+
|
|
212
|
+
Returns
|
|
213
|
+
-------
|
|
214
|
+
start_indices : ndarray, dtype=int, shape=(k,)
|
|
215
|
+
The indices that point to the segment starts for the input
|
|
216
|
+
`indices`.
|
|
119
217
|
"""
|
|
120
218
|
indices = np.asarray(indices)
|
|
121
219
|
length = starts[-1]
|
|
@@ -127,7 +225,7 @@ def get_segment_starts_for(starts, indices):
|
|
|
127
225
|
if (indices >= length).any():
|
|
128
226
|
index = np.min(np.where(indices >= length)[0])
|
|
129
227
|
raise ValueError(
|
|
130
|
-
f"Index {index} is out of range for
|
|
228
|
+
f"Index {index} is out of range for an atom array with length {length}"
|
|
131
229
|
)
|
|
132
230
|
|
|
133
231
|
insertion_points = np.searchsorted(starts, indices, side="right") - 1
|
|
@@ -145,6 +243,15 @@ def get_segment_positions(starts, indices):
|
|
|
145
243
|
The sorted start indices of segments.
|
|
146
244
|
Includes exclusive stop, i.e. the length of the corresponding
|
|
147
245
|
atom array.
|
|
246
|
+
indices : ndarray, shape=(k,)
|
|
247
|
+
These indices point to the atoms to get the corresponding
|
|
248
|
+
residue positions for.
|
|
249
|
+
Negative indices are not allowed.
|
|
250
|
+
|
|
251
|
+
Returns
|
|
252
|
+
-------
|
|
253
|
+
segment_indices : ndarray, shape=(k,)
|
|
254
|
+
The indices that point to the position of the segments.
|
|
148
255
|
"""
|
|
149
256
|
indices = np.asarray(indices)
|
|
150
257
|
length = starts[-1]
|
|
@@ -156,7 +263,7 @@ def get_segment_positions(starts, indices):
|
|
|
156
263
|
if (indices >= length).any():
|
|
157
264
|
index = np.min(np.where(indices >= length)[0])
|
|
158
265
|
raise ValueError(
|
|
159
|
-
f"Index {index} is out of range for
|
|
266
|
+
f"Index {index} is out of range for an atom array with length {length}"
|
|
160
267
|
)
|
|
161
268
|
|
|
162
269
|
return np.searchsorted(starts, indices, side="right") - 1
|
|
@@ -169,10 +276,17 @@ def segment_iter(array, starts):
|
|
|
169
276
|
|
|
170
277
|
Parameters
|
|
171
278
|
----------
|
|
279
|
+
array : AtomArray or AtomArrayStack
|
|
280
|
+
The structure to iterate over.
|
|
172
281
|
starts : ndarray, dtype=int
|
|
173
282
|
The sorted start indices of segments.
|
|
174
283
|
Includes exclusive stop, i.e. the length of the corresponding
|
|
175
284
|
atom array.
|
|
285
|
+
|
|
286
|
+
Yields
|
|
287
|
+
------
|
|
288
|
+
segment : AtomArray or AtomArrayStack
|
|
289
|
+
Each residue or chain of the structure.
|
|
176
290
|
"""
|
|
177
291
|
for i in range(len(starts) - 1):
|
|
178
292
|
yield array[..., starts[i] : starts[i + 1]]
|
biotite/structure/sequence.py
CHANGED
|
@@ -58,7 +58,6 @@ def to_sequence(atoms, allow_hetero=False):
|
|
|
58
58
|
>>> sequences, chain_starts = to_sequence(atom_array)
|
|
59
59
|
>>> print(sequences)
|
|
60
60
|
[ProteinSequence("NLYIQWLKDGGPSSGRPPPS")]
|
|
61
|
-
|
|
62
61
|
"""
|
|
63
62
|
sequences = []
|
|
64
63
|
chain_start_indices = get_chain_starts(atoms, add_exclusive_stop=True)
|