biotite 0.41.2__cp310-cp310-macosx_11_0_arm64.whl → 1.0.0__cp310-cp310-macosx_11_0_arm64.whl

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

Potentially problematic release.


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

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.cpython-310-darwin.so +0 -0
  55. biotite/sequence/align/buckets.py +12 -10
  56. biotite/sequence/align/cigar.py +43 -52
  57. biotite/sequence/align/kmeralphabet.cpython-310-darwin.so +0 -0
  58. biotite/sequence/align/kmeralphabet.pyx +55 -51
  59. biotite/sequence/align/kmersimilarity.cpython-310-darwin.so +0 -0
  60. biotite/sequence/align/kmertable.cpython-310-darwin.so +0 -0
  61. biotite/sequence/align/kmertable.pyx +3 -2
  62. biotite/sequence/align/localgapped.cpython-310-darwin.so +0 -0
  63. biotite/sequence/align/localungapped.cpython-310-darwin.so +0 -0
  64. biotite/sequence/align/matrix.py +81 -82
  65. biotite/sequence/align/multiple.cpython-310-darwin.so +0 -0
  66. biotite/sequence/align/multiple.pyx +1 -1
  67. biotite/sequence/align/pairwise.cpython-310-darwin.so +0 -0
  68. biotite/sequence/align/permutation.cpython-310-darwin.so +0 -0
  69. biotite/sequence/align/permutation.pyx +12 -4
  70. biotite/sequence/align/selector.cpython-310-darwin.so +0 -0
  71. biotite/sequence/align/selector.pyx +52 -54
  72. biotite/sequence/align/statistics.py +32 -33
  73. biotite/sequence/align/tracetable.cpython-310-darwin.so +0 -0
  74. biotite/sequence/alphabet.py +51 -65
  75. biotite/sequence/annotation.py +78 -77
  76. biotite/sequence/codec.cpython-310-darwin.so +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.cpython-310-darwin.so +0 -0
  102. biotite/sequence/phylo/tree.cpython-310-darwin.so +0 -0
  103. biotite/sequence/phylo/upgma.cpython-310-darwin.so +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 +221 -235
  110. biotite/structure/basepairs.py +260 -271
  111. biotite/structure/bonds.cpython-310-darwin.so +0 -0
  112. biotite/structure/bonds.pyx +29 -32
  113. biotite/structure/box.py +67 -71
  114. biotite/structure/celllist.cpython-310-darwin.so +0 -0
  115. biotite/structure/chains.py +55 -39
  116. biotite/structure/charges.cpython-310-darwin.so +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 +82 -77
  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.cpython-310-darwin.so +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 +64 -62
  160. biotite/structure/io/pdbx/component.py +10 -16
  161. biotite/structure/io/pdbx/convert.py +235 -246
  162. biotite/structure/io/pdbx/encoding.cpython-310-darwin.so +0 -0
  163. biotite/structure/io/trajfile.py +76 -93
  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.cpython-310-darwin.so +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.0.dist-info}/METADATA +5 -5
  184. biotite-1.0.0.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.cpython-310-darwin.so +0 -0
  189. biotite/structure/io/mmtf/convertarray.pyx +0 -341
  190. biotite/structure/io/mmtf/convertfile.cpython-310-darwin.so +0 -0
  191. biotite/structure/io/mmtf/convertfile.pyx +0 -501
  192. biotite/structure/io/mmtf/decode.cpython-310-darwin.so +0 -0
  193. biotite/structure/io/mmtf/decode.pyx +0 -152
  194. biotite/structure/io/mmtf/encode.cpython-310-darwin.so +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.0.dist-info}/WHEEL +0 -0
  205. {biotite-0.41.2.dist-info → biotite-1.0.0.dist-info}/licenses/LICENSE.rst +0 -0
@@ -4,15 +4,22 @@
4
4
 
5
5
  __name__ = "biotite.sequence.graphics"
6
6
  __author__ = "Patrick Kunzmann"
7
- __all__ = ["SymbolPlotter", "LetterPlotter", "LetterSimilarityPlotter",
8
- "LetterTypePlotter","ArrayPlotter",
9
- "plot_alignment", "plot_alignment_similarity_based",
10
- "plot_alignment_type_based","plot_alignment_array"]
7
+ __all__ = [
8
+ "SymbolPlotter",
9
+ "LetterPlotter",
10
+ "LetterSimilarityPlotter",
11
+ "LetterTypePlotter",
12
+ "ArrayPlotter",
13
+ "plot_alignment",
14
+ "plot_alignment_similarity_based",
15
+ "plot_alignment_type_based",
16
+ "plot_alignment_array",
17
+ ]
11
18
 
12
19
  import abc
13
20
  import numpy as np
14
- from ...visualize import colors
15
- from .colorschemes import get_color_scheme
21
+ from biotite.sequence.graphics.colorschemes import get_color_scheme
22
+ from biotite.visualize import colors
16
23
 
17
24
 
18
25
  class SymbolPlotter(metaclass=abc.ABCMeta):
@@ -81,8 +88,7 @@ class LetterPlotter(SymbolPlotter, metaclass=abc.ABCMeta):
81
88
  :class:`matplotlib.Text` instance of each symbol.
82
89
  """
83
90
 
84
- def __init__(self, axes, color_symbols=False,
85
- font_size=None, font_param=None):
91
+ def __init__(self, axes, color_symbols=False, font_size=None, font_param=None):
86
92
  super().__init__(axes)
87
93
  self._color_symbols = color_symbols
88
94
  self._font_size = font_size
@@ -101,9 +107,15 @@ class LetterPlotter(SymbolPlotter, metaclass=abc.ABCMeta):
101
107
  box = Rectangle(bbox.p0, bbox.width, bbox.height)
102
108
  self.axes.add_patch(box)
103
109
  text = self.axes.text(
104
- bbox.x0 + bbox.width/2, bbox.y0 + bbox.height/2,
105
- symbol, color="black", ha="center", va="center",
106
- size=self._font_size, **self._font_param)
110
+ bbox.x0 + bbox.width / 2,
111
+ bbox.y0 + bbox.height / 2,
112
+ symbol,
113
+ color="black",
114
+ ha="center",
115
+ va="center",
116
+ size=self._font_size,
117
+ **self._font_param,
118
+ )
107
119
  text.set_clip_on(True)
108
120
 
109
121
  if self._color_symbols:
@@ -196,17 +208,16 @@ class LetterSimilarityPlotter(LetterPlotter):
196
208
  because *a* does also occur in *b*\ :sub:`i`.
197
209
  """
198
210
 
199
- def __init__(self, axes, matrix=None, color_symbols=False,
200
- font_size=None, font_param=None):
201
-
211
+ def __init__(
212
+ self, axes, matrix=None, color_symbols=False, font_size=None, font_param=None
213
+ ):
202
214
  super().__init__(axes, color_symbols, font_size, font_param)
203
215
  if matrix is not None:
204
216
  self._matrix = matrix.score_matrix()
205
217
  else:
206
218
  self._matrix = None
207
219
  # Default colormap
208
- self._cmap = self._generate_colormap(colors["dimgreen"],
209
- self._color_symbols)
220
+ self._cmap = self._generate_colormap(colors["dimgreen"], self._color_symbols)
210
221
 
211
222
  def set_color(self, color=None, cmap=None):
212
223
  """
@@ -257,8 +268,7 @@ class LetterSimilarityPlotter(LetterPlotter):
257
268
  similarities[i] = 0
258
269
  else:
259
270
  code2 = alignment.sequences[i].code[index2]
260
- similarities[i] = self._get_similarity(self._matrix,
261
- code1, code2)
271
+ similarities[i] = self._get_similarity(self._matrix, code1, code2)
262
272
  # Delete self-similarity
263
273
  similarities = np.delete(similarities, seq_i)
264
274
  similarity = np.average(similarities)
@@ -283,14 +293,18 @@ class LetterSimilarityPlotter(LetterPlotter):
283
293
  if to_black:
284
294
  # From color to black
285
295
  cmap_val = np.stack(
286
- [np.interp(np.linspace(0, 1, 100), [0, 1], [color[i], 0])
287
- for i in range(len(color))]
296
+ [
297
+ np.interp(np.linspace(0, 1, 100), [0, 1], [color[i], 0])
298
+ for i in range(len(color))
299
+ ]
288
300
  ).transpose()
289
301
  else:
290
302
  # From white to color
291
303
  cmap_val = np.stack(
292
- [np.interp(np.linspace(0, 1, 100), [0, 1], [1, color[i]])
293
- for i in range(len(color))]
304
+ [
305
+ np.interp(np.linspace(0, 1, 100), [0, 1], [1, color[i]])
306
+ for i in range(len(color))
307
+ ]
294
308
  ).transpose()
295
309
  return ListedColormap(cmap_val)
296
310
 
@@ -310,7 +324,7 @@ class LetterTypePlotter(LetterPlotter):
310
324
  The alphabet of the alignment(s) to be plotted
311
325
  color_scheme : str or list of (tuple or str), optional
312
326
  Either a valid color scheme name
313
- (e.g. ``"rainbow"``, ``"clustalx"``, ``blossom``, etc.)
327
+ (e.g. ``"flower"``, ``"clustalx"``, ``blossom``, etc.)
314
328
  or a list of *Matplotlib* compatible colors.
315
329
  The list length must be at least as long as the
316
330
  length of the alphabet used by the sequences.
@@ -325,12 +339,19 @@ class LetterTypePlotter(LetterPlotter):
325
339
  :class:`matplotlib.Text` instance of each symbol.
326
340
  """
327
341
 
328
- def __init__(self, axes, alphabet, color_scheme=None, color_symbols=False,
329
- font_size=None, font_param=None):
342
+ def __init__(
343
+ self,
344
+ axes,
345
+ alphabet,
346
+ color_scheme=None,
347
+ color_symbols=False,
348
+ font_size=None,
349
+ font_param=None,
350
+ ):
330
351
  super().__init__(axes, color_symbols, font_size, font_param)
331
352
 
332
353
  if color_scheme is None:
333
- self._colors = get_color_scheme("rainbow", alphabet)
354
+ self._colors = get_color_scheme("flower", alphabet)
334
355
  elif isinstance(color_scheme, str):
335
356
  self._colors = get_color_scheme(color_scheme, alphabet)
336
357
  else:
@@ -346,7 +367,7 @@ class LetterTypePlotter(LetterPlotter):
346
367
 
347
368
 
348
369
  class ArrayPlotter(LetterPlotter):
349
- '''
370
+ """
350
371
  This :class:`SymbolPlotter` quantitatively decorates sequences alignments, with molecular
351
372
  recognition data obtained from e.g. microarrays. Symbols are visualized as characters
352
373
  on a colored background box. The color of a given box represents the recognition
@@ -371,15 +392,14 @@ class ArrayPlotter(LetterPlotter):
371
392
  Additional parameters that is given to the
372
393
  :class:`matplotlib.Text` instance of each symbol.
373
394
 
374
- '''
375
- def __init__(self, axes, fl_score, color_symbols=False,
376
- font_size=None, font_param=None):
395
+ """
377
396
 
397
+ def __init__(
398
+ self, axes, fl_score, color_symbols=False, font_size=None, font_param=None
399
+ ):
378
400
  super().__init__(axes, color_symbols, font_size, font_param)
379
401
  self.fl_score = fl_score
380
- self._cmap = self._generate_colormap(colors["dimorange"],
381
- self._color_symbols)
382
-
402
+ self._cmap = self._generate_colormap(colors["dimorange"], self._color_symbols)
383
403
 
384
404
  def get_color(self, alignment, column_i, seq_i):
385
405
  index1 = alignment.trace[column_i, seq_i]
@@ -389,7 +409,6 @@ class ArrayPlotter(LetterPlotter):
389
409
  spot_signal = self._get_signal(self.fl_score, column_i, seq_i)
390
410
  return self._cmap(spot_signal)
391
411
 
392
-
393
412
  def _get_signal(self, fl_score, column_i, seq_i):
394
413
  if fl_score is None:
395
414
  signal = 0.0
@@ -400,7 +419,6 @@ class ArrayPlotter(LetterPlotter):
400
419
  def get_cmap(self):
401
420
  return self._cmap
402
421
 
403
-
404
422
  def plot_symbol(self, bbox, alignment, column_i, seq_i):
405
423
  from matplotlib.patches import Rectangle
406
424
 
@@ -422,9 +440,15 @@ class ArrayPlotter(LetterPlotter):
422
440
  box = Rectangle(bbox.p0, bbox.width, bbox.height)
423
441
  self.axes.add_patch(box)
424
442
  text = self.axes.text(
425
- bbox.x0 + bbox.width/2, bbox.y0 + bbox.height/2,
426
- symbol, color="black", ha="center", va="center",
427
- size=self._font_size, **self._font_param)
443
+ bbox.x0 + bbox.width / 2,
444
+ bbox.y0 + bbox.height / 2,
445
+ symbol,
446
+ color="black",
447
+ ha="center",
448
+ va="center",
449
+ size=self._font_size,
450
+ **self._font_param,
451
+ )
428
452
  text.set_clip_on(True)
429
453
 
430
454
  if self._color_symbols:
@@ -455,11 +479,20 @@ class ArrayPlotter(LetterPlotter):
455
479
  return ListedColormap(cmap_val)
456
480
 
457
481
 
458
- def plot_alignment(axes, alignment, symbol_plotter, symbols_per_line=50,
459
- show_numbers=False, number_size=None, number_functions=None,
460
- labels=None, label_size=None,
461
- show_line_position=False,
462
- spacing=1, symbol_spacing=None):
482
+ def plot_alignment(
483
+ axes,
484
+ alignment,
485
+ symbol_plotter,
486
+ symbols_per_line=50,
487
+ show_numbers=False,
488
+ number_size=None,
489
+ number_functions=None,
490
+ labels=None,
491
+ label_size=None,
492
+ show_line_position=False,
493
+ spacing=1,
494
+ symbol_spacing=None,
495
+ ):
463
496
  """
464
497
  Plot a pairwise or multiple sequence alignment.
465
498
 
@@ -545,7 +578,7 @@ def plot_alignment(axes, alignment, symbol_plotter, symbols_per_line=50,
545
578
  )
546
579
  for i, func in enumerate(number_functions):
547
580
  if func is None:
548
- number_functions[i] = (lambda x: x + 1)
581
+ number_functions[i] = lambda x: x + 1
549
582
 
550
583
  seq_num = alignment.trace.shape[1]
551
584
  seq_len = alignment.trace.shape[0]
@@ -573,7 +606,7 @@ def plot_alignment(axes, alignment, symbol_plotter, symbols_per_line=50,
573
606
  for i in range(seq_len):
574
607
  y = y_start
575
608
  for j in range(seq_num):
576
- bbox = Bbox([[x, y], [x+1, y+1]])
609
+ bbox = Bbox([[x, y], [x + 1, y + 1]])
577
610
  symbol_plotter.plot_symbol(bbox, alignment, i, j)
578
611
  y += 1
579
612
  line_pos += 1
@@ -583,8 +616,7 @@ def plot_alignment(axes, alignment, symbol_plotter, symbols_per_line=50,
583
616
  y_start += seq_num + spacing
584
617
  else:
585
618
  x += 1
586
- if (symbol_spacing
587
- and (i + 1) % symbol_spacing == 0):
619
+ if symbol_spacing and (i + 1) % symbol_spacing == 0:
588
620
  line_pos += 1
589
621
  x += 1
590
622
 
@@ -613,14 +645,12 @@ def plot_alignment(axes, alignment, symbol_plotter, symbols_per_line=50,
613
645
  y = 0.5
614
646
  for i in range(line_count):
615
647
  for j in range(seq_num):
616
- if i == line_count-1:
648
+ if i == line_count - 1:
617
649
  # Last line -> get number of last column in trace
618
650
  trace_pos = len(alignment.trace) - 1
619
651
  else:
620
- trace_pos = (i+1) * symbols_per_line - 1
621
- seq_index = _get_last_valid_index(
622
- alignment, trace_pos, j
623
- )
652
+ trace_pos = (i + 1) * symbols_per_line - 1
653
+ seq_index = _get_last_valid_index(alignment, trace_pos, j)
624
654
  # if -1 -> terminal gap
625
655
  # -> skip number for this sequence in this line
626
656
  if seq_index != -1:
@@ -636,18 +666,14 @@ def plot_alignment(axes, alignment, symbol_plotter, symbols_per_line=50,
636
666
 
637
667
  axes.set_xlim(0, symbols_to_print)
638
668
  # Y-axis starts from top
639
- lim = seq_num*line_count + spacing*(line_count-1)
669
+ lim = seq_num * line_count + spacing * (line_count - 1)
640
670
  axes.set_ylim(lim, 0)
641
671
  number_axes.set_ylim(lim, 0)
642
672
  axes.set_frame_on(False)
643
673
  number_axes.set_frame_on(False)
644
674
  # Remove ticks and set label and number size
645
- axes.yaxis.set_tick_params(
646
- left=False, right=False, labelsize=label_size
647
- )
648
- number_axes.yaxis.set_tick_params(
649
- left=False, right=False, labelsize=number_size
650
- )
675
+ axes.yaxis.set_tick_params(left=False, right=False, labelsize=label_size)
676
+ number_axes.yaxis.set_tick_params(left=False, right=False, labelsize=number_size)
651
677
 
652
678
  if show_line_position:
653
679
  axes.xaxis.set_tick_params(
@@ -659,15 +685,25 @@ def plot_alignment(axes, alignment, symbol_plotter, symbols_per_line=50,
659
685
  )
660
686
 
661
687
 
662
- def plot_alignment_similarity_based(axes, alignment, symbols_per_line=50,
663
- show_numbers=False, number_size=None,
664
- number_functions=None,
665
- labels=None, label_size=None,
666
- show_line_position=False,
667
- spacing=1,
668
- color=None, cmap=None, matrix=None,
669
- color_symbols=False, symbol_spacing=None,
670
- symbol_size=None, symbol_param=None):
688
+ def plot_alignment_similarity_based(
689
+ axes,
690
+ alignment,
691
+ symbols_per_line=50,
692
+ show_numbers=False,
693
+ number_size=None,
694
+ number_functions=None,
695
+ labels=None,
696
+ label_size=None,
697
+ show_line_position=False,
698
+ spacing=1,
699
+ color=None,
700
+ cmap=None,
701
+ matrix=None,
702
+ color_symbols=False,
703
+ symbol_spacing=None,
704
+ symbol_size=None,
705
+ symbol_param=None,
706
+ ):
671
707
  r"""
672
708
  Plot a pairwise or multiple sequence alignment highlighting
673
709
  the similarity per alignment column.
@@ -788,31 +824,47 @@ def plot_alignment_similarity_based(axes, alignment, symbols_per_line=50,
788
824
  because *a* does also occur in *b*\ :sub:`i`.
789
825
  """
790
826
  symbol_plotter = LetterSimilarityPlotter(
791
- axes, matrix=matrix, font_size=symbol_size, font_param=symbol_param,
792
- color_symbols=color_symbols
827
+ axes,
828
+ matrix=matrix,
829
+ font_size=symbol_size,
830
+ font_param=symbol_param,
831
+ color_symbols=color_symbols,
793
832
  )
794
833
  if color is not None or cmap is not None:
795
834
  symbol_plotter.set_color(color=color, cmap=cmap)
796
835
  plot_alignment(
797
- axes=axes, alignment=alignment, symbol_plotter=symbol_plotter,
836
+ axes=axes,
837
+ alignment=alignment,
838
+ symbol_plotter=symbol_plotter,
798
839
  symbols_per_line=symbols_per_line,
799
- show_numbers=show_numbers, number_size=number_size,
840
+ show_numbers=show_numbers,
841
+ number_size=number_size,
800
842
  number_functions=number_functions,
801
- labels=labels, label_size=label_size,
843
+ labels=labels,
844
+ label_size=label_size,
802
845
  show_line_position=show_line_position,
803
- spacing=spacing, symbol_spacing=symbol_spacing
846
+ spacing=spacing,
847
+ symbol_spacing=symbol_spacing,
804
848
  )
805
849
 
806
850
 
807
- def plot_alignment_type_based(axes, alignment, symbols_per_line=50,
808
- show_numbers=False, number_size=None,
809
- number_functions=None,
810
- labels=None, label_size=None,
811
- show_line_position=False,
812
- spacing=1,
813
- color_scheme=None, color_symbols=False,
814
- symbol_size=None, symbol_param=None,
815
- symbol_spacing=None):
851
+ def plot_alignment_type_based(
852
+ axes,
853
+ alignment,
854
+ symbols_per_line=50,
855
+ show_numbers=False,
856
+ number_size=None,
857
+ number_functions=None,
858
+ labels=None,
859
+ label_size=None,
860
+ show_line_position=False,
861
+ spacing=1,
862
+ color_scheme=None,
863
+ color_symbols=False,
864
+ symbol_size=None,
865
+ symbol_param=None,
866
+ symbol_spacing=None,
867
+ ):
816
868
  """
817
869
  Plot a pairwise or multiple sequence alignment coloring each symbol
818
870
  based on the symbol type.
@@ -873,7 +925,7 @@ def plot_alignment_type_based(axes, alignment, symbols_per_line=50,
873
925
  is equal to the size of a symbol box.
874
926
  color_scheme : str or list of (tuple or str), optional
875
927
  Either a valid color scheme name
876
- (e.g. ``"rainbow"``, ``"clustalx"``, ``blossom``, etc.)
928
+ (e.g. ``"flower"``, ``"clustalx"``, ``blossom``, etc.)
877
929
  or a list of *Matplotlib* compatible colors.
878
930
  The list length must be at least as long as the
879
931
  length of the alphabet used by the sequences.
@@ -897,27 +949,48 @@ def plot_alignment_type_based(axes, alignment, symbols_per_line=50,
897
949
  """
898
950
  alphabet = alignment.sequences[0].get_alphabet()
899
951
  symbol_plotter = LetterTypePlotter(
900
- axes, alphabet, font_size=symbol_size, font_param=symbol_param,
901
- color_symbols=color_symbols, color_scheme=color_scheme
952
+ axes,
953
+ alphabet,
954
+ font_size=symbol_size,
955
+ font_param=symbol_param,
956
+ color_symbols=color_symbols,
957
+ color_scheme=color_scheme,
902
958
  )
903
959
  plot_alignment(
904
- axes=axes, alignment=alignment, symbol_plotter=symbol_plotter,
960
+ axes=axes,
961
+ alignment=alignment,
962
+ symbol_plotter=symbol_plotter,
905
963
  symbols_per_line=symbols_per_line,
906
- show_numbers=show_numbers, number_size=number_size,
964
+ show_numbers=show_numbers,
965
+ number_size=number_size,
907
966
  number_functions=number_functions,
908
- labels=labels, label_size=label_size,
967
+ labels=labels,
968
+ label_size=label_size,
909
969
  show_line_position=show_line_position,
910
- spacing=spacing, symbol_spacing=symbol_spacing
970
+ spacing=spacing,
971
+ symbol_spacing=symbol_spacing,
911
972
  )
912
973
 
913
- def plot_alignment_array(axes, alignment, fl_score, symbols_per_line=50,
914
- show_numbers=False, number_size=None,
915
- number_functions=None, labels=None, label_size=None,
916
- show_line_position=False, spacing=1, color=None,
917
- cmap=None, symbol_spacing=None,
918
- symbol_size=None, symbol_param=None):
919
974
 
920
- '''
975
+ def plot_alignment_array(
976
+ axes,
977
+ alignment,
978
+ fl_score,
979
+ symbols_per_line=50,
980
+ show_numbers=False,
981
+ number_size=None,
982
+ number_functions=None,
983
+ labels=None,
984
+ label_size=None,
985
+ show_line_position=False,
986
+ spacing=1,
987
+ color=None,
988
+ cmap=None,
989
+ symbol_spacing=None,
990
+ symbol_size=None,
991
+ symbol_param=None,
992
+ ):
993
+ """
921
994
  Plot a pairwise sequence alignment using an :class:`ArrayPlotter`
922
995
  instance.
923
996
 
@@ -995,19 +1068,27 @@ def plot_alignment_array(axes, alignment, fl_score, symbols_per_line=50,
995
1068
  A '*' represents a sequence match on the alignment
996
1069
  A '-' represents a sequence gap on the alignment
997
1070
 
998
- '''
1071
+ """
999
1072
  symbol_plotter = ArrayPlotter(
1000
- axes, fl_score = fl_score, font_size = symbol_size, font_param = symbol_param,
1073
+ axes,
1074
+ fl_score=fl_score,
1075
+ font_size=symbol_size,
1076
+ font_param=symbol_param,
1001
1077
  )
1002
1078
 
1003
1079
  plot_alignment(
1004
- axes=axes, alignment=alignment, symbol_plotter=symbol_plotter,
1080
+ axes=axes,
1081
+ alignment=alignment,
1082
+ symbol_plotter=symbol_plotter,
1005
1083
  symbols_per_line=symbols_per_line,
1006
- show_numbers=show_numbers, number_size=number_size,
1084
+ show_numbers=show_numbers,
1085
+ number_size=number_size,
1007
1086
  number_functions=number_functions,
1008
- labels=labels, label_size=label_size,
1087
+ labels=labels,
1088
+ label_size=label_size,
1009
1089
  show_line_position=show_line_position,
1010
- spacing=spacing, symbol_spacing=symbol_spacing
1090
+ spacing=spacing,
1091
+ symbol_spacing=symbol_spacing,
1011
1092
  )
1012
1093
 
1013
1094
 
@@ -6,12 +6,11 @@ __name__ = "biotite.sequence.graphics"
6
6
  __author__ = "Patrick Kunzmann"
7
7
  __all__ = ["get_color_scheme", "list_color_scheme_names", "load_color_scheme"]
8
8
 
9
- import numpy as np
10
- import json
11
- from os.path import join, dirname, realpath
12
9
  import glob
10
+ import json
13
11
  import os
14
- from ..alphabet import Alphabet
12
+ from os.path import dirname, join, realpath
13
+ from biotite.sequence.alphabet import Alphabet
15
14
 
16
15
 
17
16
  def load_color_scheme(file_name):
@@ -26,13 +25,13 @@ def load_color_scheme(file_name):
26
25
  ----------
27
26
  file_name : str
28
27
  The file name of the JSON file containing the scheme.
29
-
28
+
30
29
  Returns
31
30
  -------
32
31
  scheme : dict
33
32
  A dictionary representing the color scheme, It contains the
34
33
  following keys, if the input file is proper:
35
-
34
+
36
35
  - **name** - Name of the scheme.
37
36
  - **alphabet** - :class:`Alphabet` instance describing the
38
37
  type of sequence the scheme can be used for.
@@ -71,7 +70,7 @@ def get_color_scheme(name, alphabet, default="#FFFFFF"):
71
70
  default : str or tuple, optional
72
71
  A *Matplotlib* compatible color that is used for symbols that
73
72
  have no defined color in the scheme.
74
-
73
+
75
74
  Returns
76
75
  -------
77
76
  colors : list
@@ -99,11 +98,10 @@ def get_color_scheme(name, alphabet, default="#FFFFFF"):
99
98
  if scheme["name"] == name and scheme["alphabet"].extends(alphabet):
100
99
  colors = scheme["colors"]
101
100
  # Replace None values with default color
102
- colors = [color if color is not None else default
103
- for color in colors]
101
+ colors = [color if color is not None else default for color in colors]
104
102
  # Only return colors that are in scope of this alphabet
105
103
  # and not the extended alphabet
106
- return colors[:len(alphabet)]
104
+ return colors[: len(alphabet)]
107
105
  raise ValueError(f"Unkown scheme '{name}' for given alphabet")
108
106
 
109
107
 
@@ -117,7 +115,7 @@ def list_color_scheme_names(alphabet):
117
115
  The alphbet to get the color scheme names for.
118
116
  The alphabet of the scheme must equal or extend this parameter,
119
117
  to be included in the list.
120
-
118
+
121
119
  Returns
122
120
  -------
123
121
  schemes : list of str
@@ -136,4 +134,4 @@ _color_schemes = []
136
134
 
137
135
  for file_name in glob.glob(_scheme_dir + os.sep + "*.json"):
138
136
  scheme = load_color_scheme(file_name)
139
- _color_schemes.append(scheme)
137
+ _color_schemes.append(scheme)