dash-seqviz 0.1.0__py3-none-any.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.
- dash_seqviz/SeqViz.py +319 -0
- dash_seqviz/__init__.py +87 -0
- dash_seqviz/_imports_.py +5 -0
- dash_seqviz/async-SeqViz.js +3 -0
- dash_seqviz/async-SeqViz.js.map +1 -0
- dash_seqviz/dash_seqviz.min.js +2 -0
- dash_seqviz/dash_seqviz.min.js.map +1 -0
- dash_seqviz/metadata.json +1 -0
- dash_seqviz/package-info.json +59 -0
- dash_seqviz-0.1.0.dist-info/METADATA +300 -0
- dash_seqviz-0.1.0.dist-info/RECORD +14 -0
- dash_seqviz-0.1.0.dist-info/WHEEL +5 -0
- dash_seqviz-0.1.0.dist-info/licenses/LICENSE +21 -0
- dash_seqviz-0.1.0.dist-info/top_level.txt +1 -0
dash_seqviz/SeqViz.py
ADDED
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
# AUTO GENERATED FILE - DO NOT EDIT
|
|
2
|
+
|
|
3
|
+
import typing # noqa: F401
|
|
4
|
+
from typing_extensions import TypedDict, NotRequired, Literal # noqa: F401
|
|
5
|
+
from dash.development.base_component import Component, _explicitize_args
|
|
6
|
+
|
|
7
|
+
ComponentType = typing.Union[
|
|
8
|
+
str,
|
|
9
|
+
int,
|
|
10
|
+
float,
|
|
11
|
+
Component,
|
|
12
|
+
None,
|
|
13
|
+
typing.Sequence[typing.Union[str, int, float, Component, None]],
|
|
14
|
+
]
|
|
15
|
+
|
|
16
|
+
NumberType = typing.Union[
|
|
17
|
+
typing.SupportsFloat, typing.SupportsInt, typing.SupportsComplex
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class SeqViz(Component):
|
|
22
|
+
"""A SeqViz component.
|
|
23
|
+
SeqViz is a Dash wrapper for the seqviz JavaScript library.
|
|
24
|
+
It provides DNA, RNA, and protein sequence visualization with
|
|
25
|
+
circular and linear viewers, annotations, primers, and more.
|
|
26
|
+
|
|
27
|
+
Keyword arguments:
|
|
28
|
+
|
|
29
|
+
- id (string; optional):
|
|
30
|
+
The ID used to identify this component in Dash callbacks.
|
|
31
|
+
|
|
32
|
+
- accession (string; optional):
|
|
33
|
+
(Deprecated upstream) NCBI accession ID. Prefer parsing with
|
|
34
|
+
seqparse.
|
|
35
|
+
|
|
36
|
+
- annotations (list of dicts; optional):
|
|
37
|
+
Array of annotation objects to render. Each annotation: { start:
|
|
38
|
+
number, end: number, name: string, direction?: number, color?:
|
|
39
|
+
string }.
|
|
40
|
+
|
|
41
|
+
`annotations` is a list of dicts with keys:
|
|
42
|
+
|
|
43
|
+
- start (number; required)
|
|
44
|
+
|
|
45
|
+
- end (number; required)
|
|
46
|
+
|
|
47
|
+
- name (string; required)
|
|
48
|
+
|
|
49
|
+
- direction (number; optional)
|
|
50
|
+
|
|
51
|
+
- color (string; optional)
|
|
52
|
+
|
|
53
|
+
- bpColors (dict; optional):
|
|
54
|
+
Object mapping base pairs or indexes to custom colors.
|
|
55
|
+
|
|
56
|
+
- colors (list of strings; optional):
|
|
57
|
+
Array of colors for annotations, translations, and highlights.
|
|
58
|
+
|
|
59
|
+
- disableExternalFonts (boolean; default False):
|
|
60
|
+
Whether to disable downloading external fonts.
|
|
61
|
+
|
|
62
|
+
- enableCopyEvent (boolean; default True):
|
|
63
|
+
When False, disables the default copyEvent (ctrl/cmd + C).
|
|
64
|
+
|
|
65
|
+
- enableSelectAllEvent (boolean; default True):
|
|
66
|
+
When False, disables the default selectAllEvent (ctrl/cmd + A).
|
|
67
|
+
|
|
68
|
+
- enzymes (list of dicts; optional):
|
|
69
|
+
Array of restriction enzymes. Can be enzyme names (strings) or
|
|
70
|
+
custom enzyme objects.
|
|
71
|
+
|
|
72
|
+
`enzymes` is a list of string | dict with keys:
|
|
73
|
+
|
|
74
|
+
- name (string; required)
|
|
75
|
+
|
|
76
|
+
- rseq (string; required)
|
|
77
|
+
|
|
78
|
+
- fcut (number; required)
|
|
79
|
+
|
|
80
|
+
- rcut (number; required)
|
|
81
|
+
|
|
82
|
+
- color (string; optional)
|
|
83
|
+
|
|
84
|
+
- range (dict; optional)
|
|
85
|
+
|
|
86
|
+
`range` is a dict with keys:
|
|
87
|
+
|
|
88
|
+
- start (number; optional)
|
|
89
|
+
|
|
90
|
+
- end (number; optional)s
|
|
91
|
+
|
|
92
|
+
- file (string | dict; optional):
|
|
93
|
+
(Deprecated upstream) Sequence file or URL. Prefer parsing with
|
|
94
|
+
seqparse.
|
|
95
|
+
|
|
96
|
+
- highlights (list of dicts; optional):
|
|
97
|
+
Array of highlight objects. Each highlight: { start: number, end:
|
|
98
|
+
number, color?: string }.
|
|
99
|
+
|
|
100
|
+
`highlights` is a list of dicts with keys:
|
|
101
|
+
|
|
102
|
+
- start (number; required)
|
|
103
|
+
|
|
104
|
+
- end (number; required)
|
|
105
|
+
|
|
106
|
+
- color (string; optional)
|
|
107
|
+
|
|
108
|
+
- name (string; optional):
|
|
109
|
+
The name of the sequence/plasmid. Shown at the center of the
|
|
110
|
+
circular viewer.
|
|
111
|
+
|
|
112
|
+
- primers (list of dicts; optional):
|
|
113
|
+
Array of primer objects to render. Each primer: { start: number,
|
|
114
|
+
end: number, name: string, direction: number, color?: string }.
|
|
115
|
+
|
|
116
|
+
`primers` is a list of dicts with keys:
|
|
117
|
+
|
|
118
|
+
- start (number; required)
|
|
119
|
+
|
|
120
|
+
- end (number; required)
|
|
121
|
+
|
|
122
|
+
- name (string; required)
|
|
123
|
+
|
|
124
|
+
- direction (number; required)
|
|
125
|
+
|
|
126
|
+
- color (string; optional)
|
|
127
|
+
|
|
128
|
+
- rotateOnScroll (boolean; default True):
|
|
129
|
+
Whether the circular viewer rotates on scroll.
|
|
130
|
+
|
|
131
|
+
- search (dict; optional):
|
|
132
|
+
Search configuration object. { query: string, mismatch?: number }.
|
|
133
|
+
|
|
134
|
+
`search` is a dict with keys:
|
|
135
|
+
|
|
136
|
+
- query (string; required)
|
|
137
|
+
|
|
138
|
+
- mismatch (number; optional)
|
|
139
|
+
|
|
140
|
+
- searchResults (list; optional):
|
|
141
|
+
Search results emitted by seqviz (read-only for Dash usage).
|
|
142
|
+
|
|
143
|
+
- selection (dict; optional):
|
|
144
|
+
Selection state object. { start: number, end: number, clockwise?:
|
|
145
|
+
boolean }.
|
|
146
|
+
|
|
147
|
+
`selection` is a dict with keys:
|
|
148
|
+
|
|
149
|
+
- start (number; required)
|
|
150
|
+
|
|
151
|
+
- end (number; required)
|
|
152
|
+
|
|
153
|
+
- clockwise (boolean; optional)
|
|
154
|
+
|
|
155
|
+
- seq (string; optional):
|
|
156
|
+
The sequence to render. Can be DNA, RNA, or amino acid sequence.
|
|
157
|
+
|
|
158
|
+
- showComplement (boolean; default True):
|
|
159
|
+
Whether to show the complement sequence.
|
|
160
|
+
|
|
161
|
+
- translations (list of dicts; optional):
|
|
162
|
+
Array of translation objects. Each translation: { start: number,
|
|
163
|
+
end: number, direction: number, name?: string, color?: string }.
|
|
164
|
+
|
|
165
|
+
`translations` is a list of dicts with keys:
|
|
166
|
+
|
|
167
|
+
- start (number; required)
|
|
168
|
+
|
|
169
|
+
- end (number; required)
|
|
170
|
+
|
|
171
|
+
- direction (number; required)
|
|
172
|
+
|
|
173
|
+
- name (string; optional)
|
|
174
|
+
|
|
175
|
+
- color (string; optional)
|
|
176
|
+
|
|
177
|
+
- viewer (a value equal to: 'linear', 'circular', 'both', 'both_flip'; default 'both'):
|
|
178
|
+
The type and orientation of the sequence viewers. Options:
|
|
179
|
+
\"linear\", \"circular\", \"both\", \"both_flip\".
|
|
180
|
+
|
|
181
|
+
- zoom (dict; default { linear: 50 }):
|
|
182
|
+
Zoom configuration object. Currently supports: { linear: number }
|
|
183
|
+
(0-100).
|
|
184
|
+
|
|
185
|
+
`zoom` is a dict with keys:
|
|
186
|
+
|
|
187
|
+
- linear (number; optional)"""
|
|
188
|
+
_children_props = []
|
|
189
|
+
_base_nodes = ['children']
|
|
190
|
+
_namespace = 'dash_seqviz'
|
|
191
|
+
_type = 'SeqViz'
|
|
192
|
+
Annotations = TypedDict(
|
|
193
|
+
"Annotations",
|
|
194
|
+
{
|
|
195
|
+
"start": NumberType,
|
|
196
|
+
"end": NumberType,
|
|
197
|
+
"name": str,
|
|
198
|
+
"direction": NotRequired[NumberType],
|
|
199
|
+
"color": NotRequired[str]
|
|
200
|
+
}
|
|
201
|
+
)
|
|
202
|
+
|
|
203
|
+
Primers = TypedDict(
|
|
204
|
+
"Primers",
|
|
205
|
+
{
|
|
206
|
+
"start": NumberType,
|
|
207
|
+
"end": NumberType,
|
|
208
|
+
"name": str,
|
|
209
|
+
"direction": NumberType,
|
|
210
|
+
"color": NotRequired[str]
|
|
211
|
+
}
|
|
212
|
+
)
|
|
213
|
+
|
|
214
|
+
Highlights = TypedDict(
|
|
215
|
+
"Highlights",
|
|
216
|
+
{
|
|
217
|
+
"start": NumberType,
|
|
218
|
+
"end": NumberType,
|
|
219
|
+
"color": NotRequired[str]
|
|
220
|
+
}
|
|
221
|
+
)
|
|
222
|
+
|
|
223
|
+
Translations = TypedDict(
|
|
224
|
+
"Translations",
|
|
225
|
+
{
|
|
226
|
+
"start": NumberType,
|
|
227
|
+
"end": NumberType,
|
|
228
|
+
"direction": NumberType,
|
|
229
|
+
"name": NotRequired[str],
|
|
230
|
+
"color": NotRequired[str]
|
|
231
|
+
}
|
|
232
|
+
)
|
|
233
|
+
|
|
234
|
+
EnzymesRange = TypedDict(
|
|
235
|
+
"EnzymesRange",
|
|
236
|
+
{
|
|
237
|
+
"start": NotRequired[NumberType],
|
|
238
|
+
"end": NotRequired[NumberType]
|
|
239
|
+
}
|
|
240
|
+
)
|
|
241
|
+
|
|
242
|
+
Enzymes = TypedDict(
|
|
243
|
+
"Enzymes",
|
|
244
|
+
{
|
|
245
|
+
"name": str,
|
|
246
|
+
"rseq": str,
|
|
247
|
+
"fcut": NumberType,
|
|
248
|
+
"rcut": NumberType,
|
|
249
|
+
"color": NotRequired[str],
|
|
250
|
+
"range": NotRequired["EnzymesRange"]
|
|
251
|
+
}
|
|
252
|
+
)
|
|
253
|
+
|
|
254
|
+
Search = TypedDict(
|
|
255
|
+
"Search",
|
|
256
|
+
{
|
|
257
|
+
"query": str,
|
|
258
|
+
"mismatch": NotRequired[NumberType]
|
|
259
|
+
}
|
|
260
|
+
)
|
|
261
|
+
|
|
262
|
+
Selection = TypedDict(
|
|
263
|
+
"Selection",
|
|
264
|
+
{
|
|
265
|
+
"start": NumberType,
|
|
266
|
+
"end": NumberType,
|
|
267
|
+
"clockwise": NotRequired[bool]
|
|
268
|
+
}
|
|
269
|
+
)
|
|
270
|
+
|
|
271
|
+
Zoom = TypedDict(
|
|
272
|
+
"Zoom",
|
|
273
|
+
{
|
|
274
|
+
"linear": NotRequired[NumberType]
|
|
275
|
+
}
|
|
276
|
+
)
|
|
277
|
+
|
|
278
|
+
|
|
279
|
+
def __init__(
|
|
280
|
+
self,
|
|
281
|
+
id: typing.Optional[typing.Union[str, dict]] = None,
|
|
282
|
+
seq: typing.Optional[str] = None,
|
|
283
|
+
file: typing.Optional[typing.Union[str, dict]] = None,
|
|
284
|
+
accession: typing.Optional[str] = None,
|
|
285
|
+
name: typing.Optional[str] = None,
|
|
286
|
+
viewer: typing.Optional[Literal["linear", "circular", "both", "both_flip"]] = None,
|
|
287
|
+
annotations: typing.Optional[typing.Sequence["Annotations"]] = None,
|
|
288
|
+
primers: typing.Optional[typing.Sequence["Primers"]] = None,
|
|
289
|
+
highlights: typing.Optional[typing.Sequence["Highlights"]] = None,
|
|
290
|
+
translations: typing.Optional[typing.Sequence["Translations"]] = None,
|
|
291
|
+
enzymes: typing.Optional[typing.Sequence[typing.Union[str, "Enzymes"]]] = None,
|
|
292
|
+
search: typing.Optional["Search"] = None,
|
|
293
|
+
selection: typing.Optional["Selection"] = None,
|
|
294
|
+
colors: typing.Optional[typing.Sequence[str]] = None,
|
|
295
|
+
bpColors: typing.Optional[dict] = None,
|
|
296
|
+
style: typing.Optional[typing.Any] = None,
|
|
297
|
+
zoom: typing.Optional["Zoom"] = None,
|
|
298
|
+
showComplement: typing.Optional[bool] = None,
|
|
299
|
+
rotateOnScroll: typing.Optional[bool] = None,
|
|
300
|
+
disableExternalFonts: typing.Optional[bool] = None,
|
|
301
|
+
onSelection: typing.Optional[typing.Any] = None,
|
|
302
|
+
onSearch: typing.Optional[typing.Any] = None,
|
|
303
|
+
enableCopyEvent: typing.Optional[bool] = None,
|
|
304
|
+
enableSelectAllEvent: typing.Optional[bool] = None,
|
|
305
|
+
searchResults: typing.Optional[typing.Sequence] = None,
|
|
306
|
+
**kwargs
|
|
307
|
+
):
|
|
308
|
+
self._prop_names = ['id', 'accession', 'annotations', 'bpColors', 'colors', 'disableExternalFonts', 'enableCopyEvent', 'enableSelectAllEvent', 'enzymes', 'file', 'highlights', 'name', 'primers', 'rotateOnScroll', 'search', 'searchResults', 'selection', 'seq', 'showComplement', 'style', 'translations', 'viewer', 'zoom']
|
|
309
|
+
self._valid_wildcard_attributes = []
|
|
310
|
+
self.available_properties = ['id', 'accession', 'annotations', 'bpColors', 'colors', 'disableExternalFonts', 'enableCopyEvent', 'enableSelectAllEvent', 'enzymes', 'file', 'highlights', 'name', 'primers', 'rotateOnScroll', 'search', 'searchResults', 'selection', 'seq', 'showComplement', 'style', 'translations', 'viewer', 'zoom']
|
|
311
|
+
self.available_wildcard_properties = []
|
|
312
|
+
_explicit_args = kwargs.pop('_explicit_args')
|
|
313
|
+
_locals = locals()
|
|
314
|
+
_locals.update(kwargs) # For wildcard attrs and excess named props
|
|
315
|
+
args = {k: _locals[k] for k in _explicit_args}
|
|
316
|
+
|
|
317
|
+
super(SeqViz, self).__init__(**args)
|
|
318
|
+
|
|
319
|
+
setattr(SeqViz, "__init__", _explicitize_args(SeqViz.__init__))
|
dash_seqviz/__init__.py
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
from __future__ import print_function as _
|
|
2
|
+
|
|
3
|
+
import os as _os
|
|
4
|
+
import sys as _sys
|
|
5
|
+
import json
|
|
6
|
+
|
|
7
|
+
import dash as _dash
|
|
8
|
+
|
|
9
|
+
# noinspection PyUnresolvedReferences
|
|
10
|
+
from ._imports_ import *
|
|
11
|
+
from ._imports_ import __all__
|
|
12
|
+
|
|
13
|
+
if not hasattr(_dash, '__plotly_dash') and not hasattr(_dash, 'development'):
|
|
14
|
+
print('Dash was not successfully imported. '
|
|
15
|
+
'Make sure you don\'t have a file '
|
|
16
|
+
'named \n"dash.py" in your current directory.', file=_sys.stderr)
|
|
17
|
+
_sys.exit(1)
|
|
18
|
+
|
|
19
|
+
_basepath = _os.path.dirname(__file__)
|
|
20
|
+
_filepath = _os.path.abspath(_os.path.join(_basepath, 'package-info.json'))
|
|
21
|
+
with open(_filepath) as f:
|
|
22
|
+
package = json.load(f)
|
|
23
|
+
|
|
24
|
+
package_name = package['name'].replace(' ', '_').replace('-', '_')
|
|
25
|
+
__version__ = package['version']
|
|
26
|
+
|
|
27
|
+
_current_path = _os.path.dirname(_os.path.abspath(__file__))
|
|
28
|
+
|
|
29
|
+
_this_module = _sys.modules[__name__]
|
|
30
|
+
|
|
31
|
+
async_resources = ["SeqViz",]
|
|
32
|
+
|
|
33
|
+
_js_dist = []
|
|
34
|
+
|
|
35
|
+
_js_dist.extend(
|
|
36
|
+
[
|
|
37
|
+
{
|
|
38
|
+
"relative_package_path": "async-{}.js".format(async_resource),
|
|
39
|
+
"external_url": (
|
|
40
|
+
"https://unpkg.com/{0}@{2}"
|
|
41
|
+
"/{1}/async-{3}.js"
|
|
42
|
+
).format(package_name, __name__, __version__, async_resource),
|
|
43
|
+
"namespace": package_name,
|
|
44
|
+
"async": True,
|
|
45
|
+
}
|
|
46
|
+
for async_resource in async_resources
|
|
47
|
+
]
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
# TODO: Figure out if unpkg link works
|
|
51
|
+
_js_dist.extend(
|
|
52
|
+
[
|
|
53
|
+
{
|
|
54
|
+
"relative_package_path": "async-{}.js.map".format(async_resource),
|
|
55
|
+
"external_url": (
|
|
56
|
+
"https://unpkg.com/{0}@{2}"
|
|
57
|
+
"/{1}/async-{3}.js.map"
|
|
58
|
+
).format(package_name, __name__, __version__, async_resource),
|
|
59
|
+
"namespace": package_name,
|
|
60
|
+
"dynamic": True,
|
|
61
|
+
}
|
|
62
|
+
for async_resource in async_resources
|
|
63
|
+
]
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
_js_dist.extend(
|
|
67
|
+
[
|
|
68
|
+
{
|
|
69
|
+
'relative_package_path': 'dash_seqviz.min.js',
|
|
70
|
+
|
|
71
|
+
'namespace': package_name
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
'relative_package_path': 'dash_seqviz.min.js.map',
|
|
75
|
+
|
|
76
|
+
'namespace': package_name,
|
|
77
|
+
'dynamic': True
|
|
78
|
+
}
|
|
79
|
+
]
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
_css_dist = []
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
for _component in __all__:
|
|
86
|
+
setattr(locals()[_component], '_js_dist', _js_dist)
|
|
87
|
+
setattr(locals()[_component], '_css_dist', _css_dist)
|