biotite 0.41.1__cp310-cp310-win_amd64.whl → 1.0.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 (205) hide show
  1. biotite/__init__.py +2 -3
  2. biotite/application/__init__.py +36 -10
  3. biotite/application/application.py +22 -11
  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 +16 -5
  52. biotite/sequence/align/__init__.py +160 -6
  53. biotite/sequence/align/alignment.py +99 -90
  54. biotite/sequence/align/banded.cp310-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.cp310-win_amd64.pyd +0 -0
  58. biotite/sequence/align/kmeralphabet.pyx +55 -51
  59. biotite/sequence/align/kmersimilarity.cp310-win_amd64.pyd +0 -0
  60. biotite/sequence/align/kmertable.cp310-win_amd64.pyd +0 -0
  61. biotite/sequence/align/kmertable.pyx +3 -2
  62. biotite/sequence/align/localgapped.cp310-win_amd64.pyd +0 -0
  63. biotite/sequence/align/localungapped.cp310-win_amd64.pyd +0 -0
  64. biotite/sequence/align/matrix.py +81 -82
  65. biotite/sequence/align/multiple.cp310-win_amd64.pyd +0 -0
  66. biotite/sequence/align/multiple.pyx +35 -35
  67. biotite/sequence/align/pairwise.cp310-win_amd64.pyd +0 -0
  68. biotite/sequence/align/permutation.cp310-win_amd64.pyd +0 -0
  69. biotite/sequence/align/permutation.pyx +12 -4
  70. biotite/sequence/align/selector.cp310-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.cp310-win_amd64.pyd +0 -0
  74. biotite/sequence/alphabet.py +112 -126
  75. biotite/sequence/annotation.py +78 -77
  76. biotite/sequence/codec.cp310-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.cp310-win_amd64.pyd +0 -0
  102. biotite/sequence/phylo/tree.cp310-win_amd64.pyd +0 -0
  103. biotite/sequence/phylo/upgma.cp310-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 +64 -64
  108. biotite/structure/__init__.py +3 -3
  109. biotite/structure/atoms.py +226 -240
  110. biotite/structure/basepairs.py +260 -271
  111. biotite/structure/bonds.cp310-win_amd64.pyd +0 -0
  112. biotite/structure/bonds.pyx +88 -100
  113. biotite/structure/box.py +67 -71
  114. biotite/structure/celllist.cp310-win_amd64.pyd +0 -0
  115. biotite/structure/chains.py +55 -39
  116. biotite/structure/charges.cp310-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 +21 -7
  130. biotite/structure/info/groups.py +10 -15
  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.cp310-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 -52
  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.cp310-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.cp310-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.1.dist-info → biotite-1.0.0.dist-info}/METADATA +6 -6
  184. biotite-1.0.0.dist-info/RECORD +322 -0
  185. {biotite-0.41.1.dist-info → biotite-1.0.0.dist-info}/WHEEL +1 -1
  186. biotite/structure/io/ctab.py +0 -72
  187. biotite/structure/io/mmtf/__init__.py +0 -21
  188. biotite/structure/io/mmtf/assembly.py +0 -214
  189. biotite/structure/io/mmtf/convertarray.cp310-win_amd64.pyd +0 -0
  190. biotite/structure/io/mmtf/convertarray.pyx +0 -341
  191. biotite/structure/io/mmtf/convertfile.cp310-win_amd64.pyd +0 -0
  192. biotite/structure/io/mmtf/convertfile.pyx +0 -501
  193. biotite/structure/io/mmtf/decode.cp310-win_amd64.pyd +0 -0
  194. biotite/structure/io/mmtf/decode.pyx +0 -152
  195. biotite/structure/io/mmtf/encode.cp310-win_amd64.pyd +0 -0
  196. biotite/structure/io/mmtf/encode.pyx +0 -183
  197. biotite/structure/io/mmtf/file.py +0 -233
  198. biotite/structure/io/npz/__init__.py +0 -20
  199. biotite/structure/io/npz/file.py +0 -152
  200. biotite/structure/io/pdbx/legacy.py +0 -267
  201. biotite/structure/io/tng/__init__.py +0 -13
  202. biotite/structure/io/tng/file.py +0 -46
  203. biotite/temp.py +0 -86
  204. biotite-0.41.1.dist-info/RECORD +0 -340
  205. {biotite-0.41.1.dist-info → biotite-1.0.0.dist-info}/licenses/LICENSE.rst +0 -0
@@ -7,8 +7,6 @@ __author__ = "Tom David Müller, Patrick Kunzmann"
7
7
  __all__ = ["amino_acid_names", "nucleotide_names", "carbohydrate_names"]
8
8
 
9
9
  from pathlib import Path
10
- import copy
11
-
12
10
 
13
11
  CCD_DIR = Path(__file__).parent / "ccd"
14
12
 
@@ -19,7 +17,8 @@ group_lists = {}
19
17
  def amino_acid_names():
20
18
  """
21
19
  Get a tuple of amino acid three-letter codes according to the
22
- PDB *Chemical Component Dictionary* :footcite:`Westbrook2015`.
20
+ PDB *Chemical Component Dictionary*.
21
+ :footcite:`Westbrook2015`
23
22
 
24
23
  Returns
25
24
  -------
@@ -27,13 +26,11 @@ def amino_acid_names():
27
26
  A list of three-letter-codes containing residues that are
28
27
  peptide monomers.
29
28
 
30
- Notes
31
- -----
32
-
33
29
  References
34
30
  ----------
35
31
 
36
32
  .. footbibliography::
33
+
37
34
  """
38
35
  return _get_group_members("amino_acids")
39
36
 
@@ -41,7 +38,8 @@ def amino_acid_names():
41
38
  def nucleotide_names():
42
39
  """
43
40
  Get a tuple of nucleotide three-letter codes according to the
44
- PDB *Chemical Component Dictionary* :footcite:`Westbrook2015`.
41
+ PDB *Chemical Component Dictionary*.
42
+ :footcite:`Westbrook2015`
45
43
 
46
44
  Returns
47
45
  -------
@@ -49,13 +47,11 @@ def nucleotide_names():
49
47
  A list of three-letter-codes containing residues that are
50
48
  DNA/RNA monomers.
51
49
 
52
- Notes
53
- -----
54
-
55
50
  References
56
51
  ----------
57
52
 
58
53
  .. footbibliography::
54
+
59
55
  """
60
56
  return _get_group_members("nucleotides")
61
57
 
@@ -63,7 +59,8 @@ def nucleotide_names():
63
59
  def carbohydrate_names():
64
60
  """
65
61
  Get a tuple of carbohydrate three-letter codes according to the
66
- PDB *Chemical Component Dictionary* :footcite:`Westbrook2015`.
62
+ PDB *Chemical Component Dictionary*.
63
+ :footcite:`Westbrook2015`
67
64
 
68
65
  Returns
69
66
  -------
@@ -71,13 +68,11 @@ def carbohydrate_names():
71
68
  A list of three-letter-codes containing residues that are
72
69
  saccharide monomers.
73
70
 
74
- Notes
75
- -----
76
-
77
71
  References
78
72
  ----------
79
73
 
80
74
  .. footbibliography::
75
+
81
76
  """
82
77
  return _get_group_members("carbohydrates")
83
78
 
@@ -87,4 +82,4 @@ def _get_group_members(group_name):
87
82
  if group_name not in group_lists:
88
83
  with open(CCD_DIR / f"{group_name}.txt", "r") as file:
89
84
  group_lists[group_name] = tuple(file.read().split())
90
- return group_lists[group_name]
85
+ return group_lists[group_name]
@@ -8,9 +8,8 @@ __all__ = ["mass"]
8
8
 
9
9
  import json
10
10
  from pathlib import Path
11
- from ..atoms import Atom, AtomArray, AtomArrayStack
12
- from .ccd import get_from_ccd
13
-
11
+ from biotite.structure.atoms import Atom, AtomArray, AtomArrayStack
12
+ from biotite.structure.info.ccd import get_from_ccd
14
13
 
15
14
  # Masses are taken from http://www.sbcs.qmul.ac.uk/iupac/AtWt/ (2018/03/01)
16
15
  ATOM_MASSES_FILE = Path(__file__).parent / "atom_masses.json"
@@ -109,15 +108,11 @@ def mass(item, is_residue=None):
109
108
  elif isinstance(item, Atom):
110
109
  result_mass = mass(item.element, is_residue=False)
111
110
  elif isinstance(item, AtomArray) or isinstance(item, AtomArrayStack):
112
- result_mass = sum(
113
- (mass(element, is_residue=False) for element in item.element)
114
- )
111
+ result_mass = sum((mass(element, is_residue=False) for element in item.element))
115
112
 
116
113
  else:
117
- raise TypeError(
118
- f"Cannot calculate mass for {type(item).__name__} objects"
119
- )
114
+ raise TypeError(f"Cannot calculate mass for {type(item).__name__} objects")
120
115
 
121
116
  if result_mass is None:
122
117
  raise KeyError(f"{item} is not known")
123
- return result_mass
118
+ return result_mass
@@ -6,7 +6,7 @@ __name__ = "biotite.structure.info"
6
6
  __author__ = "Patrick Kunzmann"
7
7
  __all__ = ["all_residues", "full_name", "link_type", "one_letter_code"]
8
8
 
9
- from .ccd import get_ccd, get_from_ccd
9
+ from biotite.structure.info.ccd import get_ccd, get_from_ccd
10
10
 
11
11
 
12
12
  def all_residues():
@@ -6,9 +6,9 @@ __name__ = "biotite.structure.info"
6
6
  __author__ = "Patrick Kunzmann"
7
7
  __all__ = ["vdw_radius_protor", "vdw_radius_single"]
8
8
 
9
- from .bonds import bonds_in_residue
10
-
9
+ from biotite.structure.info.bonds import bonds_in_residue
11
10
 
11
+ # fmt: off
12
12
  # Contains tuples for the different ProtOr groups:
13
13
  # Tuple contains: element, valency, H count
14
14
  _PROTOR_RADII = {
@@ -35,28 +35,29 @@ _PROTOR_RADII = {
35
35
  _SINGLE_RADII = {
36
36
  "H": 1.20,
37
37
  "HE": 1.40,
38
-
38
+
39
39
  "C": 1.70,
40
40
  "N": 1.55,
41
41
  "O": 1.52,
42
42
  "F": 1.47,
43
43
  "NE": 1.54,
44
-
44
+
45
45
  "SI": 2.10,
46
46
  "P": 1.80,
47
47
  "S": 1.80,
48
48
  "CL": 1.75,
49
49
  "AR": 1.88,
50
-
50
+
51
51
  "AS": 1.85,
52
52
  "SE": 1.90,
53
53
  "BR": 1.85,
54
54
  "KR": 2.02,
55
-
55
+
56
56
  "TE": 2.06,
57
57
  "I": 1.98,
58
58
  "XE": 2.16,
59
59
  }
60
+ # fmt: on
60
61
 
61
62
  # A dictionary that caches radii for each residue
62
63
  _protor_radii = {}
@@ -82,7 +83,7 @@ def vdw_radius_protor(res_name, atom_name):
82
83
  to.
83
84
  atom_name : str
84
85
  The name of the non-hydrogen atom.
85
-
86
+
86
87
  Returns
87
88
  -------
88
89
  The Van-der-Waals radius of the given atom.
@@ -91,12 +92,12 @@ def vdw_radius_protor(res_name, atom_name):
91
92
  See also
92
93
  --------
93
94
  vdw_radius_single
94
-
95
+
95
96
  References
96
97
  ----------
97
-
98
+
98
99
  .. footbibliography::
99
-
100
+
100
101
  Examples
101
102
  --------
102
103
 
@@ -113,8 +114,7 @@ def vdw_radius_protor(res_name, atom_name):
113
114
  # Use cached radii for the residue, if already calculated
114
115
  if atom_name not in _protor_radii[res_name]:
115
116
  raise KeyError(
116
- f"Residue '{res_name}' does not contain an atom named "
117
- f"'{atom_name}'"
117
+ f"Residue '{res_name}' does not contain an atom named " f"'{atom_name}'"
118
118
  )
119
119
  return _protor_radii[res_name].get(atom_name)
120
120
  else:
@@ -124,6 +124,7 @@ def vdw_radius_protor(res_name, atom_name):
124
124
  # are cached
125
125
  return vdw_radius_protor(res_name, atom_name)
126
126
 
127
+
127
128
  def _calculate_protor_radii(res_name):
128
129
  """
129
130
  Calculate the ProtOr VdW radii for all atoms (atom names) in
@@ -159,8 +160,7 @@ def _calculate_protor_radii(res_name):
159
160
  group[2] += 1
160
161
  groups[main_atom] = group
161
162
  # Get radii based on ProtOr groups
162
- radii = {atom : _PROTOR_RADII.get(tuple(group))
163
- for atom, group in groups.items()}
163
+ radii = {atom: _PROTOR_RADII.get(tuple(group)) for atom, group in groups.items()}
164
164
  return radii
165
165
 
166
166
 
@@ -173,25 +173,25 @@ def vdw_radius_single(element):
173
173
  ----------
174
174
  element : str
175
175
  The chemical element of the atoms.
176
-
176
+
177
177
  Returns
178
178
  -------
179
179
  The Van-der-Waals radius of the atom.
180
180
  If the radius is unknown for the element, `None` is returned.
181
-
181
+
182
182
  See also
183
183
  --------
184
184
  vdw_radius_protor
185
-
185
+
186
186
  References
187
187
  ----------
188
-
188
+
189
189
  .. footbibliography::
190
-
190
+
191
191
  Examples
192
192
  --------
193
193
 
194
194
  >>> print(vdw_radius_single("C"))
195
195
  1.7
196
196
  """
197
- return _SINGLE_RADII.get(element.upper())
197
+ return _SINGLE_RADII.get(element.upper())
@@ -8,9 +8,9 @@ __all__ = ["standardize_order"]
8
8
 
9
9
  import warnings
10
10
  import numpy as np
11
- from .ccd import get_from_ccd
12
- from ..residues import get_residue_starts
13
- from ..error import BadStructureError
11
+ from biotite.structure.error import BadStructureError
12
+ from biotite.structure.info.ccd import get_from_ccd
13
+ from biotite.structure.residues import get_residue_starts
14
14
 
15
15
 
16
16
  def standardize_order(atoms):
@@ -116,26 +116,24 @@ def standardize_order(atoms):
116
116
  reordered_indices = np.zeros(atoms.array_length(), dtype=int)
117
117
 
118
118
  starts = get_residue_starts(atoms, add_exclusive_stop=True)
119
- for i in range(len(starts)-1):
119
+ for i in range(len(starts) - 1):
120
120
  start = starts[i]
121
- stop = starts[i+1]
121
+ stop = starts[i + 1]
122
122
 
123
123
  res_name = atoms.res_name[start]
124
- standard_atom_names = get_from_ccd(
125
- "chem_comp_atom", res_name, "atom_id"
126
- )
124
+ standard_atom_names = get_from_ccd("chem_comp_atom", res_name, "atom_id")
127
125
  if standard_atom_names is None:
128
126
  # If the residue is not in the CCD, keep the current order
129
127
  warnings.warn(
130
128
  f"Residue '{res_name}' is not in the CCD, "
131
129
  f"keeping current atom order"
132
130
  )
133
- reordered_indices[start : stop] = np.arange(start, stop)
131
+ reordered_indices[start:stop] = np.arange(start, stop)
134
132
  continue
135
133
 
136
- reordered_indices[start : stop] = _reorder(
137
- atoms.atom_name[start : stop], standard_atom_names
138
- ) + start
134
+ reordered_indices[start:stop] = (
135
+ _reorder(atoms.atom_name[start:stop], standard_atom_names) + start
136
+ )
139
137
 
140
138
  return reordered_indices
141
139
 
@@ -164,17 +162,13 @@ def _reorder(origin, target):
164
162
  Indices for `origin` that that changes the order of `origin`
165
163
  to the order of `target`.
166
164
  """
167
- target_hits, origin_hits = np.where(
168
- target[:, np.newaxis] == origin[np.newaxis, :]
169
- )
165
+ target_hits, origin_hits = np.where(target[:, np.newaxis] == origin[np.newaxis, :])
170
166
 
171
167
  counts = np.bincount(target_hits, minlength=len(target))
172
168
  if (counts > 1).any():
173
169
  counts = np.bincount(target_hits, minlength=len(target))
174
170
  # Identify which atom is duplicate
175
- duplicate_i = np.where(
176
- counts > 1
177
- )[0][0]
171
+ duplicate_i = np.where(counts > 1)[0][0]
178
172
  duplicate_name = target[duplicate_i]
179
173
  raise BadStructureError(
180
174
  f"Input structure has duplicate atom '{duplicate_name}'"
@@ -185,12 +179,7 @@ def _reorder(origin, target):
185
179
  # to the target structure
186
180
  # -> Identify which atoms are missing in the target structure
187
181
  # and append these to the end of the residue
188
- missing_atom_mask = np.bincount(
189
- origin_hits, minlength=len(origin)
190
- ).astype(bool)
191
- return np.concatenate([
192
- origin_hits,
193
- np.where(~missing_atom_mask)[0]
194
- ])
182
+ missing_atom_mask = np.bincount(origin_hits, minlength=len(origin)).astype(bool)
183
+ return np.concatenate([origin_hits, np.where(~missing_atom_mask)[0]])
195
184
  else:
196
- return origin_hits
185
+ return origin_hits
@@ -9,53 +9,29 @@ errors in the structure.
9
9
 
10
10
  __name__ = "biotite.structure"
11
11
  __author__ = "Patrick Kunzmann, Daniel Bauer"
12
- __all__ = ["check_id_continuity", "check_atom_id_continuity",
13
- "check_res_id_continuity", "check_backbone_continuity",
14
- "check_duplicate_atoms", "check_bond_continuity",
15
- "check_linear_continuity"]
12
+ __all__ = [
13
+ "check_atom_id_continuity",
14
+ "check_res_id_continuity",
15
+ "check_backbone_continuity",
16
+ "check_duplicate_atoms",
17
+ "check_linear_continuity",
18
+ ]
16
19
 
17
20
  import numpy as np
18
- import warnings
19
- from .atoms import AtomArray, AtomArrayStack
20
- from .filter import (
21
- filter_peptide_backbone, filter_phosphate_backbone, filter_linear_bond_continuity)
22
- from .box import coord_to_fraction
21
+ from biotite.structure.box import coord_to_fraction
22
+ from biotite.structure.filter import (
23
+ filter_linear_bond_continuity,
24
+ filter_peptide_backbone,
25
+ filter_phosphate_backbone,
26
+ )
23
27
 
24
28
 
25
29
  def _check_continuity(array):
26
30
  diff = np.diff(array)
27
- discontinuity = np.where( ((diff != 0) & (diff != 1)) )
31
+ discontinuity = np.where(((diff != 0) & (diff != 1)))
28
32
  return discontinuity[0] + 1
29
33
 
30
34
 
31
- def check_id_continuity(array):
32
- """
33
- Check if the residue IDs are incremented by more than 1 or
34
- decremented, from one atom to the next one.
35
-
36
- An increment by more than 1 is as strong clue for missing residues,
37
- a decrement means probably a start of a new chain.
38
-
39
- DEPRECATED: Use :func:`check_res_id_continuity()` instead.
40
-
41
- Parameters
42
- ----------
43
- array : AtomArray or AtomArrayStack
44
- The array to be checked.
45
-
46
- Returns
47
- -------
48
- discontinuity : ndarray, dtype=int
49
- Contains the indices of atoms after a discontinuity
50
- """
51
- warnings.warn(
52
- "'check_id_continuity()' is deprecated, "
53
- "use 'check_res_id_continuity()' instead",
54
- DeprecationWarning
55
- )
56
- return check_res_id_continuity(array)
57
-
58
-
59
35
  def check_atom_id_continuity(array):
60
36
  """
61
37
  Check if the atom IDs are incremented by more than 1 or
@@ -99,36 +75,6 @@ def check_res_id_continuity(array):
99
75
  return _check_continuity(ids)
100
76
 
101
77
 
102
- def check_bond_continuity(array, min_len=1.2, max_len=1.8):
103
- """
104
- Check if the peptide or phosphate backbone atoms have a
105
- non-reasonable distance to the next residue.
106
-
107
- A large or very small distance is a very strong clue, that there is
108
- no bond between those atoms, therefore the chain is discontinued.
109
-
110
- DEPRECATED: Please use :func:`check_backbone_continuity` for the same functionality.
111
-
112
- Parameters
113
- ----------
114
- array : AtomArray
115
- The array to be checked.
116
- min_len, max_len : float, optional
117
- The interval in which the atom-atom distance is evaluated as
118
- bond.
119
-
120
- Returns
121
- -------
122
- discontinuity : ndarray, dtype=int
123
- Contains the indices of atoms after a discontinuity.
124
- """
125
- warnings.warn(
126
- "Reimplemented into `check_backbone_continuity()`",
127
- DeprecationWarning
128
- )
129
- return check_backbone_continuity(array, min_len, max_len)
130
-
131
-
132
78
  def check_linear_continuity(array, min_len=1.2, max_len=1.8):
133
79
  """
134
80
  Check linear (consecutive) bond continuity of atoms in atom array.
@@ -223,8 +169,9 @@ def check_duplicate_atoms(array):
223
169
  The first occurence of an atom is not counted as duplicate.
224
170
  """
225
171
  duplicates = []
226
- annots = [array.get_annotation(category) for category
227
- in array.get_annotation_categories()]
172
+ annots = [
173
+ array.get_annotation(category) for category in array.get_annotation_categories()
174
+ ]
228
175
  for i in range(1, array.array_length()):
229
176
  # Start with assumption that all atoms in the array
230
177
  # until index i are duplicates of the atom at index i
@@ -233,7 +180,7 @@ def check_duplicate_atoms(array):
233
180
  # For each annotation array filter out the atoms until
234
181
  # index i that have an unequal annotation
235
182
  # to the atom at index i
236
- is_duplicate &= (annot[:i] == annot[i])
183
+ is_duplicate &= annot[:i] == annot[i]
237
184
  # After checking all annotation arrays,
238
185
  # if there still is any duplicate to the atom at index i,
239
186
  # add i the the list of duplicate atom indices
@@ -18,13 +18,12 @@ structure file.
18
18
  The recommended format for reading structure files is *BinaryCIF*.
19
19
  It has by far the shortest parsing time and file size.
20
20
 
21
- Besides the mentioned structure formats, Gromacs trajectory files can be
22
- loaded, if `mdtraj` is installed.
21
+ Besides the mentioned structure formats, common trajectory formats can be
22
+ loaded as well.
23
23
  """
24
24
 
25
25
  __name__ = "biotite.structure.io"
26
26
  __author__ = "Patrick Kunzmann"
27
27
 
28
- from .ctab import *
29
28
  from .general import *
30
- from .trajfile import *
29
+ from .trajfile import *
@@ -10,4 +10,4 @@ CDC format used by software like *CHARMM*, *OpenMM* and *NAMD*.
10
10
  __name__ = "biotite.structure.io.dcd"
11
11
  __author__ = "Patrick Kunzmann"
12
12
 
13
- from .file import *
13
+ from .file import *
@@ -6,21 +6,21 @@ __name__ = "biotite.structure.io.dcd"
6
6
  __author__ = "Patrick Kunzmann"
7
7
  __all__ = ["DCDFile"]
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 DCDFile(TrajectoryFile):
15
16
  """
16
17
  This file class represents a DCD trajectory file.
17
18
  """
18
-
19
+
19
20
  @classmethod
20
21
  def traj_type(cls):
21
- import mdtraj.formats as traj
22
- return traj.DCDTrajectoryFile
23
-
22
+ return biotraj.DCDTrajectoryFile
23
+
24
24
  @classmethod
25
25
  def process_read_values(cls, read_values):
26
26
  # .netcdf files use Angstrom
@@ -28,38 +28,40 @@ class DCDFile(TrajectoryFile):
28
28
  cell_lengths = read_values[1]
29
29
  cell_angles = read_values[2]
30
30
  if cell_lengths is None or cell_angles is None:
31
- box = None
31
+ box = None
32
32
  else:
33
33
  box = np.stack(
34
- [vectors_from_unitcell(a, b, c, alpha, beta, gamma)
35
- for (a, b, c), (alpha, beta, gamma)
36
- in zip(cell_lengths, np.deg2rad(cell_angles))],
37
- axis=0
34
+ [
35
+ vectors_from_unitcell(a, b, c, alpha, beta, gamma)
36
+ for (a, b, c), (alpha, beta, gamma) in zip(
37
+ cell_lengths, np.deg2rad(cell_angles)
38
+ )
39
+ ],
40
+ axis=0,
38
41
  )
39
42
  return coord, box, None
40
-
43
+
41
44
  @classmethod
42
45
  def prepare_write_values(cls, coord, box, time):
43
- xyz = coord.astype(np.float32, copy=False) \
44
- if coord is not None else None
46
+ xyz = coord.astype(np.float32, copy=False) if coord is not None else None
45
47
  if box is None:
46
48
  cell_lengths = None
47
- cell_angles = None
49
+ cell_angles = None
48
50
  else:
49
51
  cell_lengths = np.zeros((len(box), 3), dtype=np.float32)
50
- cell_angles = np.zeros((len(box), 3), dtype=np.float32)
52
+ cell_angles = np.zeros((len(box), 3), dtype=np.float32)
51
53
  for i, model_box in enumerate(box):
52
54
  a, b, c, alpha, beta, gamma = unitcell_from_vectors(model_box)
53
55
  cell_lengths[i] = np.array((a, b, c))
54
56
  cell_angles[i] = np.rad2deg((alpha, beta, gamma))
55
57
  return {
56
- "xyz" : xyz,
57
- "cell_lengths" : cell_lengths,
58
- "cell_angles" : cell_angles,
58
+ "xyz": xyz,
59
+ "cell_lengths": cell_lengths,
60
+ "cell_angles": cell_angles,
59
61
  }
60
62
 
61
63
  def set_time(self, time):
62
64
  if time is not None:
63
65
  raise NotImplementedError(
64
66
  "This trajectory file does not support writing simulation time"
65
- )
67
+ )