biotite 1.1.0__cp313-cp313-win_amd64.whl → 1.3.0__cp313-cp313-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.

Files changed (160) hide show
  1. biotite/application/application.py +3 -3
  2. biotite/application/autodock/app.py +1 -1
  3. biotite/application/blast/webapp.py +1 -1
  4. biotite/application/clustalo/app.py +1 -1
  5. biotite/application/localapp.py +2 -2
  6. biotite/application/msaapp.py +10 -10
  7. biotite/application/muscle/app3.py +3 -3
  8. biotite/application/muscle/app5.py +3 -3
  9. biotite/application/sra/app.py +0 -5
  10. biotite/application/util.py +21 -1
  11. biotite/application/viennarna/rnaalifold.py +8 -8
  12. biotite/application/viennarna/rnaplot.py +10 -8
  13. biotite/application/viennarna/util.py +1 -1
  14. biotite/application/webapp.py +1 -1
  15. biotite/database/afdb/__init__.py +12 -0
  16. biotite/database/afdb/download.py +191 -0
  17. biotite/database/entrez/dbnames.py +10 -0
  18. biotite/database/entrez/download.py +9 -10
  19. biotite/database/entrez/key.py +1 -1
  20. biotite/database/entrez/query.py +5 -4
  21. biotite/database/pubchem/download.py +6 -6
  22. biotite/database/pubchem/error.py +10 -0
  23. biotite/database/pubchem/query.py +12 -23
  24. biotite/database/rcsb/download.py +3 -2
  25. biotite/database/rcsb/query.py +2 -3
  26. biotite/database/uniprot/check.py +2 -2
  27. biotite/database/uniprot/download.py +2 -5
  28. biotite/database/uniprot/query.py +3 -4
  29. biotite/file.py +14 -2
  30. biotite/interface/__init__.py +19 -0
  31. biotite/interface/openmm/__init__.py +20 -0
  32. biotite/interface/openmm/state.py +93 -0
  33. biotite/interface/openmm/system.py +227 -0
  34. biotite/interface/pymol/__init__.py +201 -0
  35. biotite/interface/pymol/cgo.py +346 -0
  36. biotite/interface/pymol/convert.py +185 -0
  37. biotite/interface/pymol/display.py +267 -0
  38. biotite/interface/pymol/object.py +1226 -0
  39. biotite/interface/pymol/shapes.py +178 -0
  40. biotite/interface/pymol/startup.py +169 -0
  41. biotite/interface/rdkit/__init__.py +19 -0
  42. biotite/interface/rdkit/mol.py +490 -0
  43. biotite/interface/version.py +94 -0
  44. biotite/interface/warning.py +19 -0
  45. biotite/sequence/align/__init__.py +0 -4
  46. biotite/sequence/align/alignment.py +33 -11
  47. biotite/sequence/align/banded.cp313-win_amd64.pyd +0 -0
  48. biotite/sequence/align/banded.pyx +22 -22
  49. biotite/sequence/align/cigar.py +2 -2
  50. biotite/sequence/align/kmeralphabet.cp313-win_amd64.pyd +0 -0
  51. biotite/sequence/align/kmeralphabet.pyx +2 -2
  52. biotite/sequence/align/kmersimilarity.cp313-win_amd64.pyd +0 -0
  53. biotite/sequence/align/kmertable.cp313-win_amd64.pyd +0 -0
  54. biotite/sequence/align/kmertable.pyx +6 -6
  55. biotite/sequence/align/localgapped.cp313-win_amd64.pyd +0 -0
  56. biotite/sequence/align/localgapped.pyx +47 -47
  57. biotite/sequence/align/localungapped.cp313-win_amd64.pyd +0 -0
  58. biotite/sequence/align/localungapped.pyx +10 -10
  59. biotite/sequence/align/matrix.py +12 -3
  60. biotite/sequence/align/multiple.cp313-win_amd64.pyd +0 -0
  61. biotite/sequence/align/multiple.pyx +1 -2
  62. biotite/sequence/align/pairwise.cp313-win_amd64.pyd +0 -0
  63. biotite/sequence/align/pairwise.pyx +37 -39
  64. biotite/sequence/align/permutation.cp313-win_amd64.pyd +0 -0
  65. biotite/sequence/align/selector.cp313-win_amd64.pyd +0 -0
  66. biotite/sequence/align/selector.pyx +2 -2
  67. biotite/sequence/align/statistics.py +1 -1
  68. biotite/sequence/align/tracetable.cp313-win_amd64.pyd +0 -0
  69. biotite/sequence/alphabet.py +2 -2
  70. biotite/sequence/annotation.py +19 -13
  71. biotite/sequence/codec.cp313-win_amd64.pyd +0 -0
  72. biotite/sequence/codon.py +1 -2
  73. biotite/sequence/graphics/alignment.py +25 -39
  74. biotite/sequence/graphics/dendrogram.py +4 -2
  75. biotite/sequence/graphics/features.py +2 -2
  76. biotite/sequence/graphics/logo.py +10 -12
  77. biotite/sequence/io/fasta/convert.py +1 -2
  78. biotite/sequence/io/fasta/file.py +1 -1
  79. biotite/sequence/io/fastq/file.py +3 -3
  80. biotite/sequence/io/genbank/file.py +3 -3
  81. biotite/sequence/io/genbank/sequence.py +2 -0
  82. biotite/sequence/io/gff/convert.py +1 -1
  83. biotite/sequence/io/gff/file.py +1 -2
  84. biotite/sequence/phylo/nj.cp313-win_amd64.pyd +0 -0
  85. biotite/sequence/phylo/tree.cp313-win_amd64.pyd +0 -0
  86. biotite/sequence/phylo/upgma.cp313-win_amd64.pyd +0 -0
  87. biotite/sequence/profile.py +19 -25
  88. biotite/sequence/search.py +0 -1
  89. biotite/sequence/seqtypes.py +12 -5
  90. biotite/sequence/sequence.py +1 -2
  91. biotite/structure/__init__.py +2 -0
  92. biotite/structure/alphabet/i3d.py +1 -2
  93. biotite/structure/alphabet/pb.py +1 -2
  94. biotite/structure/alphabet/unkerasify.py +8 -2
  95. biotite/structure/atoms.py +35 -27
  96. biotite/structure/basepairs.py +39 -40
  97. biotite/structure/bonds.cp313-win_amd64.pyd +0 -0
  98. biotite/structure/bonds.pyx +8 -5
  99. biotite/structure/box.py +159 -23
  100. biotite/structure/celllist.cp313-win_amd64.pyd +0 -0
  101. biotite/structure/celllist.pyx +83 -68
  102. biotite/structure/chains.py +17 -55
  103. biotite/structure/charges.cp313-win_amd64.pyd +0 -0
  104. biotite/structure/compare.py +420 -13
  105. biotite/structure/density.py +1 -1
  106. biotite/structure/dotbracket.py +31 -32
  107. biotite/structure/filter.py +8 -8
  108. biotite/structure/geometry.py +15 -15
  109. biotite/structure/graphics/rna.py +19 -16
  110. biotite/structure/hbond.py +18 -21
  111. biotite/structure/info/atoms.py +11 -2
  112. biotite/structure/info/ccd.py +0 -2
  113. biotite/structure/info/components.bcif +0 -0
  114. biotite/structure/info/groups.py +0 -3
  115. biotite/structure/info/misc.py +0 -1
  116. biotite/structure/info/radii.py +92 -22
  117. biotite/structure/info/standardize.py +1 -2
  118. biotite/structure/integrity.py +4 -6
  119. biotite/structure/io/general.py +2 -2
  120. biotite/structure/io/gro/file.py +8 -9
  121. biotite/structure/io/mol/convert.py +1 -1
  122. biotite/structure/io/mol/ctab.py +33 -28
  123. biotite/structure/io/mol/mol.py +1 -1
  124. biotite/structure/io/mol/sdf.py +39 -13
  125. biotite/structure/io/pdb/convert.py +86 -5
  126. biotite/structure/io/pdb/file.py +90 -24
  127. biotite/structure/io/pdb/hybrid36.cp313-win_amd64.pyd +0 -0
  128. biotite/structure/io/pdbqt/file.py +4 -4
  129. biotite/structure/io/pdbx/bcif.py +22 -7
  130. biotite/structure/io/pdbx/cif.py +20 -7
  131. biotite/structure/io/pdbx/component.py +6 -0
  132. biotite/structure/io/pdbx/compress.py +71 -34
  133. biotite/structure/io/pdbx/convert.py +429 -77
  134. biotite/structure/io/pdbx/encoding.cp313-win_amd64.pyd +0 -0
  135. biotite/structure/io/pdbx/encoding.pyx +39 -23
  136. biotite/structure/io/trajfile.py +9 -6
  137. biotite/structure/io/util.py +38 -0
  138. biotite/structure/mechanics.py +0 -1
  139. biotite/structure/molecules.py +0 -15
  140. biotite/structure/pseudoknots.py +13 -19
  141. biotite/structure/repair.py +2 -4
  142. biotite/structure/residues.py +20 -48
  143. biotite/structure/rings.py +335 -0
  144. biotite/structure/sasa.cp313-win_amd64.pyd +0 -0
  145. biotite/structure/sasa.pyx +30 -30
  146. biotite/structure/segments.py +123 -9
  147. biotite/structure/sequence.py +0 -1
  148. biotite/structure/spacegroups.json +1567 -0
  149. biotite/structure/spacegroups.license +26 -0
  150. biotite/structure/sse.py +0 -2
  151. biotite/structure/superimpose.py +75 -253
  152. biotite/structure/tm.py +581 -0
  153. biotite/structure/transform.py +232 -26
  154. biotite/structure/util.py +3 -3
  155. biotite/version.py +9 -4
  156. biotite/visualize.py +111 -1
  157. {biotite-1.1.0.dist-info → biotite-1.3.0.dist-info}/METADATA +8 -36
  158. {biotite-1.1.0.dist-info → biotite-1.3.0.dist-info}/RECORD +160 -138
  159. {biotite-1.1.0.dist-info → biotite-1.3.0.dist-info}/WHEEL +1 -1
  160. {biotite-1.1.0.dist-info → biotite-1.3.0.dist-info}/licenses/LICENSE.rst +0 -0
@@ -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
- output_data = np.zeros(starts[-1], dtype=input_data.dtype)
70
- for i in range(len(starts) - 1):
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 " f"an atom array with length {length}"
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 " f"an atom array with length {length}"
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 " f"an atom array with length {length}"
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]]
@@ -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)