biotite 0.41.2__cp312-cp312-macosx_11_0_arm64.whl → 1.0.1__cp312-cp312-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-312-darwin.so +0 -0
- biotite/sequence/align/buckets.py +12 -10
- biotite/sequence/align/cigar.py +43 -52
- biotite/sequence/align/kmeralphabet.cpython-312-darwin.so +0 -0
- biotite/sequence/align/kmeralphabet.pyx +55 -51
- biotite/sequence/align/kmersimilarity.cpython-312-darwin.so +0 -0
- biotite/sequence/align/kmertable.cpython-312-darwin.so +0 -0
- biotite/sequence/align/kmertable.pyx +3 -2
- biotite/sequence/align/localgapped.cpython-312-darwin.so +0 -0
- biotite/sequence/align/localungapped.cpython-312-darwin.so +0 -0
- biotite/sequence/align/matrix.py +81 -82
- biotite/sequence/align/multiple.cpython-312-darwin.so +0 -0
- biotite/sequence/align/multiple.pyx +1 -1
- biotite/sequence/align/pairwise.cpython-312-darwin.so +0 -0
- biotite/sequence/align/permutation.cpython-312-darwin.so +0 -0
- biotite/sequence/align/permutation.pyx +12 -4
- biotite/sequence/align/selector.cpython-312-darwin.so +0 -0
- biotite/sequence/align/selector.pyx +52 -54
- biotite/sequence/align/statistics.py +32 -33
- biotite/sequence/align/tracetable.cpython-312-darwin.so +0 -0
- biotite/sequence/alphabet.py +51 -65
- biotite/sequence/annotation.py +78 -77
- biotite/sequence/codec.cpython-312-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-312-darwin.so +0 -0
- biotite/sequence/phylo/tree.cpython-312-darwin.so +0 -0
- biotite/sequence/phylo/upgma.cpython-312-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 +246 -236
- biotite/structure/basepairs.py +260 -271
- biotite/structure/bonds.cpython-312-darwin.so +0 -0
- biotite/structure/bonds.pyx +29 -32
- biotite/structure/box.py +67 -71
- biotite/structure/celllist.cpython-312-darwin.so +0 -0
- biotite/structure/chains.py +55 -39
- biotite/structure/charges.cpython-312-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 +83 -78
- 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-312-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 +140 -110
- biotite/structure/io/pdbx/component.py +10 -16
- biotite/structure/io/pdbx/convert.py +260 -258
- biotite/structure/io/pdbx/encoding.cpython-312-darwin.so +0 -0
- biotite/structure/io/trajfile.py +90 -107
- 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-312-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.1.dist-info}/METADATA +6 -5
- biotite-1.0.1.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-312-darwin.so +0 -0
- biotite/structure/io/mmtf/convertarray.pyx +0 -341
- biotite/structure/io/mmtf/convertfile.cpython-312-darwin.so +0 -0
- biotite/structure/io/mmtf/convertfile.pyx +0 -501
- biotite/structure/io/mmtf/decode.cpython-312-darwin.so +0 -0
- biotite/structure/io/mmtf/decode.pyx +0 -152
- biotite/structure/io/mmtf/encode.cpython-312-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.1.dist-info}/WHEEL +0 -0
- {biotite-0.41.2.dist-info → biotite-1.0.1.dist-info}/licenses/LICENSE.rst +0 -0
biotite/__init__.py
CHANGED
|
@@ -12,8 +12,7 @@ modules.
|
|
|
12
12
|
__name__ = "biotite"
|
|
13
13
|
__author__ = "Patrick Kunzmann"
|
|
14
14
|
|
|
15
|
-
from .file import *
|
|
16
|
-
from .temp import *
|
|
17
15
|
from .copyable import *
|
|
16
|
+
from .file import *
|
|
17
|
+
from .version import __version__, __version_tuple__ # noqa: F401
|
|
18
18
|
from .visualize import *
|
|
19
|
-
from .version import __version__, __version_tuple__
|
biotite/application/__init__.py
CHANGED
|
@@ -4,19 +4,26 @@
|
|
|
4
4
|
|
|
5
5
|
__name__ = "biotite.application"
|
|
6
6
|
__author__ = "Patrick Kunzmann"
|
|
7
|
-
__all__ = [
|
|
8
|
-
|
|
7
|
+
__all__ = [
|
|
8
|
+
"Application",
|
|
9
|
+
"AppStateError",
|
|
10
|
+
"TimeoutError",
|
|
11
|
+
"VersionError",
|
|
12
|
+
"AppState",
|
|
13
|
+
"requires_state",
|
|
14
|
+
]
|
|
9
15
|
|
|
10
16
|
import abc
|
|
11
17
|
import time
|
|
12
|
-
from functools import wraps
|
|
13
18
|
from enum import Flag, auto
|
|
19
|
+
from functools import wraps
|
|
14
20
|
|
|
15
21
|
|
|
16
22
|
class AppState(Flag):
|
|
17
23
|
"""
|
|
18
24
|
This enum type represents the app states of an application.
|
|
19
25
|
"""
|
|
26
|
+
|
|
20
27
|
CREATED = auto()
|
|
21
28
|
RUNNING = auto()
|
|
22
29
|
FINISHED = auto()
|
|
@@ -45,6 +52,7 @@ def requires_state(app_state):
|
|
|
45
52
|
... def function(self):
|
|
46
53
|
... pass
|
|
47
54
|
"""
|
|
55
|
+
|
|
48
56
|
def decorator(func):
|
|
49
57
|
@wraps(func)
|
|
50
58
|
def wrapper(*args, **kwargs):
|
|
@@ -52,16 +60,16 @@ def requires_state(app_state):
|
|
|
52
60
|
try:
|
|
53
61
|
instance = args[0]
|
|
54
62
|
except IndexError:
|
|
55
|
-
raise TypeError(
|
|
56
|
-
"This method must be called from a class instance"
|
|
57
|
-
)
|
|
63
|
+
raise TypeError("This method must be called from a class instance")
|
|
58
64
|
if not instance._state & app_state:
|
|
59
65
|
raise AppStateError(
|
|
60
66
|
f"The application is in {instance.get_app_state()} state, "
|
|
61
67
|
f"but {app_state} state is required"
|
|
62
68
|
)
|
|
63
69
|
return func(*args, **kwargs)
|
|
70
|
+
|
|
64
71
|
return wrapper
|
|
72
|
+
|
|
65
73
|
return decorator
|
|
66
74
|
|
|
67
75
|
|
|
@@ -146,11 +154,10 @@ class Application(metaclass=abc.ABCMeta):
|
|
|
146
154
|
"""
|
|
147
155
|
time.sleep(self.wait_interval())
|
|
148
156
|
while self.get_app_state() != AppState.FINISHED:
|
|
149
|
-
if timeout is not None and time.time()-self._start_time > timeout:
|
|
157
|
+
if timeout is not None and time.time() - self._start_time > timeout:
|
|
150
158
|
self.cancel()
|
|
151
159
|
raise TimeoutError(
|
|
152
|
-
f"The application expired its timeout "
|
|
153
|
-
f"({timeout:.1f} s)"
|
|
160
|
+
f"The application expired its timeout " f"({timeout:.1f} s)"
|
|
154
161
|
)
|
|
155
162
|
else:
|
|
156
163
|
time.sleep(self.wait_interval())
|
|
@@ -249,6 +256,7 @@ class AppStateError(Exception):
|
|
|
249
256
|
"""
|
|
250
257
|
Indicate that the application lifecycle was violated.
|
|
251
258
|
"""
|
|
259
|
+
|
|
252
260
|
pass
|
|
253
261
|
|
|
254
262
|
|
|
@@ -256,6 +264,7 @@ class TimeoutError(Exception):
|
|
|
256
264
|
"""
|
|
257
265
|
Indicate that the application's timeout expired.
|
|
258
266
|
"""
|
|
267
|
+
|
|
259
268
|
pass
|
|
260
269
|
|
|
261
270
|
|
|
@@ -263,4 +272,5 @@ class VersionError(Exception):
|
|
|
263
272
|
"""
|
|
264
273
|
Indicate that the application's version is invalid.
|
|
265
274
|
"""
|
|
266
|
-
|
|
275
|
+
|
|
276
|
+
pass
|
|
@@ -9,12 +9,12 @@ __all__ = ["VinaApp"]
|
|
|
9
9
|
import copy
|
|
10
10
|
from tempfile import NamedTemporaryFile
|
|
11
11
|
import numpy as np
|
|
12
|
-
from
|
|
13
|
-
from
|
|
14
|
-
from
|
|
15
|
-
from
|
|
16
|
-
from
|
|
17
|
-
from
|
|
12
|
+
from biotite.application.application import AppState, requires_state
|
|
13
|
+
from biotite.application.localapp import LocalApp, cleanup_tempfile
|
|
14
|
+
from biotite.structure.bonds import find_connected
|
|
15
|
+
from biotite.structure.error import BadStructureError
|
|
16
|
+
from biotite.structure.io.pdbqt import PDBQTFile
|
|
17
|
+
from biotite.structure.residues import get_residue_masks, get_residue_starts_for
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
class VinaApp(LocalApp):
|
|
@@ -62,8 +62,8 @@ class VinaApp(LocalApp):
|
|
|
62
62
|
... flexible=(receptor.res_id == 2) | (receptor.res_id == 5)
|
|
63
63
|
... )
|
|
64
64
|
"""
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
|
|
66
|
+
def __init__(self, ligand, receptor, center, size, flexible=None, bin_path="vina"):
|
|
67
67
|
super().__init__(bin_path)
|
|
68
68
|
|
|
69
69
|
if ligand.bonds is None:
|
|
@@ -83,23 +83,17 @@ class VinaApp(LocalApp):
|
|
|
83
83
|
|
|
84
84
|
if self._is_flexible:
|
|
85
85
|
flexible_indices = np.where(flexible)[0]
|
|
86
|
-
self._flex_res_starts = np.unique(
|
|
87
|
-
receptor, flexible_indices
|
|
88
|
-
)
|
|
89
|
-
|
|
90
|
-
self._ligand_file
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
self._receptor_file = NamedTemporaryFile(
|
|
94
|
-
"w", suffix=".pdbqt", delete=False
|
|
95
|
-
)
|
|
96
|
-
self._receptor_flex_file = NamedTemporaryFile(
|
|
86
|
+
self._flex_res_starts = np.unique(
|
|
87
|
+
get_residue_starts_for(receptor, flexible_indices)
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
self._ligand_file = NamedTemporaryFile("w", suffix=".pdbqt", delete=False)
|
|
91
|
+
self._receptor_file = NamedTemporaryFile("w", suffix=".pdbqt", delete=False)
|
|
92
|
+
self._receptor_flex_file = NamedTemporaryFile(
|
|
97
93
|
"w", suffix=".pdbqt", delete=False
|
|
98
94
|
)
|
|
99
|
-
self._out_file
|
|
100
|
-
|
|
101
|
-
)
|
|
102
|
-
|
|
95
|
+
self._out_file = NamedTemporaryFile("r", suffix=".pdbqt", delete=False)
|
|
96
|
+
|
|
103
97
|
@requires_state(AppState.CREATED)
|
|
104
98
|
def set_seed(self, seed):
|
|
105
99
|
"""
|
|
@@ -114,7 +108,7 @@ class VinaApp(LocalApp):
|
|
|
114
108
|
The seed for the random number generator.
|
|
115
109
|
"""
|
|
116
110
|
self._seed = seed
|
|
117
|
-
|
|
111
|
+
|
|
118
112
|
@requires_state(AppState.CREATED)
|
|
119
113
|
def set_exhaustiveness(self, exhaustiveness):
|
|
120
114
|
"""
|
|
@@ -131,7 +125,7 @@ class VinaApp(LocalApp):
|
|
|
131
125
|
Must be greater than 0.
|
|
132
126
|
"""
|
|
133
127
|
self._exhaustiveness = exhaustiveness
|
|
134
|
-
|
|
128
|
+
|
|
135
129
|
@requires_state(AppState.CREATED)
|
|
136
130
|
def set_max_number_of_models(self, number):
|
|
137
131
|
"""
|
|
@@ -147,7 +141,7 @@ class VinaApp(LocalApp):
|
|
|
147
141
|
The maximum number of generated modes/models.
|
|
148
142
|
"""
|
|
149
143
|
self._number = number
|
|
150
|
-
|
|
144
|
+
|
|
151
145
|
@requires_state(AppState.CREATED)
|
|
152
146
|
def set_energy_range(self, energy_range):
|
|
153
147
|
"""
|
|
@@ -168,34 +162,31 @@ class VinaApp(LocalApp):
|
|
|
168
162
|
# Use different atom ID ranges for atoms in ligand and receptor
|
|
169
163
|
# for unambiguous assignment, if the receptor contains flexible
|
|
170
164
|
# residues
|
|
171
|
-
self._ligand.set_annotation(
|
|
172
|
-
1,
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
165
|
+
self._ligand.set_annotation(
|
|
166
|
+
"atom_id", np.arange(1, self._ligand.array_length() + 1)
|
|
167
|
+
)
|
|
168
|
+
self._receptor.set_annotation(
|
|
169
|
+
"atom_id",
|
|
170
|
+
np.arange(
|
|
171
|
+
self._ligand.array_length() + 1,
|
|
172
|
+
self._ligand.array_length() + self._receptor.array_length() + 1,
|
|
173
|
+
),
|
|
174
|
+
)
|
|
179
175
|
|
|
180
176
|
ligand_file = PDBQTFile()
|
|
181
|
-
# Contains 'true' entries for all atoms that have not been
|
|
177
|
+
# Contains 'true' entries for all atoms that have not been
|
|
182
178
|
# removed from ligand
|
|
183
179
|
self._ligand_mask = ligand_file.set_structure(
|
|
184
|
-
self._ligand,
|
|
185
|
-
rotatable_bonds="all"
|
|
180
|
+
self._ligand, rotatable_bonds="all"
|
|
186
181
|
)
|
|
187
182
|
ligand_file.write(self._ligand_file)
|
|
188
183
|
self._ligand_file.flush()
|
|
189
|
-
|
|
184
|
+
|
|
190
185
|
if self._is_flexible:
|
|
191
|
-
self._rigid_mask = np.ones(
|
|
192
|
-
|
|
193
|
-
)
|
|
194
|
-
# Contains 'true' entries for all atoms that have not been
|
|
186
|
+
self._rigid_mask = np.ones(self._receptor.array_length(), dtype=bool)
|
|
187
|
+
# Contains 'true' entries for all atoms that have not been
|
|
195
188
|
# removed from receptor in flexible side chains
|
|
196
|
-
self._receptor_mask = np.zeros(
|
|
197
|
-
self._receptor.array_length(), dtype=bool
|
|
198
|
-
)
|
|
189
|
+
self._receptor_mask = np.zeros(self._receptor.array_length(), dtype=bool)
|
|
199
190
|
for i, start in enumerate(self._flex_res_starts):
|
|
200
191
|
flex_mask, rigid_mask, root = self._get_flexible_residue(start)
|
|
201
192
|
self._rigid_mask &= rigid_mask
|
|
@@ -207,7 +198,7 @@ class VinaApp(LocalApp):
|
|
|
207
198
|
self._receptor[flex_mask],
|
|
208
199
|
rotatable_bonds="all",
|
|
209
200
|
root=root_in_flex_residue,
|
|
210
|
-
include_torsdof=False
|
|
201
|
+
include_torsdof=False,
|
|
211
202
|
)
|
|
212
203
|
# Enclose each flexible residue
|
|
213
204
|
# with BEGIN_RES and END_RES
|
|
@@ -220,7 +211,7 @@ class VinaApp(LocalApp):
|
|
|
220
211
|
receptor_file.set_structure(
|
|
221
212
|
self._receptor[self._rigid_mask],
|
|
222
213
|
rotatable_bonds=None,
|
|
223
|
-
include_torsdof=False
|
|
214
|
+
include_torsdof=False,
|
|
224
215
|
)
|
|
225
216
|
receptor_file.write(self._receptor_file)
|
|
226
217
|
self._receptor_file.flush()
|
|
@@ -228,23 +219,30 @@ class VinaApp(LocalApp):
|
|
|
228
219
|
else:
|
|
229
220
|
receptor_file = PDBQTFile()
|
|
230
221
|
receptor_file.set_structure(
|
|
231
|
-
self._receptor,
|
|
232
|
-
rotatable_bonds=None,
|
|
233
|
-
include_torsdof=False
|
|
222
|
+
self._receptor, rotatable_bonds=None, include_torsdof=False
|
|
234
223
|
)
|
|
235
224
|
receptor_file.write(self._receptor_file)
|
|
236
225
|
self._receptor_file.flush()
|
|
237
226
|
|
|
238
227
|
arguments = [
|
|
239
|
-
"--ligand",
|
|
240
|
-
|
|
241
|
-
"--
|
|
242
|
-
|
|
243
|
-
"--
|
|
244
|
-
|
|
245
|
-
"--
|
|
246
|
-
|
|
247
|
-
"--
|
|
228
|
+
"--ligand",
|
|
229
|
+
self._ligand_file.name,
|
|
230
|
+
"--receptor",
|
|
231
|
+
self._receptor_file.name,
|
|
232
|
+
"--out",
|
|
233
|
+
self._out_file.name,
|
|
234
|
+
"--center_x",
|
|
235
|
+
f"{self._center[0]:.3f}",
|
|
236
|
+
"--center_y",
|
|
237
|
+
f"{self._center[1]:.3f}",
|
|
238
|
+
"--center_z",
|
|
239
|
+
f"{self._center[2]:.3f}",
|
|
240
|
+
"--size_x",
|
|
241
|
+
f"{self._size[0]:.3f}",
|
|
242
|
+
"--size_y",
|
|
243
|
+
f"{self._size[1]:.3f}",
|
|
244
|
+
"--size_z",
|
|
245
|
+
f"{self._size[2]:.3f}",
|
|
248
246
|
]
|
|
249
247
|
if self._seed is not None:
|
|
250
248
|
arguments.extend(["--seed", str(self._seed)])
|
|
@@ -259,32 +257,32 @@ class VinaApp(LocalApp):
|
|
|
259
257
|
|
|
260
258
|
self.set_arguments(arguments)
|
|
261
259
|
super().run()
|
|
262
|
-
|
|
260
|
+
|
|
263
261
|
def evaluate(self):
|
|
264
262
|
super().evaluate()
|
|
265
263
|
out_file = PDBQTFile.read(self._out_file)
|
|
266
|
-
|
|
264
|
+
|
|
267
265
|
models = out_file.get_structure()
|
|
268
266
|
|
|
269
267
|
n_ligand_atoms = np.count_nonzero(self._ligand_mask)
|
|
270
268
|
self._ligand_models = models[..., :n_ligand_atoms]
|
|
271
269
|
self._flex_models = models[..., n_ligand_atoms:]
|
|
272
270
|
self._n_models = models.stack_depth()
|
|
273
|
-
|
|
271
|
+
|
|
274
272
|
remarks = out_file.get_remarks()
|
|
275
273
|
self._energies = np.array(
|
|
276
274
|
# VINA RESULT: -5.8 0.000 0.000
|
|
277
275
|
# ^
|
|
278
276
|
[float(remark[12:].split()[0]) for remark in remarks]
|
|
279
277
|
)
|
|
280
|
-
|
|
278
|
+
|
|
281
279
|
def clean_up(self):
|
|
282
280
|
super().clean_up()
|
|
283
281
|
cleanup_tempfile(self._ligand_file)
|
|
284
282
|
cleanup_tempfile(self._receptor_file)
|
|
285
283
|
cleanup_tempfile(self._receptor_flex_file)
|
|
286
284
|
cleanup_tempfile(self._out_file)
|
|
287
|
-
|
|
285
|
+
|
|
288
286
|
@requires_state(AppState.JOINED)
|
|
289
287
|
def get_energies(self):
|
|
290
288
|
"""
|
|
@@ -302,7 +300,7 @@ class VinaApp(LocalApp):
|
|
|
302
300
|
@requires_state(AppState.JOINED)
|
|
303
301
|
def get_ligand_models(self):
|
|
304
302
|
"""
|
|
305
|
-
Get the ligand structure with the conformations for each
|
|
303
|
+
Get the ligand structure with the conformations for each
|
|
306
304
|
generated binding mode.
|
|
307
305
|
|
|
308
306
|
Returns
|
|
@@ -312,7 +310,7 @@ class VinaApp(LocalApp):
|
|
|
312
310
|
Each model corresponds to one binding mode.
|
|
313
311
|
The models are sorted from best to worst predicted binding
|
|
314
312
|
affinity.
|
|
315
|
-
|
|
313
|
+
|
|
316
314
|
Notes
|
|
317
315
|
-----
|
|
318
316
|
The returned structure may contain less atoms than the input
|
|
@@ -338,12 +336,11 @@ class VinaApp(LocalApp):
|
|
|
338
336
|
atoms are set to *NaN*.
|
|
339
337
|
"""
|
|
340
338
|
coord = np.full(
|
|
341
|
-
(self._n_models, self._ligand.array_length(), 3),
|
|
342
|
-
np.nan, dtype=np.float32
|
|
339
|
+
(self._n_models, self._ligand.array_length(), 3), np.nan, dtype=np.float32
|
|
343
340
|
)
|
|
344
341
|
coord[:, self._ligand_mask] = self._ligand_models.coord
|
|
345
342
|
return coord
|
|
346
|
-
|
|
343
|
+
|
|
347
344
|
@requires_state(AppState.JOINED)
|
|
348
345
|
def get_flexible_residue_models(self):
|
|
349
346
|
"""
|
|
@@ -360,7 +357,7 @@ class VinaApp(LocalApp):
|
|
|
360
357
|
Each model corresponds to one binding mode.
|
|
361
358
|
The models are sorted from best to worst predicted binding
|
|
362
359
|
affinity.
|
|
363
|
-
|
|
360
|
+
|
|
364
361
|
Notes
|
|
365
362
|
-----
|
|
366
363
|
The returned structure may contain less atoms than the input
|
|
@@ -385,7 +382,7 @@ class VinaApp(LocalApp):
|
|
|
385
382
|
affinity.
|
|
386
383
|
Missing coordinates due to the removed nonpolar hydrogen
|
|
387
384
|
atoms from flexible side chains are set to *NaN*.
|
|
388
|
-
|
|
385
|
+
|
|
389
386
|
Notes
|
|
390
387
|
-----
|
|
391
388
|
The output is only meaningful, if flexible side chains were
|
|
@@ -394,8 +391,7 @@ class VinaApp(LocalApp):
|
|
|
394
391
|
of the input receptor coordinates.
|
|
395
392
|
"""
|
|
396
393
|
coord = np.repeat(
|
|
397
|
-
self._receptor.coord[np.newaxis, ...],
|
|
398
|
-
repeats=self._n_models, axis=0
|
|
394
|
+
self._receptor.coord[np.newaxis, ...], repeats=self._n_models, axis=0
|
|
399
395
|
)
|
|
400
396
|
if self._is_flexible:
|
|
401
397
|
# Replace original coordinates with modeled coordinates
|
|
@@ -424,16 +420,16 @@ class VinaApp(LocalApp):
|
|
|
424
420
|
root_connect_indices, _ = self._receptor.bonds.get_bonds(root_index)
|
|
425
421
|
connected_index = None
|
|
426
422
|
try:
|
|
427
|
-
connected_index = root_connect_indices[
|
|
428
|
-
self._receptor.atom_name[root_connect_indices], ("CB",)
|
|
429
|
-
|
|
423
|
+
connected_index = root_connect_indices[
|
|
424
|
+
np.isin(self._receptor.atom_name[root_connect_indices], ("CB",))
|
|
425
|
+
][0]
|
|
430
426
|
except IndexError:
|
|
431
427
|
# Residue has no appropriate connection (e.g. in glycine)
|
|
432
428
|
# -> There is no atom in the flexible side chain
|
|
433
429
|
flex_mask = np.zeros(self._receptor.array_length(), dtype=bool)
|
|
434
430
|
rigid_mask = np.ones(self._receptor.array_length(), dtype=bool)
|
|
435
431
|
return flex_mask, rigid_mask, root_index
|
|
436
|
-
|
|
432
|
+
|
|
437
433
|
# Remove the root bond from the bond list
|
|
438
434
|
# to find the atoms involved in the flexible part
|
|
439
435
|
bonds = self._receptor.bonds.copy()
|
|
@@ -442,7 +438,7 @@ class VinaApp(LocalApp):
|
|
|
442
438
|
if root_index in flexible_indices:
|
|
443
439
|
raise BadStructureError(
|
|
444
440
|
"There are multiple connections between the flexible and "
|
|
445
|
-
"rigid part, maybe a cyclic residue like proline was selected"
|
|
441
|
+
"rigid part, maybe a cyclic residue like proline was selected"
|
|
446
442
|
)
|
|
447
443
|
|
|
448
444
|
flex_mask = np.zeros(self._receptor.array_length(), dtype=bool)
|
|
@@ -452,7 +448,6 @@ class VinaApp(LocalApp):
|
|
|
452
448
|
flex_mask[root_index] = True
|
|
453
449
|
|
|
454
450
|
return flex_mask, rigid_mask, root_index
|
|
455
|
-
|
|
456
451
|
|
|
457
452
|
@staticmethod
|
|
458
453
|
def dock(ligand, receptor, center, size, flexible=None, bin_path="vina"):
|
|
@@ -6,7 +6,7 @@ __name__ = "biotite.application.blast"
|
|
|
6
6
|
__author__ = "Patrick Kunzmann"
|
|
7
7
|
__all__ = ["BlastAlignment"]
|
|
8
8
|
|
|
9
|
-
from
|
|
9
|
+
from biotite.sequence.align.alignment import Alignment
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
class BlastAlignment(Alignment):
|
|
@@ -14,10 +14,10 @@ class BlastAlignment(Alignment):
|
|
|
14
14
|
A specialized :class:`Alignment` class for alignments using the
|
|
15
15
|
BLAST application. It stores additional data, like the E-value,
|
|
16
16
|
the HSP position and a description of the hit sequence.
|
|
17
|
-
|
|
17
|
+
|
|
18
18
|
Like its superclass, all attributes of a :class:`BlastAlignment` are
|
|
19
19
|
public. The attributes are the same as the constructor parameters.
|
|
20
|
-
|
|
20
|
+
|
|
21
21
|
Parameters
|
|
22
22
|
----------
|
|
23
23
|
sequences : list
|
|
@@ -44,16 +44,25 @@ class BlastAlignment(Alignment):
|
|
|
44
44
|
hit_definition : str
|
|
45
45
|
The name of the hit sequence.
|
|
46
46
|
"""
|
|
47
|
-
|
|
48
|
-
def __init__(
|
|
49
|
-
|
|
47
|
+
|
|
48
|
+
def __init__(
|
|
49
|
+
self,
|
|
50
|
+
sequences,
|
|
51
|
+
trace,
|
|
52
|
+
score,
|
|
53
|
+
e_value,
|
|
54
|
+
query_interval,
|
|
55
|
+
hit_interval,
|
|
56
|
+
hit_id,
|
|
57
|
+
hit_definition,
|
|
58
|
+
):
|
|
50
59
|
super().__init__(sequences, trace, score)
|
|
51
60
|
self.e_value = e_value
|
|
52
61
|
self.query_interval = query_interval
|
|
53
62
|
self.hit_interval = hit_interval
|
|
54
63
|
self.hit_id = hit_id
|
|
55
64
|
self.hit_definition = hit_definition
|
|
56
|
-
|
|
65
|
+
|
|
57
66
|
def __eq__(self, item):
|
|
58
67
|
if not isinstance(item, BlastAlignment):
|
|
59
68
|
return False
|
|
@@ -68,7 +77,7 @@ class BlastAlignment(Alignment):
|
|
|
68
77
|
if self.hit_definition != item.hit_definition:
|
|
69
78
|
return False
|
|
70
79
|
return super().__eq__(item)
|
|
71
|
-
|
|
80
|
+
|
|
72
81
|
def __getitem__(self, index):
|
|
73
82
|
super_alignment = super().__getitem__(index)
|
|
74
83
|
return BlastAlignment(
|
|
@@ -79,5 +88,5 @@ class BlastAlignment(Alignment):
|
|
|
79
88
|
self.query_interval,
|
|
80
89
|
self.hit_interval,
|
|
81
90
|
self.hit_id,
|
|
82
|
-
self.hit_definition
|
|
83
|
-
)
|
|
91
|
+
self.hit_definition,
|
|
92
|
+
)
|