biotite 0.41.2__cp312-cp312-win_amd64.whl → 1.0.1__cp312-cp312-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of biotite might be problematic. Click here for more details.

Files changed (205) hide show
  1. biotite/__init__.py +2 -3
  2. biotite/application/__init__.py +1 -1
  3. biotite/application/application.py +20 -10
  4. biotite/application/autodock/__init__.py +1 -1
  5. biotite/application/autodock/app.py +74 -79
  6. biotite/application/blast/__init__.py +1 -1
  7. biotite/application/blast/alignment.py +19 -10
  8. biotite/application/blast/webapp.py +92 -85
  9. biotite/application/clustalo/__init__.py +1 -1
  10. biotite/application/clustalo/app.py +46 -61
  11. biotite/application/dssp/__init__.py +1 -1
  12. biotite/application/dssp/app.py +8 -11
  13. biotite/application/localapp.py +62 -60
  14. biotite/application/mafft/__init__.py +1 -1
  15. biotite/application/mafft/app.py +16 -22
  16. biotite/application/msaapp.py +78 -89
  17. biotite/application/muscle/__init__.py +1 -1
  18. biotite/application/muscle/app3.py +50 -64
  19. biotite/application/muscle/app5.py +23 -31
  20. biotite/application/sra/__init__.py +1 -1
  21. biotite/application/sra/app.py +64 -68
  22. biotite/application/tantan/__init__.py +1 -1
  23. biotite/application/tantan/app.py +22 -45
  24. biotite/application/util.py +7 -9
  25. biotite/application/viennarna/rnaalifold.py +34 -28
  26. biotite/application/viennarna/rnafold.py +24 -39
  27. biotite/application/viennarna/rnaplot.py +36 -21
  28. biotite/application/viennarna/util.py +17 -12
  29. biotite/application/webapp.py +13 -14
  30. biotite/copyable.py +13 -13
  31. biotite/database/__init__.py +1 -1
  32. biotite/database/entrez/__init__.py +1 -1
  33. biotite/database/entrez/check.py +2 -3
  34. biotite/database/entrez/dbnames.py +7 -5
  35. biotite/database/entrez/download.py +55 -49
  36. biotite/database/entrez/key.py +1 -1
  37. biotite/database/entrez/query.py +62 -23
  38. biotite/database/error.py +2 -1
  39. biotite/database/pubchem/__init__.py +1 -1
  40. biotite/database/pubchem/download.py +43 -45
  41. biotite/database/pubchem/error.py +2 -2
  42. biotite/database/pubchem/query.py +34 -31
  43. biotite/database/pubchem/throttle.py +3 -4
  44. biotite/database/rcsb/__init__.py +1 -1
  45. biotite/database/rcsb/download.py +44 -52
  46. biotite/database/rcsb/query.py +85 -80
  47. biotite/database/uniprot/check.py +6 -3
  48. biotite/database/uniprot/download.py +6 -11
  49. biotite/database/uniprot/query.py +115 -31
  50. biotite/file.py +12 -31
  51. biotite/sequence/__init__.py +3 -3
  52. biotite/sequence/align/__init__.py +2 -2
  53. biotite/sequence/align/alignment.py +99 -90
  54. biotite/sequence/align/banded.cp312-win_amd64.pyd +0 -0
  55. biotite/sequence/align/buckets.py +12 -10
  56. biotite/sequence/align/cigar.py +43 -52
  57. biotite/sequence/align/kmeralphabet.cp312-win_amd64.pyd +0 -0
  58. biotite/sequence/align/kmeralphabet.pyx +55 -51
  59. biotite/sequence/align/kmersimilarity.cp312-win_amd64.pyd +0 -0
  60. biotite/sequence/align/kmertable.cp312-win_amd64.pyd +0 -0
  61. biotite/sequence/align/kmertable.pyx +3 -2
  62. biotite/sequence/align/localgapped.cp312-win_amd64.pyd +0 -0
  63. biotite/sequence/align/localungapped.cp312-win_amd64.pyd +0 -0
  64. biotite/sequence/align/matrix.py +81 -82
  65. biotite/sequence/align/multiple.cp312-win_amd64.pyd +0 -0
  66. biotite/sequence/align/multiple.pyx +1 -1
  67. biotite/sequence/align/pairwise.cp312-win_amd64.pyd +0 -0
  68. biotite/sequence/align/permutation.cp312-win_amd64.pyd +0 -0
  69. biotite/sequence/align/permutation.pyx +12 -4
  70. biotite/sequence/align/selector.cp312-win_amd64.pyd +0 -0
  71. biotite/sequence/align/selector.pyx +52 -54
  72. biotite/sequence/align/statistics.py +32 -33
  73. biotite/sequence/align/tracetable.cp312-win_amd64.pyd +0 -0
  74. biotite/sequence/alphabet.py +51 -65
  75. biotite/sequence/annotation.py +78 -77
  76. biotite/sequence/codec.cp312-win_amd64.pyd +0 -0
  77. biotite/sequence/codon.py +90 -79
  78. biotite/sequence/graphics/__init__.py +1 -1
  79. biotite/sequence/graphics/alignment.py +184 -103
  80. biotite/sequence/graphics/colorschemes.py +10 -12
  81. biotite/sequence/graphics/dendrogram.py +79 -34
  82. biotite/sequence/graphics/features.py +133 -99
  83. biotite/sequence/graphics/logo.py +22 -28
  84. biotite/sequence/graphics/plasmid.py +229 -178
  85. biotite/sequence/io/fasta/__init__.py +1 -1
  86. biotite/sequence/io/fasta/convert.py +44 -33
  87. biotite/sequence/io/fasta/file.py +42 -55
  88. biotite/sequence/io/fastq/__init__.py +1 -1
  89. biotite/sequence/io/fastq/convert.py +11 -14
  90. biotite/sequence/io/fastq/file.py +68 -112
  91. biotite/sequence/io/genbank/__init__.py +2 -2
  92. biotite/sequence/io/genbank/annotation.py +12 -20
  93. biotite/sequence/io/genbank/file.py +74 -76
  94. biotite/sequence/io/genbank/metadata.py +74 -62
  95. biotite/sequence/io/genbank/sequence.py +13 -14
  96. biotite/sequence/io/general.py +39 -30
  97. biotite/sequence/io/gff/__init__.py +2 -2
  98. biotite/sequence/io/gff/convert.py +10 -15
  99. biotite/sequence/io/gff/file.py +81 -65
  100. biotite/sequence/phylo/__init__.py +1 -1
  101. biotite/sequence/phylo/nj.cp312-win_amd64.pyd +0 -0
  102. biotite/sequence/phylo/tree.cp312-win_amd64.pyd +0 -0
  103. biotite/sequence/phylo/upgma.cp312-win_amd64.pyd +0 -0
  104. biotite/sequence/profile.py +57 -28
  105. biotite/sequence/search.py +17 -15
  106. biotite/sequence/seqtypes.py +200 -164
  107. biotite/sequence/sequence.py +15 -17
  108. biotite/structure/__init__.py +3 -3
  109. biotite/structure/atoms.py +246 -236
  110. biotite/structure/basepairs.py +260 -271
  111. biotite/structure/bonds.cp312-win_amd64.pyd +0 -0
  112. biotite/structure/bonds.pyx +29 -32
  113. biotite/structure/box.py +67 -71
  114. biotite/structure/celllist.cp312-win_amd64.pyd +0 -0
  115. biotite/structure/chains.py +55 -39
  116. biotite/structure/charges.cp312-win_amd64.pyd +0 -0
  117. biotite/structure/compare.py +32 -32
  118. biotite/structure/density.py +13 -18
  119. biotite/structure/dotbracket.py +20 -22
  120. biotite/structure/error.py +10 -2
  121. biotite/structure/filter.py +83 -78
  122. biotite/structure/geometry.py +130 -119
  123. biotite/structure/graphics/atoms.py +60 -43
  124. biotite/structure/graphics/rna.py +81 -68
  125. biotite/structure/hbond.py +112 -93
  126. biotite/structure/info/__init__.py +0 -2
  127. biotite/structure/info/atoms.py +10 -11
  128. biotite/structure/info/bonds.py +41 -43
  129. biotite/structure/info/ccd.py +4 -5
  130. biotite/structure/info/groups.py +1 -3
  131. biotite/structure/info/masses.py +5 -10
  132. biotite/structure/info/misc.py +1 -1
  133. biotite/structure/info/radii.py +20 -20
  134. biotite/structure/info/standardize.py +15 -26
  135. biotite/structure/integrity.py +18 -71
  136. biotite/structure/io/__init__.py +3 -4
  137. biotite/structure/io/dcd/__init__.py +1 -1
  138. biotite/structure/io/dcd/file.py +22 -20
  139. biotite/structure/io/general.py +47 -61
  140. biotite/structure/io/gro/__init__.py +1 -1
  141. biotite/structure/io/gro/file.py +73 -72
  142. biotite/structure/io/mol/__init__.py +1 -1
  143. biotite/structure/io/mol/convert.py +8 -11
  144. biotite/structure/io/mol/ctab.py +37 -36
  145. biotite/structure/io/mol/header.py +14 -10
  146. biotite/structure/io/mol/mol.py +9 -53
  147. biotite/structure/io/mol/sdf.py +47 -50
  148. biotite/structure/io/netcdf/__init__.py +1 -1
  149. biotite/structure/io/netcdf/file.py +24 -23
  150. biotite/structure/io/pdb/__init__.py +1 -1
  151. biotite/structure/io/pdb/convert.py +32 -20
  152. biotite/structure/io/pdb/file.py +151 -172
  153. biotite/structure/io/pdb/hybrid36.cp312-win_amd64.pyd +0 -0
  154. biotite/structure/io/pdbqt/__init__.py +1 -1
  155. biotite/structure/io/pdbqt/convert.py +17 -11
  156. biotite/structure/io/pdbqt/file.py +128 -80
  157. biotite/structure/io/pdbx/__init__.py +1 -2
  158. biotite/structure/io/pdbx/bcif.py +36 -44
  159. biotite/structure/io/pdbx/cif.py +140 -110
  160. biotite/structure/io/pdbx/component.py +10 -16
  161. biotite/structure/io/pdbx/convert.py +260 -258
  162. biotite/structure/io/pdbx/encoding.cp312-win_amd64.pyd +0 -0
  163. biotite/structure/io/trajfile.py +90 -107
  164. biotite/structure/io/trr/__init__.py +1 -1
  165. biotite/structure/io/trr/file.py +12 -15
  166. biotite/structure/io/xtc/__init__.py +1 -1
  167. biotite/structure/io/xtc/file.py +11 -14
  168. biotite/structure/mechanics.py +9 -11
  169. biotite/structure/molecules.py +3 -4
  170. biotite/structure/pseudoknots.py +53 -67
  171. biotite/structure/rdf.py +23 -21
  172. biotite/structure/repair.py +137 -86
  173. biotite/structure/residues.py +26 -16
  174. biotite/structure/sasa.cp312-win_amd64.pyd +0 -0
  175. biotite/structure/{resutil.py → segments.py} +24 -23
  176. biotite/structure/sequence.py +10 -11
  177. biotite/structure/sse.py +100 -119
  178. biotite/structure/superimpose.py +39 -77
  179. biotite/structure/transform.py +97 -71
  180. biotite/structure/util.py +11 -13
  181. biotite/version.py +2 -2
  182. biotite/visualize.py +69 -55
  183. {biotite-0.41.2.dist-info → biotite-1.0.1.dist-info}/METADATA +6 -5
  184. biotite-1.0.1.dist-info/RECORD +322 -0
  185. biotite/structure/io/ctab.py +0 -72
  186. biotite/structure/io/mmtf/__init__.py +0 -21
  187. biotite/structure/io/mmtf/assembly.py +0 -214
  188. biotite/structure/io/mmtf/convertarray.cp312-win_amd64.pyd +0 -0
  189. biotite/structure/io/mmtf/convertarray.pyx +0 -341
  190. biotite/structure/io/mmtf/convertfile.cp312-win_amd64.pyd +0 -0
  191. biotite/structure/io/mmtf/convertfile.pyx +0 -501
  192. biotite/structure/io/mmtf/decode.cp312-win_amd64.pyd +0 -0
  193. biotite/structure/io/mmtf/decode.pyx +0 -152
  194. biotite/structure/io/mmtf/encode.cp312-win_amd64.pyd +0 -0
  195. biotite/structure/io/mmtf/encode.pyx +0 -183
  196. biotite/structure/io/mmtf/file.py +0 -233
  197. biotite/structure/io/npz/__init__.py +0 -20
  198. biotite/structure/io/npz/file.py +0 -152
  199. biotite/structure/io/pdbx/legacy.py +0 -267
  200. biotite/structure/io/tng/__init__.py +0 -13
  201. biotite/structure/io/tng/file.py +0 -46
  202. biotite/temp.py +0 -86
  203. biotite-0.41.2.dist-info/RECORD +0 -340
  204. {biotite-0.41.2.dist-info → biotite-1.0.1.dist-info}/WHEEL +0 -0
  205. {biotite-0.41.2.dist-info → biotite-1.0.1.dist-info}/licenses/LICENSE.rst +0 -0
@@ -9,4 +9,4 @@ A subpackage for protein secondary structure annotation using DSSP.
9
9
  __name__ = "biotite.application.dssp"
10
10
  __author__ = "Patrick Kunzmann"
11
11
 
12
- from .app import *
12
+ from .app import *
@@ -7,11 +7,11 @@ __author__ = "Patrick Kunzmann"
7
7
  __all__ = ["DsspApp"]
8
8
 
9
9
  from tempfile import NamedTemporaryFile
10
- from ..localapp import LocalApp, cleanup_tempfile
11
- from ..application import AppState, requires_state
12
- from ...structure.io.pdbx.cif import CIFFile
13
- from ...structure.io.pdbx.convert import set_structure
14
10
  import numpy as np
11
+ from biotite.application.application import AppState, requires_state
12
+ from biotite.application.localapp import LocalApp, cleanup_tempfile
13
+ from biotite.structure.io.pdbx.cif import CIFFile
14
+ from biotite.structure.io.pdbx.convert import set_structure
15
15
 
16
16
 
17
17
  class DsspApp(LocalApp):
@@ -73,7 +73,7 @@ class DsspApp(LocalApp):
73
73
  "occupancy", np.ones(self._array.array_length(), dtype=float)
74
74
  )
75
75
 
76
- self._in_file = NamedTemporaryFile("w", suffix=".cif", delete=False)
76
+ self._in_file = NamedTemporaryFile("w", suffix=".cif", delete=False)
77
77
  self._out_file = NamedTemporaryFile("r", suffix=".dssp", delete=False)
78
78
 
79
79
  def run(self):
@@ -81,9 +81,7 @@ class DsspApp(LocalApp):
81
81
  set_structure(in_file, self._array)
82
82
  in_file.write(self._in_file)
83
83
  self._in_file.flush()
84
- self.set_arguments(
85
- ["-i", self._in_file.name, "-o", self._out_file.name]
86
- )
84
+ self.set_arguments(["-i", self._in_file.name, "-o", self._out_file.name])
87
85
  super().run()
88
86
 
89
87
  def evaluate(self):
@@ -93,13 +91,12 @@ class DsspApp(LocalApp):
93
91
  sse_start = None
94
92
  for i, line in enumerate(lines):
95
93
  if line.startswith(" # RESIDUE AA STRUCTURE"):
96
- sse_start = i+1
94
+ sse_start = i + 1
97
95
  if sse_start is None:
98
96
  raise ValueError("DSSP file does not contain SSE records")
99
97
  # Remove "!" for missing residues
100
98
  lines = [
101
- line for line in lines[sse_start:]
102
- if len(line) != 0 and line[13] != "!"
99
+ line for line in lines[sse_start:] if len(line) != 0 and line[13] != "!"
103
100
  ]
104
101
  self._sse = np.zeros(len(lines), dtype="U1")
105
102
  # Parse file for SSE letters
@@ -9,23 +9,29 @@ __all__ = ["LocalApp"]
9
9
  import abc
10
10
  import copy
11
11
  from os import chdir, getcwd, remove
12
- from .application import Application, AppState, AppStateError, requires_state
13
- from subprocess import Popen, PIPE, SubprocessError, TimeoutExpired
12
+ from subprocess import PIPE, Popen, SubprocessError, TimeoutExpired
13
+ from biotite.application.application import (
14
+ Application,
15
+ AppState,
16
+ AppStateError,
17
+ requires_state,
18
+ )
19
+
14
20
 
15
21
  class LocalApp(Application, metaclass=abc.ABCMeta):
16
22
  """
17
23
  The base class for all locally installed applications, that are used
18
24
  via the command line.
19
-
25
+
20
26
  Internally this creates a :class:`Popen` instance, which handles
21
27
  the execution.
22
-
28
+
23
29
  Parameters
24
30
  ----------
25
31
  bin_path : str
26
32
  Path of the application represented by this class.
27
33
  """
28
-
34
+
29
35
  def __init__(self, bin_path):
30
36
  super().__init__()
31
37
  self._bin_path = bin_path
@@ -35,28 +41,28 @@ class LocalApp(Application, metaclass=abc.ABCMeta):
35
41
  self._process = None
36
42
  self._command = None
37
43
  self._stdin_file = None
38
-
44
+
39
45
  @requires_state(AppState.CREATED)
40
46
  def set_arguments(self, arguments):
41
47
  """
42
48
  Set command line arguments for the application run.
43
-
49
+
44
50
  PROTECTED: Do not call from outside.
45
-
51
+
46
52
  Parameters
47
53
  ----------
48
54
  arguments : list of str
49
55
  A list of strings representing the command line options.
50
56
  """
51
57
  self._arguments = copy.copy(arguments)
52
-
58
+
53
59
  @requires_state(AppState.CREATED)
54
60
  def set_stdin(self, file):
55
61
  """
56
62
  Set a file as standard input for the application run.
57
-
63
+
58
64
  PROTECTED: Do not call from outside.
59
-
65
+
60
66
  Parameters
61
67
  ----------
62
68
  file : file object
@@ -65,7 +71,7 @@ class LocalApp(Application, metaclass=abc.ABCMeta):
65
71
  such as `StringIO` are invalid.
66
72
  """
67
73
  self._stdin_file = file
68
-
74
+
69
75
  @requires_state(AppState.CREATED)
70
76
  def add_additional_options(self, options):
71
77
  """
@@ -81,12 +87,12 @@ class LocalApp(Application, metaclass=abc.ABCMeta):
81
87
  It is recommended to use this method only, when the respective
82
88
  :class:`LocalApp` subclass does not provide a method to set the
83
89
  desired option.
84
-
90
+
85
91
  Parameters
86
92
  ----------
87
93
  options : list of str
88
94
  A list of strings representing the command line options.
89
-
95
+
90
96
  Notes
91
97
  -----
92
98
  In order to see which options the command line execution used,
@@ -114,27 +120,24 @@ class LocalApp(Application, metaclass=abc.ABCMeta):
114
120
  clustalo --full --in ...fa --out ...fa --force --output-order=tree-order --seqtype Protein --guidetree-out ...tree
115
121
  """
116
122
  self._options += options
117
-
123
+
118
124
  @requires_state(
119
- AppState.RUNNING | \
120
- AppState.CANCELLED | \
121
- AppState.FINISHED | \
122
- AppState.JOINED
125
+ AppState.RUNNING | AppState.CANCELLED | AppState.FINISHED | AppState.JOINED
123
126
  )
124
127
  def get_command(self):
125
128
  """
126
129
  Get the executed command.
127
130
 
128
131
  Cannot be called until the application has been started.
129
-
132
+
130
133
  Returns
131
134
  -------
132
135
  command : str
133
136
  The executed command.
134
-
137
+
135
138
  Examples
136
139
  --------
137
-
140
+
138
141
  >>> seq1 = ProteinSequence("BIQTITE")
139
142
  >>> seq2 = ProteinSequence("TITANITE")
140
143
  >>> seq3 = ProteinSequence("BISMITE")
@@ -146,72 +149,71 @@ class LocalApp(Application, metaclass=abc.ABCMeta):
146
149
  """
147
150
  return " ".join(self._command)
148
151
 
149
-
150
152
  @requires_state(AppState.CREATED)
151
153
  def set_exec_dir(self, exec_dir):
152
154
  """
153
155
  Set the directory where the application should be executed.
154
156
  If not set, it will be executed in the working directory at the
155
- time the application was created.
156
-
157
+ time the application was created.
158
+
157
159
  PROTECTED: Do not call from outside.
158
-
160
+
159
161
  Parameters
160
162
  ----------
161
163
  exec_dir : str
162
164
  The execution directory.
163
165
  """
164
166
  self._exec_dir = exec_dir
165
-
167
+
166
168
  @requires_state(AppState.RUNNING | AppState.FINISHED)
167
169
  def get_process(self):
168
170
  """
169
171
  Get the `Popen` instance.
170
-
172
+
171
173
  PROTECTED: Do not call from outside.
172
-
174
+
173
175
  Returns
174
176
  -------
175
177
  process : Popen
176
178
  The `Popen` instance
177
179
  """
178
180
  return self._process
179
-
181
+
180
182
  @requires_state(AppState.FINISHED | AppState.JOINED)
181
183
  def get_exit_code(self):
182
184
  """
183
185
  Get the exit code of the process.
184
-
186
+
185
187
  PROTECTED: Do not call from outside.
186
-
188
+
187
189
  Returns
188
190
  -------
189
191
  code : int
190
192
  The exit code.
191
193
  """
192
194
  return self._process.returncode
193
-
195
+
194
196
  @requires_state(AppState.FINISHED | AppState.JOINED)
195
197
  def get_stdout(self):
196
198
  """
197
199
  Get the STDOUT pipe content of the process.
198
-
200
+
199
201
  PROTECTED: Do not call from outside.
200
-
202
+
201
203
  Returns
202
204
  -------
203
205
  stdout : str
204
206
  The standard output.
205
207
  """
206
208
  return self._stdout
207
-
209
+
208
210
  @requires_state(AppState.FINISHED | AppState.JOINED)
209
211
  def get_stderr(self):
210
212
  """
211
213
  Get the STDERR pipe content of the process.
212
-
214
+
213
215
  PROTECTED: Do not call from outside.
214
-
216
+
215
217
  Returns
216
218
  -------
217
219
  stdout : str
@@ -221,38 +223,37 @@ class LocalApp(Application, metaclass=abc.ABCMeta):
221
223
 
222
224
  def run(self):
223
225
  cwd = getcwd()
224
- chdir(self._exec_dir)
226
+ chdir(self._exec_dir)
225
227
  self._command = [self._bin_path] + self._options + self._arguments
226
228
  self._process = Popen(
227
- self._command, stdin=self._stdin_file, stdout=PIPE, stderr=PIPE,
228
- encoding="UTF-8"
229
+ self._command,
230
+ stdin=self._stdin_file,
231
+ stdout=PIPE,
232
+ stderr=PIPE,
233
+ encoding="UTF-8",
229
234
  )
230
235
  chdir(cwd)
231
-
236
+
232
237
  def is_finished(self):
233
238
  code = self._process.poll()
234
- if code == None:
239
+ if code is None:
235
240
  return False
236
241
  else:
237
242
  self._stdout, self._stderr = self._process.communicate()
238
243
  return True
239
-
244
+
240
245
  @requires_state(AppState.RUNNING | AppState.FINISHED)
241
246
  def join(self, timeout=None):
242
247
  # Override method as repetitive calls of 'is_finished()'
243
248
  # are not necessary as 'communicate()' already waits for the
244
249
  # finished application
245
250
  try:
246
- self._stdout, self._stderr = self._process.communicate(
247
- timeout=timeout
248
- )
251
+ self._stdout, self._stderr = self._process.communicate(timeout=timeout)
249
252
  except TimeoutExpired:
250
253
  self.cancel()
251
- raise TimeoutError(
252
- f"The application expired its timeout ({timeout:.1f} s)"
253
- )
254
+ raise TimeoutError(f"The application expired its timeout ({timeout:.1f} s)")
254
255
  self._state = AppState.FINISHED
255
-
256
+
256
257
  try:
257
258
  self.evaluate()
258
259
  except AppStateError:
@@ -263,12 +264,11 @@ class LocalApp(Application, metaclass=abc.ABCMeta):
263
264
  else:
264
265
  self._state = AppState.JOINED
265
266
  self.clean_up()
266
-
267
-
267
+
268
268
  def wait_interval(self):
269
269
  # Not used in this implementation of 'join()'
270
270
  raise NotImplementedError()
271
-
271
+
272
272
  def evaluate(self):
273
273
  super().evaluate()
274
274
  # Check if applicaion terminated correctly
@@ -276,10 +276,9 @@ class LocalApp(Application, metaclass=abc.ABCMeta):
276
276
  if exit_code != 0:
277
277
  err_msg = self.get_stderr().replace("\n", " ")
278
278
  raise SubprocessError(
279
- f"'{self._bin_path}' returned with exit code {exit_code}: "
280
- f"{err_msg}"
279
+ f"'{self._bin_path}' returned with exit code {exit_code}: " f"{err_msg}"
281
280
  )
282
-
281
+
283
282
  def clean_up(self):
284
283
  if self.get_app_state() == AppState.CANCELLED:
285
284
  self._process.kill()
@@ -290,7 +289,7 @@ def cleanup_tempfile(temp_file):
290
289
  Close a :class:`NamedTemporaryFile` and delete it manually,
291
290
  if `delete` is set to ``False``.
292
291
  This function is a small helper function intended for usage in
293
- `LocalApp` subclasses.
292
+ `LocalApp` subclasses.
294
293
 
295
294
  The manual deletion is necessary, as Windows does not allow to open
296
295
  a :class:`NamedTemporaryFile` as second time
@@ -302,5 +301,8 @@ def cleanup_tempfile(temp_file):
302
301
  The temporary file to be closed and deleted.
303
302
  """
304
303
  temp_file.close()
305
- if not temp_file.delete:
306
- remove(temp_file.name)
304
+ try:
305
+ remove(temp_file.name)
306
+ except FileNotFoundError:
307
+ # File was already deleted, e.g. due to `TemporaryFile(delete=True)`
308
+ pass
@@ -9,4 +9,4 @@ A subpackage for multiple sequence alignments using MAFFT.
9
9
  __name__ = "biotite.application.mafft"
10
10
  __author__ = "Patrick Kunzmann"
11
11
 
12
- from .app import *
12
+ from .app import *
@@ -6,25 +6,19 @@ __name__ = "biotite.application.mafft"
6
6
  __author__ = "Patrick Kunzmann"
7
7
  __all__ = ["MafftApp"]
8
8
 
9
- import re
10
9
  import os
11
- from ..msaapp import MSAApp
12
- from ..application import AppState, requires_state
13
- from ...sequence.sequence import Sequence
14
- from ...sequence.seqtypes import NucleotideSequence, ProteinSequence
15
- from ...sequence.io.fasta.file import FastaFile
16
- from ...sequence.align.alignment import Alignment
17
- from ...sequence.phylo.tree import Tree
18
-
10
+ import re
11
+ from biotite.application.application import AppState, requires_state
12
+ from biotite.application.msaapp import MSAApp
13
+ from biotite.sequence.phylo.tree import Tree
19
14
 
20
15
  _prefix_pattern = re.compile(r"\d*_")
21
16
 
22
17
 
23
-
24
18
  class MafftApp(MSAApp):
25
19
  """
26
20
  Perform a multiple sequence alignment using MAFFT.
27
-
21
+
28
22
  Parameters
29
23
  ----------
30
24
  sequences : list of Sequence
@@ -33,7 +27,7 @@ class MafftApp(MSAApp):
33
27
  Path of the MUSCLE binary.
34
28
  matrix : SubstitutionMatrix, optional
35
29
  A custom substitution matrix.
36
-
30
+
37
31
  Examples
38
32
  --------
39
33
 
@@ -51,19 +45,19 @@ class MafftApp(MSAApp):
51
45
  -BISMITE
52
46
  --IQLITE
53
47
  """
54
-
48
+
55
49
  def __init__(self, sequences, bin_path="mafft", matrix=None):
56
50
  super().__init__(sequences, bin_path, matrix)
57
51
  self._tree = None
58
52
  self._out_tree_file_name = self.get_input_file_path() + ".tree"
59
-
53
+
60
54
  def run(self):
61
55
  args = [
62
56
  "--quiet",
63
57
  "--auto",
64
58
  "--treeout",
65
59
  # Get the reordered alignment in order for
66
- # get_alignment_order() to work properly
60
+ # get_alignment_order() to work properly
67
61
  "--reorder",
68
62
  ]
69
63
  if self.get_seqtype() == "protein":
@@ -75,7 +69,7 @@ class MafftApp(MSAApp):
75
69
  args += [self.get_input_file_path()]
76
70
  self.set_arguments(args)
77
71
  super().run()
78
-
72
+
79
73
  def evaluate(self):
80
74
  with open(self.get_output_file_path(), "w") as f:
81
75
  # MAFFT outputs alignment to stdout
@@ -89,7 +83,7 @@ class MafftApp(MSAApp):
89
83
  # -> remove the '<n>_' prefix
90
84
  newick = re.sub(_prefix_pattern, "", raw_newick)
91
85
  self._tree = Tree.from_newick(newick)
92
-
86
+
93
87
  def clean_up(self):
94
88
  os.remove(self._out_tree_file_name)
95
89
 
@@ -97,26 +91,26 @@ class MafftApp(MSAApp):
97
91
  def get_guide_tree(self):
98
92
  """
99
93
  Get the guide tree created for the progressive alignment.
100
-
94
+
101
95
  Returns
102
96
  -------
103
97
  tree : Tree
104
98
  The guide tree.
105
99
  """
106
100
  return self._tree
107
-
101
+
108
102
  @staticmethod
109
103
  def supports_nucleotide():
110
104
  return True
111
-
105
+
112
106
  @staticmethod
113
107
  def supports_protein():
114
108
  return True
115
-
109
+
116
110
  @staticmethod
117
111
  def supports_custom_nucleotide_matrix():
118
112
  return True
119
-
113
+
120
114
  @staticmethod
121
115
  def supports_custom_protein_matrix():
122
116
  return True