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

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

Potentially problematic release.


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

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-312-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-312-darwin.so +0 -0
  58. biotite/sequence/align/kmeralphabet.pyx +55 -51
  59. biotite/sequence/align/kmersimilarity.cpython-312-darwin.so +0 -0
  60. biotite/sequence/align/kmertable.cpython-312-darwin.so +0 -0
  61. biotite/sequence/align/kmertable.pyx +3 -2
  62. biotite/sequence/align/localgapped.cpython-312-darwin.so +0 -0
  63. biotite/sequence/align/localungapped.cpython-312-darwin.so +0 -0
  64. biotite/sequence/align/matrix.py +81 -82
  65. biotite/sequence/align/multiple.cpython-312-darwin.so +0 -0
  66. biotite/sequence/align/multiple.pyx +1 -1
  67. biotite/sequence/align/pairwise.cpython-312-darwin.so +0 -0
  68. biotite/sequence/align/permutation.cpython-312-darwin.so +0 -0
  69. biotite/sequence/align/permutation.pyx +12 -4
  70. biotite/sequence/align/selector.cpython-312-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-312-darwin.so +0 -0
  74. biotite/sequence/alphabet.py +51 -65
  75. biotite/sequence/annotation.py +78 -77
  76. biotite/sequence/codec.cpython-312-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-312-darwin.so +0 -0
  102. biotite/sequence/phylo/tree.cpython-312-darwin.so +0 -0
  103. biotite/sequence/phylo/upgma.cpython-312-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 +246 -236
  110. biotite/structure/basepairs.py +260 -271
  111. biotite/structure/bonds.cpython-312-darwin.so +0 -0
  112. biotite/structure/bonds.pyx +29 -32
  113. biotite/structure/box.py +67 -71
  114. biotite/structure/celllist.cpython-312-darwin.so +0 -0
  115. biotite/structure/chains.py +55 -39
  116. biotite/structure/charges.cpython-312-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 +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.cpython-312-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 +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.cpython-312-darwin.so +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.cpython-312-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.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.cpython-312-darwin.so +0 -0
  189. biotite/structure/io/mmtf/convertarray.pyx +0 -341
  190. biotite/structure/io/mmtf/convertfile.cpython-312-darwin.so +0 -0
  191. biotite/structure/io/mmtf/convertfile.pyx +0 -501
  192. biotite/structure/io/mmtf/decode.cpython-312-darwin.so +0 -0
  193. biotite/structure/io/mmtf/decode.pyx +0 -152
  194. biotite/structure/io/mmtf/encode.cpython-312-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.1.dist-info}/WHEEL +0 -0
  205. {biotite-0.41.2.dist-info → biotite-1.0.1.dist-info}/licenses/LICENSE.rst +0 -0
@@ -8,9 +8,18 @@ __all__ = ["plot_dendrogram"]
8
8
 
9
9
  import numpy as np
10
10
 
11
- def plot_dendrogram(axes, tree, orientation="left", use_distances=True,
12
- labels=None, label_size=None, color="black",
13
- show_distance=True, **kwargs):
11
+
12
+ def plot_dendrogram(
13
+ axes,
14
+ tree,
15
+ orientation="left",
16
+ use_distances=True,
17
+ labels=None,
18
+ label_size=None,
19
+ color="black",
20
+ show_distance=True,
21
+ **kwargs,
22
+ ):
14
23
  """
15
24
  Plot a dendrogram from a (phylogenetic) tree.
16
25
 
@@ -24,7 +33,7 @@ def plot_dendrogram(axes, tree, orientation="left", use_distances=True,
24
33
  If true, the `distance` attribute of the :class:`TreeNode`
25
34
  objects are used as distance measure.
26
35
  Otherwise the topological distance is used.
27
- labels : list of str, optional
36
+ labels : list of str, optional
28
37
  The leaf node labels.
29
38
  The label of a leaf node is the entry at the position of its
30
39
  `index` attribute.
@@ -40,9 +49,9 @@ def plot_dendrogram(axes, tree, orientation="left", use_distances=True,
40
49
  Additional parameters that are used to draw the dendrogram
41
50
  lines.
42
51
  """
43
-
52
+
44
53
  indices = tree.root.get_indices()
45
- leaf_dict = {indices[i] : i for i in indices}
54
+ leaf_dict = {indices[i]: i for i in indices}
46
55
 
47
56
  # Required for setting the plot limits
48
57
  max_distance = 0
@@ -50,12 +59,12 @@ def plot_dendrogram(axes, tree, orientation="left", use_distances=True,
50
59
  def _plot_node(node, distance):
51
60
  """
52
61
  Draw the lines from the given node to its children.
53
-
62
+
54
63
  Parameters
55
64
  ----------
56
65
  dist : float
57
66
  the distance of the node from root
58
-
67
+
59
68
  Returns
60
69
  -------
61
70
  pos : float
@@ -88,31 +97,43 @@ def plot_dendrogram(axes, tree, orientation="left", use_distances=True,
88
97
  if orientation in ["left", "right"]:
89
98
  # Line connecting the childs
90
99
  axes.plot(
91
- [distance, distance], [child_pos[0], child_pos[-1]],
92
- color=color, marker="None", **kwargs
100
+ [distance, distance],
101
+ [child_pos[0], child_pos[-1]],
102
+ color=color,
103
+ marker="None",
104
+ **kwargs,
93
105
  )
94
106
  # Lines depicting the distances of the childs
95
107
  for child_dist, pos in zip(child_distances, child_pos):
96
108
  axes.plot(
97
- [distance, child_dist], [pos, pos],
98
- color=color, marker="None", **kwargs
109
+ [distance, child_dist],
110
+ [pos, pos],
111
+ color=color,
112
+ marker="None",
113
+ **kwargs,
99
114
  )
100
115
  elif orientation in ["bottom", "top"]:
101
116
  # Line connecting the childs
102
117
  axes.plot(
103
- [child_pos[0], child_pos[-1]], [distance, distance],
104
- color=color, marker="None", **kwargs
118
+ [child_pos[0], child_pos[-1]],
119
+ [distance, distance],
120
+ color=color,
121
+ marker="None",
122
+ **kwargs,
105
123
  )
106
124
  # Lines depicting the distances of the childs
107
125
  for child_dist, pos in zip(child_distances, child_pos):
108
126
  axes.plot(
109
- [pos, pos], [distance, child_dist],
110
- color=color, marker="None", **kwargs
127
+ [pos, pos],
128
+ [distance, child_dist],
129
+ color=color,
130
+ marker="None",
131
+ **kwargs,
111
132
  )
112
133
  else:
113
134
  raise ValueError(f"'{orientation}' is not a valid orientation")
114
135
  return center_pos
115
-
136
+
116
137
  _plot_node(tree.root, 0)
117
138
 
118
139
  if labels is not None:
@@ -133,12 +154,18 @@ def plot_dendrogram(axes, tree, orientation="left", use_distances=True,
133
154
  axes.set_yticks(np.arange(0, len(indices)))
134
155
  axes.set_yticklabels(labels)
135
156
  axes.yaxis.set_tick_params(
136
- left=False, right=False, labelleft=False, labelright=True,
137
- labelsize=label_size
157
+ left=False,
158
+ right=False,
159
+ labelleft=False,
160
+ labelright=True,
161
+ labelsize=label_size,
138
162
  )
139
163
  axes.xaxis.set_tick_params(
140
- bottom=True, top=False, labelbottom=show_distance, labeltop=False,
141
- labelsize=label_size
164
+ bottom=True,
165
+ top=False,
166
+ labelbottom=show_distance,
167
+ labeltop=False,
168
+ labelsize=label_size,
142
169
  )
143
170
  elif orientation == "right":
144
171
  axes.set_xlim(max_distance, zero_limit)
@@ -146,12 +173,18 @@ def plot_dendrogram(axes, tree, orientation="left", use_distances=True,
146
173
  axes.set_yticks(np.arange(0, len(indices)))
147
174
  axes.set_yticklabels(labels)
148
175
  axes.yaxis.set_tick_params(
149
- left=False, right=False, labelleft=True, labelright=False,
150
- labelsize=label_size
176
+ left=False,
177
+ right=False,
178
+ labelleft=True,
179
+ labelright=False,
180
+ labelsize=label_size,
151
181
  )
152
182
  axes.xaxis.set_tick_params(
153
- bottom=True, top=False, labelbottom=show_distance, labeltop=False,
154
- labelsize=label_size
183
+ bottom=True,
184
+ top=False,
185
+ labelbottom=show_distance,
186
+ labeltop=False,
187
+ labelsize=label_size,
155
188
  )
156
189
  elif orientation == "bottom":
157
190
  axes.set_ylim(zero_limit, max_distance)
@@ -159,12 +192,18 @@ def plot_dendrogram(axes, tree, orientation="left", use_distances=True,
159
192
  axes.set_xticks(np.arange(0, len(indices)))
160
193
  axes.set_xticklabels(labels)
161
194
  axes.xaxis.set_tick_params(
162
- bottom=False, top=False, labelbottom=False, labeltop=True,
163
- labelsize=label_size
195
+ bottom=False,
196
+ top=False,
197
+ labelbottom=False,
198
+ labeltop=True,
199
+ labelsize=label_size,
164
200
  )
165
201
  axes.yaxis.set_tick_params(
166
- left=True, right=False, labelleft=show_distance, labelright=False,
167
- labelsize=label_size
202
+ left=True,
203
+ right=False,
204
+ labelleft=show_distance,
205
+ labelright=False,
206
+ labelsize=label_size,
168
207
  )
169
208
  elif orientation == "top":
170
209
  axes.set_ylim(max_distance, zero_limit)
@@ -172,13 +211,19 @@ def plot_dendrogram(axes, tree, orientation="left", use_distances=True,
172
211
  axes.set_xticks(np.arange(0, len(indices)))
173
212
  axes.set_xticklabels(labels)
174
213
  axes.xaxis.set_tick_params(
175
- bottom=False, top=False, labelbottom=True, labeltop=False,
176
- labelsize=label_size
214
+ bottom=False,
215
+ top=False,
216
+ labelbottom=True,
217
+ labeltop=False,
218
+ labelsize=label_size,
177
219
  )
178
220
  axes.yaxis.set_tick_params(
179
- left=True, right=False, labelleft=show_distance, labelright=False,
180
- labelsize=label_size
221
+ left=True,
222
+ right=False,
223
+ labelleft=show_distance,
224
+ labelright=False,
225
+ labelsize=label_size,
181
226
  )
182
227
  else:
183
228
  raise ValueError(f"'{orientation}' is not a valid orientation")
184
- axes.set_frame_on(False)
229
+ axes.set_frame_on(False)
@@ -4,22 +4,35 @@
4
4
 
5
5
  __name__ = "biotite.sequence.graphics"
6
6
  __author__ = "Patrick Kunzmann"
7
- __all__ = ["plot_feature_map", "FeaturePlotter", "MiscFeaturePlotter",
8
- "CodingPlotter", "PromoterPlotter", "TerminatorPlotter",
9
- "RBSPlotter"]
7
+ __all__ = [
8
+ "plot_feature_map",
9
+ "FeaturePlotter",
10
+ "MiscFeaturePlotter",
11
+ "CodingPlotter",
12
+ "PromoterPlotter",
13
+ "TerminatorPlotter",
14
+ "RBSPlotter",
15
+ ]
10
16
 
11
- import copy
12
17
  import abc
13
- import numpy as np
14
- from ...visualize import colors, AdaptiveFancyArrow
15
- from ..annotation import Annotation, Feature, Location
16
-
17
-
18
- def plot_feature_map(axes, annotation, loc_range=None,
19
- multi_line=True, symbols_per_line=1000,
20
- show_numbers=False, number_size=None, line_width=0.05,
21
- show_line_position=False, spacing=0.25,
22
- feature_plotters=None, style_param=None):
18
+ from biotite.sequence.annotation import Location
19
+ from biotite.visualize import AdaptiveFancyArrow, colors
20
+
21
+
22
+ def plot_feature_map(
23
+ axes,
24
+ annotation,
25
+ loc_range=None,
26
+ multi_line=True,
27
+ symbols_per_line=1000,
28
+ show_numbers=False,
29
+ number_size=None,
30
+ line_width=0.05,
31
+ show_line_position=False,
32
+ spacing=0.25,
33
+ feature_plotters=None,
34
+ style_param=None,
35
+ ):
23
36
  """
24
37
  Plot a sequence annotation, by showing the range of each feature
25
38
  on one or multiple position depicting line(s).
@@ -87,8 +100,8 @@ def plot_feature_map(axes, annotation, loc_range=None,
87
100
  features.
88
101
  When two features overlap, their drawing area does also overlap.
89
102
  """
90
- from matplotlib.transforms import Bbox
91
103
  from matplotlib.patches import Rectangle
104
+ from matplotlib.transforms import Bbox
92
105
 
93
106
  if loc_range is None:
94
107
  loc_range = annotation.get_location_range()
@@ -98,13 +111,13 @@ def plot_feature_map(axes, annotation, loc_range=None,
98
111
  else:
99
112
  # Line length covers the entire location range
100
113
  symbols_per_line = loc_range_length
101
-
114
+
102
115
  plotters = [
103
116
  PromoterPlotter(),
104
117
  TerminatorPlotter(),
105
118
  RBSPlotter(),
106
119
  CodingPlotter(),
107
- MiscFeaturePlotter()
120
+ MiscFeaturePlotter(),
108
121
  ]
109
122
  if feature_plotters is not None:
110
123
  plotters = list(feature_plotters) + plotters
@@ -116,7 +129,6 @@ def plot_feature_map(axes, annotation, loc_range=None,
116
129
  if loc_range_length % symbols_per_line != 0:
117
130
  line_count += 1
118
131
 
119
-
120
132
  ### Draw lines ###
121
133
  remaining_symbols = loc_range_length
122
134
  y = 0.5
@@ -127,14 +139,19 @@ def plot_feature_map(axes, annotation, loc_range=None,
127
139
  else:
128
140
  # Last line -> Line spans to end of annotation
129
141
  line_length = remaining_symbols
130
- axes.add_patch(Rectangle(
131
- (0, y-line_width/2), line_length, line_width,
132
- color="gray", linewidth=0
133
- ))
142
+ axes.add_patch(
143
+ Rectangle(
144
+ (0, y - line_width / 2),
145
+ line_length,
146
+ line_width,
147
+ color="gray",
148
+ linewidth=0,
149
+ )
150
+ )
134
151
  # Increment by spacing and width (=1) of feature
135
152
  y += spacing + 1
136
153
  remaining_symbols -= symbols_per_line
137
-
154
+
138
155
  ### Draw features ###
139
156
  line_start_loc = loc_range[0]
140
157
  y = 0
@@ -160,15 +177,12 @@ def plot_feature_map(axes, annotation, loc_range=None,
160
177
  width = loc_len
161
178
  height = 1
162
179
  bbox = Bbox.from_bounds(x, y, width, height)
163
- plotter.draw(
164
- axes, feature, bbox, loc,
165
- style_param=style_param
166
- )
180
+ plotter.draw(axes, feature, bbox, loc, style_param=style_param)
167
181
  # Increment by spacing and width (=1) of feature
168
182
  y += spacing + 1
169
183
  remaining_symbols += symbols_per_line
170
184
  line_start_loc += symbols_per_line
171
-
185
+
172
186
  ### Draw position numbers ###
173
187
  ticks = []
174
188
  tick_labels = []
@@ -176,11 +190,11 @@ def plot_feature_map(axes, annotation, loc_range=None,
176
190
  # Numbers at center height of each feature line -> 0.5
177
191
  y = 0.5
178
192
  for i in range(line_count):
179
- if i == line_count-1:
193
+ if i == line_count - 1:
180
194
  # Last line -> get number of last column in trace
181
- loc = loc_range[1] -1
195
+ loc = loc_range[1] - 1
182
196
  else:
183
- loc = loc_range[0] + ((i+1) * symbols_per_line) -1
197
+ loc = loc_range[0] + ((i + 1) * symbols_per_line) - 1
184
198
  ticks.append(y)
185
199
  tick_labels.append(str(loc))
186
200
  # Increment by spacing and width of feature (1)
@@ -188,20 +202,17 @@ def plot_feature_map(axes, annotation, loc_range=None,
188
202
  axes.set_yticks(ticks)
189
203
  axes.set_yticklabels(tick_labels)
190
204
 
191
-
192
205
  axes.set_xlim(0, symbols_per_line)
193
206
  # Y-axis starts from top
194
- axes.set_ylim(1*line_count + spacing*(line_count-1), 0)
207
+ axes.set_ylim(1 * line_count + spacing * (line_count - 1), 0)
195
208
  axes.set_frame_on(False)
196
209
  # Draw location numbers on right side
197
210
  axes.get_yaxis().set_tick_params(
198
211
  left=False, right=False, labelleft=False, labelright=True
199
212
  )
200
213
  # Remove ticks and set number font size
201
- axes.yaxis.set_tick_params(
202
- left=False, right=False, labelsize=number_size
203
- )
204
-
214
+ axes.yaxis.set_tick_params(left=False, right=False, labelsize=number_size)
215
+
205
216
  if show_line_position:
206
217
  axes.xaxis.set_tick_params(
207
218
  top=False, bottom=True, labeltop=False, labelbottom=True
@@ -236,7 +247,7 @@ class FeaturePlotter(metaclass=abc.ABCMeta):
236
247
  ----------
237
248
  feature : Feature
238
249
  The sequence feature to be checked.
239
-
250
+
240
251
  Returns
241
252
  -------
242
253
  compatibility : bool
@@ -244,7 +255,7 @@ class FeaturePlotter(metaclass=abc.ABCMeta):
244
255
  false otherwise.
245
256
  """
246
257
  pass
247
-
258
+
248
259
  @abc.abstractmethod
249
260
  def draw(self, axes, feature, bbox, location, style_param):
250
261
  """
@@ -284,7 +295,7 @@ class CodingPlotter(FeaturePlotter):
284
295
  The width of the arrow head
285
296
  as fraction of the feature drawing area height.
286
297
  """
287
-
298
+
288
299
  def __init__(self, tail_width=0.5, head_width=0.8):
289
300
  self._tail_width = tail_width
290
301
  self._head_width = head_width
@@ -294,9 +305,9 @@ class CodingPlotter(FeaturePlotter):
294
305
  return True
295
306
  else:
296
307
  return False
297
-
308
+
298
309
  def draw(self, axes, feature, bbox, loc, style_param):
299
- y = bbox.y0 + bbox.height/2
310
+ y = bbox.y0 + bbox.height / 2
300
311
  dy = 0
301
312
  if loc.strand == Location.Strand.FORWARD:
302
313
  x = bbox.x0
@@ -304,25 +315,35 @@ class CodingPlotter(FeaturePlotter):
304
315
  else:
305
316
  x = bbox.x1
306
317
  dx = -bbox.width
307
-
308
- if (
309
- loc.strand == Location.Strand.FORWARD
310
- and loc.defect & Location.Defect.MISS_RIGHT
311
- ) or (
312
- loc.strand == Location.Strand.REVERSE
313
- and loc.defect & Location.Defect.MISS_LEFT
314
- ):
315
- # If the feature extends into the prevoius or next line
316
- # do not draw an arrow head
317
- draw_head = False
318
+
319
+ if (
320
+ loc.strand == Location.Strand.FORWARD
321
+ and loc.defect & Location.Defect.MISS_RIGHT
322
+ ) or (
323
+ loc.strand == Location.Strand.REVERSE
324
+ and loc.defect & Location.Defect.MISS_LEFT
325
+ ):
326
+ # If the feature extends into the prevoius or next line
327
+ # do not draw an arrow head
328
+ draw_head = False
318
329
  else:
319
- draw_head = True
320
-
330
+ draw_head = True
331
+
321
332
  # Create head with 90 degrees tip -> head width/length ratio = 1/2
322
- axes.add_patch(AdaptiveFancyArrow(
323
- x, y, dx, dy, self._tail_width, self._head_width, head_ratio=0.5,
324
- draw_head=draw_head, color=colors["dimgreen"], linewidth=0
325
- ))
333
+ axes.add_patch(
334
+ AdaptiveFancyArrow(
335
+ x,
336
+ y,
337
+ dx,
338
+ dy,
339
+ self._tail_width,
340
+ self._head_width,
341
+ head_ratio=0.5,
342
+ draw_head=draw_head,
343
+ color=colors["dimgreen"],
344
+ linewidth=0,
345
+ )
346
+ )
326
347
 
327
348
  if feature.key == "CDS":
328
349
  if "product" not in feature.qual:
@@ -332,17 +353,23 @@ class CodingPlotter(FeaturePlotter):
332
353
  else:
333
354
  label = feature.qual["product"]
334
355
  elif feature.key == "gene":
335
- if "gene" not in feature.qual:
356
+ if "gene" not in feature.qual:
336
357
  label = None
337
358
  else:
338
359
  label = feature.qual["gene"]
339
-
360
+
340
361
  if label is not None:
341
- center_x = bbox.x0 + bbox.width/2
342
- center_y = bbox.y0 + bbox.height/2
362
+ center_x = bbox.x0 + bbox.width / 2
363
+ center_y = bbox.y0 + bbox.height / 2
343
364
  axes.text(
344
- center_x, center_y, label, color="black",
345
- ha="center", va="center", size=11)
365
+ center_x,
366
+ center_y,
367
+ label,
368
+ color="black",
369
+ ha="center",
370
+ va="center",
371
+ size=11,
372
+ )
346
373
 
347
374
 
348
375
  class MiscFeaturePlotter(FeaturePlotter):
@@ -363,17 +390,20 @@ class MiscFeaturePlotter(FeaturePlotter):
363
390
 
364
391
  def matches(self, feature):
365
392
  return True
366
-
393
+
367
394
  def draw(self, axes, feature, bbox, loc, style_param):
368
395
  from matplotlib.patches import Rectangle
369
396
 
370
397
  rect = Rectangle(
371
- (bbox.x0, bbox.y0 + bbox.height/2 * (1-self._height)),
372
- bbox.width, bbox.height*self._height,
373
- color=colors["dimorange"], linewidth=0
398
+ (bbox.x0, bbox.y0 + bbox.height / 2 * (1 - self._height)),
399
+ bbox.width,
400
+ bbox.height * self._height,
401
+ color=colors["dimorange"],
402
+ linewidth=0,
374
403
  )
375
404
  axes.add_patch(rect)
376
405
 
406
+
377
407
  class PromoterPlotter(FeaturePlotter):
378
408
  """
379
409
  A plotter for *regulatory* features with the *promoter* or
@@ -394,8 +424,7 @@ class PromoterPlotter(FeaturePlotter):
394
424
  as fraction of the halffeature drawing area height.
395
425
  """
396
426
 
397
- def __init__(self, line_width=2, head_width=2,
398
- head_length=6, head_height=0.8):
427
+ def __init__(self, line_width=2, head_width=2, head_length=6, head_height=0.8):
399
428
  self._line_width = line_width
400
429
  self._head_width = head_width
401
430
  self._head_length = head_length
@@ -404,43 +433,42 @@ class PromoterPlotter(FeaturePlotter):
404
433
  def matches(self, feature):
405
434
  if feature.key == "regulatory":
406
435
  if "regulatory_class" in feature.qual:
407
- if feature.qual["regulatory_class"] in ["promoter","TATA_box"]:
436
+ if feature.qual["regulatory_class"] in ["promoter", "TATA_box"]:
408
437
  return True
409
438
  return False
410
-
439
+
411
440
  def draw(self, axes, feature, bbox, loc, style_param):
412
- from matplotlib.patches import FancyArrowPatch, ArrowStyle
441
+ from matplotlib.patches import ArrowStyle, FancyArrowPatch
413
442
  from matplotlib.path import Path
414
443
 
415
- x_center = bbox.x0 + bbox.width/2
416
- y_center = bbox.y0 + bbox.height/2
444
+ x_center = bbox.x0 + bbox.width / 2
445
+ y_center = bbox.y0 + bbox.height / 2
417
446
 
418
447
  path = Path(
419
448
  vertices=[
420
449
  (bbox.x0, y_center),
421
- (bbox.x0, y_center - bbox.height/2 * self._head_height),
422
- (bbox.x1, y_center - bbox.height/2 * self._head_height),
450
+ (bbox.x0, y_center - bbox.height / 2 * self._head_height),
451
+ (bbox.x1, y_center - bbox.height / 2 * self._head_height),
423
452
  ],
424
- codes=[
425
- Path.MOVETO,
426
- Path.CURVE3,
427
- Path.CURVE3
428
- ]
453
+ codes=[Path.MOVETO, Path.CURVE3, Path.CURVE3],
429
454
  )
430
455
  style = ArrowStyle.CurveFilledB(
431
456
  head_width=self._head_width, head_length=self._head_length
432
457
  )
433
458
  arrow = FancyArrowPatch(
434
- path=path, arrowstyle=style, linewidth=self._line_width,
435
- color="black"
459
+ path=path, arrowstyle=style, linewidth=self._line_width, color="black"
436
460
  )
437
461
  axes.add_patch(arrow)
438
-
462
+
439
463
  if "note" in feature.qual:
440
464
  axes.text(
441
- x_center, y_center + bbox.height/4, feature.qual["note"],
442
- color="black", ha="center", va="center",
443
- size=9
465
+ x_center,
466
+ y_center + bbox.height / 4,
467
+ feature.qual["note"],
468
+ color="black",
469
+ ha="center",
470
+ va="center",
471
+ size=9,
444
472
  )
445
473
 
446
474
 
@@ -465,14 +493,17 @@ class TerminatorPlotter(FeaturePlotter):
465
493
  if feature.qual["regulatory_class"] == "terminator":
466
494
  return True
467
495
  return False
468
-
469
- def draw(self, axes, feature, bbox, loc, style_param):
470
496
 
471
- x = bbox.x0 + bbox.width/2
497
+ def draw(self, axes, feature, bbox, loc, style_param):
498
+ x = bbox.x0 + bbox.width / 2
472
499
 
473
500
  axes.plot(
474
- (x, x), (bbox.y0, bbox.y1), color="black",
475
- linestyle="-", linewidth=self._bar_width, marker="None"
501
+ (x, x),
502
+ (bbox.y0, bbox.y1),
503
+ color="black",
504
+ linestyle="-",
505
+ linewidth=self._bar_width,
506
+ marker="None",
476
507
  )
477
508
 
478
509
 
@@ -499,12 +530,15 @@ class RBSPlotter(FeaturePlotter):
499
530
  if feature.qual["regulatory_class"] == "ribosome_binding_site":
500
531
  return True
501
532
  return False
502
-
533
+
503
534
  def draw(self, axes, feature, bbox, loc, style_param):
504
535
  from matplotlib.patches import Ellipse
505
536
 
506
537
  ellipse = Ellipse(
507
- (bbox.x0 + bbox.width/2, bbox.y0 + bbox.height/2),
508
- bbox.width, self._height*bbox.height,
509
- color=colors["dimorange"], linewidth=0)
510
- axes.add_patch(ellipse)
538
+ (bbox.x0 + bbox.width / 2, bbox.y0 + bbox.height / 2),
539
+ bbox.width,
540
+ self._height * bbox.height,
541
+ color=colors["dimorange"],
542
+ linewidth=0,
543
+ )
544
+ axes.add_patch(ellipse)