biotite 1.1.0__cp313-cp313-macosx_10_13_x86_64.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 (332) hide show
  1. biotite/__init__.py +18 -0
  2. biotite/application/__init__.py +69 -0
  3. biotite/application/application.py +276 -0
  4. biotite/application/autodock/__init__.py +12 -0
  5. biotite/application/autodock/app.py +500 -0
  6. biotite/application/blast/__init__.py +14 -0
  7. biotite/application/blast/alignment.py +92 -0
  8. biotite/application/blast/webapp.py +428 -0
  9. biotite/application/clustalo/__init__.py +12 -0
  10. biotite/application/clustalo/app.py +223 -0
  11. biotite/application/dssp/__init__.py +12 -0
  12. biotite/application/dssp/app.py +159 -0
  13. biotite/application/localapp.py +342 -0
  14. biotite/application/mafft/__init__.py +12 -0
  15. biotite/application/mafft/app.py +116 -0
  16. biotite/application/msaapp.py +363 -0
  17. biotite/application/muscle/__init__.py +13 -0
  18. biotite/application/muscle/app3.py +227 -0
  19. biotite/application/muscle/app5.py +163 -0
  20. biotite/application/sra/__init__.py +18 -0
  21. biotite/application/sra/app.py +452 -0
  22. biotite/application/tantan/__init__.py +12 -0
  23. biotite/application/tantan/app.py +199 -0
  24. biotite/application/util.py +57 -0
  25. biotite/application/viennarna/__init__.py +18 -0
  26. biotite/application/viennarna/rnaalifold.py +310 -0
  27. biotite/application/viennarna/rnafold.py +254 -0
  28. biotite/application/viennarna/rnaplot.py +206 -0
  29. biotite/application/viennarna/util.py +77 -0
  30. biotite/application/webapp.py +76 -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 +60 -0
  35. biotite/database/entrez/dbnames.py +91 -0
  36. biotite/database/entrez/download.py +229 -0
  37. biotite/database/entrez/key.py +44 -0
  38. biotite/database/entrez/query.py +262 -0
  39. biotite/database/error.py +16 -0
  40. biotite/database/pubchem/__init__.py +21 -0
  41. biotite/database/pubchem/download.py +258 -0
  42. biotite/database/pubchem/error.py +20 -0
  43. biotite/database/pubchem/query.py +830 -0
  44. biotite/database/pubchem/throttle.py +98 -0
  45. biotite/database/rcsb/__init__.py +13 -0
  46. biotite/database/rcsb/download.py +159 -0
  47. biotite/database/rcsb/query.py +964 -0
  48. biotite/database/uniprot/__init__.py +13 -0
  49. biotite/database/uniprot/check.py +40 -0
  50. biotite/database/uniprot/download.py +129 -0
  51. biotite/database/uniprot/query.py +293 -0
  52. biotite/file.py +232 -0
  53. biotite/sequence/__init__.py +84 -0
  54. biotite/sequence/align/__init__.py +203 -0
  55. biotite/sequence/align/alignment.py +680 -0
  56. biotite/sequence/align/banded.cpython-313-darwin.so +0 -0
  57. biotite/sequence/align/banded.pyx +652 -0
  58. biotite/sequence/align/buckets.py +71 -0
  59. biotite/sequence/align/cigar.py +425 -0
  60. biotite/sequence/align/kmeralphabet.cpython-313-darwin.so +0 -0
  61. biotite/sequence/align/kmeralphabet.pyx +595 -0
  62. biotite/sequence/align/kmersimilarity.cpython-313-darwin.so +0 -0
  63. biotite/sequence/align/kmersimilarity.pyx +233 -0
  64. biotite/sequence/align/kmertable.cpython-313-darwin.so +0 -0
  65. biotite/sequence/align/kmertable.pyx +3411 -0
  66. biotite/sequence/align/localgapped.cpython-313-darwin.so +0 -0
  67. biotite/sequence/align/localgapped.pyx +892 -0
  68. biotite/sequence/align/localungapped.cpython-313-darwin.so +0 -0
  69. biotite/sequence/align/localungapped.pyx +279 -0
  70. biotite/sequence/align/matrix.py +622 -0
  71. biotite/sequence/align/matrix_data/3Di.mat +24 -0
  72. biotite/sequence/align/matrix_data/BLOSUM100.mat +31 -0
  73. biotite/sequence/align/matrix_data/BLOSUM30.mat +31 -0
  74. biotite/sequence/align/matrix_data/BLOSUM35.mat +31 -0
  75. biotite/sequence/align/matrix_data/BLOSUM40.mat +31 -0
  76. biotite/sequence/align/matrix_data/BLOSUM45.mat +31 -0
  77. biotite/sequence/align/matrix_data/BLOSUM50.mat +31 -0
  78. biotite/sequence/align/matrix_data/BLOSUM50_13p.mat +25 -0
  79. biotite/sequence/align/matrix_data/BLOSUM50_14.3.mat +25 -0
  80. biotite/sequence/align/matrix_data/BLOSUM50_5.0.mat +25 -0
  81. biotite/sequence/align/matrix_data/BLOSUM55.mat +31 -0
  82. biotite/sequence/align/matrix_data/BLOSUM60.mat +31 -0
  83. biotite/sequence/align/matrix_data/BLOSUM62.mat +31 -0
  84. biotite/sequence/align/matrix_data/BLOSUM62_13p.mat +25 -0
  85. biotite/sequence/align/matrix_data/BLOSUM62_14.3.mat +25 -0
  86. biotite/sequence/align/matrix_data/BLOSUM62_5.0.mat +25 -0
  87. biotite/sequence/align/matrix_data/BLOSUM65.mat +31 -0
  88. biotite/sequence/align/matrix_data/BLOSUM70.mat +31 -0
  89. biotite/sequence/align/matrix_data/BLOSUM75.mat +31 -0
  90. biotite/sequence/align/matrix_data/BLOSUM80.mat +31 -0
  91. biotite/sequence/align/matrix_data/BLOSUM85.mat +31 -0
  92. biotite/sequence/align/matrix_data/BLOSUM90.mat +31 -0
  93. biotite/sequence/align/matrix_data/BLOSUMN.mat +31 -0
  94. biotite/sequence/align/matrix_data/CorBLOSUM49_5.0.mat +25 -0
  95. biotite/sequence/align/matrix_data/CorBLOSUM57_13p.mat +25 -0
  96. biotite/sequence/align/matrix_data/CorBLOSUM57_14.3.mat +25 -0
  97. biotite/sequence/align/matrix_data/CorBLOSUM61_5.0.mat +25 -0
  98. biotite/sequence/align/matrix_data/CorBLOSUM66_13p.mat +25 -0
  99. biotite/sequence/align/matrix_data/CorBLOSUM67_14.3.mat +25 -0
  100. biotite/sequence/align/matrix_data/DAYHOFF.mat +32 -0
  101. biotite/sequence/align/matrix_data/GONNET.mat +26 -0
  102. biotite/sequence/align/matrix_data/IDENTITY.mat +25 -0
  103. biotite/sequence/align/matrix_data/MATCH.mat +25 -0
  104. biotite/sequence/align/matrix_data/NUC.mat +25 -0
  105. biotite/sequence/align/matrix_data/PAM10.mat +34 -0
  106. biotite/sequence/align/matrix_data/PAM100.mat +34 -0
  107. biotite/sequence/align/matrix_data/PAM110.mat +34 -0
  108. biotite/sequence/align/matrix_data/PAM120.mat +34 -0
  109. biotite/sequence/align/matrix_data/PAM130.mat +34 -0
  110. biotite/sequence/align/matrix_data/PAM140.mat +34 -0
  111. biotite/sequence/align/matrix_data/PAM150.mat +34 -0
  112. biotite/sequence/align/matrix_data/PAM160.mat +34 -0
  113. biotite/sequence/align/matrix_data/PAM170.mat +34 -0
  114. biotite/sequence/align/matrix_data/PAM180.mat +34 -0
  115. biotite/sequence/align/matrix_data/PAM190.mat +34 -0
  116. biotite/sequence/align/matrix_data/PAM20.mat +34 -0
  117. biotite/sequence/align/matrix_data/PAM200.mat +34 -0
  118. biotite/sequence/align/matrix_data/PAM210.mat +34 -0
  119. biotite/sequence/align/matrix_data/PAM220.mat +34 -0
  120. biotite/sequence/align/matrix_data/PAM230.mat +34 -0
  121. biotite/sequence/align/matrix_data/PAM240.mat +34 -0
  122. biotite/sequence/align/matrix_data/PAM250.mat +34 -0
  123. biotite/sequence/align/matrix_data/PAM260.mat +34 -0
  124. biotite/sequence/align/matrix_data/PAM270.mat +34 -0
  125. biotite/sequence/align/matrix_data/PAM280.mat +34 -0
  126. biotite/sequence/align/matrix_data/PAM290.mat +34 -0
  127. biotite/sequence/align/matrix_data/PAM30.mat +34 -0
  128. biotite/sequence/align/matrix_data/PAM300.mat +34 -0
  129. biotite/sequence/align/matrix_data/PAM310.mat +34 -0
  130. biotite/sequence/align/matrix_data/PAM320.mat +34 -0
  131. biotite/sequence/align/matrix_data/PAM330.mat +34 -0
  132. biotite/sequence/align/matrix_data/PAM340.mat +34 -0
  133. biotite/sequence/align/matrix_data/PAM350.mat +34 -0
  134. biotite/sequence/align/matrix_data/PAM360.mat +34 -0
  135. biotite/sequence/align/matrix_data/PAM370.mat +34 -0
  136. biotite/sequence/align/matrix_data/PAM380.mat +34 -0
  137. biotite/sequence/align/matrix_data/PAM390.mat +34 -0
  138. biotite/sequence/align/matrix_data/PAM40.mat +34 -0
  139. biotite/sequence/align/matrix_data/PAM400.mat +34 -0
  140. biotite/sequence/align/matrix_data/PAM410.mat +34 -0
  141. biotite/sequence/align/matrix_data/PAM420.mat +34 -0
  142. biotite/sequence/align/matrix_data/PAM430.mat +34 -0
  143. biotite/sequence/align/matrix_data/PAM440.mat +34 -0
  144. biotite/sequence/align/matrix_data/PAM450.mat +34 -0
  145. biotite/sequence/align/matrix_data/PAM460.mat +34 -0
  146. biotite/sequence/align/matrix_data/PAM470.mat +34 -0
  147. biotite/sequence/align/matrix_data/PAM480.mat +34 -0
  148. biotite/sequence/align/matrix_data/PAM490.mat +34 -0
  149. biotite/sequence/align/matrix_data/PAM50.mat +34 -0
  150. biotite/sequence/align/matrix_data/PAM500.mat +34 -0
  151. biotite/sequence/align/matrix_data/PAM60.mat +34 -0
  152. biotite/sequence/align/matrix_data/PAM70.mat +34 -0
  153. biotite/sequence/align/matrix_data/PAM80.mat +34 -0
  154. biotite/sequence/align/matrix_data/PAM90.mat +34 -0
  155. biotite/sequence/align/matrix_data/PB.license +21 -0
  156. biotite/sequence/align/matrix_data/PB.mat +18 -0
  157. biotite/sequence/align/matrix_data/RBLOSUM52_5.0.mat +25 -0
  158. biotite/sequence/align/matrix_data/RBLOSUM59_13p.mat +25 -0
  159. biotite/sequence/align/matrix_data/RBLOSUM59_14.3.mat +25 -0
  160. biotite/sequence/align/matrix_data/RBLOSUM64_5.0.mat +25 -0
  161. biotite/sequence/align/matrix_data/RBLOSUM69_13p.mat +25 -0
  162. biotite/sequence/align/matrix_data/RBLOSUM69_14.3.mat +25 -0
  163. biotite/sequence/align/multiple.cpython-313-darwin.so +0 -0
  164. biotite/sequence/align/multiple.pyx +620 -0
  165. biotite/sequence/align/pairwise.cpython-313-darwin.so +0 -0
  166. biotite/sequence/align/pairwise.pyx +587 -0
  167. biotite/sequence/align/permutation.cpython-313-darwin.so +0 -0
  168. biotite/sequence/align/permutation.pyx +313 -0
  169. biotite/sequence/align/primes.txt +821 -0
  170. biotite/sequence/align/selector.cpython-313-darwin.so +0 -0
  171. biotite/sequence/align/selector.pyx +954 -0
  172. biotite/sequence/align/statistics.py +264 -0
  173. biotite/sequence/align/tracetable.cpython-313-darwin.so +0 -0
  174. biotite/sequence/align/tracetable.pxd +64 -0
  175. biotite/sequence/align/tracetable.pyx +370 -0
  176. biotite/sequence/alphabet.py +555 -0
  177. biotite/sequence/annotation.py +830 -0
  178. biotite/sequence/codec.cpython-313-darwin.so +0 -0
  179. biotite/sequence/codec.pyx +155 -0
  180. biotite/sequence/codon.py +477 -0
  181. biotite/sequence/codon_tables.txt +202 -0
  182. biotite/sequence/graphics/__init__.py +33 -0
  183. biotite/sequence/graphics/alignment.py +1115 -0
  184. biotite/sequence/graphics/color_schemes/3di_flower.json +48 -0
  185. biotite/sequence/graphics/color_schemes/autumn.json +51 -0
  186. biotite/sequence/graphics/color_schemes/blossom.json +51 -0
  187. biotite/sequence/graphics/color_schemes/clustalx_dna.json +11 -0
  188. biotite/sequence/graphics/color_schemes/clustalx_protein.json +28 -0
  189. biotite/sequence/graphics/color_schemes/flower.json +51 -0
  190. biotite/sequence/graphics/color_schemes/jalview_buried.json +31 -0
  191. biotite/sequence/graphics/color_schemes/jalview_hydrophobicity.json +31 -0
  192. biotite/sequence/graphics/color_schemes/jalview_prop_helix.json +31 -0
  193. biotite/sequence/graphics/color_schemes/jalview_prop_strand.json +31 -0
  194. biotite/sequence/graphics/color_schemes/jalview_prop_turn.json +31 -0
  195. biotite/sequence/graphics/color_schemes/jalview_taylor.json +28 -0
  196. biotite/sequence/graphics/color_schemes/jalview_zappo.json +28 -0
  197. biotite/sequence/graphics/color_schemes/ocean.json +51 -0
  198. biotite/sequence/graphics/color_schemes/pb_flower.json +40 -0
  199. biotite/sequence/graphics/color_schemes/rainbow_dna.json +11 -0
  200. biotite/sequence/graphics/color_schemes/rainbow_protein.json +30 -0
  201. biotite/sequence/graphics/color_schemes/spring.json +51 -0
  202. biotite/sequence/graphics/color_schemes/sunset.json +51 -0
  203. biotite/sequence/graphics/color_schemes/wither.json +51 -0
  204. biotite/sequence/graphics/colorschemes.py +170 -0
  205. biotite/sequence/graphics/dendrogram.py +229 -0
  206. biotite/sequence/graphics/features.py +544 -0
  207. biotite/sequence/graphics/logo.py +104 -0
  208. biotite/sequence/graphics/plasmid.py +712 -0
  209. biotite/sequence/io/__init__.py +12 -0
  210. biotite/sequence/io/fasta/__init__.py +22 -0
  211. biotite/sequence/io/fasta/convert.py +284 -0
  212. biotite/sequence/io/fasta/file.py +265 -0
  213. biotite/sequence/io/fastq/__init__.py +19 -0
  214. biotite/sequence/io/fastq/convert.py +117 -0
  215. biotite/sequence/io/fastq/file.py +507 -0
  216. biotite/sequence/io/genbank/__init__.py +17 -0
  217. biotite/sequence/io/genbank/annotation.py +269 -0
  218. biotite/sequence/io/genbank/file.py +573 -0
  219. biotite/sequence/io/genbank/metadata.py +336 -0
  220. biotite/sequence/io/genbank/sequence.py +171 -0
  221. biotite/sequence/io/general.py +201 -0
  222. biotite/sequence/io/gff/__init__.py +26 -0
  223. biotite/sequence/io/gff/convert.py +128 -0
  224. biotite/sequence/io/gff/file.py +450 -0
  225. biotite/sequence/phylo/__init__.py +36 -0
  226. biotite/sequence/phylo/nj.cpython-313-darwin.so +0 -0
  227. biotite/sequence/phylo/nj.pyx +221 -0
  228. biotite/sequence/phylo/tree.cpython-313-darwin.so +0 -0
  229. biotite/sequence/phylo/tree.pyx +1169 -0
  230. biotite/sequence/phylo/upgma.cpython-313-darwin.so +0 -0
  231. biotite/sequence/phylo/upgma.pyx +164 -0
  232. biotite/sequence/profile.py +567 -0
  233. biotite/sequence/search.py +118 -0
  234. biotite/sequence/seqtypes.py +713 -0
  235. biotite/sequence/sequence.py +374 -0
  236. biotite/setup_ccd.py +197 -0
  237. biotite/structure/__init__.py +133 -0
  238. biotite/structure/alphabet/__init__.py +25 -0
  239. biotite/structure/alphabet/encoder.py +332 -0
  240. biotite/structure/alphabet/encoder_weights_3di.kerasify +0 -0
  241. biotite/structure/alphabet/i3d.py +110 -0
  242. biotite/structure/alphabet/layers.py +86 -0
  243. biotite/structure/alphabet/pb.license +21 -0
  244. biotite/structure/alphabet/pb.py +171 -0
  245. biotite/structure/alphabet/unkerasify.py +122 -0
  246. biotite/structure/atoms.py +1554 -0
  247. biotite/structure/basepairs.py +1404 -0
  248. biotite/structure/bonds.cpython-313-darwin.so +0 -0
  249. biotite/structure/bonds.pyx +1972 -0
  250. biotite/structure/box.py +588 -0
  251. biotite/structure/celllist.cpython-313-darwin.so +0 -0
  252. biotite/structure/celllist.pyx +849 -0
  253. biotite/structure/chains.py +314 -0
  254. biotite/structure/charges.cpython-313-darwin.so +0 -0
  255. biotite/structure/charges.pyx +520 -0
  256. biotite/structure/compare.py +274 -0
  257. biotite/structure/density.py +109 -0
  258. biotite/structure/dotbracket.py +214 -0
  259. biotite/structure/error.py +39 -0
  260. biotite/structure/filter.py +590 -0
  261. biotite/structure/geometry.py +655 -0
  262. biotite/structure/graphics/__init__.py +13 -0
  263. biotite/structure/graphics/atoms.py +243 -0
  264. biotite/structure/graphics/rna.py +295 -0
  265. biotite/structure/hbond.py +428 -0
  266. biotite/structure/info/__init__.py +24 -0
  267. biotite/structure/info/atom_masses.json +121 -0
  268. biotite/structure/info/atoms.py +81 -0
  269. biotite/structure/info/bonds.py +149 -0
  270. biotite/structure/info/ccd.py +202 -0
  271. biotite/structure/info/components.bcif +0 -0
  272. biotite/structure/info/groups.py +131 -0
  273. biotite/structure/info/masses.py +121 -0
  274. biotite/structure/info/misc.py +138 -0
  275. biotite/structure/info/radii.py +197 -0
  276. biotite/structure/info/standardize.py +186 -0
  277. biotite/structure/integrity.py +215 -0
  278. biotite/structure/io/__init__.py +29 -0
  279. biotite/structure/io/dcd/__init__.py +13 -0
  280. biotite/structure/io/dcd/file.py +67 -0
  281. biotite/structure/io/general.py +243 -0
  282. biotite/structure/io/gro/__init__.py +14 -0
  283. biotite/structure/io/gro/file.py +344 -0
  284. biotite/structure/io/mol/__init__.py +20 -0
  285. biotite/structure/io/mol/convert.py +112 -0
  286. biotite/structure/io/mol/ctab.py +415 -0
  287. biotite/structure/io/mol/header.py +120 -0
  288. biotite/structure/io/mol/mol.py +149 -0
  289. biotite/structure/io/mol/sdf.py +914 -0
  290. biotite/structure/io/netcdf/__init__.py +13 -0
  291. biotite/structure/io/netcdf/file.py +64 -0
  292. biotite/structure/io/pdb/__init__.py +20 -0
  293. biotite/structure/io/pdb/convert.py +307 -0
  294. biotite/structure/io/pdb/file.py +1290 -0
  295. biotite/structure/io/pdb/hybrid36.cpython-313-darwin.so +0 -0
  296. biotite/structure/io/pdb/hybrid36.pyx +242 -0
  297. biotite/structure/io/pdbqt/__init__.py +15 -0
  298. biotite/structure/io/pdbqt/convert.py +113 -0
  299. biotite/structure/io/pdbqt/file.py +688 -0
  300. biotite/structure/io/pdbx/__init__.py +23 -0
  301. biotite/structure/io/pdbx/bcif.py +656 -0
  302. biotite/structure/io/pdbx/cif.py +1075 -0
  303. biotite/structure/io/pdbx/component.py +245 -0
  304. biotite/structure/io/pdbx/compress.py +321 -0
  305. biotite/structure/io/pdbx/convert.py +1745 -0
  306. biotite/structure/io/pdbx/encoding.cpython-313-darwin.so +0 -0
  307. biotite/structure/io/pdbx/encoding.pyx +1031 -0
  308. biotite/structure/io/trajfile.py +693 -0
  309. biotite/structure/io/trr/__init__.py +13 -0
  310. biotite/structure/io/trr/file.py +43 -0
  311. biotite/structure/io/xtc/__init__.py +13 -0
  312. biotite/structure/io/xtc/file.py +43 -0
  313. biotite/structure/mechanics.py +73 -0
  314. biotite/structure/molecules.py +352 -0
  315. biotite/structure/pseudoknots.py +628 -0
  316. biotite/structure/rdf.py +245 -0
  317. biotite/structure/repair.py +304 -0
  318. biotite/structure/residues.py +572 -0
  319. biotite/structure/sasa.cpython-313-darwin.so +0 -0
  320. biotite/structure/sasa.pyx +322 -0
  321. biotite/structure/segments.py +178 -0
  322. biotite/structure/sequence.py +111 -0
  323. biotite/structure/sse.py +308 -0
  324. biotite/structure/superimpose.py +689 -0
  325. biotite/structure/transform.py +530 -0
  326. biotite/structure/util.py +168 -0
  327. biotite/version.py +16 -0
  328. biotite/visualize.py +265 -0
  329. biotite-1.1.0.dist-info/METADATA +190 -0
  330. biotite-1.1.0.dist-info/RECORD +332 -0
  331. biotite-1.1.0.dist-info/WHEEL +4 -0
  332. biotite-1.1.0.dist-info/licenses/LICENSE.rst +30 -0
@@ -0,0 +1,43 @@
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.structure.io.trr"
6
+ __author__ = "Patrick Kunzmann"
7
+ __all__ = ["TRRFile"]
8
+
9
+ import biotraj
10
+ import numpy as np
11
+ from biotite.structure.io.trajfile import TrajectoryFile
12
+
13
+
14
+ class TRRFile(TrajectoryFile):
15
+ """
16
+ This file class represents a TRR trajectory file.
17
+ """
18
+
19
+ @classmethod
20
+ def traj_type(cls):
21
+ return biotraj.TRRTrajectoryFile
22
+
23
+ @classmethod
24
+ def process_read_values(cls, read_values):
25
+ # nm to Angstrom
26
+ coord = read_values[0] * 10
27
+ box = read_values[3]
28
+ if box is not None:
29
+ box *= 10
30
+ time = read_values[1]
31
+ return coord, box, time
32
+
33
+ @classmethod
34
+ def prepare_write_values(cls, coord, box, time):
35
+ # Angstrom to nm
36
+ xyz = np.divide(coord, 10, dtype=np.float32) if coord is not None else None
37
+ time = time.astype(np.float32, copy=False) if time is not None else None
38
+ box = np.divide(box, 10, dtype=np.float32) if box is not None else None
39
+ return {
40
+ "xyz": xyz,
41
+ "box": box,
42
+ "time": time,
43
+ }
@@ -0,0 +1,13 @@
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
+ This subpackage is used for reading and writing trajectories in the
7
+ compressed *Gromacs* XTC format.
8
+ """
9
+
10
+ __name__ = "biotite.structure.io.xtc"
11
+ __author__ = "Patrick Kunzmann"
12
+
13
+ from .file import *
@@ -0,0 +1,43 @@
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.structure.io.xtc"
6
+ __author__ = "Patrick Kunzmann"
7
+ __all__ = ["XTCFile"]
8
+
9
+ import biotraj
10
+ import numpy as np
11
+ from biotite.structure.io.trajfile import TrajectoryFile
12
+
13
+
14
+ class XTCFile(TrajectoryFile):
15
+ """
16
+ This file class represents a XTC trajectory file.
17
+ """
18
+
19
+ @classmethod
20
+ def traj_type(cls):
21
+ return biotraj.XTCTrajectoryFile
22
+
23
+ @classmethod
24
+ def process_read_values(cls, read_values):
25
+ # nm to Angstrom
26
+ coord = read_values[0] * 10
27
+ box = read_values[3]
28
+ if box is not None:
29
+ box *= 10
30
+ time = read_values[1]
31
+ return coord, box, time
32
+
33
+ @classmethod
34
+ def prepare_write_values(cls, coord, box, time):
35
+ # Angstrom to nm
36
+ xyz = np.divide(coord, 10, dtype=np.float32) if coord is not None else None
37
+ time = time.astype(np.float32, copy=False) if time is not None else None
38
+ box = np.divide(box, 10, dtype=np.float32) if box is not None else None
39
+ return {
40
+ "xyz": xyz,
41
+ "box": box,
42
+ "time": time,
43
+ }
@@ -0,0 +1,73 @@
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
+ This module provides functions for calculation of mechanical or
7
+ mass-related properties of a molecular structure.
8
+ """
9
+
10
+ __name__ = "biotite.structure"
11
+ __author__ = "Patrick Kunzmann"
12
+ __all__ = ["mass_center", "gyration_radius"]
13
+
14
+ import numpy as np
15
+ from biotite.structure.geometry import distance
16
+ from biotite.structure.info.masses import mass
17
+
18
+
19
+ def gyration_radius(array, masses=None):
20
+ """
21
+ Compute the radius/radii of gyration of an atom array or stack.
22
+
23
+ Parameters
24
+ ----------
25
+ array : AtomArray or AtomArrayStack
26
+ The array or stack to calculate the radius/radii of gyration
27
+ for.
28
+ masses : ndarray, optional
29
+ The masses to use for each atom in the input `array`.
30
+ Must have the same length as `array`. By default, the standard
31
+ atomic mass for each element is taken.
32
+
33
+
34
+ Returns
35
+ -------
36
+ masses : float or ndarray, dtype=float
37
+ If `array` is an :class:`AtomArray`, the radius of gyration is
38
+ returned as single float.
39
+ If `array` is an :class:`AtomArrayStack`, a :class:`ndarray`
40
+ containing the radii of gyration for every model is returned.
41
+ """
42
+ if masses is None:
43
+ masses = np.array([mass(element) for element in array.element])
44
+ center = mass_center(array, masses)
45
+ radii = distance(array, center[..., np.newaxis, :])
46
+ inertia_moment = np.sum(masses * radii * radii, axis=-1)
47
+ return np.sqrt(inertia_moment / np.sum(masses))
48
+
49
+
50
+ def mass_center(array, masses=None):
51
+ """
52
+ Calculate the center(s) of mass of an atom array or stack.
53
+
54
+ Parameters
55
+ ----------
56
+ array : AtomArray or AtomArrayStack
57
+ The array or stack to calculate the center(s) of mass for.
58
+ masses : ndarray, optional
59
+ The masses to use for each atom in the input `array`.
60
+ Must have the same length as `array`. By default, the standard
61
+ atomic mass for each element is taken.
62
+
63
+ Returns
64
+ -------
65
+ radius : ndarray, ndarray, dtype=float
66
+ Array containing the the coordinates of the center of mass.
67
+ If `array` is an :class:`AtomArray`, this will be an length 3
68
+ :class:`ndarray`; if it is an :class:`AtomArrayStack` with *n* models,
69
+ a (*n x 3*) :class:`ndarray` is returned.
70
+ """
71
+ if masses is None:
72
+ masses = np.array([mass(element) for element in array.element])
73
+ return np.sum(masses[:, np.newaxis] * array.coord, axis=-2) / np.sum(masses)
@@ -0,0 +1,352 @@
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
+ This module provides utility for separating structures into single
7
+ molecules.
8
+ """
9
+
10
+ __name__ = "biotite.structure"
11
+ __author__ = "Patrick Kunzmann"
12
+ __all__ = ["get_molecule_indices", "get_molecule_masks", "molecule_iter"]
13
+
14
+ import numpy as np
15
+ from biotite.structure.atoms import AtomArray, AtomArrayStack
16
+ from biotite.structure.bonds import BondList, find_connected
17
+
18
+
19
+ def get_molecule_indices(array):
20
+ """
21
+ Get an index array for each molecule in the given structure.
22
+
23
+ A molecule is defined as a group of atoms that are directly or
24
+ indirectly connected via covalent bonds.
25
+ In this function a single atom, that has no connection to any other
26
+ atom (e.g. an ion), also qualifies as a molecule.
27
+
28
+ Parameters
29
+ ----------
30
+ array : AtomArray or AtomArrayStack or BondList
31
+ The input structure with an associated :class:`BondList`.
32
+ Alternatively, the :class:`BondList` can be directly supplied.
33
+
34
+ Returns
35
+ -------
36
+ indices : list of ndarray, dtype=int
37
+ Each element in the list is an index array referring to the
38
+ atoms of a single molecule.
39
+ Consequently, the length of this list is equal to the number of
40
+ molecules in the input `array`.
41
+
42
+ See also
43
+ --------
44
+ get_molecule_masks
45
+ molecule_iter
46
+
47
+ Examples
48
+ --------
49
+ Get an :class:`AtomArray` for ATP and show that it is a single
50
+ molecule:
51
+
52
+ >>> atp = residue("ATP")
53
+ >>> indices = get_molecule_indices(atp)
54
+ >>> print(len(indices))
55
+ 1
56
+
57
+ Separate ATP into two molecules by breaking the glycosidic bond
58
+ to the triphosphate:
59
+
60
+ >>> i, j = np.where(np.isin(atp.atom_name, ("O5'", "PA")))[0]
61
+ >>> atp.bonds.remove_bond(i, j)
62
+ >>> indices = get_molecule_indices(atp)
63
+ >>> print(len(indices))
64
+ 2
65
+ >>> print(atp[indices[0]])
66
+ HET 0 ATP PG P 1.200 -0.226 -6.850
67
+ HET 0 ATP O1G O 1.740 1.140 -6.672
68
+ HET 0 ATP O2G O 2.123 -1.036 -7.891
69
+ HET 0 ATP O3G O -0.302 -0.139 -7.421
70
+ HET 0 ATP PB P 0.255 -0.130 -4.446
71
+ HET 0 ATP O1B O 0.810 1.234 -4.304
72
+ HET 0 ATP O2B O -1.231 -0.044 -5.057
73
+ HET 0 ATP O3B O 1.192 -0.990 -5.433
74
+ HET 0 ATP PA P -0.745 0.068 -2.071
75
+ HET 0 ATP O1A O -2.097 0.143 -2.669
76
+ HET 0 ATP O2A O -0.125 1.549 -1.957
77
+ HET 0 ATP O3A O 0.203 -0.840 -3.002
78
+ HET 0 ATP HOG2 H 2.100 -0.546 -8.725
79
+ HET 0 ATP HOG3 H -0.616 -1.048 -7.522
80
+ HET 0 ATP HOB2 H -1.554 -0.952 -5.132
81
+ HET 0 ATP HOA2 H 0.752 1.455 -1.563
82
+ >>> print(atp[indices[1]])
83
+ HET 0 ATP O5' O -0.844 -0.587 -0.604
84
+ HET 0 ATP C5' C -1.694 0.260 0.170
85
+ HET 0 ATP C4' C -1.831 -0.309 1.584
86
+ HET 0 ATP O4' O -0.542 -0.355 2.234
87
+ HET 0 ATP C3' C -2.683 0.630 2.465
88
+ HET 0 ATP O3' O -4.033 0.165 2.534
89
+ HET 0 ATP C2' C -2.011 0.555 3.856
90
+ HET 0 ATP O2' O -2.926 0.043 4.827
91
+ HET 0 ATP C1' C -0.830 -0.418 3.647
92
+ HET 0 ATP N9 N 0.332 0.015 4.425
93
+ HET 0 ATP C8 C 1.302 0.879 4.012
94
+ HET 0 ATP N7 N 2.184 1.042 4.955
95
+ HET 0 ATP C5 C 1.833 0.300 6.033
96
+ HET 0 ATP C6 C 2.391 0.077 7.303
97
+ HET 0 ATP N6 N 3.564 0.706 7.681
98
+ HET 0 ATP N1 N 1.763 -0.747 8.135
99
+ HET 0 ATP C2 C 0.644 -1.352 7.783
100
+ HET 0 ATP N3 N 0.088 -1.178 6.602
101
+ HET 0 ATP C4 C 0.644 -0.371 5.704
102
+ HET 0 ATP H5'1 H -2.678 0.312 -0.296
103
+ HET 0 ATP H5'2 H -1.263 1.259 0.221
104
+ HET 0 ATP H4' H -2.275 -1.304 1.550
105
+ HET 0 ATP H3' H -2.651 1.649 2.078
106
+ HET 0 ATP HO3' H -4.515 0.788 3.094
107
+ HET 0 ATP H2' H -1.646 1.537 4.157
108
+ HET 0 ATP HO2' H -3.667 0.662 4.867
109
+ HET 0 ATP H1' H -1.119 -1.430 3.931
110
+ HET 0 ATP H8 H 1.334 1.357 3.044
111
+ HET 0 ATP HN61 H 3.938 0.548 8.562
112
+ HET 0 ATP HN62 H 4.015 1.303 7.064
113
+ HET 0 ATP H2 H 0.166 -2.014 8.490
114
+ """
115
+ if isinstance(array, BondList):
116
+ bonds = array
117
+ elif isinstance(array, (AtomArray, AtomArrayStack)):
118
+ if array.bonds is None:
119
+ raise ValueError("An associated BondList is required")
120
+ bonds = array.bonds
121
+ else:
122
+ raise TypeError(
123
+ f"Expected a 'BondList', 'AtomArray' or 'AtomArrayStack', "
124
+ f"not '{type(array).__name__}'"
125
+ )
126
+
127
+ molecule_indices = []
128
+ visited_mask = np.zeros(bonds.get_atom_count(), dtype=bool)
129
+ while not visited_mask.all():
130
+ root = np.argmin(visited_mask)
131
+ connected = find_connected(bonds, root)
132
+ visited_mask[connected] = True
133
+ molecule_indices.append(connected)
134
+ return molecule_indices
135
+
136
+
137
+ def get_molecule_masks(array):
138
+ """
139
+ Get a boolean mask for each molecule in the given structure.
140
+
141
+ A molecule is defined as a group of atoms that are directly or
142
+ indirectly connected via covalent bonds.
143
+ In this function a single atom, that has no connection to any other
144
+ atom (e.g. an ion), also qualifies as a molecule.
145
+
146
+ Parameters
147
+ ----------
148
+ array : AtomArray, shape=(n,) or AtomArrayStack, shape=(m,n) or BondList
149
+ The input structure with an associated :class:`BondList`.
150
+ Alternatively, the :class:`BondList` can be directly supplied.
151
+
152
+ Returns
153
+ -------
154
+ masks : ndarray, shape=(k,n), dtype=bool,
155
+ Each element in the array is a boolean mask referring to the
156
+ atoms of a single molecule.
157
+ Consequently, the length of this list is equal to the number of
158
+ molecules in the input `array`.
159
+
160
+ See also
161
+ --------
162
+ get_molecule_indices
163
+ molecule_iter
164
+
165
+ Examples
166
+ --------
167
+ Get an :class:`AtomArray` for ATP and show that it is a single
168
+ molecule:
169
+
170
+ >>> atp = residue("ATP")
171
+ >>> masks = get_molecule_masks(atp)
172
+ >>> print(len(masks))
173
+ 1
174
+
175
+ Separate ATP into two molecules by breaking the glycosidic bond
176
+ to the triphosphate:
177
+
178
+ >>> i, j = np.where(np.isin(atp.atom_name, ("O5'", "PA")))[0]
179
+ >>> atp.bonds.remove_bond(i, j)
180
+ >>> masks = get_molecule_masks(atp)
181
+ >>> print(len(masks))
182
+ 2
183
+ >>> print(atp[masks[0]])
184
+ HET 0 ATP PG P 1.200 -0.226 -6.850
185
+ HET 0 ATP O1G O 1.740 1.140 -6.672
186
+ HET 0 ATP O2G O 2.123 -1.036 -7.891
187
+ HET 0 ATP O3G O -0.302 -0.139 -7.421
188
+ HET 0 ATP PB P 0.255 -0.130 -4.446
189
+ HET 0 ATP O1B O 0.810 1.234 -4.304
190
+ HET 0 ATP O2B O -1.231 -0.044 -5.057
191
+ HET 0 ATP O3B O 1.192 -0.990 -5.433
192
+ HET 0 ATP PA P -0.745 0.068 -2.071
193
+ HET 0 ATP O1A O -2.097 0.143 -2.669
194
+ HET 0 ATP O2A O -0.125 1.549 -1.957
195
+ HET 0 ATP O3A O 0.203 -0.840 -3.002
196
+ HET 0 ATP HOG2 H 2.100 -0.546 -8.725
197
+ HET 0 ATP HOG3 H -0.616 -1.048 -7.522
198
+ HET 0 ATP HOB2 H -1.554 -0.952 -5.132
199
+ HET 0 ATP HOA2 H 0.752 1.455 -1.563
200
+ >>> print(atp[masks[1]])
201
+ HET 0 ATP O5' O -0.844 -0.587 -0.604
202
+ HET 0 ATP C5' C -1.694 0.260 0.170
203
+ HET 0 ATP C4' C -1.831 -0.309 1.584
204
+ HET 0 ATP O4' O -0.542 -0.355 2.234
205
+ HET 0 ATP C3' C -2.683 0.630 2.465
206
+ HET 0 ATP O3' O -4.033 0.165 2.534
207
+ HET 0 ATP C2' C -2.011 0.555 3.856
208
+ HET 0 ATP O2' O -2.926 0.043 4.827
209
+ HET 0 ATP C1' C -0.830 -0.418 3.647
210
+ HET 0 ATP N9 N 0.332 0.015 4.425
211
+ HET 0 ATP C8 C 1.302 0.879 4.012
212
+ HET 0 ATP N7 N 2.184 1.042 4.955
213
+ HET 0 ATP C5 C 1.833 0.300 6.033
214
+ HET 0 ATP C6 C 2.391 0.077 7.303
215
+ HET 0 ATP N6 N 3.564 0.706 7.681
216
+ HET 0 ATP N1 N 1.763 -0.747 8.135
217
+ HET 0 ATP C2 C 0.644 -1.352 7.783
218
+ HET 0 ATP N3 N 0.088 -1.178 6.602
219
+ HET 0 ATP C4 C 0.644 -0.371 5.704
220
+ HET 0 ATP H5'1 H -2.678 0.312 -0.296
221
+ HET 0 ATP H5'2 H -1.263 1.259 0.221
222
+ HET 0 ATP H4' H -2.275 -1.304 1.550
223
+ HET 0 ATP H3' H -2.651 1.649 2.078
224
+ HET 0 ATP HO3' H -4.515 0.788 3.094
225
+ HET 0 ATP H2' H -1.646 1.537 4.157
226
+ HET 0 ATP HO2' H -3.667 0.662 4.867
227
+ HET 0 ATP H1' H -1.119 -1.430 3.931
228
+ HET 0 ATP H8 H 1.334 1.357 3.044
229
+ HET 0 ATP HN61 H 3.938 0.548 8.562
230
+ HET 0 ATP HN62 H 4.015 1.303 7.064
231
+ HET 0 ATP H2 H 0.166 -2.014 8.490
232
+ """
233
+ if isinstance(array, BondList):
234
+ bonds = array
235
+ elif isinstance(array, (AtomArray, AtomArrayStack)):
236
+ if array.bonds is None:
237
+ raise ValueError("An associated BondList is required")
238
+ bonds = array.bonds
239
+ else:
240
+ raise TypeError(
241
+ f"Expected a 'BondList', 'AtomArray' or 'AtomArrayStack', "
242
+ f"not '{type(array).__name__}'"
243
+ )
244
+
245
+ molecule_indices = get_molecule_indices(bonds)
246
+ molecule_masks = np.zeros(
247
+ (len(molecule_indices), bonds.get_atom_count()), dtype=bool
248
+ )
249
+ for i in range(len(molecule_indices)):
250
+ molecule_masks[i, molecule_indices[i]] = True
251
+ return molecule_masks
252
+
253
+
254
+ def molecule_iter(array):
255
+ """
256
+ Iterate over each molecule in a input structure.
257
+
258
+ A molecule is defined as a group of atoms that are directly or
259
+ indirectly connected via covalent bonds.
260
+ In this function a single atom, that has no connection to any other
261
+ atom (e.g. an ion), also qualifies as a molecule.
262
+
263
+ Parameters
264
+ ----------
265
+ array : AtomArray or AtomArrayStack
266
+ The input structure with an associated :class:`BondList`.
267
+
268
+ Yields
269
+ ------
270
+ molecule : AtomArray or AtomArrayStack
271
+ A single molecule of the input `array`.
272
+
273
+ See also
274
+ --------
275
+ get_molecule_indices
276
+ get_molecule_masks
277
+
278
+ Examples
279
+ --------
280
+ Get an :class:`AtomArray` for ATP and break it into two molecules
281
+ at the glycosidic bond to the triphosphate:
282
+
283
+ >>> atp = residue("ATP")
284
+ >>> i, j = np.where(np.isin(atp.atom_name, ("O5'", "PA")))[0]
285
+ >>> atp.bonds.remove_bond(i, j)
286
+ >>> for molecule in molecule_iter(atp):
287
+ ... print("New molecule")
288
+ ... print(molecule)
289
+ ... print()
290
+ New molecule
291
+ HET 0 ATP PG P 1.200 -0.226 -6.850
292
+ HET 0 ATP O1G O 1.740 1.140 -6.672
293
+ HET 0 ATP O2G O 2.123 -1.036 -7.891
294
+ HET 0 ATP O3G O -0.302 -0.139 -7.421
295
+ HET 0 ATP PB P 0.255 -0.130 -4.446
296
+ HET 0 ATP O1B O 0.810 1.234 -4.304
297
+ HET 0 ATP O2B O -1.231 -0.044 -5.057
298
+ HET 0 ATP O3B O 1.192 -0.990 -5.433
299
+ HET 0 ATP PA P -0.745 0.068 -2.071
300
+ HET 0 ATP O1A O -2.097 0.143 -2.669
301
+ HET 0 ATP O2A O -0.125 1.549 -1.957
302
+ HET 0 ATP O3A O 0.203 -0.840 -3.002
303
+ HET 0 ATP HOG2 H 2.100 -0.546 -8.725
304
+ HET 0 ATP HOG3 H -0.616 -1.048 -7.522
305
+ HET 0 ATP HOB2 H -1.554 -0.952 -5.132
306
+ HET 0 ATP HOA2 H 0.752 1.455 -1.563
307
+ <BLANKLINE>
308
+ New molecule
309
+ HET 0 ATP O5' O -0.844 -0.587 -0.604
310
+ HET 0 ATP C5' C -1.694 0.260 0.170
311
+ HET 0 ATP C4' C -1.831 -0.309 1.584
312
+ HET 0 ATP O4' O -0.542 -0.355 2.234
313
+ HET 0 ATP C3' C -2.683 0.630 2.465
314
+ HET 0 ATP O3' O -4.033 0.165 2.534
315
+ HET 0 ATP C2' C -2.011 0.555 3.856
316
+ HET 0 ATP O2' O -2.926 0.043 4.827
317
+ HET 0 ATP C1' C -0.830 -0.418 3.647
318
+ HET 0 ATP N9 N 0.332 0.015 4.425
319
+ HET 0 ATP C8 C 1.302 0.879 4.012
320
+ HET 0 ATP N7 N 2.184 1.042 4.955
321
+ HET 0 ATP C5 C 1.833 0.300 6.033
322
+ HET 0 ATP C6 C 2.391 0.077 7.303
323
+ HET 0 ATP N6 N 3.564 0.706 7.681
324
+ HET 0 ATP N1 N 1.763 -0.747 8.135
325
+ HET 0 ATP C2 C 0.644 -1.352 7.783
326
+ HET 0 ATP N3 N 0.088 -1.178 6.602
327
+ HET 0 ATP C4 C 0.644 -0.371 5.704
328
+ HET 0 ATP H5'1 H -2.678 0.312 -0.296
329
+ HET 0 ATP H5'2 H -1.263 1.259 0.221
330
+ HET 0 ATP H4' H -2.275 -1.304 1.550
331
+ HET 0 ATP H3' H -2.651 1.649 2.078
332
+ HET 0 ATP HO3' H -4.515 0.788 3.094
333
+ HET 0 ATP H2' H -1.646 1.537 4.157
334
+ HET 0 ATP HO2' H -3.667 0.662 4.867
335
+ HET 0 ATP H1' H -1.119 -1.430 3.931
336
+ HET 0 ATP H8 H 1.334 1.357 3.044
337
+ HET 0 ATP HN61 H 3.938 0.548 8.562
338
+ HET 0 ATP HN62 H 4.015 1.303 7.064
339
+ HET 0 ATP H2 H 0.166 -2.014 8.490
340
+ <BLANKLINE>
341
+ """
342
+ if array.bonds is None:
343
+ raise ValueError("An associated BondList is required")
344
+ bonds = array.bonds
345
+
346
+ visited_mask = np.zeros(bonds.get_atom_count(), dtype=bool)
347
+ while not visited_mask.all():
348
+ # Take the first atom that has not been considered yet as root
349
+ root = np.argmin(visited_mask)
350
+ connected = find_connected(bonds, root)
351
+ visited_mask[connected] = True
352
+ yield array[..., connected]