biotite 0.41.2__cp311-cp311-macosx_11_0_arm64.whl → 1.0.1__cp311-cp311-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.
- 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.cpython-311-darwin.so +0 -0
- biotite/sequence/align/buckets.py +12 -10
- biotite/sequence/align/cigar.py +43 -52
- biotite/sequence/align/kmeralphabet.cpython-311-darwin.so +0 -0
- biotite/sequence/align/kmeralphabet.pyx +55 -51
- biotite/sequence/align/kmersimilarity.cpython-311-darwin.so +0 -0
- biotite/sequence/align/kmertable.cpython-311-darwin.so +0 -0
- biotite/sequence/align/kmertable.pyx +3 -2
- biotite/sequence/align/localgapped.cpython-311-darwin.so +0 -0
- biotite/sequence/align/localungapped.cpython-311-darwin.so +0 -0
- biotite/sequence/align/matrix.py +81 -82
- biotite/sequence/align/multiple.cpython-311-darwin.so +0 -0
- biotite/sequence/align/multiple.pyx +1 -1
- biotite/sequence/align/pairwise.cpython-311-darwin.so +0 -0
- biotite/sequence/align/permutation.cpython-311-darwin.so +0 -0
- biotite/sequence/align/permutation.pyx +12 -4
- biotite/sequence/align/selector.cpython-311-darwin.so +0 -0
- biotite/sequence/align/selector.pyx +52 -54
- biotite/sequence/align/statistics.py +32 -33
- biotite/sequence/align/tracetable.cpython-311-darwin.so +0 -0
- biotite/sequence/alphabet.py +51 -65
- biotite/sequence/annotation.py +78 -77
- biotite/sequence/codec.cpython-311-darwin.so +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.cpython-311-darwin.so +0 -0
- biotite/sequence/phylo/tree.cpython-311-darwin.so +0 -0
- biotite/sequence/phylo/upgma.cpython-311-darwin.so +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.cpython-311-darwin.so +0 -0
- biotite/structure/bonds.pyx +29 -32
- biotite/structure/box.py +67 -71
- biotite/structure/celllist.cpython-311-darwin.so +0 -0
- biotite/structure/chains.py +55 -39
- biotite/structure/charges.cpython-311-darwin.so +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.cpython-311-darwin.so +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.cpython-311-darwin.so +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.cpython-311-darwin.so +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.cpython-311-darwin.so +0 -0
- biotite/structure/io/mmtf/convertarray.pyx +0 -341
- biotite/structure/io/mmtf/convertfile.cpython-311-darwin.so +0 -0
- biotite/structure/io/mmtf/convertfile.pyx +0 -501
- biotite/structure/io/mmtf/decode.cpython-311-darwin.so +0 -0
- biotite/structure/io/mmtf/decode.pyx +0 -152
- biotite/structure/io/mmtf/encode.cpython-311-darwin.so +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
|
@@ -7,18 +7,25 @@ __author__ = "Patrick Kunzmann"
|
|
|
7
7
|
__all__ = ["plot_atoms", "plot_ball_and_stick_model"]
|
|
8
8
|
|
|
9
9
|
import numpy as np
|
|
10
|
-
import matplotlib.pyplot as plt
|
|
11
10
|
from mpl_toolkits.mplot3d import Axes3D
|
|
12
11
|
from mpl_toolkits.mplot3d.art3d import Line3DCollection
|
|
13
12
|
|
|
14
13
|
|
|
15
|
-
def plot_atoms(
|
|
16
|
-
|
|
14
|
+
def plot_atoms(
|
|
15
|
+
axes,
|
|
16
|
+
atoms,
|
|
17
|
+
colors,
|
|
18
|
+
line_width=1.0,
|
|
19
|
+
background_color=None,
|
|
20
|
+
center=None,
|
|
21
|
+
size=None,
|
|
22
|
+
zoom=1.0,
|
|
23
|
+
):
|
|
17
24
|
"""
|
|
18
25
|
Plot an :class:`AtomArray` as lines between bonded atoms.
|
|
19
26
|
|
|
20
27
|
The z-axis points into the screen plane.
|
|
21
|
-
|
|
28
|
+
|
|
22
29
|
Parameters
|
|
23
30
|
----------
|
|
24
31
|
axes : Axes3D
|
|
@@ -49,7 +56,7 @@ def plot_atoms(axes, atoms, colors, line_width=1.0, background_color=None,
|
|
|
49
56
|
|
|
50
57
|
- ``> 1.0``: Zoom in.
|
|
51
58
|
- ``< 1.0``: Zoom out.
|
|
52
|
-
|
|
59
|
+
|
|
53
60
|
Notes
|
|
54
61
|
-----
|
|
55
62
|
This is a very simple visualization tools for quick visual analysis
|
|
@@ -61,38 +68,37 @@ def plot_atoms(axes, atoms, colors, line_width=1.0, background_color=None,
|
|
|
61
68
|
raise ValueError("The given axes mut be an 'Axes3D'")
|
|
62
69
|
if atoms.bonds is None:
|
|
63
70
|
raise ValueError("The atom array must have an associated bond list")
|
|
64
|
-
|
|
71
|
+
|
|
65
72
|
# Calculating connections between atoms
|
|
66
73
|
line_coord = []
|
|
67
74
|
line_colors = []
|
|
68
|
-
for index1, index2 in atoms.bonds.as_array()[
|
|
75
|
+
for index1, index2 in atoms.bonds.as_array()[:, :2]:
|
|
69
76
|
# Every connection consist of two lines:
|
|
70
77
|
# One from the first atom to the center
|
|
71
78
|
# and from from the second atom to the center
|
|
72
79
|
line_start = atoms.coord[index1]
|
|
73
80
|
line_end = atoms.coord[index2]
|
|
74
81
|
line_center = (line_start + line_end) / 2
|
|
75
|
-
|
|
82
|
+
|
|
76
83
|
# Add line from first atom
|
|
77
|
-
line_coord.append((
|
|
78
|
-
line_start, line_center
|
|
79
|
-
))
|
|
84
|
+
line_coord.append((line_start, line_center))
|
|
80
85
|
line_colors.append(colors[index1])
|
|
81
|
-
|
|
86
|
+
|
|
82
87
|
# Add line from second atom
|
|
83
|
-
line_coord.append((
|
|
84
|
-
line_end, line_center
|
|
85
|
-
))
|
|
88
|
+
line_coord.append((line_end, line_center))
|
|
86
89
|
line_colors.append(colors[index2])
|
|
87
90
|
|
|
88
91
|
# Plot computed line coordinates and colors
|
|
89
92
|
# Use 'Line3DCollection' for higher efficiency
|
|
90
93
|
lines = Line3DCollection(
|
|
91
|
-
line_coord,
|
|
92
|
-
|
|
94
|
+
line_coord,
|
|
95
|
+
color=line_colors,
|
|
96
|
+
linewidths=line_width,
|
|
97
|
+
capstyle="round",
|
|
98
|
+
joinstyle="round",
|
|
93
99
|
)
|
|
94
100
|
axes.add_collection(lines)
|
|
95
|
-
|
|
101
|
+
|
|
96
102
|
# Set viewing angle
|
|
97
103
|
axes.azim = -90
|
|
98
104
|
axes.elev = 90
|
|
@@ -105,17 +111,25 @@ def plot_atoms(axes, atoms, colors, line_width=1.0, background_color=None,
|
|
|
105
111
|
_set_box(axes, atoms.coord, center, size, zoom)
|
|
106
112
|
|
|
107
113
|
|
|
108
|
-
def plot_ball_and_stick_model(
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
114
|
+
def plot_ball_and_stick_model(
|
|
115
|
+
axes,
|
|
116
|
+
atoms,
|
|
117
|
+
colors,
|
|
118
|
+
ball_size=200,
|
|
119
|
+
line_color="black",
|
|
120
|
+
line_width=1.0,
|
|
121
|
+
background_color=None,
|
|
122
|
+
center=None,
|
|
123
|
+
size=None,
|
|
124
|
+
zoom=1.0,
|
|
125
|
+
):
|
|
112
126
|
"""
|
|
113
127
|
Plot an :class:`AtomArray` as *ball-and-stick* model.
|
|
114
128
|
|
|
115
129
|
The z-axis points into the screen plane.
|
|
116
130
|
|
|
117
131
|
UNSTABLE: This function is probably subject to future changes.
|
|
118
|
-
|
|
132
|
+
|
|
119
133
|
Parameters
|
|
120
134
|
----------
|
|
121
135
|
axes : Axes3D
|
|
@@ -154,7 +168,7 @@ def plot_ball_and_stick_model(axes, atoms, colors, ball_size=200,
|
|
|
154
168
|
|
|
155
169
|
- ``> 1.0``: Zoom in.
|
|
156
170
|
- ``< 1.0``: Zoom out.
|
|
157
|
-
|
|
171
|
+
|
|
158
172
|
Notes
|
|
159
173
|
-----
|
|
160
174
|
This is a very simple visualization tools for quick visual analysis
|
|
@@ -166,26 +180,27 @@ def plot_ball_and_stick_model(axes, atoms, colors, ball_size=200,
|
|
|
166
180
|
raise ValueError("The given axes mut be an 'Axes3D'")
|
|
167
181
|
if atoms.bonds is None:
|
|
168
182
|
raise ValueError("The atom array must have an associated bond list")
|
|
169
|
-
|
|
183
|
+
|
|
170
184
|
# Calculating connections between atoms
|
|
171
185
|
line_coord = [
|
|
172
186
|
(atoms.coord[index1], atoms.coord[index2])
|
|
173
|
-
for index1, index2 in atoms.bonds.as_array()[
|
|
187
|
+
for index1, index2 in atoms.bonds.as_array()[:, :2]
|
|
174
188
|
]
|
|
175
189
|
|
|
176
190
|
# Plot sticks
|
|
177
191
|
# Use 'Line3DCollection' for higher efficiency
|
|
178
192
|
sticks = Line3DCollection(
|
|
179
|
-
line_coord,
|
|
180
|
-
|
|
193
|
+
line_coord,
|
|
194
|
+
color=line_color,
|
|
195
|
+
linewidths=line_width,
|
|
196
|
+
capstyle="round",
|
|
197
|
+
joinstyle="round",
|
|
181
198
|
)
|
|
182
199
|
axes.add_collection(sticks)
|
|
183
200
|
|
|
184
201
|
# Plot balls
|
|
185
|
-
axes.scatter(
|
|
186
|
-
|
|
187
|
-
)
|
|
188
|
-
|
|
202
|
+
axes.scatter(*atoms.coord.T, s=ball_size, c=colors, linewidth=0, alpha=1)
|
|
203
|
+
|
|
189
204
|
# Set viewing angle
|
|
190
205
|
axes.azim = -90
|
|
191
206
|
axes.elev = 90
|
|
@@ -211,16 +226,18 @@ def _set_box(axes, coord, center, size, zoom):
|
|
|
211
226
|
)
|
|
212
227
|
|
|
213
228
|
if size is None:
|
|
214
|
-
size = np.array(
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
axes.
|
|
223
|
-
|
|
229
|
+
size = np.array(
|
|
230
|
+
[
|
|
231
|
+
coord[:, 0].max() - coord[:, 0].min(),
|
|
232
|
+
coord[:, 1].max() - coord[:, 1].min(),
|
|
233
|
+
coord[:, 2].max() - coord[:, 2].min(),
|
|
234
|
+
]
|
|
235
|
+
).max()
|
|
236
|
+
|
|
237
|
+
axes.set_xlim(center[0] - size / (2 * zoom), center[0] + size / (2 * zoom))
|
|
238
|
+
axes.set_ylim(center[1] - size / (2 * zoom), center[1] + size / (2 * zoom))
|
|
239
|
+
axes.set_zlim(center[2] - size / (2 * zoom), center[2] + size / (2 * zoom))
|
|
240
|
+
|
|
224
241
|
# Make the axis lengths of the 'plot box' equal
|
|
225
242
|
# The 'plot box' is not visible due to 'axes.axis("off")'
|
|
226
|
-
axes.set_box_aspect([1,1,1])
|
|
243
|
+
axes.set_box_aspect([1, 1, 1])
|
|
@@ -7,29 +7,43 @@ __author__ = "Tom David Müller"
|
|
|
7
7
|
__all__ = ["plot_nucleotide_secondary_structure"]
|
|
8
8
|
|
|
9
9
|
import shutil
|
|
10
|
-
import numpy as np
|
|
11
10
|
from itertools import repeat
|
|
12
|
-
|
|
13
|
-
from
|
|
11
|
+
import numpy as np
|
|
12
|
+
from biotite.application.viennarna import RNAplotApp
|
|
13
|
+
from biotite.structure import pseudoknots
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
def plot_nucleotide_secondary_structure(
|
|
17
|
-
axes,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
17
|
+
axes,
|
|
18
|
+
base_labels,
|
|
19
|
+
base_pairs,
|
|
20
|
+
length,
|
|
21
|
+
layout_type=RNAplotApp.Layout.NAVIEW,
|
|
22
|
+
draw_pseudoknots=True,
|
|
23
|
+
pseudoknot_order=None,
|
|
24
|
+
angle=0,
|
|
25
|
+
bond_linewidth=1,
|
|
26
|
+
bond_linestyle=None,
|
|
27
|
+
bond_color="black",
|
|
28
|
+
backbone_linewidth=1,
|
|
29
|
+
backbone_linestyle="solid",
|
|
30
|
+
backbone_color="grey",
|
|
31
|
+
base_text=None,
|
|
32
|
+
base_box=None,
|
|
33
|
+
annotation_positions=None,
|
|
34
|
+
annotation_offset=8.5,
|
|
35
|
+
annotation_text=None,
|
|
36
|
+
border=0.03,
|
|
37
|
+
bin_path="RNAplot",
|
|
38
|
+
):
|
|
25
39
|
"""
|
|
26
40
|
Generate 2D plots of nucleic acid secondary structures using the
|
|
27
41
|
interface to *RNAplot*, which is part of the *ViennaRNA* software
|
|
28
42
|
package.
|
|
29
43
|
|
|
30
|
-
Internally a :class:`biotite.application.viennarna.RNAplotApp`
|
|
31
|
-
instance is created to generate coordinates for each individual base
|
|
32
|
-
on a 2D plane. *ViennaRNA* must be installed in order to use this
|
|
44
|
+
Internally a :class:`biotite.application.viennarna.RNAplotApp`
|
|
45
|
+
instance is created to generate coordinates for each individual base
|
|
46
|
+
on a 2D plane. *ViennaRNA* must be installed in order to use this
|
|
33
47
|
function.
|
|
34
48
|
|
|
35
49
|
Parameters
|
|
@@ -49,7 +63,7 @@ def plot_nucleotide_secondary_structure(
|
|
|
49
63
|
Whether pseudoknotted bonds should be drawn.
|
|
50
64
|
pseudoknot_order : iterable, optional (default: None)
|
|
51
65
|
The pseudoknot order of each pair in the input `base_pairs`.
|
|
52
|
-
If no pseudoknot order is given, a solution determined by
|
|
66
|
+
If no pseudoknot order is given, a solution determined by
|
|
53
67
|
:func:`biotite.structure.pseudoknots` is picked at random.
|
|
54
68
|
angle : int or float, optional (default: 0)
|
|
55
69
|
The angle the plot should be rotated.
|
|
@@ -74,9 +88,9 @@ def plot_nucleotide_secondary_structure(
|
|
|
74
88
|
backbone_color : str or ndarray, shape=(3,) or shape=(4,), dtype=float, optional (default: 'grey')
|
|
75
89
|
The *Matplotlib* compatible color of the backbone.
|
|
76
90
|
base_text : dict or iterable, optional (default: {'size': 'small'})
|
|
77
|
-
The keyword parameters for the *Matplotlib* ``Text`` objects
|
|
78
|
-
denoting the type of each base. Provide a single value to set
|
|
79
|
-
the parameters for all labels or an iterable to set the
|
|
91
|
+
The keyword parameters for the *Matplotlib* ``Text`` objects
|
|
92
|
+
denoting the type of each base. Provide a single value to set
|
|
93
|
+
the parameters for all labels or an iterable to set the
|
|
80
94
|
parameters for each individual label.
|
|
81
95
|
base_box : dict or iterable, optional (default: {'pad'=0, 'color'='white'})
|
|
82
96
|
The *Matplotlib* compatible properties of the ``FancyBboxPatch``
|
|
@@ -91,9 +105,9 @@ def plot_nucleotide_secondary_structure(
|
|
|
91
105
|
annotation_offset : int or float, optional (default: 8.5)
|
|
92
106
|
The offset of the annotations from the base labels.
|
|
93
107
|
annotation_text : dict or iterable, optional (default: {'size': 'small'})
|
|
94
|
-
The keyword parameters for the *Matplotlib* ``Text`` objects
|
|
95
|
-
annotating the sequence. Provide a single value to set the
|
|
96
|
-
parameters for all annotations or an iterable to set the
|
|
108
|
+
The keyword parameters for the *Matplotlib* ``Text`` objects
|
|
109
|
+
annotating the sequence. Provide a single value to set the
|
|
110
|
+
parameters for all annotations or an iterable to set the
|
|
97
111
|
parameters for each individual annotation.
|
|
98
112
|
border : float, optional (default: 0.03)
|
|
99
113
|
The percentage of the coordinate range to be left as whitespace
|
|
@@ -105,8 +119,8 @@ def plot_nucleotide_secondary_structure(
|
|
|
105
119
|
# Check if RNAplot is installed
|
|
106
120
|
if shutil.which(bin_path) is None:
|
|
107
121
|
raise FileNotFoundError(
|
|
108
|
-
|
|
109
|
-
|
|
122
|
+
"RNAplot is not installed at the specified location, unable to "
|
|
123
|
+
"plot secondary structure."
|
|
110
124
|
)
|
|
111
125
|
|
|
112
126
|
# Get the unknotted base pairs
|
|
@@ -127,7 +141,7 @@ def plot_nucleotide_secondary_structure(
|
|
|
127
141
|
# Set the default properties of the Matplotlib `bbox` surrounding
|
|
128
142
|
# the base labels
|
|
129
143
|
if base_box is None:
|
|
130
|
-
base_box=np.full(length, {
|
|
144
|
+
base_box = np.full(length, {"pad": 0, "color": "white"})
|
|
131
145
|
# if `base_box` is a dictionary, extrapolate
|
|
132
146
|
elif isinstance(base_box, dict):
|
|
133
147
|
base_box = np.full(length, base_box)
|
|
@@ -135,25 +149,23 @@ def plot_nucleotide_secondary_structure(
|
|
|
135
149
|
# By default pseudoknotted bonds are denoted as dashed lines, while
|
|
136
150
|
# unknotted bonds are denoted as solid lines
|
|
137
151
|
if bond_linestyle is None:
|
|
138
|
-
bond_linestyle = np.full(base_pairs.shape[0],
|
|
139
|
-
bond_linestyle[pseudoknot_order != 0] =
|
|
152
|
+
bond_linestyle = np.full(base_pairs.shape[0], "solid", dtype="object")
|
|
153
|
+
bond_linestyle[pseudoknot_order != 0] = "dashed"
|
|
140
154
|
# If `bond_linestyle` is a string, extrapolate
|
|
141
155
|
elif isinstance(bond_linestyle, str):
|
|
142
|
-
bond_linestyle = np.full(
|
|
143
|
-
base_pairs.shape[0], bond_linestyle, dtype='object'
|
|
144
|
-
)
|
|
156
|
+
bond_linestyle = np.full(base_pairs.shape[0], bond_linestyle, dtype="object")
|
|
145
157
|
|
|
146
158
|
# If pseudoknots are not to be drawn, remove pseudoknotted bonds,
|
|
147
159
|
# regardless of the given linestyles
|
|
148
160
|
if not draw_pseudoknots:
|
|
149
161
|
# Ensure that the array can hold the 'None' value
|
|
150
162
|
# (not possible with 'U1' dtype for example)
|
|
151
|
-
bond_linestyle = np.asarray(bond_linestyle, dtype=
|
|
152
|
-
bond_linestyle[pseudoknot_order != 0] =
|
|
163
|
+
bond_linestyle = np.asarray(bond_linestyle, dtype="object")
|
|
164
|
+
bond_linestyle[pseudoknot_order != 0] = "None"
|
|
153
165
|
|
|
154
166
|
# Set the default properties of the base labels
|
|
155
167
|
if base_text is None:
|
|
156
|
-
base_text = np.full(length, {
|
|
168
|
+
base_text = np.full(length, {"size": "small"})
|
|
157
169
|
elif isinstance(base_text, dict):
|
|
158
170
|
base_text = np.full(length, base_text)
|
|
159
171
|
|
|
@@ -164,7 +176,7 @@ def plot_nucleotide_secondary_structure(
|
|
|
164
176
|
|
|
165
177
|
# Set the default font properties of the base annotations
|
|
166
178
|
if annotation_text is None:
|
|
167
|
-
annotation_text = repeat({
|
|
179
|
+
annotation_text = repeat({"size": "small"})
|
|
168
180
|
elif isinstance(annotation_text, dict):
|
|
169
181
|
annotation_text = repeat(annotation_text)
|
|
170
182
|
|
|
@@ -173,15 +185,14 @@ def plot_nucleotide_secondary_structure(
|
|
|
173
185
|
base_pairs=unknotted_base_pairs,
|
|
174
186
|
length=length,
|
|
175
187
|
bin_path=bin_path,
|
|
176
|
-
layout_type=layout_type
|
|
188
|
+
layout_type=layout_type,
|
|
177
189
|
)
|
|
178
190
|
|
|
179
191
|
# Rotate Coordinates
|
|
180
192
|
if angle != 0:
|
|
181
193
|
angle = np.deg2rad(angle)
|
|
182
194
|
rot_matrix = np.array(
|
|
183
|
-
[[np.cos(angle), -np.sin(angle)],
|
|
184
|
-
[np.sin(angle), np.cos(angle)]]
|
|
195
|
+
[[np.cos(angle), -np.sin(angle)], [np.sin(angle), np.cos(angle)]]
|
|
185
196
|
)
|
|
186
197
|
for i, coord in enumerate(coordinates):
|
|
187
198
|
coordinates[i] = np.dot(rot_matrix, coord)
|
|
@@ -197,31 +208,32 @@ def plot_nucleotide_secondary_structure(
|
|
|
197
208
|
)
|
|
198
209
|
axes.set_frame_on(False)
|
|
199
210
|
|
|
200
|
-
|
|
201
211
|
# Define buffer area (Border)
|
|
202
212
|
coord_range = abs(np.max(coordinates)) + abs(np.min(coordinates))
|
|
203
|
-
buffer = border*coord_range
|
|
213
|
+
buffer = border * coord_range
|
|
204
214
|
|
|
205
215
|
# Adjust display
|
|
206
216
|
axes.set_xlim(
|
|
207
|
-
np.min(coordinates[:,0])-buffer, np.max(coordinates[:,0])+buffer
|
|
217
|
+
np.min(coordinates[:, 0]) - buffer, np.max(coordinates[:, 0]) + buffer
|
|
208
218
|
)
|
|
209
219
|
axes.set_ylim(
|
|
210
|
-
np.min(coordinates[:,1])-buffer, np.max(coordinates[:,1])+buffer
|
|
220
|
+
np.min(coordinates[:, 1]) - buffer, np.max(coordinates[:, 1]) + buffer
|
|
211
221
|
)
|
|
212
|
-
axes.set_aspect(aspect=
|
|
222
|
+
axes.set_aspect(aspect="equal")
|
|
213
223
|
|
|
214
224
|
# Draw backbone
|
|
215
|
-
axes.plot(
|
|
216
|
-
|
|
225
|
+
axes.plot(
|
|
226
|
+
coordinates[:, 0],
|
|
227
|
+
coordinates[:, 1],
|
|
228
|
+
color=backbone_color,
|
|
229
|
+
linestyle=backbone_linestyle,
|
|
230
|
+
linewidth=backbone_linewidth,
|
|
231
|
+
)
|
|
217
232
|
|
|
218
233
|
# Draw base labels
|
|
219
|
-
for coords, label, box, text in zip(
|
|
220
|
-
coordinates, base_labels, base_box, base_text
|
|
221
|
-
):
|
|
234
|
+
for coords, label, box, text in zip(coordinates, base_labels, base_box, base_text):
|
|
222
235
|
t = axes.text(
|
|
223
|
-
|
|
224
|
-
ha='center', va='center', **text
|
|
236
|
+
x=coords[0], y=coords[1], s=label, ha="center", va="center", **text
|
|
225
237
|
)
|
|
226
238
|
t.set_bbox(box)
|
|
227
239
|
|
|
@@ -237,37 +249,41 @@ def plot_nucleotide_secondary_structure(
|
|
|
237
249
|
|
|
238
250
|
# Draw annotations
|
|
239
251
|
for i, text in zip(annotation_positions, annotation_text):
|
|
240
|
-
if (i > 0) and ((i+1) < length):
|
|
252
|
+
if (i > 0) and ((i + 1) < length):
|
|
241
253
|
# Get the average of the direction vectors to the next and
|
|
242
254
|
# previous base
|
|
243
255
|
vector_to_previous = np.array(
|
|
244
|
-
[
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
vector_to_previous
|
|
256
|
+
[
|
|
257
|
+
coordinates[i - 1][0] - coordinates[i][0],
|
|
258
|
+
coordinates[i - 1][1] - coordinates[i][1],
|
|
259
|
+
]
|
|
249
260
|
)
|
|
261
|
+
vector_to_previous = vector_to_previous / np.linalg.norm(vector_to_previous)
|
|
250
262
|
vector_to_next = np.array(
|
|
251
|
-
[
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
vector_to_next
|
|
263
|
+
[
|
|
264
|
+
coordinates[i][0] - coordinates[i + 1][0],
|
|
265
|
+
coordinates[i][1] - coordinates[i + 1][1],
|
|
266
|
+
]
|
|
256
267
|
)
|
|
268
|
+
vector_to_next = vector_to_next / np.linalg.norm(vector_to_next)
|
|
257
269
|
vector = (vector_to_next + vector_to_previous) / 2
|
|
258
270
|
elif i > 0:
|
|
259
271
|
# For the last base get the direction vector to the previous
|
|
260
272
|
# base
|
|
261
273
|
vector = np.array(
|
|
262
|
-
[
|
|
263
|
-
|
|
274
|
+
[
|
|
275
|
+
coordinates[i - 1][0] - coordinates[i][0],
|
|
276
|
+
coordinates[i - 1][1] - coordinates[i][1],
|
|
277
|
+
]
|
|
264
278
|
)
|
|
265
279
|
else:
|
|
266
280
|
# For the first base get the direction vector to the next
|
|
267
281
|
# base
|
|
268
282
|
vector = np.array(
|
|
269
|
-
[
|
|
270
|
-
|
|
283
|
+
[
|
|
284
|
+
coordinates[i][0] - coordinates[i + 1][0],
|
|
285
|
+
coordinates[i][1] - coordinates[i + 1][1],
|
|
286
|
+
]
|
|
271
287
|
)
|
|
272
288
|
# Normalize the vector
|
|
273
289
|
vector = vector / np.linalg.norm(vector)
|
|
@@ -275,8 +291,5 @@ def plot_nucleotide_secondary_structure(
|
|
|
275
291
|
vector = np.array([vector[1], -vector[0]])
|
|
276
292
|
# The annotations are offset in the direction of the
|
|
277
293
|
# perpendicular vector
|
|
278
|
-
x, y = coordinates[i] + (annotation_offset*vector)
|
|
279
|
-
axes.text(
|
|
280
|
-
x=x, y=y, s=i+1,
|
|
281
|
-
ha='center', va='center', **text
|
|
282
|
-
)
|
|
294
|
+
x, y = coordinates[i] + (annotation_offset * vector)
|
|
295
|
+
axes.text(x=x, y=y, s=i + 1, ha="center", va="center", **text)
|