biotite 0.41.2__cp310-cp310-win_amd64.whl → 1.0.1__cp310-cp310-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.
- biotite/__init__.py +2 -3
- biotite/application/__init__.py +1 -1
- biotite/application/application.py +20 -10
- biotite/application/autodock/__init__.py +1 -1
- biotite/application/autodock/app.py +74 -79
- biotite/application/blast/__init__.py +1 -1
- biotite/application/blast/alignment.py +19 -10
- biotite/application/blast/webapp.py +92 -85
- biotite/application/clustalo/__init__.py +1 -1
- biotite/application/clustalo/app.py +46 -61
- biotite/application/dssp/__init__.py +1 -1
- biotite/application/dssp/app.py +8 -11
- biotite/application/localapp.py +62 -60
- biotite/application/mafft/__init__.py +1 -1
- biotite/application/mafft/app.py +16 -22
- biotite/application/msaapp.py +78 -89
- biotite/application/muscle/__init__.py +1 -1
- biotite/application/muscle/app3.py +50 -64
- biotite/application/muscle/app5.py +23 -31
- biotite/application/sra/__init__.py +1 -1
- biotite/application/sra/app.py +64 -68
- biotite/application/tantan/__init__.py +1 -1
- biotite/application/tantan/app.py +22 -45
- biotite/application/util.py +7 -9
- biotite/application/viennarna/rnaalifold.py +34 -28
- biotite/application/viennarna/rnafold.py +24 -39
- biotite/application/viennarna/rnaplot.py +36 -21
- biotite/application/viennarna/util.py +17 -12
- biotite/application/webapp.py +13 -14
- biotite/copyable.py +13 -13
- biotite/database/__init__.py +1 -1
- biotite/database/entrez/__init__.py +1 -1
- biotite/database/entrez/check.py +2 -3
- biotite/database/entrez/dbnames.py +7 -5
- biotite/database/entrez/download.py +55 -49
- biotite/database/entrez/key.py +1 -1
- biotite/database/entrez/query.py +62 -23
- biotite/database/error.py +2 -1
- biotite/database/pubchem/__init__.py +1 -1
- biotite/database/pubchem/download.py +43 -45
- biotite/database/pubchem/error.py +2 -2
- biotite/database/pubchem/query.py +34 -31
- biotite/database/pubchem/throttle.py +3 -4
- biotite/database/rcsb/__init__.py +1 -1
- biotite/database/rcsb/download.py +44 -52
- biotite/database/rcsb/query.py +85 -80
- biotite/database/uniprot/check.py +6 -3
- biotite/database/uniprot/download.py +6 -11
- biotite/database/uniprot/query.py +115 -31
- biotite/file.py +12 -31
- biotite/sequence/__init__.py +3 -3
- biotite/sequence/align/__init__.py +2 -2
- biotite/sequence/align/alignment.py +99 -90
- biotite/sequence/align/banded.cp310-win_amd64.pyd +0 -0
- biotite/sequence/align/buckets.py +12 -10
- biotite/sequence/align/cigar.py +43 -52
- biotite/sequence/align/kmeralphabet.cp310-win_amd64.pyd +0 -0
- biotite/sequence/align/kmeralphabet.pyx +55 -51
- biotite/sequence/align/kmersimilarity.cp310-win_amd64.pyd +0 -0
- biotite/sequence/align/kmertable.cp310-win_amd64.pyd +0 -0
- biotite/sequence/align/kmertable.pyx +3 -2
- biotite/sequence/align/localgapped.cp310-win_amd64.pyd +0 -0
- biotite/sequence/align/localungapped.cp310-win_amd64.pyd +0 -0
- biotite/sequence/align/matrix.py +81 -82
- biotite/sequence/align/multiple.cp310-win_amd64.pyd +0 -0
- biotite/sequence/align/multiple.pyx +1 -1
- biotite/sequence/align/pairwise.cp310-win_amd64.pyd +0 -0
- biotite/sequence/align/permutation.cp310-win_amd64.pyd +0 -0
- biotite/sequence/align/permutation.pyx +12 -4
- biotite/sequence/align/selector.cp310-win_amd64.pyd +0 -0
- biotite/sequence/align/selector.pyx +52 -54
- biotite/sequence/align/statistics.py +32 -33
- biotite/sequence/align/tracetable.cp310-win_amd64.pyd +0 -0
- biotite/sequence/alphabet.py +51 -65
- biotite/sequence/annotation.py +78 -77
- biotite/sequence/codec.cp310-win_amd64.pyd +0 -0
- biotite/sequence/codon.py +90 -79
- biotite/sequence/graphics/__init__.py +1 -1
- biotite/sequence/graphics/alignment.py +184 -103
- biotite/sequence/graphics/colorschemes.py +10 -12
- biotite/sequence/graphics/dendrogram.py +79 -34
- biotite/sequence/graphics/features.py +133 -99
- biotite/sequence/graphics/logo.py +22 -28
- biotite/sequence/graphics/plasmid.py +229 -178
- biotite/sequence/io/fasta/__init__.py +1 -1
- biotite/sequence/io/fasta/convert.py +44 -33
- biotite/sequence/io/fasta/file.py +42 -55
- biotite/sequence/io/fastq/__init__.py +1 -1
- biotite/sequence/io/fastq/convert.py +11 -14
- biotite/sequence/io/fastq/file.py +68 -112
- biotite/sequence/io/genbank/__init__.py +2 -2
- biotite/sequence/io/genbank/annotation.py +12 -20
- biotite/sequence/io/genbank/file.py +74 -76
- biotite/sequence/io/genbank/metadata.py +74 -62
- biotite/sequence/io/genbank/sequence.py +13 -14
- biotite/sequence/io/general.py +39 -30
- biotite/sequence/io/gff/__init__.py +2 -2
- biotite/sequence/io/gff/convert.py +10 -15
- biotite/sequence/io/gff/file.py +81 -65
- biotite/sequence/phylo/__init__.py +1 -1
- biotite/sequence/phylo/nj.cp310-win_amd64.pyd +0 -0
- biotite/sequence/phylo/tree.cp310-win_amd64.pyd +0 -0
- biotite/sequence/phylo/upgma.cp310-win_amd64.pyd +0 -0
- biotite/sequence/profile.py +57 -28
- biotite/sequence/search.py +17 -15
- biotite/sequence/seqtypes.py +200 -164
- biotite/sequence/sequence.py +15 -17
- biotite/structure/__init__.py +3 -3
- biotite/structure/atoms.py +246 -236
- biotite/structure/basepairs.py +260 -271
- biotite/structure/bonds.cp310-win_amd64.pyd +0 -0
- biotite/structure/bonds.pyx +29 -32
- biotite/structure/box.py +67 -71
- biotite/structure/celllist.cp310-win_amd64.pyd +0 -0
- biotite/structure/chains.py +55 -39
- biotite/structure/charges.cp310-win_amd64.pyd +0 -0
- biotite/structure/compare.py +32 -32
- biotite/structure/density.py +13 -18
- biotite/structure/dotbracket.py +20 -22
- biotite/structure/error.py +10 -2
- biotite/structure/filter.py +83 -78
- biotite/structure/geometry.py +130 -119
- biotite/structure/graphics/atoms.py +60 -43
- biotite/structure/graphics/rna.py +81 -68
- biotite/structure/hbond.py +112 -93
- biotite/structure/info/__init__.py +0 -2
- biotite/structure/info/atoms.py +10 -11
- biotite/structure/info/bonds.py +41 -43
- biotite/structure/info/ccd.py +4 -5
- biotite/structure/info/groups.py +1 -3
- biotite/structure/info/masses.py +5 -10
- biotite/structure/info/misc.py +1 -1
- biotite/structure/info/radii.py +20 -20
- biotite/structure/info/standardize.py +15 -26
- biotite/structure/integrity.py +18 -71
- biotite/structure/io/__init__.py +3 -4
- biotite/structure/io/dcd/__init__.py +1 -1
- biotite/structure/io/dcd/file.py +22 -20
- biotite/structure/io/general.py +47 -61
- biotite/structure/io/gro/__init__.py +1 -1
- biotite/structure/io/gro/file.py +73 -72
- biotite/structure/io/mol/__init__.py +1 -1
- biotite/structure/io/mol/convert.py +8 -11
- biotite/structure/io/mol/ctab.py +37 -36
- biotite/structure/io/mol/header.py +14 -10
- biotite/structure/io/mol/mol.py +9 -53
- biotite/structure/io/mol/sdf.py +47 -50
- biotite/structure/io/netcdf/__init__.py +1 -1
- biotite/structure/io/netcdf/file.py +24 -23
- biotite/structure/io/pdb/__init__.py +1 -1
- biotite/structure/io/pdb/convert.py +32 -20
- biotite/structure/io/pdb/file.py +151 -172
- biotite/structure/io/pdb/hybrid36.cp310-win_amd64.pyd +0 -0
- biotite/structure/io/pdbqt/__init__.py +1 -1
- biotite/structure/io/pdbqt/convert.py +17 -11
- biotite/structure/io/pdbqt/file.py +128 -80
- biotite/structure/io/pdbx/__init__.py +1 -2
- biotite/structure/io/pdbx/bcif.py +36 -44
- biotite/structure/io/pdbx/cif.py +140 -110
- biotite/structure/io/pdbx/component.py +10 -16
- biotite/structure/io/pdbx/convert.py +260 -258
- biotite/structure/io/pdbx/encoding.cp310-win_amd64.pyd +0 -0
- biotite/structure/io/trajfile.py +90 -107
- biotite/structure/io/trr/__init__.py +1 -1
- biotite/structure/io/trr/file.py +12 -15
- biotite/structure/io/xtc/__init__.py +1 -1
- biotite/structure/io/xtc/file.py +11 -14
- biotite/structure/mechanics.py +9 -11
- biotite/structure/molecules.py +3 -4
- biotite/structure/pseudoknots.py +53 -67
- biotite/structure/rdf.py +23 -21
- biotite/structure/repair.py +137 -86
- biotite/structure/residues.py +26 -16
- biotite/structure/sasa.cp310-win_amd64.pyd +0 -0
- biotite/structure/{resutil.py → segments.py} +24 -23
- biotite/structure/sequence.py +10 -11
- biotite/structure/sse.py +100 -119
- biotite/structure/superimpose.py +39 -77
- biotite/structure/transform.py +97 -71
- biotite/structure/util.py +11 -13
- biotite/version.py +2 -2
- biotite/visualize.py +69 -55
- {biotite-0.41.2.dist-info → biotite-1.0.1.dist-info}/METADATA +6 -5
- biotite-1.0.1.dist-info/RECORD +322 -0
- biotite/structure/io/ctab.py +0 -72
- biotite/structure/io/mmtf/__init__.py +0 -21
- biotite/structure/io/mmtf/assembly.py +0 -214
- biotite/structure/io/mmtf/convertarray.cp310-win_amd64.pyd +0 -0
- biotite/structure/io/mmtf/convertarray.pyx +0 -341
- biotite/structure/io/mmtf/convertfile.cp310-win_amd64.pyd +0 -0
- biotite/structure/io/mmtf/convertfile.pyx +0 -501
- biotite/structure/io/mmtf/decode.cp310-win_amd64.pyd +0 -0
- biotite/structure/io/mmtf/decode.pyx +0 -152
- biotite/structure/io/mmtf/encode.cp310-win_amd64.pyd +0 -0
- biotite/structure/io/mmtf/encode.pyx +0 -183
- biotite/structure/io/mmtf/file.py +0 -233
- biotite/structure/io/npz/__init__.py +0 -20
- biotite/structure/io/npz/file.py +0 -152
- biotite/structure/io/pdbx/legacy.py +0 -267
- biotite/structure/io/tng/__init__.py +0 -13
- biotite/structure/io/tng/file.py +0 -46
- biotite/temp.py +0 -86
- biotite-0.41.2.dist-info/RECORD +0 -340
- {biotite-0.41.2.dist-info → biotite-1.0.1.dist-info}/WHEEL +0 -0
- {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
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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]
|
|
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],
|
|
92
|
-
|
|
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],
|
|
98
|
-
|
|
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]],
|
|
104
|
-
|
|
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],
|
|
110
|
-
|
|
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,
|
|
137
|
-
|
|
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,
|
|
141
|
-
|
|
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,
|
|
150
|
-
|
|
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,
|
|
154
|
-
|
|
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,
|
|
163
|
-
|
|
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,
|
|
167
|
-
|
|
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,
|
|
176
|
-
|
|
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,
|
|
180
|
-
|
|
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__ = [
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
14
|
-
from
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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(
|
|
131
|
-
(
|
|
132
|
-
|
|
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
|
-
|
|
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
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
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
|
-
|
|
320
|
-
|
|
330
|
+
draw_head = True
|
|
331
|
+
|
|
321
332
|
# Create head with 90 degrees tip -> head width/length ratio = 1/2
|
|
322
|
-
axes.add_patch(
|
|
323
|
-
|
|
324
|
-
|
|
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
|
|
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,
|
|
345
|
-
|
|
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,
|
|
373
|
-
|
|
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
|
|
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,
|
|
442
|
-
|
|
443
|
-
|
|
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
|
-
|
|
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),
|
|
475
|
-
|
|
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,
|
|
509
|
-
|
|
510
|
-
|
|
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)
|