biotite 0.41.2__cp311-cp311-macosx_11_0_arm64.whl → 1.0.0__cp311-cp311-macosx_11_0_arm64.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 (205) hide show
  1. biotite/__init__.py +2 -3
  2. biotite/application/__init__.py +1 -1
  3. biotite/application/application.py +20 -10
  4. biotite/application/autodock/__init__.py +1 -1
  5. biotite/application/autodock/app.py +74 -79
  6. biotite/application/blast/__init__.py +1 -1
  7. biotite/application/blast/alignment.py +19 -10
  8. biotite/application/blast/webapp.py +92 -85
  9. biotite/application/clustalo/__init__.py +1 -1
  10. biotite/application/clustalo/app.py +46 -61
  11. biotite/application/dssp/__init__.py +1 -1
  12. biotite/application/dssp/app.py +8 -11
  13. biotite/application/localapp.py +62 -60
  14. biotite/application/mafft/__init__.py +1 -1
  15. biotite/application/mafft/app.py +16 -22
  16. biotite/application/msaapp.py +78 -89
  17. biotite/application/muscle/__init__.py +1 -1
  18. biotite/application/muscle/app3.py +50 -64
  19. biotite/application/muscle/app5.py +23 -31
  20. biotite/application/sra/__init__.py +1 -1
  21. biotite/application/sra/app.py +64 -68
  22. biotite/application/tantan/__init__.py +1 -1
  23. biotite/application/tantan/app.py +22 -45
  24. biotite/application/util.py +7 -9
  25. biotite/application/viennarna/rnaalifold.py +34 -28
  26. biotite/application/viennarna/rnafold.py +24 -39
  27. biotite/application/viennarna/rnaplot.py +36 -21
  28. biotite/application/viennarna/util.py +17 -12
  29. biotite/application/webapp.py +13 -14
  30. biotite/copyable.py +13 -13
  31. biotite/database/__init__.py +1 -1
  32. biotite/database/entrez/__init__.py +1 -1
  33. biotite/database/entrez/check.py +2 -3
  34. biotite/database/entrez/dbnames.py +7 -5
  35. biotite/database/entrez/download.py +55 -49
  36. biotite/database/entrez/key.py +1 -1
  37. biotite/database/entrez/query.py +62 -23
  38. biotite/database/error.py +2 -1
  39. biotite/database/pubchem/__init__.py +1 -1
  40. biotite/database/pubchem/download.py +43 -45
  41. biotite/database/pubchem/error.py +2 -2
  42. biotite/database/pubchem/query.py +34 -31
  43. biotite/database/pubchem/throttle.py +3 -4
  44. biotite/database/rcsb/__init__.py +1 -1
  45. biotite/database/rcsb/download.py +44 -52
  46. biotite/database/rcsb/query.py +85 -80
  47. biotite/database/uniprot/check.py +6 -3
  48. biotite/database/uniprot/download.py +6 -11
  49. biotite/database/uniprot/query.py +115 -31
  50. biotite/file.py +12 -31
  51. biotite/sequence/__init__.py +3 -3
  52. biotite/sequence/align/__init__.py +2 -2
  53. biotite/sequence/align/alignment.py +99 -90
  54. biotite/sequence/align/banded.cpython-311-darwin.so +0 -0
  55. biotite/sequence/align/buckets.py +12 -10
  56. biotite/sequence/align/cigar.py +43 -52
  57. biotite/sequence/align/kmeralphabet.cpython-311-darwin.so +0 -0
  58. biotite/sequence/align/kmeralphabet.pyx +55 -51
  59. biotite/sequence/align/kmersimilarity.cpython-311-darwin.so +0 -0
  60. biotite/sequence/align/kmertable.cpython-311-darwin.so +0 -0
  61. biotite/sequence/align/kmertable.pyx +3 -2
  62. biotite/sequence/align/localgapped.cpython-311-darwin.so +0 -0
  63. biotite/sequence/align/localungapped.cpython-311-darwin.so +0 -0
  64. biotite/sequence/align/matrix.py +81 -82
  65. biotite/sequence/align/multiple.cpython-311-darwin.so +0 -0
  66. biotite/sequence/align/multiple.pyx +1 -1
  67. biotite/sequence/align/pairwise.cpython-311-darwin.so +0 -0
  68. biotite/sequence/align/permutation.cpython-311-darwin.so +0 -0
  69. biotite/sequence/align/permutation.pyx +12 -4
  70. biotite/sequence/align/selector.cpython-311-darwin.so +0 -0
  71. biotite/sequence/align/selector.pyx +52 -54
  72. biotite/sequence/align/statistics.py +32 -33
  73. biotite/sequence/align/tracetable.cpython-311-darwin.so +0 -0
  74. biotite/sequence/alphabet.py +51 -65
  75. biotite/sequence/annotation.py +78 -77
  76. biotite/sequence/codec.cpython-311-darwin.so +0 -0
  77. biotite/sequence/codon.py +90 -79
  78. biotite/sequence/graphics/__init__.py +1 -1
  79. biotite/sequence/graphics/alignment.py +184 -103
  80. biotite/sequence/graphics/colorschemes.py +10 -12
  81. biotite/sequence/graphics/dendrogram.py +79 -34
  82. biotite/sequence/graphics/features.py +133 -99
  83. biotite/sequence/graphics/logo.py +22 -28
  84. biotite/sequence/graphics/plasmid.py +229 -178
  85. biotite/sequence/io/fasta/__init__.py +1 -1
  86. biotite/sequence/io/fasta/convert.py +44 -33
  87. biotite/sequence/io/fasta/file.py +42 -55
  88. biotite/sequence/io/fastq/__init__.py +1 -1
  89. biotite/sequence/io/fastq/convert.py +11 -14
  90. biotite/sequence/io/fastq/file.py +68 -112
  91. biotite/sequence/io/genbank/__init__.py +2 -2
  92. biotite/sequence/io/genbank/annotation.py +12 -20
  93. biotite/sequence/io/genbank/file.py +74 -76
  94. biotite/sequence/io/genbank/metadata.py +74 -62
  95. biotite/sequence/io/genbank/sequence.py +13 -14
  96. biotite/sequence/io/general.py +39 -30
  97. biotite/sequence/io/gff/__init__.py +2 -2
  98. biotite/sequence/io/gff/convert.py +10 -15
  99. biotite/sequence/io/gff/file.py +81 -65
  100. biotite/sequence/phylo/__init__.py +1 -1
  101. biotite/sequence/phylo/nj.cpython-311-darwin.so +0 -0
  102. biotite/sequence/phylo/tree.cpython-311-darwin.so +0 -0
  103. biotite/sequence/phylo/upgma.cpython-311-darwin.so +0 -0
  104. biotite/sequence/profile.py +57 -28
  105. biotite/sequence/search.py +17 -15
  106. biotite/sequence/seqtypes.py +200 -164
  107. biotite/sequence/sequence.py +15 -17
  108. biotite/structure/__init__.py +3 -3
  109. biotite/structure/atoms.py +221 -235
  110. biotite/structure/basepairs.py +260 -271
  111. biotite/structure/bonds.cpython-311-darwin.so +0 -0
  112. biotite/structure/bonds.pyx +29 -32
  113. biotite/structure/box.py +67 -71
  114. biotite/structure/celllist.cpython-311-darwin.so +0 -0
  115. biotite/structure/chains.py +55 -39
  116. biotite/structure/charges.cpython-311-darwin.so +0 -0
  117. biotite/structure/compare.py +32 -32
  118. biotite/structure/density.py +13 -18
  119. biotite/structure/dotbracket.py +20 -22
  120. biotite/structure/error.py +10 -2
  121. biotite/structure/filter.py +82 -77
  122. biotite/structure/geometry.py +130 -119
  123. biotite/structure/graphics/atoms.py +60 -43
  124. biotite/structure/graphics/rna.py +81 -68
  125. biotite/structure/hbond.py +112 -93
  126. biotite/structure/info/__init__.py +0 -2
  127. biotite/structure/info/atoms.py +10 -11
  128. biotite/structure/info/bonds.py +41 -43
  129. biotite/structure/info/ccd.py +4 -5
  130. biotite/structure/info/groups.py +1 -3
  131. biotite/structure/info/masses.py +5 -10
  132. biotite/structure/info/misc.py +1 -1
  133. biotite/structure/info/radii.py +20 -20
  134. biotite/structure/info/standardize.py +15 -26
  135. biotite/structure/integrity.py +18 -71
  136. biotite/structure/io/__init__.py +3 -4
  137. biotite/structure/io/dcd/__init__.py +1 -1
  138. biotite/structure/io/dcd/file.py +22 -20
  139. biotite/structure/io/general.py +47 -61
  140. biotite/structure/io/gro/__init__.py +1 -1
  141. biotite/structure/io/gro/file.py +73 -72
  142. biotite/structure/io/mol/__init__.py +1 -1
  143. biotite/structure/io/mol/convert.py +8 -11
  144. biotite/structure/io/mol/ctab.py +37 -36
  145. biotite/structure/io/mol/header.py +14 -10
  146. biotite/structure/io/mol/mol.py +9 -53
  147. biotite/structure/io/mol/sdf.py +47 -50
  148. biotite/structure/io/netcdf/__init__.py +1 -1
  149. biotite/structure/io/netcdf/file.py +24 -23
  150. biotite/structure/io/pdb/__init__.py +1 -1
  151. biotite/structure/io/pdb/convert.py +32 -20
  152. biotite/structure/io/pdb/file.py +151 -172
  153. biotite/structure/io/pdb/hybrid36.cpython-311-darwin.so +0 -0
  154. biotite/structure/io/pdbqt/__init__.py +1 -1
  155. biotite/structure/io/pdbqt/convert.py +17 -11
  156. biotite/structure/io/pdbqt/file.py +128 -80
  157. biotite/structure/io/pdbx/__init__.py +1 -2
  158. biotite/structure/io/pdbx/bcif.py +36 -44
  159. biotite/structure/io/pdbx/cif.py +64 -62
  160. biotite/structure/io/pdbx/component.py +10 -16
  161. biotite/structure/io/pdbx/convert.py +235 -246
  162. biotite/structure/io/pdbx/encoding.cpython-311-darwin.so +0 -0
  163. biotite/structure/io/trajfile.py +76 -93
  164. biotite/structure/io/trr/__init__.py +1 -1
  165. biotite/structure/io/trr/file.py +12 -15
  166. biotite/structure/io/xtc/__init__.py +1 -1
  167. biotite/structure/io/xtc/file.py +11 -14
  168. biotite/structure/mechanics.py +9 -11
  169. biotite/structure/molecules.py +3 -4
  170. biotite/structure/pseudoknots.py +53 -67
  171. biotite/structure/rdf.py +23 -21
  172. biotite/structure/repair.py +137 -86
  173. biotite/structure/residues.py +26 -16
  174. biotite/structure/sasa.cpython-311-darwin.so +0 -0
  175. biotite/structure/{resutil.py → segments.py} +24 -23
  176. biotite/structure/sequence.py +10 -11
  177. biotite/structure/sse.py +100 -119
  178. biotite/structure/superimpose.py +39 -77
  179. biotite/structure/transform.py +97 -71
  180. biotite/structure/util.py +11 -13
  181. biotite/version.py +2 -2
  182. biotite/visualize.py +69 -55
  183. {biotite-0.41.2.dist-info → biotite-1.0.0.dist-info}/METADATA +5 -5
  184. biotite-1.0.0.dist-info/RECORD +322 -0
  185. biotite/structure/io/ctab.py +0 -72
  186. biotite/structure/io/mmtf/__init__.py +0 -21
  187. biotite/structure/io/mmtf/assembly.py +0 -214
  188. biotite/structure/io/mmtf/convertarray.cpython-311-darwin.so +0 -0
  189. biotite/structure/io/mmtf/convertarray.pyx +0 -341
  190. biotite/structure/io/mmtf/convertfile.cpython-311-darwin.so +0 -0
  191. biotite/structure/io/mmtf/convertfile.pyx +0 -501
  192. biotite/structure/io/mmtf/decode.cpython-311-darwin.so +0 -0
  193. biotite/structure/io/mmtf/decode.pyx +0 -152
  194. biotite/structure/io/mmtf/encode.cpython-311-darwin.so +0 -0
  195. biotite/structure/io/mmtf/encode.pyx +0 -183
  196. biotite/structure/io/mmtf/file.py +0 -233
  197. biotite/structure/io/npz/__init__.py +0 -20
  198. biotite/structure/io/npz/file.py +0 -152
  199. biotite/structure/io/pdbx/legacy.py +0 -267
  200. biotite/structure/io/tng/__init__.py +0 -13
  201. biotite/structure/io/tng/file.py +0 -46
  202. biotite/temp.py +0 -86
  203. biotite-0.41.2.dist-info/RECORD +0 -340
  204. {biotite-0.41.2.dist-info → biotite-1.0.0.dist-info}/WHEEL +0 -0
  205. {biotite-0.41.2.dist-info → biotite-1.0.0.dist-info}/licenses/LICENSE.rst +0 -0
@@ -6,25 +6,22 @@ __name__ = "biotite.structure.io"
6
6
  __author__ = "Patrick Kunzmann"
7
7
  __all__ = ["TrajectoryFile"]
8
8
 
9
- import itertools
10
9
  import abc
10
+ import itertools
11
11
  import numpy as np
12
- from ..atoms import AtomArray, AtomArrayStack, stack, from_template
13
- from ...file import File
12
+ from biotite.file import File
13
+ from biotite.structure.atoms import AtomArray, AtomArrayStack, from_template
14
14
 
15
15
 
16
16
  class TrajectoryFile(File, metaclass=abc.ABCMeta):
17
17
  """
18
18
  This file class represents a trajectory file interfacing a
19
- trajectory file class from `MDtraj`.
20
-
19
+ trajectory file class from `biotraj`.
20
+
21
21
  A trajectory file stores atom coordinates over multiple (time)
22
22
  frames. The file formats are usually binary and involve sometimes
23
23
  heavy compression, so that a large number of frames can be stored
24
24
  in relatively small space.
25
- Since all :class:`TrajectoryFile` subclasses interface *MDtraj*
26
- trajectory file classes, `MDtraj` must be installed to use any of
27
- them.
28
25
 
29
26
  Notes
30
27
  -----
@@ -34,27 +31,27 @@ class TrajectoryFile(File, metaclass=abc.ABCMeta):
34
31
  Therefore, it is strongly recommended to make a copy of the
35
32
  respective array, if the array is modified.
36
33
  """
37
-
34
+
38
35
  def __init__(self):
39
36
  super().__init__()
40
37
  self._coord = None
41
38
  self._time = None
42
39
  self._box = None
43
40
  self._model_count = None
44
-
45
41
 
46
42
  @classmethod
47
- def read(cls, file_name, start=None, stop=None, step=None,
48
- atom_i=None, chunk_size=None):
43
+ def read(
44
+ cls, file_name, start=None, stop=None, step=None, atom_i=None, chunk_size=None
45
+ ):
49
46
  """
50
47
  Read a trajectory file.
51
-
48
+
52
49
  A trajectory file can be seen as a file representation of an
53
50
  :class:`AtomArrayStack`.
54
51
  Therefore, `start`, `stop` and `step` represent slice parameters
55
52
  of the index of the first dimension and
56
53
  `atom_i` represents an index array for the second dimension.
57
-
54
+
58
55
  Parameters
59
56
  ----------
60
57
  file_name : str
@@ -85,7 +82,7 @@ class TrajectoryFile(File, metaclass=abc.ABCMeta):
85
82
  Although lower values can decrease the memory consumption of
86
83
  reading trajectories, they also increase the computation
87
84
  time.
88
-
85
+
89
86
  Returns
90
87
  -------
91
88
  file_object : TrajectoryFile
@@ -105,7 +102,6 @@ class TrajectoryFile(File, metaclass=abc.ABCMeta):
105
102
 
106
103
  traj_type = cls.traj_type()
107
104
  with traj_type(file_name, "r") as f:
108
-
109
105
  if start is None:
110
106
  start = 0
111
107
  # Discard atoms before start
@@ -116,13 +112,13 @@ class TrajectoryFile(File, metaclass=abc.ABCMeta):
116
112
  TrajectoryFile._read_chunk_wise(
117
113
  f, start, None, atom_i, chunk_size, discard=True
118
114
  )
119
-
115
+
120
116
  # The upcoming frames are saved
121
117
  # Calculate the amount of frames to be read
122
118
  if stop is None:
123
119
  n_frames = None
124
120
  else:
125
- n_frames = stop-start
121
+ n_frames = stop - start
126
122
  if step is not None and n_frames is not None:
127
123
  # Divide number of frames by 'step' in order to convert
128
124
  # 'step' into 'stride'
@@ -130,7 +126,7 @@ class TrajectoryFile(File, metaclass=abc.ABCMeta):
130
126
  # the number of frames is decremented before division
131
127
  # and incremented afterwards again
132
128
  n_frames = ((n_frames - 1) // step) + 1
133
-
129
+
134
130
  # Read frames
135
131
  if chunk_size is None:
136
132
  result = f.read(n_frames, stride=step, atom_indices=atom_i)
@@ -138,7 +134,7 @@ class TrajectoryFile(File, metaclass=abc.ABCMeta):
138
134
  result = TrajectoryFile._read_chunk_wise(
139
135
  f, n_frames, step, atom_i, chunk_size, discard=False
140
136
  )
141
-
137
+
142
138
  # nm to Angstrom
143
139
  coord, box, time = cls.process_read_values(result)
144
140
  file.set_coord(coord)
@@ -146,15 +142,15 @@ class TrajectoryFile(File, metaclass=abc.ABCMeta):
146
142
  file.set_time(time)
147
143
 
148
144
  return file
149
-
150
145
 
151
146
  @classmethod
152
- def read_iter(cls, file_name, start=None, stop=None, step=None,
153
- atom_i=None, stack_size=None):
147
+ def read_iter(
148
+ cls, file_name, start=None, stop=None, step=None, atom_i=None, stack_size=None
149
+ ):
154
150
  """
155
151
  Create an iterator over each frame of the given trajectory file
156
152
  in the selected range.
157
-
153
+
158
154
  Parameters
159
155
  ----------
160
156
  file_name : str
@@ -181,7 +177,7 @@ class TrajectoryFile(File, metaclass=abc.ABCMeta):
181
177
  values.
182
178
  If the number of frames is not a multiple of `stack_size`,
183
179
  the final stack is smaller than `stack_size`.
184
-
180
+
185
181
  Yields
186
182
  ------
187
183
  coord : ndarray, dtype=float32, shape=(n,3) or shape=(m,n,3)
@@ -190,30 +186,29 @@ class TrajectoryFile(File, metaclass=abc.ABCMeta):
190
186
  The box vectors of the current frame or stack.
191
187
  time : float or ndarray, dtype=float32, shape=(n,) or None
192
188
  The simulation time of the current frame or stack in *ps*.
193
-
189
+
194
190
  See also
195
191
  --------
196
192
  read_iter_structure
197
-
193
+
198
194
  Notes
199
195
  -----
200
196
  The `step` parameter does currently not work for *DCD* files.
201
197
  """
202
198
  traj_type = cls.traj_type()
203
199
  with traj_type(file_name, "r") as f:
204
-
205
200
  if start is None:
206
201
  start = 0
207
202
  # Discard atoms before start
208
203
  if start != 0:
209
204
  f.read(n_frames=start, stride=None, atom_indices=atom_i)
210
-
205
+
211
206
  # The upcoming frames are read
212
207
  # Calculate the amount of frames to be read
213
208
  if stop is None:
214
209
  n_frames = None
215
210
  else:
216
- n_frames = stop-start
211
+ n_frames = stop - start
217
212
  if step is not None and n_frames is not None:
218
213
  # Divide number of frames by 'step' in order to convert
219
214
  # 'step' into 'stride'
@@ -221,7 +216,6 @@ class TrajectoryFile(File, metaclass=abc.ABCMeta):
221
216
  # the number of frames is decremented before division
222
217
  # and incremented afterwards again
223
218
  n_frames = ((n_frames - 1) // step) + 1
224
-
225
219
 
226
220
  # Read frames
227
221
  if stack_size is None:
@@ -242,7 +236,7 @@ class TrajectoryFile(File, metaclass=abc.ABCMeta):
242
236
  yield coord, box, time
243
237
  if remaining_frames is not None:
244
238
  remaining_frames -= 1
245
-
239
+
246
240
  else:
247
241
  remaining_frames = n_frames
248
242
  while remaining_frames is None or remaining_frames > 0:
@@ -260,11 +254,18 @@ class TrajectoryFile(File, metaclass=abc.ABCMeta):
260
254
  yield coord, box, time
261
255
  if remaining_frames is not None:
262
256
  remaining_frames -= stack_size
263
-
264
257
 
265
258
  @classmethod
266
- def read_iter_structure(cls, file_name, template, start=None, stop=None,
267
- step=None, atom_i=None, stack_size=None):
259
+ def read_iter_structure(
260
+ cls,
261
+ file_name,
262
+ template,
263
+ start=None,
264
+ stop=None,
265
+ step=None,
266
+ atom_i=None,
267
+ stack_size=None,
268
+ ):
268
269
  """
269
270
  Create an iterator over each frame of the given trajectory file
270
271
  in the selected range.
@@ -275,8 +276,8 @@ class TrajectoryFile(File, metaclass=abc.ABCMeta):
275
276
  information and no topology information, this method requires
276
277
  a template atom array or stack. This template can be acquired
277
278
  for example from a PDB file, which is associated with the
278
- trajectory file.
279
-
279
+ trajectory file.
280
+
280
281
  Parameters
281
282
  ----------
282
283
  file_name : str
@@ -306,18 +307,18 @@ class TrajectoryFile(File, metaclass=abc.ABCMeta):
306
307
  determined by this parameter.
307
308
  If the number of frames is not a multiple of `stack_size`,
308
309
  the final stack is smaller than `stack_size`.
309
-
310
+
310
311
  Yields
311
312
  ------
312
313
  structure : AtomArray or AtomArrayStack
313
314
  The structure of the current frame as :class:`AtomArray`.
314
315
  If `stack_size` is set, multiple frames are returned as
315
316
  :class:`AtomArrayStack`.
316
-
317
+
317
318
  See also
318
319
  --------
319
320
  read_iter
320
-
321
+
321
322
  Notes
322
323
  -----
323
324
  This iterator creates a new copy of the given template for every
@@ -335,7 +336,7 @@ class TrajectoryFile(File, metaclass=abc.ABCMeta):
335
336
  f"An 'AtomArray' or 'AtomArrayStack' is expected as template, "
336
337
  f"not '{type(template).__name__}'"
337
338
  )
338
-
339
+
339
340
  for coord, box, _ in cls.read_iter(
340
341
  file_name, start, stop, step, atom_i, stack_size
341
342
  ):
@@ -347,7 +348,6 @@ class TrajectoryFile(File, metaclass=abc.ABCMeta):
347
348
  else:
348
349
  yield from_template(template, coord, box)
349
350
 
350
-
351
351
  def write(self, file_name):
352
352
  """
353
353
  Write the content into a trajectory file.
@@ -360,9 +360,8 @@ class TrajectoryFile(File, metaclass=abc.ABCMeta):
360
360
  """
361
361
  traj_type = self.traj_type()
362
362
  param = self.prepare_write_values(self._coord, self._box, self._time)
363
- with traj_type(file_name, 'w') as f:
363
+ with traj_type(file_name, "w") as f:
364
364
  f.write(**param)
365
-
366
365
 
367
366
  @classmethod
368
367
  def write_iter(cls, file_name, coord, box=None, time=None):
@@ -376,7 +375,7 @@ class TrajectoryFile(File, metaclass=abc.ABCMeta):
376
375
  Hence, this class method may save a large amount of memory if
377
376
  a large file should be written, if `coord` are provided as
378
377
  generator.
379
-
378
+
380
379
  Parameters
381
380
  ----------
382
381
  file_name : str
@@ -391,7 +390,7 @@ class TrajectoryFile(File, metaclass=abc.ABCMeta):
391
390
 
392
391
  Notes
393
392
  -----
394
- The `time` parameter has no effect for *TNG* and *DCD* files.
393
+ The `time` parameter has no effect for *DCD* files.
395
394
  """
396
395
  if box is None:
397
396
  box = itertools.repeat(None)
@@ -399,7 +398,7 @@ class TrajectoryFile(File, metaclass=abc.ABCMeta):
399
398
  time = itertools.repeat(None)
400
399
 
401
400
  traj_type = cls.traj_type()
402
- with traj_type(file_name, 'w') as f:
401
+ with traj_type(file_name, "w") as f:
403
402
  for c, b, t in zip(coord, box, time):
404
403
  if c.ndim != 2:
405
404
  raise IndexError(
@@ -414,24 +413,22 @@ class TrajectoryFile(File, metaclass=abc.ABCMeta):
414
413
  t = np.expand_dims(t, axis=0)
415
414
  param = cls.prepare_write_values(c, b, t)
416
415
  f.write(**param)
417
-
418
416
 
419
417
  def get_coord(self):
420
418
  """
421
419
  Extract only the atom coordinates from the trajectory file.
422
-
420
+
423
421
  Returns
424
422
  -------
425
423
  coord : ndarray, dtype=float, shape=(m,n,3)
426
424
  The coordinates stored in the trajectory file.
427
425
  """
428
426
  return self._coord
429
-
430
427
 
431
428
  def get_time(self):
432
429
  """
433
430
  Get the simlation time in *ps* values for each frame.
434
-
431
+
435
432
  Returns
436
433
  -------
437
434
  time : ndarray, dtype=float, shape=(m,)
@@ -439,12 +436,11 @@ class TrajectoryFile(File, metaclass=abc.ABCMeta):
439
436
  frames, that were read from the file.
440
437
  """
441
438
  return self._time
442
-
443
439
 
444
440
  def get_box(self):
445
441
  """
446
442
  Get the box vectors for each frame.
447
-
443
+
448
444
  Returns
449
445
  -------
450
446
  box : ndarray, dtype=float, shape=(m,3,3)
@@ -452,12 +448,11 @@ class TrajectoryFile(File, metaclass=abc.ABCMeta):
452
448
  frames, that were read from the file.
453
449
  """
454
450
  return self._box
455
-
456
451
 
457
452
  def set_coord(self, coord):
458
453
  """
459
454
  Set the atom coordinates in the trajectory file.
460
-
455
+
461
456
  Parameters
462
457
  ----------
463
458
  coord : ndarray, dtype=float, shape=(m,n,3)
@@ -465,12 +460,11 @@ class TrajectoryFile(File, metaclass=abc.ABCMeta):
465
460
  """
466
461
  self._check_model_count(coord)
467
462
  self._coord = coord
468
-
469
463
 
470
464
  def set_time(self, time):
471
465
  """
472
466
  Set the simulation time of each frame in the trajectory file.
473
-
467
+
474
468
  Parameters
475
469
  ----------
476
470
  time : ndarray, dtype=float, shape=(m,)
@@ -478,13 +472,12 @@ class TrajectoryFile(File, metaclass=abc.ABCMeta):
478
472
  """
479
473
  self._check_model_count(time)
480
474
  self._time = time
481
-
482
475
 
483
476
  def set_box(self, box):
484
477
  """
485
478
  Set the periodic box vectors of each frame in the trajectory
486
479
  file.
487
-
480
+
488
481
  Parameters
489
482
  ----------
490
483
  time : ndarray, dtype=float, shape=(m,3,3)
@@ -492,25 +485,24 @@ class TrajectoryFile(File, metaclass=abc.ABCMeta):
492
485
  """
493
486
  self._check_model_count(box)
494
487
  self._box = box
495
-
496
488
 
497
489
  def get_structure(self, template):
498
490
  """
499
491
  Convert the trajectory file content into an
500
492
  :class:`AtomArrayStack`.
501
-
493
+
502
494
  Since trajectory files usually only contain atom coordinate
503
495
  information and no topology information, this method requires
504
496
  a template atom array or stack. This template can be acquired
505
497
  for example from a PDB file, which is associated with the
506
- trajectory file.
507
-
498
+ trajectory file.
499
+
508
500
  Parameters
509
501
  ----------
510
502
  template : AtomArray or AtomArrayStack
511
503
  The template array or stack, where the atom annotation data
512
504
  is taken from.
513
-
505
+
514
506
  Returns
515
507
  -------
516
508
  array_stack : AtomArrayStack
@@ -519,15 +511,14 @@ class TrajectoryFile(File, metaclass=abc.ABCMeta):
519
511
  trajectory file.
520
512
  """
521
513
  return from_template(template, self.get_coord(), self.get_box())
522
-
523
514
 
524
515
  def set_structure(self, structure, time=None):
525
516
  """
526
517
  Write an atom array (stack) into the trajectory file object.
527
-
518
+
528
519
  The topology information (chain, residue, etc.) is not saved in
529
520
  the file.
530
-
521
+
531
522
  Parameters
532
523
  ----------
533
524
  structure : AtomArray or AtomArrayStack
@@ -547,51 +538,47 @@ class TrajectoryFile(File, metaclass=abc.ABCMeta):
547
538
  if time is not None:
548
539
  self.set_time(time)
549
540
 
550
-
551
541
  def copy(self):
552
542
  """
553
543
  This operation is not implemented for trajectory files.
554
-
544
+
555
545
  Raises
556
546
  ------
557
547
  NotImplementedError
558
548
  """
559
- raise NotImplementedError("Copying is not implemented "
560
- "for trajectory files")
561
-
549
+ raise NotImplementedError("Copying is not implemented " "for trajectory files")
562
550
 
563
551
  @classmethod
564
552
  @abc.abstractmethod
565
553
  def traj_type(cls):
566
554
  """
567
- The `MDtraj` files class to be used.
568
-
555
+ The ``biotraj`` files class to be used.
556
+
569
557
  PROTECTED: Override when inheriting.
570
-
558
+
571
559
  Returns
572
560
  -------
573
561
  class
574
- An `MDtraj` subclass of :class:`TrajectoryFile`.
562
+ An ``biotraj`` subclass of :class:`TrajectoryFile`.
575
563
  """
576
564
  pass
577
-
578
565
 
579
566
  @classmethod
580
567
  @abc.abstractmethod
581
568
  def process_read_values(cls, read_values):
582
569
  """
583
570
  Convert the return value of the `read()` method of the
584
- respective :class:`mdtraj.TrajectoryFile` into coordinates,
571
+ respective :class:`biotraj.TrajectoryFile` into coordinates,
585
572
  simulation box and simulation time.
586
-
573
+
587
574
  PROTECTED: Override when inheriting.
588
-
575
+
589
576
  Parameters
590
577
  ----------
591
578
  read_values : tuple
592
579
  The return value of the respective
593
- :func:`mdtraj.TrajectoryFile.read()` method.
594
-
580
+ :func:`biotraj.TrajectoryFile.read()` method.
581
+
595
582
  Returns
596
583
  -------
597
584
  coord : ndarray, dtype=float, shape=(m,n,3)
@@ -602,7 +589,6 @@ class TrajectoryFile(File, metaclass=abc.ABCMeta):
602
589
  The simulation time in ps for each frame.
603
590
  """
604
591
  pass
605
-
606
592
 
607
593
  @classmethod
608
594
  @abc.abstractmethod
@@ -610,7 +596,7 @@ class TrajectoryFile(File, metaclass=abc.ABCMeta):
610
596
  """
611
597
  Convert the `coord`, `box` and `time` attribute into a
612
598
  dictionary that is given as *kwargs* to the respective
613
- :func:`mdtraj.TrajectoryFile.write()` method.
599
+ :func:`biotraj.TrajectoryFile.write()` method.
614
600
 
615
601
  PROTECTED: Override when inheriting.
616
602
 
@@ -622,16 +608,15 @@ class TrajectoryFile(File, metaclass=abc.ABCMeta):
622
608
  The box vectors in Å for each frame.
623
609
  time : ndarray, dtype=float, shape=(m,)
624
610
  The simulation time in ps for each frame.
625
-
611
+
626
612
  Returns
627
613
  -------
628
614
  parameters : dict
629
615
  This dictionary is given as *kwargs* parameter to the
630
- respective :func:`mdtraj.TrajectoryFile.write()` method.
616
+ respective :func:`biotraj.TrajectoryFile.write()` method.
631
617
  """
632
618
  pass
633
619
 
634
-
635
620
  def _check_model_count(self, array):
636
621
  """
637
622
  Check if the amount of models in the given array is equal to
@@ -650,11 +635,9 @@ class TrajectoryFile(File, metaclass=abc.ABCMeta):
650
635
  f"{len(array)} models were given, "
651
636
  f"but the file contains {self._model_count} models"
652
637
  )
653
-
654
638
 
655
639
  @staticmethod
656
- def _read_chunk_wise(file, n_frames, step, atom_i, chunk_size,
657
- discard=False):
640
+ def _read_chunk_wise(file, n_frames, step, atom_i, chunk_size, discard=False):
658
641
  """
659
642
  Similar to :func:`read()`, just for chunk-wise reading of the
660
643
  trajectory.
@@ -674,7 +657,7 @@ class TrajectoryFile(File, metaclass=abc.ABCMeta):
674
657
  try:
675
658
  chunk = file.read(n_frames=n, stride=step, atom_indices=atom_i)
676
659
  except ValueError as e:
677
- # MDTraj raises exception because no coordinates can be
660
+ # biotraj raises exception because no coordinates can be
678
661
  # concatenated
679
662
  # -> all frames have been read
680
663
  # -> stop reading chunks
@@ -691,7 +674,7 @@ class TrajectoryFile(File, metaclass=abc.ABCMeta):
691
674
  chunks.append(chunk)
692
675
  if remaining_frames is not None:
693
676
  remaining_frames -= n
694
-
677
+
695
678
  if not discard:
696
679
  # Assemble the chunks into contiguous arrays
697
680
  # for each value (coord, box, time)
@@ -707,4 +690,4 @@ class TrajectoryFile(File, metaclass=abc.ABCMeta):
707
690
  result[i] = None
708
691
  return tuple(result)
709
692
  else:
710
- return None
693
+ return None
@@ -10,4 +10,4 @@ uncompressed *Gromacs* TRR format.
10
10
  __name__ = "biotite.structure.io.trr"
11
11
  __author__ = "Patrick Kunzmann"
12
12
 
13
- from .file import *
13
+ from .file import *
@@ -6,20 +6,20 @@ __name__ = "biotite.structure.io.trr"
6
6
  __author__ = "Patrick Kunzmann"
7
7
  __all__ = ["TRRFile"]
8
8
 
9
+ import biotraj
9
10
  import numpy as np
10
- from ..trajfile import TrajectoryFile
11
+ from biotite.structure.io.trajfile import TrajectoryFile
11
12
 
12
13
 
13
14
  class TRRFile(TrajectoryFile):
14
15
  """
15
16
  This file class represents a TRR trajectory file.
16
17
  """
17
-
18
+
18
19
  @classmethod
19
20
  def traj_type(cls):
20
- import mdtraj.formats as traj
21
- return traj.TRRTrajectoryFile
22
-
21
+ return biotraj.TRRTrajectoryFile
22
+
23
23
  @classmethod
24
24
  def process_read_values(cls, read_values):
25
25
  # nm to Angstrom
@@ -29,18 +29,15 @@ class TRRFile(TrajectoryFile):
29
29
  box *= 10
30
30
  time = read_values[1]
31
31
  return coord, box, time
32
-
32
+
33
33
  @classmethod
34
34
  def prepare_write_values(cls, coord, box, time):
35
35
  # Angstrom to nm
36
- xyz = np.divide(coord, 10, dtype=np.float32) \
37
- if coord is not None else None
38
- time = time.astype(np.float32, copy=False) \
39
- if time is not None else None
40
- box = np.divide(box, 10, dtype=np.float32) \
41
- if box is not None else None
36
+ xyz = np.divide(coord, 10, dtype=np.float32) if coord is not None else None
37
+ time = time.astype(np.float32, copy=False) if time is not None else None
38
+ box = np.divide(box, 10, dtype=np.float32) if box is not None else None
42
39
  return {
43
- "xyz" : xyz,
44
- "box" : box,
45
- "time" : time,
40
+ "xyz": xyz,
41
+ "box": box,
42
+ "time": time,
46
43
  }
@@ -10,4 +10,4 @@ compressed *Gromacs* XTC format.
10
10
  __name__ = "biotite.structure.io.xtc"
11
11
  __author__ = "Patrick Kunzmann"
12
12
 
13
- from .file import *
13
+ from .file import *
@@ -6,19 +6,19 @@ __name__ = "biotite.structure.io.xtc"
6
6
  __author__ = "Patrick Kunzmann"
7
7
  __all__ = ["XTCFile"]
8
8
 
9
+ import biotraj
9
10
  import numpy as np
10
- from ..trajfile import TrajectoryFile
11
+ from biotite.structure.io.trajfile import TrajectoryFile
11
12
 
12
13
 
13
14
  class XTCFile(TrajectoryFile):
14
15
  """
15
16
  This file class represents a XTC trajectory file.
16
17
  """
17
-
18
+
18
19
  @classmethod
19
20
  def traj_type(cls):
20
- import mdtraj.formats as traj
21
- return traj.XTCTrajectoryFile
21
+ return biotraj.XTCTrajectoryFile
22
22
 
23
23
  @classmethod
24
24
  def process_read_values(cls, read_values):
@@ -29,18 +29,15 @@ class XTCFile(TrajectoryFile):
29
29
  box *= 10
30
30
  time = read_values[1]
31
31
  return coord, box, time
32
-
32
+
33
33
  @classmethod
34
34
  def prepare_write_values(cls, coord, box, time):
35
35
  # Angstrom to nm
36
- xyz = np.divide(coord, 10, dtype=np.float32) \
37
- if coord is not None else None
38
- time = time.astype(np.float32, copy=False) \
39
- if time is not None else None
40
- box = np.divide(box, 10, dtype=np.float32) \
41
- if box is not None else None
36
+ xyz = np.divide(coord, 10, dtype=np.float32) if coord is not None else None
37
+ time = time.astype(np.float32, copy=False) if time is not None else None
38
+ box = np.divide(box, 10, dtype=np.float32) if box is not None else None
42
39
  return {
43
- "xyz" : xyz,
44
- "box" : box,
45
- "time" : time,
40
+ "xyz": xyz,
41
+ "box": box,
42
+ "time": time,
46
43
  }