biotite 0.41.1__cp312-cp312-macosx_10_16_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.

Files changed (340) hide show
  1. biotite/__init__.py +19 -0
  2. biotite/application/__init__.py +43 -0
  3. biotite/application/application.py +265 -0
  4. biotite/application/autodock/__init__.py +12 -0
  5. biotite/application/autodock/app.py +505 -0
  6. biotite/application/blast/__init__.py +14 -0
  7. biotite/application/blast/alignment.py +83 -0
  8. biotite/application/blast/webapp.py +421 -0
  9. biotite/application/clustalo/__init__.py +12 -0
  10. biotite/application/clustalo/app.py +238 -0
  11. biotite/application/dssp/__init__.py +12 -0
  12. biotite/application/dssp/app.py +152 -0
  13. biotite/application/localapp.py +306 -0
  14. biotite/application/mafft/__init__.py +12 -0
  15. biotite/application/mafft/app.py +122 -0
  16. biotite/application/msaapp.py +374 -0
  17. biotite/application/muscle/__init__.py +13 -0
  18. biotite/application/muscle/app3.py +254 -0
  19. biotite/application/muscle/app5.py +171 -0
  20. biotite/application/sra/__init__.py +18 -0
  21. biotite/application/sra/app.py +456 -0
  22. biotite/application/tantan/__init__.py +12 -0
  23. biotite/application/tantan/app.py +222 -0
  24. biotite/application/util.py +59 -0
  25. biotite/application/viennarna/__init__.py +18 -0
  26. biotite/application/viennarna/rnaalifold.py +304 -0
  27. biotite/application/viennarna/rnafold.py +269 -0
  28. biotite/application/viennarna/rnaplot.py +187 -0
  29. biotite/application/viennarna/util.py +72 -0
  30. biotite/application/webapp.py +77 -0
  31. biotite/copyable.py +71 -0
  32. biotite/database/__init__.py +23 -0
  33. biotite/database/entrez/__init__.py +15 -0
  34. biotite/database/entrez/check.py +61 -0
  35. biotite/database/entrez/dbnames.py +89 -0
  36. biotite/database/entrez/download.py +223 -0
  37. biotite/database/entrez/key.py +44 -0
  38. biotite/database/entrez/query.py +223 -0
  39. biotite/database/error.py +15 -0
  40. biotite/database/pubchem/__init__.py +21 -0
  41. biotite/database/pubchem/download.py +260 -0
  42. biotite/database/pubchem/error.py +20 -0
  43. biotite/database/pubchem/query.py +827 -0
  44. biotite/database/pubchem/throttle.py +99 -0
  45. biotite/database/rcsb/__init__.py +13 -0
  46. biotite/database/rcsb/download.py +167 -0
  47. biotite/database/rcsb/query.py +959 -0
  48. biotite/database/uniprot/__init__.py +13 -0
  49. biotite/database/uniprot/check.py +32 -0
  50. biotite/database/uniprot/download.py +134 -0
  51. biotite/database/uniprot/query.py +209 -0
  52. biotite/file.py +251 -0
  53. biotite/sequence/__init__.py +73 -0
  54. biotite/sequence/align/__init__.py +49 -0
  55. biotite/sequence/align/alignment.py +658 -0
  56. biotite/sequence/align/banded.cpython-312-darwin.so +0 -0
  57. biotite/sequence/align/banded.pyx +652 -0
  58. biotite/sequence/align/buckets.py +69 -0
  59. biotite/sequence/align/cigar.py +434 -0
  60. biotite/sequence/align/kmeralphabet.cpython-312-darwin.so +0 -0
  61. biotite/sequence/align/kmeralphabet.pyx +574 -0
  62. biotite/sequence/align/kmersimilarity.cpython-312-darwin.so +0 -0
  63. biotite/sequence/align/kmersimilarity.pyx +233 -0
  64. biotite/sequence/align/kmertable.cpython-312-darwin.so +0 -0
  65. biotite/sequence/align/kmertable.pyx +3400 -0
  66. biotite/sequence/align/localgapped.cpython-312-darwin.so +0 -0
  67. biotite/sequence/align/localgapped.pyx +892 -0
  68. biotite/sequence/align/localungapped.cpython-312-darwin.so +0 -0
  69. biotite/sequence/align/localungapped.pyx +279 -0
  70. biotite/sequence/align/matrix.py +405 -0
  71. biotite/sequence/align/matrix_data/BLOSUM100.mat +31 -0
  72. biotite/sequence/align/matrix_data/BLOSUM30.mat +31 -0
  73. biotite/sequence/align/matrix_data/BLOSUM35.mat +31 -0
  74. biotite/sequence/align/matrix_data/BLOSUM40.mat +31 -0
  75. biotite/sequence/align/matrix_data/BLOSUM45.mat +31 -0
  76. biotite/sequence/align/matrix_data/BLOSUM50.mat +31 -0
  77. biotite/sequence/align/matrix_data/BLOSUM50_13p.mat +25 -0
  78. biotite/sequence/align/matrix_data/BLOSUM50_14.3.mat +25 -0
  79. biotite/sequence/align/matrix_data/BLOSUM50_5.0.mat +25 -0
  80. biotite/sequence/align/matrix_data/BLOSUM55.mat +31 -0
  81. biotite/sequence/align/matrix_data/BLOSUM60.mat +31 -0
  82. biotite/sequence/align/matrix_data/BLOSUM62.mat +31 -0
  83. biotite/sequence/align/matrix_data/BLOSUM62_13p.mat +25 -0
  84. biotite/sequence/align/matrix_data/BLOSUM62_14.3.mat +25 -0
  85. biotite/sequence/align/matrix_data/BLOSUM62_5.0.mat +25 -0
  86. biotite/sequence/align/matrix_data/BLOSUM65.mat +31 -0
  87. biotite/sequence/align/matrix_data/BLOSUM70.mat +31 -0
  88. biotite/sequence/align/matrix_data/BLOSUM75.mat +31 -0
  89. biotite/sequence/align/matrix_data/BLOSUM80.mat +31 -0
  90. biotite/sequence/align/matrix_data/BLOSUM85.mat +31 -0
  91. biotite/sequence/align/matrix_data/BLOSUM90.mat +31 -0
  92. biotite/sequence/align/matrix_data/BLOSUMN.mat +31 -0
  93. biotite/sequence/align/matrix_data/CorBLOSUM49_5.0.mat +25 -0
  94. biotite/sequence/align/matrix_data/CorBLOSUM57_13p.mat +25 -0
  95. biotite/sequence/align/matrix_data/CorBLOSUM57_14.3.mat +25 -0
  96. biotite/sequence/align/matrix_data/CorBLOSUM61_5.0.mat +25 -0
  97. biotite/sequence/align/matrix_data/CorBLOSUM66_13p.mat +25 -0
  98. biotite/sequence/align/matrix_data/CorBLOSUM67_14.3.mat +25 -0
  99. biotite/sequence/align/matrix_data/DAYHOFF.mat +32 -0
  100. biotite/sequence/align/matrix_data/GONNET.mat +26 -0
  101. biotite/sequence/align/matrix_data/IDENTITY.mat +25 -0
  102. biotite/sequence/align/matrix_data/MATCH.mat +25 -0
  103. biotite/sequence/align/matrix_data/NUC.mat +25 -0
  104. biotite/sequence/align/matrix_data/PAM10.mat +34 -0
  105. biotite/sequence/align/matrix_data/PAM100.mat +34 -0
  106. biotite/sequence/align/matrix_data/PAM110.mat +34 -0
  107. biotite/sequence/align/matrix_data/PAM120.mat +34 -0
  108. biotite/sequence/align/matrix_data/PAM130.mat +34 -0
  109. biotite/sequence/align/matrix_data/PAM140.mat +34 -0
  110. biotite/sequence/align/matrix_data/PAM150.mat +34 -0
  111. biotite/sequence/align/matrix_data/PAM160.mat +34 -0
  112. biotite/sequence/align/matrix_data/PAM170.mat +34 -0
  113. biotite/sequence/align/matrix_data/PAM180.mat +34 -0
  114. biotite/sequence/align/matrix_data/PAM190.mat +34 -0
  115. biotite/sequence/align/matrix_data/PAM20.mat +34 -0
  116. biotite/sequence/align/matrix_data/PAM200.mat +34 -0
  117. biotite/sequence/align/matrix_data/PAM210.mat +34 -0
  118. biotite/sequence/align/matrix_data/PAM220.mat +34 -0
  119. biotite/sequence/align/matrix_data/PAM230.mat +34 -0
  120. biotite/sequence/align/matrix_data/PAM240.mat +34 -0
  121. biotite/sequence/align/matrix_data/PAM250.mat +34 -0
  122. biotite/sequence/align/matrix_data/PAM260.mat +34 -0
  123. biotite/sequence/align/matrix_data/PAM270.mat +34 -0
  124. biotite/sequence/align/matrix_data/PAM280.mat +34 -0
  125. biotite/sequence/align/matrix_data/PAM290.mat +34 -0
  126. biotite/sequence/align/matrix_data/PAM30.mat +34 -0
  127. biotite/sequence/align/matrix_data/PAM300.mat +34 -0
  128. biotite/sequence/align/matrix_data/PAM310.mat +34 -0
  129. biotite/sequence/align/matrix_data/PAM320.mat +34 -0
  130. biotite/sequence/align/matrix_data/PAM330.mat +34 -0
  131. biotite/sequence/align/matrix_data/PAM340.mat +34 -0
  132. biotite/sequence/align/matrix_data/PAM350.mat +34 -0
  133. biotite/sequence/align/matrix_data/PAM360.mat +34 -0
  134. biotite/sequence/align/matrix_data/PAM370.mat +34 -0
  135. biotite/sequence/align/matrix_data/PAM380.mat +34 -0
  136. biotite/sequence/align/matrix_data/PAM390.mat +34 -0
  137. biotite/sequence/align/matrix_data/PAM40.mat +34 -0
  138. biotite/sequence/align/matrix_data/PAM400.mat +34 -0
  139. biotite/sequence/align/matrix_data/PAM410.mat +34 -0
  140. biotite/sequence/align/matrix_data/PAM420.mat +34 -0
  141. biotite/sequence/align/matrix_data/PAM430.mat +34 -0
  142. biotite/sequence/align/matrix_data/PAM440.mat +34 -0
  143. biotite/sequence/align/matrix_data/PAM450.mat +34 -0
  144. biotite/sequence/align/matrix_data/PAM460.mat +34 -0
  145. biotite/sequence/align/matrix_data/PAM470.mat +34 -0
  146. biotite/sequence/align/matrix_data/PAM480.mat +34 -0
  147. biotite/sequence/align/matrix_data/PAM490.mat +34 -0
  148. biotite/sequence/align/matrix_data/PAM50.mat +34 -0
  149. biotite/sequence/align/matrix_data/PAM500.mat +34 -0
  150. biotite/sequence/align/matrix_data/PAM60.mat +34 -0
  151. biotite/sequence/align/matrix_data/PAM70.mat +34 -0
  152. biotite/sequence/align/matrix_data/PAM80.mat +34 -0
  153. biotite/sequence/align/matrix_data/PAM90.mat +34 -0
  154. biotite/sequence/align/matrix_data/RBLOSUM52_5.0.mat +25 -0
  155. biotite/sequence/align/matrix_data/RBLOSUM59_13p.mat +25 -0
  156. biotite/sequence/align/matrix_data/RBLOSUM59_14.3.mat +25 -0
  157. biotite/sequence/align/matrix_data/RBLOSUM64_5.0.mat +25 -0
  158. biotite/sequence/align/matrix_data/RBLOSUM69_13p.mat +25 -0
  159. biotite/sequence/align/matrix_data/RBLOSUM69_14.3.mat +25 -0
  160. biotite/sequence/align/multiple.cpython-312-darwin.so +0 -0
  161. biotite/sequence/align/multiple.pyx +620 -0
  162. biotite/sequence/align/pairwise.cpython-312-darwin.so +0 -0
  163. biotite/sequence/align/pairwise.pyx +587 -0
  164. biotite/sequence/align/permutation.cpython-312-darwin.so +0 -0
  165. biotite/sequence/align/permutation.pyx +305 -0
  166. biotite/sequence/align/primes.txt +821 -0
  167. biotite/sequence/align/selector.cpython-312-darwin.so +0 -0
  168. biotite/sequence/align/selector.pyx +956 -0
  169. biotite/sequence/align/statistics.py +265 -0
  170. biotite/sequence/align/tracetable.cpython-312-darwin.so +0 -0
  171. biotite/sequence/align/tracetable.pxd +64 -0
  172. biotite/sequence/align/tracetable.pyx +370 -0
  173. biotite/sequence/alphabet.py +566 -0
  174. biotite/sequence/annotation.py +829 -0
  175. biotite/sequence/codec.cpython-312-darwin.so +0 -0
  176. biotite/sequence/codec.pyx +155 -0
  177. biotite/sequence/codon.py +466 -0
  178. biotite/sequence/codon_tables.txt +202 -0
  179. biotite/sequence/graphics/__init__.py +33 -0
  180. biotite/sequence/graphics/alignment.py +1034 -0
  181. biotite/sequence/graphics/color_schemes/autumn.json +51 -0
  182. biotite/sequence/graphics/color_schemes/blossom.json +51 -0
  183. biotite/sequence/graphics/color_schemes/clustalx_dna.json +11 -0
  184. biotite/sequence/graphics/color_schemes/clustalx_protein.json +28 -0
  185. biotite/sequence/graphics/color_schemes/flower.json +51 -0
  186. biotite/sequence/graphics/color_schemes/jalview_buried.json +31 -0
  187. biotite/sequence/graphics/color_schemes/jalview_hydrophobicity.json +31 -0
  188. biotite/sequence/graphics/color_schemes/jalview_prop_helix.json +31 -0
  189. biotite/sequence/graphics/color_schemes/jalview_prop_strand.json +31 -0
  190. biotite/sequence/graphics/color_schemes/jalview_prop_turn.json +31 -0
  191. biotite/sequence/graphics/color_schemes/jalview_taylor.json +28 -0
  192. biotite/sequence/graphics/color_schemes/jalview_zappo.json +28 -0
  193. biotite/sequence/graphics/color_schemes/ocean.json +51 -0
  194. biotite/sequence/graphics/color_schemes/pb_flower.json +39 -0
  195. biotite/sequence/graphics/color_schemes/rainbow_dna.json +11 -0
  196. biotite/sequence/graphics/color_schemes/rainbow_protein.json +30 -0
  197. biotite/sequence/graphics/color_schemes/spring.json +51 -0
  198. biotite/sequence/graphics/color_schemes/sunset.json +51 -0
  199. biotite/sequence/graphics/color_schemes/wither.json +51 -0
  200. biotite/sequence/graphics/colorschemes.py +139 -0
  201. biotite/sequence/graphics/dendrogram.py +184 -0
  202. biotite/sequence/graphics/features.py +510 -0
  203. biotite/sequence/graphics/logo.py +110 -0
  204. biotite/sequence/graphics/plasmid.py +661 -0
  205. biotite/sequence/io/__init__.py +12 -0
  206. biotite/sequence/io/fasta/__init__.py +22 -0
  207. biotite/sequence/io/fasta/convert.py +273 -0
  208. biotite/sequence/io/fasta/file.py +278 -0
  209. biotite/sequence/io/fastq/__init__.py +19 -0
  210. biotite/sequence/io/fastq/convert.py +120 -0
  211. biotite/sequence/io/fastq/file.py +551 -0
  212. biotite/sequence/io/genbank/__init__.py +17 -0
  213. biotite/sequence/io/genbank/annotation.py +277 -0
  214. biotite/sequence/io/genbank/file.py +575 -0
  215. biotite/sequence/io/genbank/metadata.py +324 -0
  216. biotite/sequence/io/genbank/sequence.py +172 -0
  217. biotite/sequence/io/general.py +192 -0
  218. biotite/sequence/io/gff/__init__.py +26 -0
  219. biotite/sequence/io/gff/convert.py +133 -0
  220. biotite/sequence/io/gff/file.py +434 -0
  221. biotite/sequence/phylo/__init__.py +36 -0
  222. biotite/sequence/phylo/nj.cpython-312-darwin.so +0 -0
  223. biotite/sequence/phylo/nj.pyx +221 -0
  224. biotite/sequence/phylo/tree.cpython-312-darwin.so +0 -0
  225. biotite/sequence/phylo/tree.pyx +1169 -0
  226. biotite/sequence/phylo/upgma.cpython-312-darwin.so +0 -0
  227. biotite/sequence/phylo/upgma.pyx +164 -0
  228. biotite/sequence/profile.py +456 -0
  229. biotite/sequence/search.py +116 -0
  230. biotite/sequence/seqtypes.py +556 -0
  231. biotite/sequence/sequence.py +374 -0
  232. biotite/structure/__init__.py +132 -0
  233. biotite/structure/atoms.py +1455 -0
  234. biotite/structure/basepairs.py +1415 -0
  235. biotite/structure/bonds.cpython-312-darwin.so +0 -0
  236. biotite/structure/bonds.pyx +1933 -0
  237. biotite/structure/box.py +592 -0
  238. biotite/structure/celllist.cpython-312-darwin.so +0 -0
  239. biotite/structure/celllist.pyx +849 -0
  240. biotite/structure/chains.py +298 -0
  241. biotite/structure/charges.cpython-312-darwin.so +0 -0
  242. biotite/structure/charges.pyx +520 -0
  243. biotite/structure/compare.py +274 -0
  244. biotite/structure/density.py +114 -0
  245. biotite/structure/dotbracket.py +216 -0
  246. biotite/structure/error.py +31 -0
  247. biotite/structure/filter.py +585 -0
  248. biotite/structure/geometry.py +697 -0
  249. biotite/structure/graphics/__init__.py +13 -0
  250. biotite/structure/graphics/atoms.py +226 -0
  251. biotite/structure/graphics/rna.py +282 -0
  252. biotite/structure/hbond.py +409 -0
  253. biotite/structure/info/__init__.py +25 -0
  254. biotite/structure/info/atom_masses.json +121 -0
  255. biotite/structure/info/atoms.py +82 -0
  256. biotite/structure/info/bonds.py +145 -0
  257. biotite/structure/info/ccd/README.rst +8 -0
  258. biotite/structure/info/ccd/amino_acids.txt +1663 -0
  259. biotite/structure/info/ccd/carbohydrates.txt +1135 -0
  260. biotite/structure/info/ccd/components.bcif +0 -0
  261. biotite/structure/info/ccd/nucleotides.txt +798 -0
  262. biotite/structure/info/ccd.py +95 -0
  263. biotite/structure/info/groups.py +90 -0
  264. biotite/structure/info/masses.py +123 -0
  265. biotite/structure/info/misc.py +144 -0
  266. biotite/structure/info/radii.py +197 -0
  267. biotite/structure/info/standardize.py +196 -0
  268. biotite/structure/integrity.py +268 -0
  269. biotite/structure/io/__init__.py +30 -0
  270. biotite/structure/io/ctab.py +72 -0
  271. biotite/structure/io/dcd/__init__.py +13 -0
  272. biotite/structure/io/dcd/file.py +65 -0
  273. biotite/structure/io/general.py +257 -0
  274. biotite/structure/io/gro/__init__.py +14 -0
  275. biotite/structure/io/gro/file.py +343 -0
  276. biotite/structure/io/mmtf/__init__.py +21 -0
  277. biotite/structure/io/mmtf/assembly.py +214 -0
  278. biotite/structure/io/mmtf/convertarray.cpython-312-darwin.so +0 -0
  279. biotite/structure/io/mmtf/convertarray.pyx +341 -0
  280. biotite/structure/io/mmtf/convertfile.cpython-312-darwin.so +0 -0
  281. biotite/structure/io/mmtf/convertfile.pyx +501 -0
  282. biotite/structure/io/mmtf/decode.cpython-312-darwin.so +0 -0
  283. biotite/structure/io/mmtf/decode.pyx +152 -0
  284. biotite/structure/io/mmtf/encode.cpython-312-darwin.so +0 -0
  285. biotite/structure/io/mmtf/encode.pyx +183 -0
  286. biotite/structure/io/mmtf/file.py +233 -0
  287. biotite/structure/io/mol/__init__.py +20 -0
  288. biotite/structure/io/mol/convert.py +115 -0
  289. biotite/structure/io/mol/ctab.py +414 -0
  290. biotite/structure/io/mol/header.py +116 -0
  291. biotite/structure/io/mol/mol.py +193 -0
  292. biotite/structure/io/mol/sdf.py +916 -0
  293. biotite/structure/io/netcdf/__init__.py +13 -0
  294. biotite/structure/io/netcdf/file.py +63 -0
  295. biotite/structure/io/npz/__init__.py +20 -0
  296. biotite/structure/io/npz/file.py +152 -0
  297. biotite/structure/io/pdb/__init__.py +20 -0
  298. biotite/structure/io/pdb/convert.py +293 -0
  299. biotite/structure/io/pdb/file.py +1240 -0
  300. biotite/structure/io/pdb/hybrid36.cpython-312-darwin.so +0 -0
  301. biotite/structure/io/pdb/hybrid36.pyx +242 -0
  302. biotite/structure/io/pdbqt/__init__.py +15 -0
  303. biotite/structure/io/pdbqt/convert.py +107 -0
  304. biotite/structure/io/pdbqt/file.py +640 -0
  305. biotite/structure/io/pdbx/__init__.py +23 -0
  306. biotite/structure/io/pdbx/bcif.py +648 -0
  307. biotite/structure/io/pdbx/cif.py +1032 -0
  308. biotite/structure/io/pdbx/component.py +246 -0
  309. biotite/structure/io/pdbx/convert.py +1597 -0
  310. biotite/structure/io/pdbx/encoding.cpython-312-darwin.so +0 -0
  311. biotite/structure/io/pdbx/encoding.pyx +950 -0
  312. biotite/structure/io/pdbx/legacy.py +267 -0
  313. biotite/structure/io/tng/__init__.py +13 -0
  314. biotite/structure/io/tng/file.py +46 -0
  315. biotite/structure/io/trajfile.py +710 -0
  316. biotite/structure/io/trr/__init__.py +13 -0
  317. biotite/structure/io/trr/file.py +46 -0
  318. biotite/structure/io/xtc/__init__.py +13 -0
  319. biotite/structure/io/xtc/file.py +46 -0
  320. biotite/structure/mechanics.py +75 -0
  321. biotite/structure/molecules.py +353 -0
  322. biotite/structure/pseudoknots.py +642 -0
  323. biotite/structure/rdf.py +243 -0
  324. biotite/structure/repair.py +253 -0
  325. biotite/structure/residues.py +562 -0
  326. biotite/structure/resutil.py +178 -0
  327. biotite/structure/sasa.cpython-312-darwin.so +0 -0
  328. biotite/structure/sasa.pyx +322 -0
  329. biotite/structure/sequence.py +112 -0
  330. biotite/structure/sse.py +327 -0
  331. biotite/structure/superimpose.py +727 -0
  332. biotite/structure/transform.py +504 -0
  333. biotite/structure/util.py +98 -0
  334. biotite/temp.py +86 -0
  335. biotite/version.py +16 -0
  336. biotite/visualize.py +251 -0
  337. biotite-0.41.1.dist-info/METADATA +187 -0
  338. biotite-0.41.1.dist-info/RECORD +340 -0
  339. biotite-0.41.1.dist-info/WHEEL +4 -0
  340. biotite-0.41.1.dist-info/licenses/LICENSE.rst +30 -0
@@ -0,0 +1,505 @@
1
+ # This source code is part of the Biotite package and is distributed
2
+ # under the 3-Clause BSD License. Please see 'LICENSE.rst' for further
3
+ # information.
4
+
5
+ __name__ = "biotite.application.autodock"
6
+ __author__ = "Patrick Kunzmann"
7
+ __all__ = ["VinaApp"]
8
+
9
+ import copy
10
+ from tempfile import NamedTemporaryFile
11
+ import numpy as np
12
+ from ..localapp import LocalApp, cleanup_tempfile
13
+ from ..application import AppState, requires_state
14
+ from ...structure.io.pdbqt import PDBQTFile
15
+ from ...structure.residues import get_residue_starts_for, get_residue_masks
16
+ from ...structure.bonds import find_connected
17
+ from ...structure.error import BadStructureError
18
+
19
+
20
+ class VinaApp(LocalApp):
21
+ """
22
+ Dock a ligand to a receptor molecule using *AutoDock Vina*.
23
+
24
+ Parameters
25
+ ----------
26
+ ligand : AtomArray
27
+ The structure of the receptor molecule.
28
+ Must have an associated :class:`BondList`.
29
+ An associated ``charge`` annotation is recommended for proper
30
+ calculation of partial charges.
31
+ receptor : AtomArray, shape=(n,)
32
+ The structure of the receptor molecule.
33
+ Must have an associated :class:`BondList`.
34
+ An associated ``charge`` annotation is recommended for proper
35
+ calculation of partial charges.
36
+ center : ndarray, shape=(3,), dtype=float
37
+ The *xyz* coordinates for the center of the search space.
38
+ size : ndarray, shape=(3,), dtype=float
39
+ The size of the search space in *xyz* directions.
40
+ flexible : ndarray, shape=(n,), dtype=bool, optional
41
+ A boolean mask that indicates flexible amino acid side chains
42
+ in `receptor`.
43
+ Each residue, where at least one atom index is ``True`` in
44
+ `flexible`, is considered flexible.
45
+ By default, the receptor has no flexibility.
46
+ bin_path : str, optional
47
+ Path to the *Vina* binary.
48
+
49
+ Examples
50
+ --------
51
+
52
+ >>> # A dummy receptor and ligand
53
+ >>> ligand = residue("ASP")
54
+ >>> receptor = atom_array
55
+ >>> app = VinaApp(
56
+ ... ligand, receptor,
57
+ ... # Binding pocket is in the center of the receptor
58
+ ... center=centroid(receptor),
59
+ ... # 20 Å x 20 Å x 20 Å search space
60
+ ... size=[20, 20, 20],
61
+ ... # Handle residues 2 and 5 as flexible
62
+ ... flexible=(receptor.res_id == 2) | (receptor.res_id == 5)
63
+ ... )
64
+ """
65
+ def __init__(self, ligand, receptor, center, size, flexible=None,
66
+ bin_path="vina"):
67
+ super().__init__(bin_path)
68
+
69
+ if ligand.bonds is None:
70
+ raise ValueError("The ligand has no associated BondList")
71
+ if receptor.bonds is None:
72
+ raise ValueError("The receptor has no associated BondList")
73
+
74
+ self._ligand = ligand.copy()
75
+ self._receptor = receptor.copy()
76
+ self._center = copy.deepcopy(center)
77
+ self._size = copy.deepcopy(size)
78
+ self._is_flexible = flexible is not None
79
+ self._seed = None
80
+ self._exhaustiveness = None
81
+ self._number = None
82
+ self._energy_range = None
83
+
84
+ if self._is_flexible:
85
+ flexible_indices = np.where(flexible)[0]
86
+ self._flex_res_starts = np.unique(get_residue_starts_for(
87
+ receptor, flexible_indices
88
+ ))
89
+
90
+ self._ligand_file = NamedTemporaryFile(
91
+ "w", suffix=".pdbqt", delete=False
92
+ )
93
+ self._receptor_file = NamedTemporaryFile(
94
+ "w", suffix=".pdbqt", delete=False
95
+ )
96
+ self._receptor_flex_file = NamedTemporaryFile(
97
+ "w", suffix=".pdbqt", delete=False
98
+ )
99
+ self._out_file = NamedTemporaryFile(
100
+ "r", suffix=".pdbqt", delete=False
101
+ )
102
+
103
+ @requires_state(AppState.CREATED)
104
+ def set_seed(self, seed):
105
+ """
106
+ Fix the seed for the random number generator to get
107
+ reproducible results.
108
+
109
+ By default, the seed is chosen randomly.
110
+
111
+ Parameters
112
+ ----------
113
+ seed : int
114
+ The seed for the random number generator.
115
+ """
116
+ self._seed = seed
117
+
118
+ @requires_state(AppState.CREATED)
119
+ def set_exhaustiveness(self, exhaustiveness):
120
+ """
121
+ Set the *exhaustiveness* parameter for *Vina*.
122
+
123
+ A higher exhaustiveness may lead to better docking results, but
124
+ also increases the computation time.
125
+ By default, the exhaustiveness is ``8``.
126
+
127
+ Parameters
128
+ ----------
129
+ exhaustiveness : int
130
+ The value for the exhaustiveness parameter.
131
+ Must be greater than 0.
132
+ """
133
+ self._exhaustiveness = exhaustiveness
134
+
135
+ @requires_state(AppState.CREATED)
136
+ def set_max_number_of_models(self, number):
137
+ """
138
+ Set the maximum number of binding modes to generate.
139
+
140
+ *Vina* may generate less modes, if the docking process does
141
+ not find enough distinct conformations.
142
+ By default, the maximum number is ``9``.
143
+
144
+ Parameters
145
+ ----------
146
+ number : int
147
+ The maximum number of generated modes/models.
148
+ """
149
+ self._number = number
150
+
151
+ @requires_state(AppState.CREATED)
152
+ def set_energy_range(self, energy_range):
153
+ """
154
+ Set the maximum energy range of the generated models.
155
+
156
+ *Vina* will ignore binding modes if the difference between this
157
+ mode and the best mode is greater than this value.
158
+ By default, the range is ``3.0``.
159
+
160
+ Parameters
161
+ ----------
162
+ number : float
163
+ The energy range (kcal/mol).
164
+ """
165
+ self._energy_range = energy_range
166
+
167
+ def run(self):
168
+ # Use different atom ID ranges for atoms in ligand and receptor
169
+ # for unambiguous assignment, if the receptor contains flexible
170
+ # residues
171
+ self._ligand.set_annotation("atom_id", np.arange(
172
+ 1,
173
+ self._ligand.array_length() + 1
174
+ ))
175
+ self._receptor.set_annotation("atom_id", np.arange(
176
+ self._ligand.array_length() + 1,
177
+ self._ligand.array_length() + self._receptor.array_length() + 1
178
+ ))
179
+
180
+ ligand_file = PDBQTFile()
181
+ # Contains 'true' entries for all atoms that have not been
182
+ # removed from ligand
183
+ self._ligand_mask = ligand_file.set_structure(
184
+ self._ligand,
185
+ rotatable_bonds="all"
186
+ )
187
+ ligand_file.write(self._ligand_file)
188
+ self._ligand_file.flush()
189
+
190
+ if self._is_flexible:
191
+ self._rigid_mask = np.ones(
192
+ self._receptor.array_length(), dtype=bool
193
+ )
194
+ # Contains 'true' entries for all atoms that have not been
195
+ # removed from receptor in flexible side chains
196
+ self._receptor_mask = np.zeros(
197
+ self._receptor.array_length(), dtype=bool
198
+ )
199
+ for i, start in enumerate(self._flex_res_starts):
200
+ flex_mask, rigid_mask, root = self._get_flexible_residue(start)
201
+ self._rigid_mask &= rigid_mask
202
+ root_in_flex_residue = np.where(
203
+ np.arange(self._receptor.array_length())[flex_mask] == root
204
+ )[0][0]
205
+ flex_file = PDBQTFile()
206
+ self._receptor_mask[flex_mask] |= flex_file.set_structure(
207
+ self._receptor[flex_mask],
208
+ rotatable_bonds="all",
209
+ root=root_in_flex_residue,
210
+ include_torsdof=False
211
+ )
212
+ # Enclose each flexible residue
213
+ # with BEGIN_RES and END_RES
214
+ self._receptor_flex_file.write(f"BEGIN_RES {i}\n")
215
+ flex_file.write(self._receptor_flex_file)
216
+ self._receptor_flex_file.write(f"END_RES {i}\n")
217
+ self._receptor_flex_file.flush()
218
+
219
+ receptor_file = PDBQTFile()
220
+ receptor_file.set_structure(
221
+ self._receptor[self._rigid_mask],
222
+ rotatable_bonds=None,
223
+ include_torsdof=False
224
+ )
225
+ receptor_file.write(self._receptor_file)
226
+ self._receptor_file.flush()
227
+
228
+ else:
229
+ receptor_file = PDBQTFile()
230
+ receptor_file.set_structure(
231
+ self._receptor,
232
+ rotatable_bonds=None,
233
+ include_torsdof=False
234
+ )
235
+ receptor_file.write(self._receptor_file)
236
+ self._receptor_file.flush()
237
+
238
+ arguments = [
239
+ "--ligand", self._ligand_file.name,
240
+ "--receptor", self._receptor_file.name,
241
+ "--out", self._out_file.name,
242
+ "--center_x", f"{self._center[0]:.3f}",
243
+ "--center_y", f"{self._center[1]:.3f}",
244
+ "--center_z", f"{self._center[2]:.3f}",
245
+ "--size_x", f"{self._size[0]:.3f}",
246
+ "--size_y", f"{self._size[1]:.3f}",
247
+ "--size_z", f"{self._size[2]:.3f}",
248
+ ]
249
+ if self._seed is not None:
250
+ arguments.extend(["--seed", str(self._seed)])
251
+ if self._exhaustiveness is not None:
252
+ arguments.extend(["--exhaustiveness", str(self._exhaustiveness)])
253
+ if self._number is not None:
254
+ arguments.extend(["--num_modes", str(self._number)])
255
+ if self._energy_range is not None:
256
+ arguments.extend(["--energy_range", str(self._energy_range)])
257
+ if self._is_flexible:
258
+ arguments.extend(["--flex", str(self._receptor_flex_file.name)])
259
+
260
+ self.set_arguments(arguments)
261
+ super().run()
262
+
263
+ def evaluate(self):
264
+ super().evaluate()
265
+ out_file = PDBQTFile.read(self._out_file)
266
+
267
+ models = out_file.get_structure()
268
+
269
+ n_ligand_atoms = np.count_nonzero(self._ligand_mask)
270
+ self._ligand_models = models[..., :n_ligand_atoms]
271
+ self._flex_models = models[..., n_ligand_atoms:]
272
+ self._n_models = models.stack_depth()
273
+
274
+ remarks = out_file.get_remarks()
275
+ self._energies = np.array(
276
+ # VINA RESULT: -5.8 0.000 0.000
277
+ # ^
278
+ [float(remark[12:].split()[0]) for remark in remarks]
279
+ )
280
+
281
+ def clean_up(self):
282
+ super().clean_up()
283
+ cleanup_tempfile(self._ligand_file)
284
+ cleanup_tempfile(self._receptor_file)
285
+ cleanup_tempfile(self._receptor_flex_file)
286
+ cleanup_tempfile(self._out_file)
287
+
288
+ @requires_state(AppState.JOINED)
289
+ def get_energies(self):
290
+ """
291
+ Get the predicted binding energy for each generated binding
292
+ mode.
293
+
294
+ Returns
295
+ -------
296
+ energies : ndarray, dtype=float
297
+ The predicted binding energies (kcal/mol).
298
+ The energies are sorted from best to worst.
299
+ """
300
+ return self._energies
301
+
302
+ @requires_state(AppState.JOINED)
303
+ def get_ligand_models(self):
304
+ """
305
+ Get the ligand structure with the conformations for each
306
+ generated binding mode.
307
+
308
+ Returns
309
+ -------
310
+ ligand : AtomArrayStack
311
+ The docked ligand.
312
+ Each model corresponds to one binding mode.
313
+ The models are sorted from best to worst predicted binding
314
+ affinity.
315
+
316
+ Notes
317
+ -----
318
+ The returned structure may contain less atoms than the input
319
+ structure, as *Vina* removes nonpolar hydrogen atoms.
320
+ Furthermore, the returned structure contains *AutoDock* atom
321
+ types as ``element`` annotation.
322
+ """
323
+ return self._ligand_models
324
+
325
+ @requires_state(AppState.JOINED)
326
+ def get_ligand_coord(self):
327
+ """
328
+ Get the ligand coordinates for each generated binding mode.
329
+
330
+ Returns
331
+ -------
332
+ coord : ndarray, shape=(m,n,3), dtype=float
333
+ The coordinates for *m* binding modes and *n* atoms
334
+ of the input ligand.
335
+ The models are sorted from best to worst predicted binding
336
+ affinity.
337
+ Missing coordinates due to the removed nonpolar hydrogen
338
+ atoms are set to *NaN*.
339
+ """
340
+ coord = np.full(
341
+ (self._n_models, self._ligand.array_length(), 3),
342
+ np.nan, dtype=np.float32
343
+ )
344
+ coord[:, self._ligand_mask] = self._ligand_models.coord
345
+ return coord
346
+
347
+ @requires_state(AppState.JOINED)
348
+ def get_flexible_residue_models(self):
349
+ """
350
+ Get the structure for the flexible side chains with the
351
+ conformations for each generated binding mode.
352
+
353
+ If no flexible side chains were defined, the returned
354
+ :class:`AtomArrayStack` contains no atoms.
355
+
356
+ Returns
357
+ -------
358
+ side_chains : AtomArrayStack
359
+ The docked side chains.
360
+ Each model corresponds to one binding mode.
361
+ The models are sorted from best to worst predicted binding
362
+ affinity.
363
+
364
+ Notes
365
+ -----
366
+ The returned structure may contain less atoms than the input
367
+ structure, as *Vina* removes nonpolar hydrogen atoms.
368
+ Furthermore, the returned structure contains *AutoDock* atom
369
+ types as ``element`` annotation.
370
+ """
371
+ return self._flex_models
372
+
373
+ @requires_state(AppState.JOINED)
374
+ def get_receptor_coord(self):
375
+ """
376
+ Get the get_receptor_coord coordinates for each generated
377
+ binding mode.
378
+
379
+ Returns
380
+ -------
381
+ coord : ndarray, shape=(m,n,3), dtype=float
382
+ The coordinates for *m* binding modes and *n* atoms
383
+ of the input receptor.
384
+ The models are sorted from best to worst predicted binding
385
+ affinity.
386
+ Missing coordinates due to the removed nonpolar hydrogen
387
+ atoms from flexible side chains are set to *NaN*.
388
+
389
+ Notes
390
+ -----
391
+ The output is only meaningful, if flexible side chains were
392
+ defined.
393
+ Otherwise, the returned coordinates are simply *m* repetitions
394
+ of the input receptor coordinates.
395
+ """
396
+ coord = np.repeat(
397
+ self._receptor.coord[np.newaxis, ...],
398
+ repeats=self._n_models, axis=0
399
+ )
400
+ if self._is_flexible:
401
+ # Replace original coordinates with modeled coordinates
402
+ # for the the flexible side chains
403
+ # The coordinates from removed atoms are NaN
404
+ coord[:, ~self._rigid_mask] = np.nan
405
+ coord[:, self._receptor_mask] = self._flex_models.coord
406
+ return coord
407
+
408
+ def _get_flexible_residue(self, residue_start):
409
+ residue_indices = np.where(
410
+ get_residue_masks(self._receptor, [residue_start])[0]
411
+ )[0]
412
+ root_indices_in_residue = np.isin(
413
+ self._receptor.atom_name[residue_indices], ("CA",)
414
+ )
415
+ root_indices = residue_indices[root_indices_in_residue]
416
+ if len(root_indices) == 0:
417
+ raise BadStructureError("Found no CA atom in residue")
418
+ if len(root_indices) > 1:
419
+ raise BadStructureError("Multiple CA atom in residue")
420
+ root_index = root_indices[0]
421
+
422
+ # Find the index of the atom connected to root on the flexible
423
+ # side chain (CB)
424
+ root_connect_indices, _ = self._receptor.bonds.get_bonds(root_index)
425
+ connected_index = None
426
+ try:
427
+ connected_index = root_connect_indices[np.isin(
428
+ self._receptor.atom_name[root_connect_indices], ("CB",)
429
+ )][0]
430
+ except IndexError:
431
+ # Residue has no appropriate connection (e.g. in glycine)
432
+ # -> There is no atom in the flexible side chain
433
+ flex_mask = np.zeros(self._receptor.array_length(), dtype=bool)
434
+ rigid_mask = np.ones(self._receptor.array_length(), dtype=bool)
435
+ return flex_mask, rigid_mask, root_index
436
+
437
+ # Remove the root bond from the bond list
438
+ # to find the atoms involved in the flexible part
439
+ bonds = self._receptor.bonds.copy()
440
+ bonds.remove_bond(root_index, connected_index)
441
+ flexible_indices = find_connected(bonds, connected_index)
442
+ if root_index in flexible_indices:
443
+ raise BadStructureError(
444
+ "There are multiple connections between the flexible and "
445
+ "rigid part, maybe a cyclic residue like proline was selected"
446
+ )
447
+
448
+ flex_mask = np.zeros(self._receptor.array_length(), dtype=bool)
449
+ flex_mask[flexible_indices] = True
450
+ rigid_mask = ~flex_mask
451
+ # Root index is part of rigid and flexible part
452
+ flex_mask[root_index] = True
453
+
454
+ return flex_mask, rigid_mask, root_index
455
+
456
+
457
+ @staticmethod
458
+ def dock(ligand, receptor, center, size, flexible=None, bin_path="vina"):
459
+ """
460
+ Dock a ligand to a receptor molecule using *AutoDock Vina*.
461
+
462
+ This is a convenience function, that wraps the :class:`VinaApp`
463
+ execution.
464
+
465
+ Parameters
466
+ ----------
467
+ ligand : AtomArray
468
+ The structure of the receptor molecule.
469
+ Must have an associated :class:`BondList`.
470
+ An associated ``charge`` annotation is recommended for proper
471
+ calculation of partial charges.
472
+ receptor : AtomArray, shape=(n,)
473
+ The structure of the receptor molecule.
474
+ Must have an associated :class:`BondList`.
475
+ An associated ``charge`` annotation is recommended for proper
476
+ calculation of partial charges.
477
+ center : ndarray, shape=(3,), dtype=float
478
+ The *xyz* coordinates for the center of the search space.
479
+ size : ndarray, shape=(3,), dtype=float
480
+ The size of the search space in *xyz* directions.
481
+ flexible : ndarray, shape=(n,), dtype=bool, optional
482
+ A boolean mask that indicates flexible amino acid side chains
483
+ in `receptor`.
484
+ Each residue, where at least one atom index is ``True`` in
485
+ `flexible`, is considered flexible.
486
+ By default, the receptor has no flexibility.
487
+ bin_path : str, optional
488
+ Path to the *Vina* binary.
489
+
490
+ Returns
491
+ -------
492
+ coord : ndarray, shape=(m,n,3), dtype=float
493
+ The docked ligand coordinates for *m* binding modes and
494
+ *n* atoms of the input ligand.
495
+ The models are sorted from best to worst predicted binding
496
+ affinity.
497
+ Missing coordinates due to the removed nonpolar hydrogen
498
+ atoms are set to *NaN*.
499
+ energies : ndarray, shape=(m,), dtype=float
500
+ The corresponding predicted binding energies (kcal/mol).
501
+ """
502
+ app = VinaApp(ligand, receptor, center, size, flexible, bin_path)
503
+ app.start()
504
+ app.join()
505
+ return app.get_ligand_coord(), app.get_energies()
@@ -0,0 +1,14 @@
1
+ # This source code is part of the Biotite package and is distributed
2
+ # under the 3-Clause BSD License. Please see 'LICENSE.rst' for further
3
+ # information.
4
+
5
+ """
6
+ A subpackage for heuristic local alignments against a large database
7
+ using BLAST.
8
+ """
9
+
10
+ __name__ = "biotite.application.blast"
11
+ __author__ = "Patrick Kunzmann"
12
+
13
+ from .webapp import *
14
+ from .alignment import *
@@ -0,0 +1,83 @@
1
+ # This source code is part of the Biotite package and is distributed
2
+ # under the 3-Clause BSD License. Please see 'LICENSE.rst' for further
3
+ # information.
4
+
5
+ __name__ = "biotite.application.blast"
6
+ __author__ = "Patrick Kunzmann"
7
+ __all__ = ["BlastAlignment"]
8
+
9
+ from ...sequence.align.alignment import Alignment
10
+
11
+
12
+ class BlastAlignment(Alignment):
13
+ """
14
+ A specialized :class:`Alignment` class for alignments using the
15
+ BLAST application. It stores additional data, like the E-value,
16
+ the HSP position and a description of the hit sequence.
17
+
18
+ Like its superclass, all attributes of a :class:`BlastAlignment` are
19
+ public. The attributes are the same as the constructor parameters.
20
+
21
+ Parameters
22
+ ----------
23
+ sequences : list
24
+ A list of aligned sequences. Does actually not contain the
25
+ complete original sequences, but the HSP sequences.
26
+ trace : ndarray, dtype=int, shape=(n,m)
27
+ The alignment trace.
28
+ score : int
29
+ Alignment score.
30
+ e_value : float
31
+ Expectation value for the number of random sequences of a
32
+ similar sized database getting an equal or higher score by
33
+ change when aligned with the query sequence.
34
+ query_interval : tuple of int
35
+ Describes the position of the HSP part of the query sequence
36
+ in the original query sequence. The first element is the start
37
+ position, the second element is the inclusive stop position.
38
+ Indexing starts at 1.
39
+ hit_interval : tuple of int
40
+ Analogous to `query_interval`, this describes the position of
41
+ the HSP part of the hit sequence in the complete hit sequence.
42
+ hit_id : str
43
+ The NCBI *unique identifier* (UID) of the hit sequence.
44
+ hit_definition : str
45
+ The name of the hit sequence.
46
+ """
47
+
48
+ def __init__(self, sequences, trace, score, e_value,
49
+ query_interval, hit_interval, hit_id, hit_definition):
50
+ super().__init__(sequences, trace, score)
51
+ self.e_value = e_value
52
+ self.query_interval = query_interval
53
+ self.hit_interval = hit_interval
54
+ self.hit_id = hit_id
55
+ self.hit_definition = hit_definition
56
+
57
+ def __eq__(self, item):
58
+ if not isinstance(item, BlastAlignment):
59
+ return False
60
+ if self.e_value != item.e_value:
61
+ return False
62
+ if self.query_interval != item.query_interval:
63
+ return False
64
+ if self.hit_interval != item.hit_interval:
65
+ return False
66
+ if self.hit_id != item.hit_id:
67
+ return False
68
+ if self.hit_definition != item.hit_definition:
69
+ return False
70
+ return super().__eq__(item)
71
+
72
+ def __getitem__(self, index):
73
+ super_alignment = super().__getitem__(index)
74
+ return BlastAlignment(
75
+ super_alignment.sequences,
76
+ super_alignment.trace,
77
+ super_alignment.score,
78
+ self.e_value,
79
+ self.query_interval,
80
+ self.hit_interval,
81
+ self.hit_id,
82
+ self.hit_definition
83
+ )