biotite 0.39.0__cp310-cp310-win_amd64.whl → 0.41.0__cp310-cp310-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 (121) hide show
  1. biotite/__init__.py +3 -3
  2. biotite/application/dssp/app.py +18 -18
  3. biotite/database/pubchem/download.py +23 -23
  4. biotite/database/pubchem/query.py +7 -7
  5. biotite/database/rcsb/download.py +19 -14
  6. biotite/file.py +17 -9
  7. biotite/sequence/align/banded.c +258 -237
  8. biotite/sequence/align/banded.cp310-win_amd64.pyd +0 -0
  9. biotite/sequence/align/cigar.py +60 -15
  10. biotite/sequence/align/kmeralphabet.c +243 -222
  11. biotite/sequence/align/kmeralphabet.cp310-win_amd64.pyd +0 -0
  12. biotite/sequence/align/kmersimilarity.c +215 -196
  13. biotite/sequence/align/kmersimilarity.cp310-win_amd64.pyd +0 -0
  14. biotite/sequence/align/kmertable.cp310-win_amd64.pyd +0 -0
  15. biotite/sequence/align/kmertable.cpp +233 -205
  16. biotite/sequence/align/localgapped.c +258 -237
  17. biotite/sequence/align/localgapped.cp310-win_amd64.pyd +0 -0
  18. biotite/sequence/align/localungapped.c +235 -214
  19. biotite/sequence/align/localungapped.cp310-win_amd64.pyd +0 -0
  20. biotite/sequence/align/multiple.c +255 -234
  21. biotite/sequence/align/multiple.cp310-win_amd64.pyd +0 -0
  22. biotite/sequence/align/pairwise.c +274 -253
  23. biotite/sequence/align/pairwise.cp310-win_amd64.pyd +0 -0
  24. biotite/sequence/align/permutation.c +215 -196
  25. biotite/sequence/align/permutation.cp310-win_amd64.pyd +0 -0
  26. biotite/sequence/align/selector.c +217 -197
  27. biotite/sequence/align/selector.cp310-win_amd64.pyd +0 -0
  28. biotite/sequence/align/tracetable.c +215 -195
  29. biotite/sequence/align/tracetable.cp310-win_amd64.pyd +0 -0
  30. biotite/sequence/annotation.py +2 -2
  31. biotite/sequence/codec.c +235 -214
  32. biotite/sequence/codec.cp310-win_amd64.pyd +0 -0
  33. biotite/sequence/io/fasta/convert.py +27 -24
  34. biotite/sequence/phylo/nj.c +215 -196
  35. biotite/sequence/phylo/nj.cp310-win_amd64.pyd +0 -0
  36. biotite/sequence/phylo/tree.c +227 -202
  37. biotite/sequence/phylo/tree.cp310-win_amd64.pyd +0 -0
  38. biotite/sequence/phylo/upgma.c +215 -196
  39. biotite/sequence/phylo/upgma.cp310-win_amd64.pyd +0 -0
  40. biotite/structure/__init__.py +2 -0
  41. biotite/structure/basepairs.py +7 -12
  42. biotite/structure/bonds.c +1437 -1279
  43. biotite/structure/bonds.cp310-win_amd64.pyd +0 -0
  44. biotite/structure/celllist.c +217 -197
  45. biotite/structure/celllist.cp310-win_amd64.pyd +0 -0
  46. biotite/structure/charges.c +1052 -1101
  47. biotite/structure/charges.cp310-win_amd64.pyd +0 -0
  48. biotite/structure/dotbracket.py +2 -0
  49. biotite/structure/filter.py +30 -37
  50. biotite/structure/info/__init__.py +5 -8
  51. biotite/structure/info/atoms.py +31 -68
  52. biotite/structure/info/bonds.py +47 -101
  53. biotite/structure/info/ccd/README.rst +8 -0
  54. biotite/structure/info/ccd/amino_acids.txt +1663 -0
  55. biotite/structure/info/ccd/carbohydrates.txt +1135 -0
  56. biotite/structure/info/ccd/components.bcif +0 -0
  57. biotite/structure/info/ccd/nucleotides.txt +798 -0
  58. biotite/structure/info/ccd.py +95 -0
  59. biotite/structure/info/groups.py +90 -0
  60. biotite/structure/info/masses.py +21 -20
  61. biotite/structure/info/misc.py +78 -25
  62. biotite/structure/info/standardize.py +17 -12
  63. biotite/structure/integrity.py +19 -70
  64. biotite/structure/io/__init__.py +2 -4
  65. biotite/structure/io/ctab.py +12 -106
  66. biotite/structure/io/general.py +167 -181
  67. biotite/structure/io/gro/file.py +16 -16
  68. biotite/structure/io/mmtf/__init__.py +3 -0
  69. biotite/structure/io/mmtf/convertarray.c +219 -198
  70. biotite/structure/io/mmtf/convertarray.cp310-win_amd64.pyd +0 -0
  71. biotite/structure/io/mmtf/convertfile.c +217 -197
  72. biotite/structure/io/mmtf/convertfile.cp310-win_amd64.pyd +0 -0
  73. biotite/structure/io/mmtf/decode.c +225 -204
  74. biotite/structure/io/mmtf/decode.cp310-win_amd64.pyd +0 -0
  75. biotite/structure/io/mmtf/encode.c +215 -196
  76. biotite/structure/io/mmtf/encode.cp310-win_amd64.pyd +0 -0
  77. biotite/structure/io/mmtf/file.py +34 -26
  78. biotite/structure/io/mol/__init__.py +4 -2
  79. biotite/structure/io/mol/convert.py +71 -7
  80. biotite/structure/io/mol/ctab.py +414 -0
  81. biotite/structure/io/mol/header.py +116 -0
  82. biotite/structure/io/mol/{file.py → mol.py} +69 -82
  83. biotite/structure/io/mol/sdf.py +909 -0
  84. biotite/structure/io/npz/__init__.py +3 -0
  85. biotite/structure/io/npz/file.py +21 -18
  86. biotite/structure/io/pdb/__init__.py +3 -3
  87. biotite/structure/io/pdb/file.py +89 -34
  88. biotite/structure/io/pdb/hybrid36.c +63 -43
  89. biotite/structure/io/pdb/hybrid36.cp310-win_amd64.pyd +0 -0
  90. biotite/structure/io/pdbqt/file.py +32 -32
  91. biotite/structure/io/pdbx/__init__.py +12 -6
  92. biotite/structure/io/pdbx/bcif.py +648 -0
  93. biotite/structure/io/pdbx/cif.py +1032 -0
  94. biotite/structure/io/pdbx/component.py +246 -0
  95. biotite/structure/io/pdbx/convert.py +858 -386
  96. biotite/structure/io/pdbx/encoding.c +112813 -0
  97. biotite/structure/io/pdbx/encoding.cp310-win_amd64.pyd +0 -0
  98. biotite/structure/io/pdbx/legacy.py +267 -0
  99. biotite/structure/molecules.py +151 -151
  100. biotite/structure/repair.py +253 -0
  101. biotite/structure/sasa.c +215 -196
  102. biotite/structure/sasa.cp310-win_amd64.pyd +0 -0
  103. biotite/structure/sequence.py +112 -0
  104. biotite/structure/superimpose.py +618 -116
  105. {biotite-0.39.0.dist-info → biotite-0.41.0.dist-info}/METADATA +3 -3
  106. {biotite-0.39.0.dist-info → biotite-0.41.0.dist-info}/RECORD +109 -103
  107. {biotite-0.39.0.dist-info → biotite-0.41.0.dist-info}/WHEEL +1 -1
  108. biotite/structure/info/amino_acids.json +0 -1556
  109. biotite/structure/info/amino_acids.py +0 -42
  110. biotite/structure/info/carbohydrates.json +0 -1122
  111. biotite/structure/info/carbohydrates.py +0 -39
  112. biotite/structure/info/intra_bonds.msgpack +0 -0
  113. biotite/structure/info/link_types.msgpack +0 -1
  114. biotite/structure/info/nucleotides.json +0 -772
  115. biotite/structure/info/nucleotides.py +0 -39
  116. biotite/structure/info/residue_masses.msgpack +0 -0
  117. biotite/structure/info/residue_names.msgpack +0 -3
  118. biotite/structure/info/residues.msgpack +0 -0
  119. biotite/structure/io/pdbx/file.py +0 -652
  120. {biotite-0.39.0.dist-info → biotite-0.41.0.dist-info}/LICENSE.rst +0 -0
  121. {biotite-0.39.0.dist-info → biotite-0.41.0.dist-info}/top_level.txt +0 -0
@@ -6,25 +6,21 @@ __name__ = "biotite.structure.io.mol"
6
6
  __author__ = "Patrick Kunzmann"
7
7
  __all__ = ["MOLFile"]
8
8
 
9
- import datetime
10
- from warnings import warn
11
- import numpy as np
12
- from ...atoms import AtomArray
13
9
  from ....file import TextFile, InvalidFileError
14
- from ...error import BadStructureError
15
- from ..ctab import read_structure_from_ctab, write_structure_to_ctab
10
+ from .ctab import read_structure_from_ctab, write_structure_to_ctab
11
+ from .header import Header
16
12
  from ...bonds import BondType
17
13
 
18
14
 
19
15
  # Number of header lines
20
16
  N_HEADER = 3
21
- DATE_FORMAT = "%m%d%y%H%M"
22
17
 
23
18
 
24
19
  class MOLFile(TextFile):
25
20
  """
26
21
  This class represents a file in MOL format, that is used to store
27
- structure information for small molecules. :footcite:`Dalby1992`
22
+ structure information for small molecules.
23
+ :footcite:`Dalby1992`
28
24
 
29
25
  Since its use is intended for single small molecules, it stores
30
26
  less atom annotation information than the macromolecular structure
@@ -35,6 +31,11 @@ class MOLFile(TextFile):
35
31
  This class can also be used to parse the first structure from an SDF
36
32
  file, as the SDF format extends the MOL format.
37
33
 
34
+ Attributes
35
+ ----------
36
+ header : Header
37
+ The header of the MOL file.
38
+
38
39
  References
39
40
  ----------
40
41
 
@@ -77,88 +78,66 @@ class MOLFile(TextFile):
77
78
  super().__init__()
78
79
  # empty header lines
79
80
  self.lines = [""] * N_HEADER
81
+ self._header = None
82
+
83
+
84
+ @classmethod
85
+ def read(cls, file):
86
+ mol_file = super().read(file)
87
+ mol_file._header = None
88
+ return mol_file
89
+
90
+
91
+ @property
92
+ def header(self):
93
+ if self._header is None:
94
+ self._header = Header.deserialize("\n".join(self.lines[0:3]) + "\n")
95
+ return self._header
96
+
97
+
98
+ @header.setter
99
+ def header(self, header):
100
+ self._header = header
101
+ self.lines[0:3] = self._header.serialize().splitlines()
102
+
80
103
 
81
104
  def get_header(self):
82
105
  """
83
106
  Get the header from the MOL file.
84
107
 
108
+ DEPRECATED: Use the :attr:`header` property instead.
109
+
85
110
  Returns
86
111
  -------
87
- mol_name : str
88
- The name of the molecule.
89
- initials : str
90
- The author's initials.
91
- program : str
92
- The program name.
93
- time : datetime
94
- The time of file creation.
95
- dimensions : str
96
- Dimensional codes.
97
- scaling_factors : str
98
- Scaling factors.
99
- energy : str
100
- Energy from modeling program.
101
- registry_number : str
102
- MDL registry number.
103
- comments : str
104
- Additional comments.
112
+ header_attributes
113
+ See :class:`Header`.
105
114
  """
106
- mol_name = self.lines[0].strip()
107
- initials = self.lines[1][0:2].strip()
108
- program = self.lines[1][2:10].strip()
109
- time = datetime.datetime.strptime(self.lines[1][10:20],
110
- DATE_FORMAT)
111
- dimensions = self.lines[1][20:22].strip()
112
- scaling_factors = self.lines[1][22:34].strip()
113
- energy = self.lines[1][34:46].strip()
114
- registry_number = self.lines[1][46:52].strip()
115
- comments = self.lines[2].strip()
116
- return mol_name, initials, program, time, dimensions, \
117
- scaling_factors, energy, registry_number, comments
118
-
119
-
120
- def set_header(self, mol_name, initials="", program="", time=None,
121
- dimensions="", scaling_factors="", energy="",
122
- registry_number="", comments=""):
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):
123
130
  """
124
131
  Set the header for the MOL file.
125
132
 
133
+ DEPRECATED: Use the :attr:`header` property instead.
134
+
126
135
  Parameters
127
136
  ----------
128
- mol_name : str
129
- The name of the molecule.
130
- initials : str, optional
131
- The author's initials. Maximum length is 2.
132
- program : str, optional
133
- The program name. Maximum length is 8.
134
- time : datetime or date, optional
135
- The time of file creation.
136
- dimensions : str, optional
137
- Dimensional codes. Maximum length is 2.
138
- scaling_factors : str, optional
139
- Scaling factors. Maximum length is 12.
140
- energy : str, optional
141
- Energy from modeling program. Maximum length is 12.
142
- registry_number : str, optional
143
- MDL registry number. Maximum length is 6.
144
- comments : str, optional
145
- Additional comments.
137
+ **args, **kwars
138
+ See :class:`Header`.
146
139
  """
147
- if time is None:
148
- time = datetime.datetime.now()
149
- time_str = time.strftime(DATE_FORMAT)
150
-
151
- self.lines[0] = str(mol_name)
152
- self.lines[1] = (
153
- f"{initials:>2}"
154
- f"{program:>8}"
155
- f"{time_str:>10}"
156
- f"{dimensions:>2}"
157
- f"{scaling_factors:>12}"
158
- f"{energy:>12}"
159
- f"{registry_number:>6}"
160
- )
161
- self.lines[2] = str(comments)
140
+ self.header = Header(*args, **kwargs)
162
141
 
163
142
 
164
143
  def get_structure(self):
@@ -179,7 +158,8 @@ class MOLFile(TextFile):
179
158
  return read_structure_from_ctab(ctab_lines)
180
159
 
181
160
 
182
- def set_structure(self, atoms, default_bond_type=BondType.ANY):
161
+ def set_structure(self, atoms, default_bond_type=BondType.ANY,
162
+ version=None):
183
163
  """
184
164
  Set the :class:`AtomArray` for the file.
185
165
 
@@ -188,17 +168,24 @@ class MOLFile(TextFile):
188
168
  array : AtomArray
189
169
  The array to be saved into this file.
190
170
  Must have an associated :class:`BondList`.
191
- default_bond_type : BondType
192
- Bond type fallback in the *Bond block* if a bond has no bond_type
193
- defined in *atoms* array. By default, each bond is treated as
171
+ default_bond_type : BondType, optional
172
+ Bond type fallback for the *Bond block*, if a
173
+ :class:`BondType` has no CTAB counterpart.
174
+ By default, each such bond is treated as
194
175
  :attr:`BondType.ANY`.
176
+ version : {"V2000", "V3000"}, optional
177
+ The version of the CTAB format.
178
+ ``"V2000"`` uses the *Atom* and *Bond* block, while
179
+ ``"V3000"`` uses the *Properties* block.
180
+ By default, ``"V2000"`` is used, unless the number of atoms
181
+ or bonds exceeds 999, in which case ``"V3000"`` is used.
195
182
  """
196
183
  self.lines = self.lines[:N_HEADER] + write_structure_to_ctab(
197
- atoms,
198
- default_bond_type
184
+ atoms, default_bond_type, version
199
185
  )
200
186
 
201
187
 
188
+
202
189
  def _get_ctab_lines(lines):
203
190
  for i, line in enumerate(lines):
204
191
  if line.startswith("M END"):