biotite 0.41.2__cp310-cp310-macosx_11_0_arm64.whl → 1.0.0__cp310-cp310-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.
- biotite/__init__.py +2 -3
- biotite/application/__init__.py +1 -1
- biotite/application/application.py +20 -10
- biotite/application/autodock/__init__.py +1 -1
- biotite/application/autodock/app.py +74 -79
- biotite/application/blast/__init__.py +1 -1
- biotite/application/blast/alignment.py +19 -10
- biotite/application/blast/webapp.py +92 -85
- biotite/application/clustalo/__init__.py +1 -1
- biotite/application/clustalo/app.py +46 -61
- biotite/application/dssp/__init__.py +1 -1
- biotite/application/dssp/app.py +8 -11
- biotite/application/localapp.py +62 -60
- biotite/application/mafft/__init__.py +1 -1
- biotite/application/mafft/app.py +16 -22
- biotite/application/msaapp.py +78 -89
- biotite/application/muscle/__init__.py +1 -1
- biotite/application/muscle/app3.py +50 -64
- biotite/application/muscle/app5.py +23 -31
- biotite/application/sra/__init__.py +1 -1
- biotite/application/sra/app.py +64 -68
- biotite/application/tantan/__init__.py +1 -1
- biotite/application/tantan/app.py +22 -45
- biotite/application/util.py +7 -9
- biotite/application/viennarna/rnaalifold.py +34 -28
- biotite/application/viennarna/rnafold.py +24 -39
- biotite/application/viennarna/rnaplot.py +36 -21
- biotite/application/viennarna/util.py +17 -12
- biotite/application/webapp.py +13 -14
- biotite/copyable.py +13 -13
- biotite/database/__init__.py +1 -1
- biotite/database/entrez/__init__.py +1 -1
- biotite/database/entrez/check.py +2 -3
- biotite/database/entrez/dbnames.py +7 -5
- biotite/database/entrez/download.py +55 -49
- biotite/database/entrez/key.py +1 -1
- biotite/database/entrez/query.py +62 -23
- biotite/database/error.py +2 -1
- biotite/database/pubchem/__init__.py +1 -1
- biotite/database/pubchem/download.py +43 -45
- biotite/database/pubchem/error.py +2 -2
- biotite/database/pubchem/query.py +34 -31
- biotite/database/pubchem/throttle.py +3 -4
- biotite/database/rcsb/__init__.py +1 -1
- biotite/database/rcsb/download.py +44 -52
- biotite/database/rcsb/query.py +85 -80
- biotite/database/uniprot/check.py +6 -3
- biotite/database/uniprot/download.py +6 -11
- biotite/database/uniprot/query.py +115 -31
- biotite/file.py +12 -31
- biotite/sequence/__init__.py +3 -3
- biotite/sequence/align/__init__.py +2 -2
- biotite/sequence/align/alignment.py +99 -90
- biotite/sequence/align/banded.cpython-310-darwin.so +0 -0
- biotite/sequence/align/buckets.py +12 -10
- biotite/sequence/align/cigar.py +43 -52
- biotite/sequence/align/kmeralphabet.cpython-310-darwin.so +0 -0
- biotite/sequence/align/kmeralphabet.pyx +55 -51
- biotite/sequence/align/kmersimilarity.cpython-310-darwin.so +0 -0
- biotite/sequence/align/kmertable.cpython-310-darwin.so +0 -0
- biotite/sequence/align/kmertable.pyx +3 -2
- biotite/sequence/align/localgapped.cpython-310-darwin.so +0 -0
- biotite/sequence/align/localungapped.cpython-310-darwin.so +0 -0
- biotite/sequence/align/matrix.py +81 -82
- biotite/sequence/align/multiple.cpython-310-darwin.so +0 -0
- biotite/sequence/align/multiple.pyx +1 -1
- biotite/sequence/align/pairwise.cpython-310-darwin.so +0 -0
- biotite/sequence/align/permutation.cpython-310-darwin.so +0 -0
- biotite/sequence/align/permutation.pyx +12 -4
- biotite/sequence/align/selector.cpython-310-darwin.so +0 -0
- biotite/sequence/align/selector.pyx +52 -54
- biotite/sequence/align/statistics.py +32 -33
- biotite/sequence/align/tracetable.cpython-310-darwin.so +0 -0
- biotite/sequence/alphabet.py +51 -65
- biotite/sequence/annotation.py +78 -77
- biotite/sequence/codec.cpython-310-darwin.so +0 -0
- biotite/sequence/codon.py +90 -79
- biotite/sequence/graphics/__init__.py +1 -1
- biotite/sequence/graphics/alignment.py +184 -103
- biotite/sequence/graphics/colorschemes.py +10 -12
- biotite/sequence/graphics/dendrogram.py +79 -34
- biotite/sequence/graphics/features.py +133 -99
- biotite/sequence/graphics/logo.py +22 -28
- biotite/sequence/graphics/plasmid.py +229 -178
- biotite/sequence/io/fasta/__init__.py +1 -1
- biotite/sequence/io/fasta/convert.py +44 -33
- biotite/sequence/io/fasta/file.py +42 -55
- biotite/sequence/io/fastq/__init__.py +1 -1
- biotite/sequence/io/fastq/convert.py +11 -14
- biotite/sequence/io/fastq/file.py +68 -112
- biotite/sequence/io/genbank/__init__.py +2 -2
- biotite/sequence/io/genbank/annotation.py +12 -20
- biotite/sequence/io/genbank/file.py +74 -76
- biotite/sequence/io/genbank/metadata.py +74 -62
- biotite/sequence/io/genbank/sequence.py +13 -14
- biotite/sequence/io/general.py +39 -30
- biotite/sequence/io/gff/__init__.py +2 -2
- biotite/sequence/io/gff/convert.py +10 -15
- biotite/sequence/io/gff/file.py +81 -65
- biotite/sequence/phylo/__init__.py +1 -1
- biotite/sequence/phylo/nj.cpython-310-darwin.so +0 -0
- biotite/sequence/phylo/tree.cpython-310-darwin.so +0 -0
- biotite/sequence/phylo/upgma.cpython-310-darwin.so +0 -0
- biotite/sequence/profile.py +57 -28
- biotite/sequence/search.py +17 -15
- biotite/sequence/seqtypes.py +200 -164
- biotite/sequence/sequence.py +15 -17
- biotite/structure/__init__.py +3 -3
- biotite/structure/atoms.py +221 -235
- biotite/structure/basepairs.py +260 -271
- biotite/structure/bonds.cpython-310-darwin.so +0 -0
- biotite/structure/bonds.pyx +29 -32
- biotite/structure/box.py +67 -71
- biotite/structure/celllist.cpython-310-darwin.so +0 -0
- biotite/structure/chains.py +55 -39
- biotite/structure/charges.cpython-310-darwin.so +0 -0
- biotite/structure/compare.py +32 -32
- biotite/structure/density.py +13 -18
- biotite/structure/dotbracket.py +20 -22
- biotite/structure/error.py +10 -2
- biotite/structure/filter.py +82 -77
- biotite/structure/geometry.py +130 -119
- biotite/structure/graphics/atoms.py +60 -43
- biotite/structure/graphics/rna.py +81 -68
- biotite/structure/hbond.py +112 -93
- biotite/structure/info/__init__.py +0 -2
- biotite/structure/info/atoms.py +10 -11
- biotite/structure/info/bonds.py +41 -43
- biotite/structure/info/ccd.py +4 -5
- biotite/structure/info/groups.py +1 -3
- biotite/structure/info/masses.py +5 -10
- biotite/structure/info/misc.py +1 -1
- biotite/structure/info/radii.py +20 -20
- biotite/structure/info/standardize.py +15 -26
- biotite/structure/integrity.py +18 -71
- biotite/structure/io/__init__.py +3 -4
- biotite/structure/io/dcd/__init__.py +1 -1
- biotite/structure/io/dcd/file.py +22 -20
- biotite/structure/io/general.py +47 -61
- biotite/structure/io/gro/__init__.py +1 -1
- biotite/structure/io/gro/file.py +73 -72
- biotite/structure/io/mol/__init__.py +1 -1
- biotite/structure/io/mol/convert.py +8 -11
- biotite/structure/io/mol/ctab.py +37 -36
- biotite/structure/io/mol/header.py +14 -10
- biotite/structure/io/mol/mol.py +9 -53
- biotite/structure/io/mol/sdf.py +47 -50
- biotite/structure/io/netcdf/__init__.py +1 -1
- biotite/structure/io/netcdf/file.py +24 -23
- biotite/structure/io/pdb/__init__.py +1 -1
- biotite/structure/io/pdb/convert.py +32 -20
- biotite/structure/io/pdb/file.py +151 -172
- biotite/structure/io/pdb/hybrid36.cpython-310-darwin.so +0 -0
- biotite/structure/io/pdbqt/__init__.py +1 -1
- biotite/structure/io/pdbqt/convert.py +17 -11
- biotite/structure/io/pdbqt/file.py +128 -80
- biotite/structure/io/pdbx/__init__.py +1 -2
- biotite/structure/io/pdbx/bcif.py +36 -44
- biotite/structure/io/pdbx/cif.py +64 -62
- biotite/structure/io/pdbx/component.py +10 -16
- biotite/structure/io/pdbx/convert.py +235 -246
- biotite/structure/io/pdbx/encoding.cpython-310-darwin.so +0 -0
- biotite/structure/io/trajfile.py +76 -93
- biotite/structure/io/trr/__init__.py +1 -1
- biotite/structure/io/trr/file.py +12 -15
- biotite/structure/io/xtc/__init__.py +1 -1
- biotite/structure/io/xtc/file.py +11 -14
- biotite/structure/mechanics.py +9 -11
- biotite/structure/molecules.py +3 -4
- biotite/structure/pseudoknots.py +53 -67
- biotite/structure/rdf.py +23 -21
- biotite/structure/repair.py +137 -86
- biotite/structure/residues.py +26 -16
- biotite/structure/sasa.cpython-310-darwin.so +0 -0
- biotite/structure/{resutil.py → segments.py} +24 -23
- biotite/structure/sequence.py +10 -11
- biotite/structure/sse.py +100 -119
- biotite/structure/superimpose.py +39 -77
- biotite/structure/transform.py +97 -71
- biotite/structure/util.py +11 -13
- biotite/version.py +2 -2
- biotite/visualize.py +69 -55
- {biotite-0.41.2.dist-info → biotite-1.0.0.dist-info}/METADATA +5 -5
- biotite-1.0.0.dist-info/RECORD +322 -0
- biotite/structure/io/ctab.py +0 -72
- biotite/structure/io/mmtf/__init__.py +0 -21
- biotite/structure/io/mmtf/assembly.py +0 -214
- biotite/structure/io/mmtf/convertarray.cpython-310-darwin.so +0 -0
- biotite/structure/io/mmtf/convertarray.pyx +0 -341
- biotite/structure/io/mmtf/convertfile.cpython-310-darwin.so +0 -0
- biotite/structure/io/mmtf/convertfile.pyx +0 -501
- biotite/structure/io/mmtf/decode.cpython-310-darwin.so +0 -0
- biotite/structure/io/mmtf/decode.pyx +0 -152
- biotite/structure/io/mmtf/encode.cpython-310-darwin.so +0 -0
- biotite/structure/io/mmtf/encode.pyx +0 -183
- biotite/structure/io/mmtf/file.py +0 -233
- biotite/structure/io/npz/__init__.py +0 -20
- biotite/structure/io/npz/file.py +0 -152
- biotite/structure/io/pdbx/legacy.py +0 -267
- biotite/structure/io/tng/__init__.py +0 -13
- biotite/structure/io/tng/file.py +0 -46
- biotite/temp.py +0 -86
- biotite-0.41.2.dist-info/RECORD +0 -340
- {biotite-0.41.2.dist-info → biotite-1.0.0.dist-info}/WHEEL +0 -0
- {biotite-0.41.2.dist-info → biotite-1.0.0.dist-info}/licenses/LICENSE.rst +0 -0
biotite/structure/info/radii.py
CHANGED
|
@@ -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
|
|
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 .
|
|
12
|
-
from
|
|
13
|
-
from
|
|
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
|
|
131
|
+
reordered_indices[start:stop] = np.arange(start, stop)
|
|
134
132
|
continue
|
|
135
133
|
|
|
136
|
-
reordered_indices[start
|
|
137
|
-
atoms.atom_name[start
|
|
138
|
-
)
|
|
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
|
-
|
|
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
|
biotite/structure/integrity.py
CHANGED
|
@@ -9,53 +9,29 @@ errors in the structure.
|
|
|
9
9
|
|
|
10
10
|
__name__ = "biotite.structure"
|
|
11
11
|
__author__ = "Patrick Kunzmann, Daniel Bauer"
|
|
12
|
-
__all__ = [
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
|
19
|
-
from .
|
|
20
|
-
|
|
21
|
-
filter_peptide_backbone,
|
|
22
|
-
|
|
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(
|
|
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 = [
|
|
227
|
-
|
|
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 &=
|
|
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
|
biotite/structure/io/__init__.py
CHANGED
|
@@ -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,
|
|
22
|
-
loaded
|
|
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 *
|
biotite/structure/io/dcd/file.py
CHANGED
|
@@ -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
|
|
11
|
-
from
|
|
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
|
-
|
|
22
|
-
|
|
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
|
-
|
|
31
|
+
box = None
|
|
32
32
|
else:
|
|
33
33
|
box = np.stack(
|
|
34
|
-
[
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
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
|
|
49
|
+
cell_angles = None
|
|
48
50
|
else:
|
|
49
51
|
cell_lengths = np.zeros((len(box), 3), dtype=np.float32)
|
|
50
|
-
cell_angles
|
|
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"
|
|
57
|
-
"cell_lengths"
|
|
58
|
-
"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
|
+
)
|
biotite/structure/io/general.py
CHANGED
|
@@ -12,9 +12,9 @@ __author__ = "Patrick Kunzmann"
|
|
|
12
12
|
__all__ = ["load_structure", "save_structure"]
|
|
13
13
|
|
|
14
14
|
import datetime
|
|
15
|
-
import os.path
|
|
16
15
|
import io
|
|
17
|
-
|
|
16
|
+
import os.path
|
|
17
|
+
from biotite.structure.atoms import AtomArrayStack
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
def load_structure(file_path, template=None, **kwargs):
|
|
@@ -64,73 +64,63 @@ def load_structure(file_path, template=None, **kwargs):
|
|
|
64
64
|
_, suffix = os.path.splitext(file_path)
|
|
65
65
|
match suffix:
|
|
66
66
|
case ".pdb":
|
|
67
|
-
from .pdb import PDBFile
|
|
67
|
+
from biotite.structure.io.pdb import PDBFile
|
|
68
|
+
|
|
68
69
|
file = PDBFile.read(file_path)
|
|
69
70
|
array = file.get_structure(**kwargs)
|
|
70
71
|
return _as_single_model_if_possible(array)
|
|
71
72
|
case ".pdbqt":
|
|
72
|
-
from .pdbqt import PDBQTFile
|
|
73
|
+
from biotite.structure.io.pdbqt import PDBQTFile
|
|
74
|
+
|
|
73
75
|
file = PDBQTFile.read(file_path)
|
|
74
76
|
array = file.get_structure(**kwargs)
|
|
75
77
|
return _as_single_model_if_possible(array)
|
|
76
78
|
case ".cif" | ".pdbx":
|
|
77
|
-
from .pdbx import CIFFile, get_structure
|
|
79
|
+
from biotite.structure.io.pdbx import CIFFile, get_structure
|
|
80
|
+
|
|
78
81
|
file = CIFFile.read(file_path)
|
|
79
82
|
array = get_structure(file, **kwargs)
|
|
80
83
|
return _as_single_model_if_possible(array)
|
|
81
84
|
case ".bcif":
|
|
82
|
-
from .pdbx import BinaryCIFFile, get_structure
|
|
85
|
+
from biotite.structure.io.pdbx import BinaryCIFFile, get_structure
|
|
86
|
+
|
|
83
87
|
file = BinaryCIFFile.read(file_path)
|
|
84
88
|
array = get_structure(file, **kwargs)
|
|
85
89
|
return _as_single_model_if_possible(array)
|
|
86
90
|
case ".gro":
|
|
87
|
-
from .gro import GROFile
|
|
91
|
+
from biotite.structure.io.gro import GROFile
|
|
92
|
+
|
|
88
93
|
file = GROFile.read(file_path)
|
|
89
94
|
array = file.get_structure(**kwargs)
|
|
90
95
|
return _as_single_model_if_possible(array)
|
|
91
|
-
case ".mmtf":
|
|
92
|
-
from .mmtf import MMTFFile, get_structure
|
|
93
|
-
file = MMTFFile.read(file_path)
|
|
94
|
-
array = get_structure(file, **kwargs)
|
|
95
|
-
return _as_single_model_if_possible(array)
|
|
96
|
-
case ".npz":
|
|
97
|
-
from .npz import NpzFile
|
|
98
|
-
file = NpzFile.read(file_path)
|
|
99
|
-
array = file.get_structure(**kwargs)
|
|
100
|
-
return _as_single_model_if_possible(array)
|
|
101
96
|
case ".mol":
|
|
102
|
-
from .mol import MOLFile
|
|
97
|
+
from biotite.structure.io.mol import MOLFile
|
|
98
|
+
|
|
103
99
|
file = MOLFile.read(file_path)
|
|
104
100
|
array = file.get_structure(**kwargs)
|
|
105
101
|
# MOL and SDF files only contain a single model
|
|
106
102
|
return array
|
|
107
103
|
case ".sdf" | ".sd":
|
|
108
|
-
from .mol import SDFile, get_structure
|
|
104
|
+
from biotite.structure.io.mol import SDFile, get_structure
|
|
105
|
+
|
|
109
106
|
file = SDFile.read(file_path)
|
|
110
107
|
array = get_structure(file, **kwargs)
|
|
111
108
|
return array
|
|
112
|
-
case ".trr" | ".xtc" | ".
|
|
109
|
+
case ".trr" | ".xtc" | ".dcd" | ".netcdf":
|
|
113
110
|
if template is None:
|
|
114
|
-
raise TypeError(
|
|
115
|
-
"Template must be specified for trajectory files"
|
|
116
|
-
)
|
|
111
|
+
raise TypeError("Template must be specified for trajectory files")
|
|
117
112
|
# Filter template for atom ids, if an unfiltered template
|
|
118
|
-
if (
|
|
119
|
-
"atom_i" in kwargs
|
|
120
|
-
and template.shape[-1] != len(kwargs["atom_i"])
|
|
121
|
-
):
|
|
113
|
+
if "atom_i" in kwargs and template.shape[-1] != len(kwargs["atom_i"]):
|
|
122
114
|
template = template[..., kwargs["atom_i"]]
|
|
123
|
-
from .
|
|
124
|
-
from .
|
|
125
|
-
from .
|
|
126
|
-
from .
|
|
127
|
-
|
|
115
|
+
from biotite.structure.io.dcd import DCDFile
|
|
116
|
+
from biotite.structure.io.netcdf import NetCDFFile
|
|
117
|
+
from biotite.structure.io.trr import TRRFile
|
|
118
|
+
from biotite.structure.io.xtc import XTCFile
|
|
119
|
+
|
|
128
120
|
if suffix == ".trr":
|
|
129
121
|
traj_file_cls = TRRFile
|
|
130
122
|
if suffix == ".xtc":
|
|
131
123
|
traj_file_cls = XTCFile
|
|
132
|
-
if suffix == ".tng":
|
|
133
|
-
traj_file_cls = TNGFile
|
|
134
124
|
if suffix == ".dcd":
|
|
135
125
|
traj_file_cls = DCDFile
|
|
136
126
|
if suffix == ".netcdf":
|
|
@@ -169,65 +159,60 @@ def save_structure(file_path, array, **kwargs):
|
|
|
169
159
|
_, suffix = os.path.splitext(file_path)
|
|
170
160
|
match suffix:
|
|
171
161
|
case ".pdb":
|
|
172
|
-
from .pdb import PDBFile
|
|
162
|
+
from biotite.structure.io.pdb import PDBFile
|
|
163
|
+
|
|
173
164
|
file = PDBFile()
|
|
174
165
|
file.set_structure(array, **kwargs)
|
|
175
166
|
file.write(file_path)
|
|
176
167
|
case ".pdbqt":
|
|
177
|
-
from .pdbqt import PDBQTFile
|
|
168
|
+
from biotite.structure.io.pdbqt import PDBQTFile
|
|
169
|
+
|
|
178
170
|
file = PDBQTFile()
|
|
179
171
|
file.set_structure(array, **kwargs)
|
|
180
172
|
file.write(file_path)
|
|
181
173
|
case ".cif" | ".pdbx":
|
|
182
|
-
from .pdbx import CIFFile, set_structure
|
|
174
|
+
from biotite.structure.io.pdbx import CIFFile, set_structure
|
|
175
|
+
|
|
183
176
|
file = CIFFile()
|
|
184
177
|
set_structure(file, array, **kwargs)
|
|
185
178
|
file.write(file_path)
|
|
186
179
|
case ".bcif":
|
|
187
|
-
from .pdbx import BinaryCIFFile, set_structure
|
|
180
|
+
from biotite.structure.io.pdbx import BinaryCIFFile, set_structure
|
|
181
|
+
|
|
188
182
|
file = BinaryCIFFile()
|
|
189
183
|
set_structure(file, array, **kwargs)
|
|
190
184
|
file.write(file_path)
|
|
191
185
|
case ".gro":
|
|
192
|
-
from .gro import GROFile
|
|
186
|
+
from biotite.structure.io.gro import GROFile
|
|
187
|
+
|
|
193
188
|
file = GROFile()
|
|
194
189
|
file.set_structure(array, **kwargs)
|
|
195
190
|
file.write(file_path)
|
|
196
|
-
case ".mmtf":
|
|
197
|
-
from .mmtf import MMTFFile, set_structure
|
|
198
|
-
file = MMTFFile()
|
|
199
|
-
set_structure(file, array, **kwargs)
|
|
200
|
-
file.write(file_path)
|
|
201
|
-
case ".npz":
|
|
202
|
-
from .npz import NpzFile
|
|
203
|
-
file = NpzFile()
|
|
204
|
-
file.set_structure(array, **kwargs)
|
|
205
|
-
file.write(file_path)
|
|
206
191
|
case ".mol":
|
|
207
|
-
from .mol import MOLFile
|
|
192
|
+
from biotite.structure.io.mol import MOLFile
|
|
193
|
+
|
|
208
194
|
file = MOLFile()
|
|
209
195
|
file.set_structure(array, **kwargs)
|
|
210
196
|
file.header = _mol_header()
|
|
211
197
|
file.write(file_path)
|
|
212
198
|
case ".sdf" | ".sd":
|
|
213
|
-
from .mol import SDFile, SDRecord, set_structure
|
|
199
|
+
from biotite.structure.io.mol import SDFile, SDRecord, set_structure
|
|
200
|
+
|
|
214
201
|
record = SDRecord()
|
|
215
202
|
record.set_structure(array, **kwargs)
|
|
216
203
|
record.header = _mol_header()
|
|
217
204
|
file = SDFile({"Molecule": record})
|
|
218
205
|
file.write(file_path)
|
|
219
|
-
case ".trr" | ".xtc" | ".
|
|
220
|
-
from .
|
|
221
|
-
from .
|
|
222
|
-
from .
|
|
223
|
-
from .
|
|
224
|
-
|
|
206
|
+
case ".trr" | ".xtc" | ".dcd" | ".netcdf":
|
|
207
|
+
from biotite.structure.io.dcd import DCDFile
|
|
208
|
+
from biotite.structure.io.netcdf import NetCDFFile
|
|
209
|
+
from biotite.structure.io.trr import TRRFile
|
|
210
|
+
from biotite.structure.io.xtc import XTCFile
|
|
211
|
+
|
|
225
212
|
if suffix == ".trr":
|
|
226
213
|
traj_file_cls = TRRFile
|
|
227
214
|
if suffix == ".xtc":
|
|
228
215
|
traj_file_cls = XTCFile
|
|
229
|
-
if suffix == ".tng":
|
|
230
|
-
traj_file_cls = TNGFile
|
|
231
216
|
if suffix == ".dcd":
|
|
232
217
|
traj_file_cls = DCDFile
|
|
233
218
|
if suffix == ".netcdf":
|
|
@@ -248,10 +233,11 @@ def _as_single_model_if_possible(atoms):
|
|
|
248
233
|
|
|
249
234
|
|
|
250
235
|
def _mol_header():
|
|
251
|
-
from .mol import Header
|
|
236
|
+
from biotite.structure.io.mol import Header
|
|
237
|
+
|
|
252
238
|
return Header(
|
|
253
239
|
mol_name="Molecule",
|
|
254
240
|
program="Biotite",
|
|
255
241
|
time=datetime.datetime.now(),
|
|
256
242
|
dimensions="3D",
|
|
257
|
-
)
|
|
243
|
+
)
|