biotite 0.41.2__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.

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.cp312-win_amd64.pyd +0 -0
  55. biotite/sequence/align/buckets.py +12 -10
  56. biotite/sequence/align/cigar.py +43 -52
  57. biotite/sequence/align/kmeralphabet.cp312-win_amd64.pyd +0 -0
  58. biotite/sequence/align/kmeralphabet.pyx +55 -51
  59. biotite/sequence/align/kmersimilarity.cp312-win_amd64.pyd +0 -0
  60. biotite/sequence/align/kmertable.cp312-win_amd64.pyd +0 -0
  61. biotite/sequence/align/kmertable.pyx +3 -2
  62. biotite/sequence/align/localgapped.cp312-win_amd64.pyd +0 -0
  63. biotite/sequence/align/localungapped.cp312-win_amd64.pyd +0 -0
  64. biotite/sequence/align/matrix.py +81 -82
  65. biotite/sequence/align/multiple.cp312-win_amd64.pyd +0 -0
  66. biotite/sequence/align/multiple.pyx +1 -1
  67. biotite/sequence/align/pairwise.cp312-win_amd64.pyd +0 -0
  68. biotite/sequence/align/permutation.cp312-win_amd64.pyd +0 -0
  69. biotite/sequence/align/permutation.pyx +12 -4
  70. biotite/sequence/align/selector.cp312-win_amd64.pyd +0 -0
  71. biotite/sequence/align/selector.pyx +52 -54
  72. biotite/sequence/align/statistics.py +32 -33
  73. biotite/sequence/align/tracetable.cp312-win_amd64.pyd +0 -0
  74. biotite/sequence/alphabet.py +51 -65
  75. biotite/sequence/annotation.py +78 -77
  76. biotite/sequence/codec.cp312-win_amd64.pyd +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.cp312-win_amd64.pyd +0 -0
  102. biotite/sequence/phylo/tree.cp312-win_amd64.pyd +0 -0
  103. biotite/sequence/phylo/upgma.cp312-win_amd64.pyd +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.cp312-win_amd64.pyd +0 -0
  112. biotite/structure/bonds.pyx +29 -32
  113. biotite/structure/box.py +67 -71
  114. biotite/structure/celllist.cp312-win_amd64.pyd +0 -0
  115. biotite/structure/chains.py +55 -39
  116. biotite/structure/charges.cp312-win_amd64.pyd +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.cp312-win_amd64.pyd +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.cp312-win_amd64.pyd +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.cp312-win_amd64.pyd +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.cp312-win_amd64.pyd +0 -0
  189. biotite/structure/io/mmtf/convertarray.pyx +0 -341
  190. biotite/structure/io/mmtf/convertfile.cp312-win_amd64.pyd +0 -0
  191. biotite/structure/io/mmtf/convertfile.pyx +0 -501
  192. biotite/structure/io/mmtf/decode.cp312-win_amd64.pyd +0 -0
  193. biotite/structure/io/mmtf/decode.pyx +0 -152
  194. biotite/structure/io/mmtf/encode.cp312-win_amd64.pyd +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,11 +6,13 @@ __name__ = "biotite.structure.io.mol"
6
6
  __author__ = "Patrick Kunzmann"
7
7
  __all__ = ["MOLFile"]
8
8
 
9
- from ....file import TextFile, InvalidFileError
10
- from .ctab import read_structure_from_ctab, write_structure_to_ctab
11
- from .header import Header
12
- from ...bonds import BondType
13
-
9
+ from biotite.file import InvalidFileError, TextFile
10
+ from biotite.structure.bonds import BondType
11
+ from biotite.structure.io.mol.ctab import (
12
+ read_structure_from_ctab,
13
+ write_structure_to_ctab,
14
+ )
15
+ from biotite.structure.io.mol.header import Header
14
16
 
15
17
  # Number of header lines
16
18
  N_HEADER = 3
@@ -80,66 +82,23 @@ class MOLFile(TextFile):
80
82
  self.lines = [""] * N_HEADER
81
83
  self._header = None
82
84
 
83
-
84
85
  @classmethod
85
86
  def read(cls, file):
86
87
  mol_file = super().read(file)
87
88
  mol_file._header = None
88
89
  return mol_file
89
90
 
90
-
91
91
  @property
92
92
  def header(self):
93
93
  if self._header is None:
94
94
  self._header = Header.deserialize("\n".join(self.lines[0:3]) + "\n")
95
95
  return self._header
96
96
 
97
-
98
97
  @header.setter
99
98
  def header(self, header):
100
99
  self._header = header
101
100
  self.lines[0:3] = self._header.serialize().splitlines()
102
101
 
103
-
104
- def get_header(self):
105
- """
106
- Get the header from the MOL file.
107
-
108
- DEPRECATED: Use the :attr:`header` property instead.
109
-
110
- Returns
111
- -------
112
- header_attributes
113
- See :class:`Header`.
114
- """
115
- header = self.header
116
- return (
117
- header.mol_name,
118
- header.initials,
119
- header.program,
120
- header.time,
121
- header.dimensions,
122
- header.scaling_factors,
123
- header.energy,
124
- header.registry_number,
125
- header.comments
126
- )
127
-
128
-
129
- def set_header(self, *args, **kwargs):
130
- """
131
- Set the header for the MOL file.
132
-
133
- DEPRECATED: Use the :attr:`header` property instead.
134
-
135
- Parameters
136
- ----------
137
- **args, **kwars
138
- See :class:`Header`.
139
- """
140
- self.header = Header(*args, **kwargs)
141
-
142
-
143
102
  def get_structure(self):
144
103
  """
145
104
  Get an :class:`AtomArray` from the MOL file.
@@ -157,9 +116,7 @@ class MOLFile(TextFile):
157
116
  raise InvalidFileError("File does not contain structure data")
158
117
  return read_structure_from_ctab(ctab_lines)
159
118
 
160
-
161
- def set_structure(self, atoms, default_bond_type=BondType.ANY,
162
- version=None):
119
+ def set_structure(self, atoms, default_bond_type=BondType.ANY, version=None):
163
120
  """
164
121
  Set the :class:`AtomArray` for the file.
165
122
 
@@ -185,9 +142,8 @@ class MOLFile(TextFile):
185
142
  )
186
143
 
187
144
 
188
-
189
145
  def _get_ctab_lines(lines):
190
146
  for i, line in enumerate(lines):
191
147
  if line.startswith("M END"):
192
- return lines[N_HEADER:i+1]
148
+ return lines[N_HEADER : i + 1]
193
149
  return lines[N_HEADER:]
@@ -8,16 +8,24 @@ __all__ = ["SDFile", "SDRecord", "Metadata"]
8
8
 
9
9
  import re
10
10
  import warnings
11
+ from collections.abc import Mapping, MutableMapping
11
12
  from dataclasses import dataclass
12
- from collections.abc import MutableMapping, Mapping
13
13
  import numpy as np
14
- from ....file import File, InvalidFileError, is_open_compatible, is_text, \
15
- DeserializationError, SerializationError
16
- from .ctab import read_structure_from_ctab, write_structure_to_ctab
17
- from .header import Header
18
- from ...atoms import AtomArray
19
- from ...bonds import BondList, BondType
20
-
14
+ from biotite.file import (
15
+ DeserializationError,
16
+ File,
17
+ InvalidFileError,
18
+ SerializationError,
19
+ is_open_compatible,
20
+ is_text,
21
+ )
22
+ from biotite.structure.atoms import AtomArray
23
+ from biotite.structure.bonds import BondList, BondType
24
+ from biotite.structure.io.mol.ctab import (
25
+ read_structure_from_ctab,
26
+ write_structure_to_ctab,
27
+ )
28
+ from biotite.structure.io.mol.header import Header
21
29
 
22
30
  _N_HEADER = 3
23
31
  # Number of header lines
@@ -96,6 +104,7 @@ class Metadata(MutableMapping):
96
104
  number, name, registry_internal, registry_external
97
105
  The same as the parameters.
98
106
  """
107
+
99
108
  # The characters that can be given as input to `name`
100
109
  # First character must be alphanumeric,
101
110
  # following characters may include underscores and periods
@@ -103,7 +112,7 @@ class Metadata(MutableMapping):
103
112
  # they are still used in practice and therefore allowed here
104
113
  _NAME_INPUT_REGEX = re.compile(r"^[a-zA-Z0-9][\w.]*$")
105
114
  # These regexes are used to parse the key from a line
106
- _COMPONENT_REGEX = {
115
+ _COMPONENT_REGEX = {
107
116
  "number": re.compile(r"^DT(\d+)$"),
108
117
  "name": re.compile(r"^<([a-zA-Z0-9][\w.]*)>$"),
109
118
  "registry_internal": re.compile(r"^(\d+)$"),
@@ -162,9 +171,7 @@ class Metadata(MutableMapping):
162
171
  break
163
172
  else:
164
173
  # There is no matching pattern
165
- raise DeserializationError(
166
- f"Invalid key component '{component}'"
167
- )
174
+ raise DeserializationError(f"Invalid key component '{component}'")
168
175
  return Metadata.Key(**parsed_component_dict)
169
176
 
170
177
  def serialize(self):
@@ -190,7 +197,6 @@ class Metadata(MutableMapping):
190
197
  def __str__(self):
191
198
  return self.serialize()
192
199
 
193
-
194
200
  def __init__(self, metadata=None):
195
201
  if metadata is None:
196
202
  metadata = {}
@@ -222,9 +228,7 @@ class Metadata(MutableMapping):
222
228
  current_value = None
223
229
  else:
224
230
  if current_key is None:
225
- raise DeserializationError(
226
- "Value found before metadata key"
227
- )
231
+ raise DeserializationError("Value found before metadata key")
228
232
  if current_value is None:
229
233
  current_value = line
230
234
  else:
@@ -388,7 +392,7 @@ class SDRecord:
388
392
  if isinstance(self._header, str):
389
393
  try:
390
394
  self._header = Header.deserialize(self._header)
391
- except:
395
+ except Exception:
392
396
  raise DeserializationError("Failed to deserialize header")
393
397
  return self._header
394
398
 
@@ -406,7 +410,7 @@ class SDRecord:
406
410
  if isinstance(self._metadata, str):
407
411
  try:
408
412
  self._metadata = Metadata.deserialize(self._metadata)
409
- except:
413
+ except Exception:
410
414
  raise DeserializationError("Failed to deserialize metadata")
411
415
  return self._metadata
412
416
 
@@ -483,8 +487,7 @@ class SDRecord:
483
487
  raise InvalidFileError("File does not contain structure data")
484
488
  return read_structure_from_ctab(ctab_lines)
485
489
 
486
- def set_structure(self, atoms, default_bond_type=BondType.ANY,
487
- version=None):
490
+ def set_structure(self, atoms, default_bond_type=BondType.ANY, version=None):
488
491
  """
489
492
  Set the structural data in the SD record.
490
493
 
@@ -505,9 +508,9 @@ class SDRecord:
505
508
  By default, ``"V2000"`` is used, unless the number of atoms
506
509
  or bonds exceeds 999, in which case ``"V3000"`` is used.
507
510
  """
508
- self._ctab = _join_with_terminal_newline(write_structure_to_ctab(
509
- atoms, default_bond_type, version
510
- ))
511
+ self._ctab = _join_with_terminal_newline(
512
+ write_structure_to_ctab(atoms, default_bond_type, version)
513
+ )
511
514
 
512
515
  def __eq__(self, other):
513
516
  if not isinstance(other, type(self)):
@@ -736,28 +739,29 @@ class SDFile(File, MutableMapping):
736
739
  The content to be deserialized.
737
740
  """
738
741
  lines = text.splitlines()
739
- record_ends = np.array([
740
- i for i, line in enumerate(lines)
741
- if line.startswith(_RECORD_DELIMITER)
742
- ], dtype=int)
742
+ record_ends = np.array(
743
+ [i for i, line in enumerate(lines) if line.startswith(_RECORD_DELIMITER)],
744
+ dtype=int,
745
+ )
743
746
  if len(record_ends) == 0:
744
747
  warnings.warn(
745
748
  "Final record delimiter missing, "
746
749
  "maybe this is a MOL file instead of a SD file"
747
750
  )
748
- record_ends = np.array([len(lines)-1], dtype=int)
751
+ record_ends = np.array([len(lines) - 1], dtype=int)
749
752
  # The first record starts at the first line and the last
750
753
  # delimiter is at the end of the file
751
754
  # Records in the middle start directly after the delimiter
752
755
  record_starts = np.concatenate(([0], record_ends[:-1] + 1), dtype=int)
753
756
  record_names = [lines[start].strip() for start in record_starts]
754
- return SDFile({
755
- # Do not include the delimiter
756
- # -> stop at end (instead of end + 1)
757
- name: _join_with_terminal_newline(lines[start : end])
758
- for name, start, end
759
- in zip(record_names, record_starts, record_ends)
760
- })
757
+ return SDFile(
758
+ {
759
+ # Do not include the delimiter
760
+ # -> stop at end (instead of end + 1)
761
+ name: _join_with_terminal_newline(lines[start:end])
762
+ for name, start, end in zip(record_names, record_starts, record_ends)
763
+ }
764
+ )
761
765
 
762
766
  def serialize(self):
763
767
  """
@@ -776,7 +780,7 @@ class SDFile(File, MutableMapping):
776
780
  else:
777
781
  try:
778
782
  text_blocks.append(record.serialize())
779
- except:
783
+ except Exception:
780
784
  raise SerializationError(
781
785
  f"Failed to serialize record '{record_name}'"
782
786
  )
@@ -835,19 +839,15 @@ class SDFile(File, MutableMapping):
835
839
  # -> must be deserialized first
836
840
  try:
837
841
  record = SDRecord.deserialize(record)
838
- except:
839
- raise DeserializationError(
840
- f"Failed to deserialize record '{key}'"
841
- )
842
+ except Exception:
843
+ raise DeserializationError(f"Failed to deserialize record '{key}'")
842
844
  # Update with deserialized object
843
845
  self._records[key] = record
844
846
  return record
845
847
 
846
848
  def __setitem__(self, key, record):
847
849
  if not isinstance(record, SDRecord):
848
- raise TypeError(
849
- f"Expected 'SDRecord', but got '{type(record).__name__}'"
850
- )
850
+ raise TypeError(f"Expected 'SDRecord', but got '{type(record).__name__}'")
851
851
  # The molecule name in the header is unique across the file
852
852
  record.header.mol_name = key
853
853
  self._records[key] = record
@@ -895,22 +895,19 @@ def _to_metadata_key(key):
895
895
  return Metadata.Key(name=key)
896
896
  else:
897
897
  raise TypeError(
898
- "Expected 'Metadata.Key' or str, "
899
- f"but got '{type(key).__name__}'"
898
+ "Expected 'Metadata.Key' or str, " f"but got '{type(key).__name__}'"
900
899
  )
901
900
 
902
901
 
903
902
  def _add_key_value_pair(metadata, key, value):
904
903
  if key is not None:
905
904
  if value is None:
906
- raise DeserializationError(
907
- f"No value found for metadata key {key}"
908
- )
905
+ raise DeserializationError(f"No value found for metadata key {key}")
909
906
  metadata[key] = value
910
907
 
911
908
 
912
909
  def _get_ctab_stop(lines):
913
910
  for i in range(_N_HEADER, len(lines)):
914
911
  if lines[i].startswith("M END"):
915
- return i+1
916
- return len(lines)
912
+ return i + 1
913
+ return len(lines)
@@ -10,4 +10,4 @@ This subpackage is used for reading and writing trajectories in the
10
10
  __name__ = "biotite.structure.io.netcdf"
11
11
  __author__ = "Patrick Kunzmann"
12
12
 
13
- from .file import *
13
+ from .file import *
@@ -6,21 +6,21 @@ __name__ = "biotite.structure.io.netcdf"
6
6
  __author__ = "Patrick Kunzmann"
7
7
  __all__ = ["NetCDFFile"]
8
8
 
9
+ import biotraj
9
10
  import numpy as np
10
- from ..trajfile import TrajectoryFile
11
- from ...box import vectors_from_unitcell, unitcell_from_vectors
11
+ from biotite.structure.box import unitcell_from_vectors, vectors_from_unitcell
12
+ from biotite.structure.io.trajfile import TrajectoryFile
12
13
 
13
14
 
14
15
  class NetCDFFile(TrajectoryFile):
15
16
  """
16
17
  This file class represents a NetCDF trajectory file.
17
18
  """
18
-
19
+
19
20
  @classmethod
20
21
  def traj_type(cls):
21
- import mdtraj.formats as traj
22
- return traj.NetCDFTrajectoryFile
23
-
22
+ return biotraj.NetCDFTrajectoryFile
23
+
24
24
  @classmethod
25
25
  def process_read_values(cls, read_values):
26
26
  # .dcd files use Angstrom
@@ -29,35 +29,36 @@ class NetCDFFile(TrajectoryFile):
29
29
  cell_lengths = read_values[2]
30
30
  cell_angles = read_values[3]
31
31
  if cell_lengths is None or cell_angles is None:
32
- box = None
32
+ box = None
33
33
  else:
34
34
  box = np.stack(
35
- [vectors_from_unitcell(a, b, c, alpha, beta, gamma)
36
- for (a, b, c), (alpha, beta, gamma)
37
- in zip(cell_lengths, np.deg2rad(cell_angles))],
38
- axis=0
35
+ [
36
+ vectors_from_unitcell(a, b, c, alpha, beta, gamma)
37
+ for (a, b, c), (alpha, beta, gamma) in zip(
38
+ cell_lengths, np.deg2rad(cell_angles)
39
+ )
40
+ ],
41
+ axis=0,
39
42
  )
40
43
  return coord, box, time
41
-
44
+
42
45
  @classmethod
43
46
  def prepare_write_values(cls, coord, box, time):
44
- coord = coord.astype(np.float32, copy=False) \
45
- if coord is not None else None
46
- time = time.astype(np.float32, copy=False) \
47
- if time is not None else None
47
+ coord = coord.astype(np.float32, copy=False) if coord is not None else None
48
+ time = time.astype(np.float32, copy=False) if time is not None else None
48
49
  if box is None:
49
50
  cell_lengths = None
50
- cell_angles = None
51
+ cell_angles = None
51
52
  else:
52
53
  cell_lengths = np.zeros((len(box), 3), dtype=np.float32)
53
- cell_angles = np.zeros((len(box), 3), dtype=np.float32)
54
+ cell_angles = np.zeros((len(box), 3), dtype=np.float32)
54
55
  for i, model_box in enumerate(box):
55
56
  a, b, c, alpha, beta, gamma = unitcell_from_vectors(model_box)
56
57
  cell_lengths[i] = np.array((a, b, c))
57
58
  cell_angles[i] = np.rad2deg((alpha, beta, gamma))
58
59
  return {
59
- "coordinates" : coord,
60
- "time" : time,
61
- "cell_lengths" : cell_lengths,
62
- "cell_angles" : cell_angles,
63
- }
60
+ "coordinates": coord,
61
+ "time": time,
62
+ "cell_lengths": cell_lengths,
63
+ "cell_angles": cell_angles,
64
+ }
@@ -16,5 +16,5 @@ In all other cases, usage of the :mod:`pdbx` subpackage is encouraged.
16
16
  __name__ = "biotite.structure.io.pdb"
17
17
  __author__ = "Patrick Kunzmann"
18
18
 
19
+ from .convert import *
19
20
  from .file import *
20
- from .convert import *
@@ -9,8 +9,14 @@ subpackages.
9
9
 
10
10
  __name__ = "biotite.structure.io.pdb"
11
11
  __author__ = "Patrick Kunzmann"
12
- __all__ = ["get_model_count", "get_structure", "set_structure",
13
- "list_assemblies", "get_assembly", "get_symmetry_mates"]
12
+ __all__ = [
13
+ "get_model_count",
14
+ "get_structure",
15
+ "set_structure",
16
+ "list_assemblies",
17
+ "get_assembly",
18
+ "get_symmetry_mates",
19
+ ]
14
20
 
15
21
 
16
22
  def get_model_count(pdb_file):
@@ -30,8 +36,9 @@ def get_model_count(pdb_file):
30
36
  return pdb_file.get_model_count()
31
37
 
32
38
 
33
- def get_structure(pdb_file, model=None, altloc="first", extra_fields=[],
34
- include_bonds=False):
39
+ def get_structure(
40
+ pdb_file, model=None, altloc="first", extra_fields=[], include_bonds=False
41
+ ):
35
42
  """
36
43
  Create an :class:`AtomArray` or :class:`AtomArrayStack` from a
37
44
  :class:`PDBFile`.
@@ -39,7 +46,7 @@ def get_structure(pdb_file, model=None, altloc="first", extra_fields=[],
39
46
  This function is a thin wrapper around the :class:`PDBFile` method
40
47
  :func:`get_structure()` for the sake of consistency with other
41
48
  ``structure.io`` subpackages.
42
-
49
+
43
50
  Parameters
44
51
  ----------
45
52
  pdb_file : PDBFile
@@ -77,12 +84,12 @@ def get_structure(pdb_file, model=None, altloc="first", extra_fields=[],
77
84
  (e.g. especially inter-residue bonds),
78
85
  have :attr:`BondType.ANY`, since the PDB format itself does
79
86
  not support bond orders.
80
-
87
+
81
88
  Returns
82
89
  -------
83
90
  array : AtomArray or AtomArrayStack
84
91
  The return type depends on the `model` parameter.
85
-
92
+
86
93
  """
87
94
  return pdb_file.get_structure(model, altloc, extra_fields, include_bonds)
88
95
 
@@ -95,11 +102,11 @@ def set_structure(pdb_file, array, hybrid36=False):
95
102
  This function is a thin wrapper around the :class:`PDBFile` method
96
103
  :func:`set_structure()` for the sake of consistency with other
97
104
  ``structure.io`` subpackages.
98
-
105
+
99
106
  This will save the coordinates, the mandatory annotation categories
100
107
  and the optional annotation categories
101
108
  'atom_id', 'b_factor', 'occupancy' and 'charge'.
102
-
109
+
103
110
  Parameters
104
111
  ----------
105
112
  pdb_file : PDBFile
@@ -137,7 +144,7 @@ def list_assemblies(pdb_file):
137
144
  -------
138
145
  assemblies : list of str
139
146
  A list that contains the available assembly IDs.
140
-
147
+
141
148
  Examples
142
149
  --------
143
150
  >>> import os.path
@@ -148,8 +155,14 @@ def list_assemblies(pdb_file):
148
155
  return pdb_file.list_assemblies()
149
156
 
150
157
 
151
- def get_assembly(pdb_file, assembly_id=None, model=None, altloc="first",
152
- extra_fields=[], include_bonds=False):
158
+ def get_assembly(
159
+ pdb_file,
160
+ assembly_id=None,
161
+ model=None,
162
+ altloc="first",
163
+ extra_fields=[],
164
+ include_bonds=False,
165
+ ):
153
166
  """
154
167
  Build the given biological assembly.
155
168
 
@@ -205,7 +218,7 @@ def get_assembly(pdb_file, assembly_id=None, model=None, altloc="first",
205
218
  assembly : AtomArray or AtomArrayStack
206
219
  The assembly.
207
220
  The return type depends on the `model` parameter.
208
-
221
+
209
222
  Examples
210
223
  --------
211
224
 
@@ -218,8 +231,9 @@ def get_assembly(pdb_file, assembly_id=None, model=None, altloc="first",
218
231
  )
219
232
 
220
233
 
221
- def get_symmetry_mates(pdb_file, model=None, altloc="first",
222
- extra_fields=[], include_bonds=False):
234
+ def get_symmetry_mates(
235
+ pdb_file, model=None, altloc="first", extra_fields=[], include_bonds=False
236
+ ):
223
237
  """
224
238
  Build a structure model containing all symmetric copies
225
239
  of the structure within a single unit cell, given by the space
@@ -274,13 +288,13 @@ def get_symmetry_mates(pdb_file, model=None, altloc="first",
274
288
  symmetry_mates : AtomArray or AtomArrayStack
275
289
  All atoms within a single unit cell.
276
290
  The return type depends on the `model` parameter.
277
-
291
+
278
292
  Notes
279
293
  -----
280
294
  To expand the structure beyond a single unit cell, use
281
295
  :func:`repeat_box()` with the return value as its
282
296
  input.
283
-
297
+
284
298
  Examples
285
299
  --------
286
300
 
@@ -288,6 +302,4 @@ def get_symmetry_mates(pdb_file, model=None, altloc="first",
288
302
  >>> file = PDBFile.read(os.path.join(path_to_structures, "1aki.pdb"))
289
303
  >>> atoms_in_unit_cell = get_symmetry_mates(file, model=1)
290
304
  """
291
- return pdb_file.get_symmetry_mates(
292
- model, altloc, extra_fields, include_bonds
293
- )
305
+ return pdb_file.get_symmetry_mates(model, altloc, extra_fields, include_bonds)