genome-spy-python 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.
Files changed (64) hide show
  1. genome_spy/__init__.py +199 -0
  2. genome_spy/_chart_authoring.py +231 -0
  3. genome_spy/_conditions.py +72 -0
  4. genome_spy/_embed.py +87 -0
  5. genome_spy/_expressions.py +271 -0
  6. genome_spy/_parameters.py +267 -0
  7. genome_spy/_render.py +207 -0
  8. genome_spy/_utils.py +75 -0
  9. genome_spy/_widget.py +262 -0
  10. genome_spy/api.py +198 -0
  11. genome_spy/arrow.py +155 -0
  12. genome_spy/channels.py +193 -0
  13. genome_spy/chart.py +1240 -0
  14. genome_spy/data.py +56 -0
  15. genome_spy/data_transformers.py +267 -0
  16. genome_spy/datasets/__init__.py +189 -0
  17. genome_spy/datasets/_airway.py +219 -0
  18. genome_spy/datasets/_annotations.py +37 -0
  19. genome_spy/datasets/_gistic.py +43 -0
  20. genome_spy/datasets/_grammar.py +66 -0
  21. genome_spy/datasets/_hapmap.py +180 -0
  22. genome_spy/datasets/_mutation.py +289 -0
  23. genome_spy/datasets/_oncoprint.py +523 -0
  24. genome_spy/datasets/data/airway_metadata.csv +9 -0
  25. genome_spy/datasets/data/airway_scaledcounts.csv +38695 -0
  26. genome_spy/datasets/data/brca.maf.gz +0 -0
  27. genome_spy/datasets/data/hapmap_gwas.csv +14413 -0
  28. genome_spy/datasets/data/mutation_impact_reference.json +27 -0
  29. genome_spy/datasets/data/oncoprint_dataset3.json +266 -0
  30. genome_spy/datasets/data/p53_sequence_comparison.json.gz +0 -0
  31. genome_spy/datasets/data/pik3ca_mutations.json +1 -0
  32. genome_spy/datasets/data/pik3ca_tcga_brca_lollipop.json +38 -0
  33. genome_spy/datasets/data/refseq_gene_bodies.csv.gz +0 -0
  34. genome_spy/datasets/data/tal1_alphagenome_reference.json.gz +0 -0
  35. genome_spy/datasets/data/tcga.tsv +146 -0
  36. genome_spy/datasets/data/tcga_laml.maf.gz +0 -0
  37. genome_spy/datasets/data/tcga_laml_annot.tsv +201 -0
  38. genome_spy/datasets/data/tcga_laml_combined_oncoplot.json.gz +0 -0
  39. genome_spy/datasets/data/tcga_ov_gistic_lesions.tsv.gz +0 -0
  40. genome_spy/datasets/data/tcga_ov_gistic_scores.tsv.gz +0 -0
  41. genome_spy/helpers.py +185 -0
  42. genome_spy/jupyter.py +5 -0
  43. genome_spy/py.typed +0 -0
  44. genome_spy/schema/__init__.py +784 -0
  45. genome_spy/schema/_kwds.py +1394 -0
  46. genome_spy/schema/_typing.py +186 -0
  47. genome_spy/schema/capabilities.json +593 -0
  48. genome_spy/schema/channels.py +8943 -0
  49. genome_spy/schema/composition.py +1064 -0
  50. genome_spy/schema/core.py +51821 -0
  51. genome_spy/schema/ergonomics.py +2056 -0
  52. genome_spy/schema/expressions.py +476 -0
  53. genome_spy/schema/genome-spy-schema.json +33657 -0
  54. genome_spy/schema/lazy.py +326 -0
  55. genome_spy/schema/mixins.py +11684 -0
  56. genome_spy/schemapi.py +264 -0
  57. genome_spy/static/widget.js +345 -0
  58. genome_spy_python-0.1.0.dist-info/METADATA +185 -0
  59. genome_spy_python-0.1.0.dist-info/RECORD +64 -0
  60. genome_spy_python-0.1.0.dist-info/WHEEL +4 -0
  61. genome_spy_python-0.1.0.dist-info/licenses/LICENSE +21 -0
  62. genome_spy_python-0.1.0.dist-info/licenses/LICENSES/ALTAIR-BSD-3-Clause.txt +27 -0
  63. genome_spy_python-0.1.0.dist-info/licenses/LICENSES/GALLERY-DATA-MIT.txt +22 -0
  64. genome_spy_python-0.1.0.dist-info/licenses/THIRD_PARTY_NOTICES.md +42 -0
@@ -0,0 +1,476 @@
1
+ """Generated from GenomeSpy expression-runtime documentation. Do not edit."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import TYPE_CHECKING
6
+
7
+ from genome_spy._expressions import Expression, _function_expression
8
+ from genome_spy.schema import core
9
+ from genome_spy.schemapi import Undefined, UndefinedType
10
+
11
+ if TYPE_CHECKING:
12
+ from genome_spy._expressions import IntoExpression
13
+
14
+
15
+ class _ExprMeta(type):
16
+ """Provide read-only GenomeSpy expression constants."""
17
+
18
+ @property
19
+ def NaN(cls) -> Expression:
20
+ """Return the GenomeSpy ``NaN`` constant."""
21
+ return Expression("NaN")
22
+
23
+ @property
24
+ def E(cls) -> Expression:
25
+ """Return the GenomeSpy ``E`` constant."""
26
+ return Expression("E")
27
+
28
+ @property
29
+ def LN2(cls) -> Expression:
30
+ """Return the GenomeSpy ``LN2`` constant."""
31
+ return Expression("LN2")
32
+
33
+ @property
34
+ def LN10(cls) -> Expression:
35
+ """Return the GenomeSpy ``LN10`` constant."""
36
+ return Expression("LN10")
37
+
38
+ @property
39
+ def LOG2E(cls) -> Expression:
40
+ """Return the GenomeSpy ``LOG2E`` constant."""
41
+ return Expression("LOG2E")
42
+
43
+ @property
44
+ def LOG10E(cls) -> Expression:
45
+ """Return the GenomeSpy ``LOG10E`` constant."""
46
+ return Expression("LOG10E")
47
+
48
+ @property
49
+ def PI(cls) -> Expression:
50
+ """Return the GenomeSpy ``PI`` constant."""
51
+ return Expression("PI")
52
+
53
+ @property
54
+ def SQRT1_2(cls) -> Expression:
55
+ """Return the GenomeSpy ``SQRT1_2`` constant."""
56
+ return Expression("SQRT1_2")
57
+
58
+ @property
59
+ def SQRT2(cls) -> Expression:
60
+ """Return the GenomeSpy ``SQRT2`` constant."""
61
+ return Expression("SQRT2")
62
+
63
+ @property
64
+ def MIN_VALUE(cls) -> Expression:
65
+ """Return the GenomeSpy ``MIN_VALUE`` constant."""
66
+ return Expression("MIN_VALUE")
67
+
68
+ @property
69
+ def MAX_VALUE(cls) -> Expression:
70
+ """Return the GenomeSpy ``MAX_VALUE`` constant."""
71
+ return Expression("MAX_VALUE")
72
+
73
+
74
+ class expr(core.ExprRef, metaclass=_ExprMeta):
75
+ """Build expression references, constants, and function calls."""
76
+
77
+ def __new__(cls, expression: str | Expression) -> core.ExprRef: # type: ignore[misc]
78
+ return core.ExprRef(expr=str(expression))
79
+
80
+ @classmethod
81
+ def if_(
82
+ cls,
83
+ test: IntoExpression,
84
+ thenValue: IntoExpression,
85
+ elseValue: IntoExpression,
86
+ /,
87
+ ) -> Expression:
88
+ """Build a GenomeSpy ``if`` expression."""
89
+ return _function_expression("if", test, thenValue, elseValue)
90
+
91
+ @classmethod
92
+ def isArray(cls, value: IntoExpression, /) -> Expression:
93
+ """Build a GenomeSpy ``isArray`` expression."""
94
+ return _function_expression("isArray", value)
95
+
96
+ @classmethod
97
+ def isBoolean(cls, value: IntoExpression, /) -> Expression:
98
+ """Build a GenomeSpy ``isBoolean`` expression."""
99
+ return _function_expression("isBoolean", value)
100
+
101
+ @classmethod
102
+ def isNumber(cls, value: IntoExpression, /) -> Expression:
103
+ """Build a GenomeSpy ``isNumber`` expression."""
104
+ return _function_expression("isNumber", value)
105
+
106
+ @classmethod
107
+ def isObject(cls, value: IntoExpression, /) -> Expression:
108
+ """Build a GenomeSpy ``isObject`` expression."""
109
+ return _function_expression("isObject", value)
110
+
111
+ @classmethod
112
+ def isRegExp(cls, value: IntoExpression, /) -> Expression:
113
+ """Build a GenomeSpy ``isRegExp`` expression."""
114
+ return _function_expression("isRegExp", value)
115
+
116
+ @classmethod
117
+ def isString(cls, value: IntoExpression, /) -> Expression:
118
+ """Build a GenomeSpy ``isString`` expression."""
119
+ return _function_expression("isString", value)
120
+
121
+ @classmethod
122
+ def isDefined(cls, value: IntoExpression, /) -> Expression:
123
+ """Build a GenomeSpy ``isDefined`` expression."""
124
+ return _function_expression("isDefined", value)
125
+
126
+ @classmethod
127
+ def isValid(cls, value: IntoExpression, /) -> Expression:
128
+ """Build a GenomeSpy ``isValid`` expression."""
129
+ return _function_expression("isValid", value)
130
+
131
+ @classmethod
132
+ def isNaN(cls, value: IntoExpression, /) -> Expression:
133
+ """Build a GenomeSpy ``isNaN`` expression."""
134
+ return _function_expression("isNaN", value)
135
+
136
+ @classmethod
137
+ def isFinite(cls, value: IntoExpression, /) -> Expression:
138
+ """Build a GenomeSpy ``isFinite`` expression."""
139
+ return _function_expression("isFinite", value)
140
+
141
+ @classmethod
142
+ def abs(cls, value: IntoExpression, /) -> Expression:
143
+ """Build a GenomeSpy ``abs`` expression."""
144
+ return _function_expression("abs", value)
145
+
146
+ @classmethod
147
+ def acos(cls, value: IntoExpression, /) -> Expression:
148
+ """Build a GenomeSpy ``acos`` expression."""
149
+ return _function_expression("acos", value)
150
+
151
+ @classmethod
152
+ def asin(cls, value: IntoExpression, /) -> Expression:
153
+ """Build a GenomeSpy ``asin`` expression."""
154
+ return _function_expression("asin", value)
155
+
156
+ @classmethod
157
+ def atan(cls, value: IntoExpression, /) -> Expression:
158
+ """Build a GenomeSpy ``atan`` expression."""
159
+ return _function_expression("atan", value)
160
+
161
+ @classmethod
162
+ def atan2(cls, dy: IntoExpression, dx: IntoExpression, /) -> Expression:
163
+ """Build a GenomeSpy ``atan2`` expression."""
164
+ return _function_expression("atan2", dy, dx)
165
+
166
+ @classmethod
167
+ def ceil(cls, value: IntoExpression, /) -> Expression:
168
+ """Build a GenomeSpy ``ceil`` expression."""
169
+ return _function_expression("ceil", value)
170
+
171
+ @classmethod
172
+ def cos(cls, value: IntoExpression, /) -> Expression:
173
+ """Build a GenomeSpy ``cos`` expression."""
174
+ return _function_expression("cos", value)
175
+
176
+ @classmethod
177
+ def exp(cls, exponent: IntoExpression, /) -> Expression:
178
+ """Build a GenomeSpy ``exp`` expression."""
179
+ return _function_expression("exp", exponent)
180
+
181
+ @classmethod
182
+ def floor(cls, value: IntoExpression, /) -> Expression:
183
+ """Build a GenomeSpy ``floor`` expression."""
184
+ return _function_expression("floor", value)
185
+
186
+ @classmethod
187
+ def hypot(cls, value: IntoExpression, /) -> Expression:
188
+ """Build a GenomeSpy ``hypot`` expression."""
189
+ return _function_expression("hypot", value)
190
+
191
+ @classmethod
192
+ def log(cls, value: IntoExpression, /) -> Expression:
193
+ """Build a GenomeSpy ``log`` expression."""
194
+ return _function_expression("log", value)
195
+
196
+ @classmethod
197
+ def max(
198
+ cls, value1: IntoExpression, value2: IntoExpression, *args: IntoExpression
199
+ ) -> Expression:
200
+ """Build a GenomeSpy ``max`` expression."""
201
+ return _function_expression("max", value1, value2, *args)
202
+
203
+ @classmethod
204
+ def min(
205
+ cls, value1: IntoExpression, value2: IntoExpression, *args: IntoExpression
206
+ ) -> Expression:
207
+ """Build a GenomeSpy ``min`` expression."""
208
+ return _function_expression("min", value1, value2, *args)
209
+
210
+ @classmethod
211
+ def pow(cls, value: IntoExpression, exponent: IntoExpression, /) -> Expression:
212
+ """Build a GenomeSpy ``pow`` expression."""
213
+ return _function_expression("pow", value, exponent)
214
+
215
+ @classmethod
216
+ def random(cls) -> Expression:
217
+ """Build a GenomeSpy ``random`` expression."""
218
+ return _function_expression("random")
219
+
220
+ @classmethod
221
+ def round(cls, value: IntoExpression, /) -> Expression:
222
+ """Build a GenomeSpy ``round`` expression."""
223
+ return _function_expression("round", value)
224
+
225
+ @classmethod
226
+ def sin(cls, value: IntoExpression, /) -> Expression:
227
+ """Build a GenomeSpy ``sin`` expression."""
228
+ return _function_expression("sin", value)
229
+
230
+ @classmethod
231
+ def sqrt(cls, value: IntoExpression, /) -> Expression:
232
+ """Build a GenomeSpy ``sqrt`` expression."""
233
+ return _function_expression("sqrt", value)
234
+
235
+ @classmethod
236
+ def tan(cls, value: IntoExpression, /) -> Expression:
237
+ """Build a GenomeSpy ``tan`` expression."""
238
+ return _function_expression("tan", value)
239
+
240
+ @classmethod
241
+ def clamp(
242
+ cls, value: IntoExpression, min: IntoExpression, max: IntoExpression, /
243
+ ) -> Expression:
244
+ """Build a GenomeSpy ``clamp`` expression."""
245
+ return _function_expression("clamp", value, min, max)
246
+
247
+ @classmethod
248
+ def length(cls, array: IntoExpression, /) -> Expression:
249
+ """Build a GenomeSpy ``length`` expression."""
250
+ return _function_expression("length", array)
251
+
252
+ @classmethod
253
+ def join(
254
+ cls,
255
+ array: IntoExpression,
256
+ separator: IntoExpression | UndefinedType = Undefined,
257
+ /,
258
+ ) -> Expression:
259
+ """Build a GenomeSpy ``join`` expression."""
260
+ arguments = [array, separator]
261
+ while arguments and arguments[-1] is Undefined:
262
+ arguments.pop()
263
+ if any(argument is Undefined for argument in arguments):
264
+ raise ValueError("join optional arguments cannot contain gaps")
265
+ return _function_expression("join", *arguments)
266
+
267
+ @classmethod
268
+ def indexof(cls, array: IntoExpression, value: IntoExpression, /) -> Expression:
269
+ """Build a GenomeSpy ``indexof`` expression."""
270
+ return _function_expression("indexof", array, value)
271
+
272
+ @classmethod
273
+ def lastindexof(cls, array: IntoExpression, value: IntoExpression, /) -> Expression:
274
+ """Build a GenomeSpy ``lastindexof`` expression."""
275
+ return _function_expression("lastindexof", array, value)
276
+
277
+ @classmethod
278
+ def reverse(cls, array: IntoExpression, /) -> Expression:
279
+ """Build a GenomeSpy ``reverse`` expression."""
280
+ return _function_expression("reverse", array)
281
+
282
+ @classmethod
283
+ def slice(
284
+ cls,
285
+ array: IntoExpression,
286
+ start: IntoExpression,
287
+ end: IntoExpression | UndefinedType = Undefined,
288
+ /,
289
+ ) -> Expression:
290
+ """Build a GenomeSpy ``slice`` expression."""
291
+ arguments = [array, start, end]
292
+ while arguments and arguments[-1] is Undefined:
293
+ arguments.pop()
294
+ if any(argument is Undefined for argument in arguments):
295
+ raise ValueError("slice optional arguments cannot contain gaps")
296
+ return _function_expression("slice", *arguments)
297
+
298
+ @classmethod
299
+ def sort(cls, array: IntoExpression, /) -> Expression:
300
+ """Build a GenomeSpy ``sort`` expression."""
301
+ return _function_expression("sort", array)
302
+
303
+ @classmethod
304
+ def span(cls, array: IntoExpression, /) -> Expression:
305
+ """Build a GenomeSpy ``span`` expression."""
306
+ return _function_expression("span", array)
307
+
308
+ @classmethod
309
+ def parseFloat(cls, string: IntoExpression, /) -> Expression:
310
+ """Build a GenomeSpy ``parseFloat`` expression."""
311
+ return _function_expression("parseFloat", string)
312
+
313
+ @classmethod
314
+ def parseInt(cls, string: IntoExpression, /) -> Expression:
315
+ """Build a GenomeSpy ``parseInt`` expression."""
316
+ return _function_expression("parseInt", string)
317
+
318
+ @classmethod
319
+ def upper(cls, string: IntoExpression, /) -> Expression:
320
+ """Build a GenomeSpy ``upper`` expression."""
321
+ return _function_expression("upper", string)
322
+
323
+ @classmethod
324
+ def lower(cls, string: IntoExpression, /) -> Expression:
325
+ """Build a GenomeSpy ``lower`` expression."""
326
+ return _function_expression("lower", string)
327
+
328
+ @classmethod
329
+ def replace(
330
+ cls,
331
+ string: IntoExpression,
332
+ pattern: IntoExpression,
333
+ replacement: IntoExpression,
334
+ /,
335
+ ) -> Expression:
336
+ """Build a GenomeSpy ``replace`` expression."""
337
+ return _function_expression("replace", string, pattern, replacement)
338
+
339
+ @classmethod
340
+ def split(
341
+ cls,
342
+ string: IntoExpression,
343
+ separator: IntoExpression,
344
+ limit: IntoExpression | UndefinedType = Undefined,
345
+ /,
346
+ ) -> Expression:
347
+ """Build a GenomeSpy ``split`` expression."""
348
+ arguments = [string, separator, limit]
349
+ while arguments and arguments[-1] is Undefined:
350
+ arguments.pop()
351
+ if any(argument is Undefined for argument in arguments):
352
+ raise ValueError("split optional arguments cannot contain gaps")
353
+ return _function_expression("split", *arguments)
354
+
355
+ @classmethod
356
+ def substring(
357
+ cls,
358
+ string: IntoExpression,
359
+ start: IntoExpression,
360
+ end: IntoExpression | UndefinedType = Undefined,
361
+ /,
362
+ ) -> Expression:
363
+ """Build a GenomeSpy ``substring`` expression."""
364
+ arguments = [string, start, end]
365
+ while arguments and arguments[-1] is Undefined:
366
+ arguments.pop()
367
+ if any(argument is Undefined for argument in arguments):
368
+ raise ValueError("substring optional arguments cannot contain gaps")
369
+ return _function_expression("substring", *arguments)
370
+
371
+ @classmethod
372
+ def trim(cls, string: IntoExpression, /) -> Expression:
373
+ """Build a GenomeSpy ``trim`` expression."""
374
+ return _function_expression("trim", string)
375
+
376
+ @classmethod
377
+ def btoa(cls, string: IntoExpression, /) -> Expression:
378
+ """Build a GenomeSpy ``btoa`` expression."""
379
+ return _function_expression("btoa", string)
380
+
381
+ @classmethod
382
+ def atob(cls, string: IntoExpression, /) -> Expression:
383
+ """Build a GenomeSpy ``atob`` expression."""
384
+ return _function_expression("atob", string)
385
+
386
+ @classmethod
387
+ def format(cls, value: IntoExpression, specifier: IntoExpression, /) -> Expression:
388
+ """Build a GenomeSpy ``format`` expression."""
389
+ return _function_expression("format", value, specifier)
390
+
391
+ @classmethod
392
+ def regexp(
393
+ cls,
394
+ pattern: IntoExpression,
395
+ flags: IntoExpression | UndefinedType = Undefined,
396
+ /,
397
+ ) -> Expression:
398
+ """Build a GenomeSpy ``regexp`` expression."""
399
+ arguments = [pattern, flags]
400
+ while arguments and arguments[-1] is Undefined:
401
+ arguments.pop()
402
+ if any(argument is Undefined for argument in arguments):
403
+ raise ValueError("regexp optional arguments cannot contain gaps")
404
+ return _function_expression("regexp", *arguments)
405
+
406
+ @classmethod
407
+ def test(
408
+ cls,
409
+ regexp: IntoExpression,
410
+ string: IntoExpression | UndefinedType = Undefined,
411
+ /,
412
+ ) -> Expression:
413
+ """Build a GenomeSpy ``test`` expression."""
414
+ arguments = [regexp, string]
415
+ while arguments and arguments[-1] is Undefined:
416
+ arguments.pop()
417
+ if any(argument is Undefined for argument in arguments):
418
+ raise ValueError("test optional arguments cannot contain gaps")
419
+ return _function_expression("test", *arguments)
420
+
421
+ @classmethod
422
+ def scale(cls, channel: IntoExpression, value: IntoExpression, /) -> Expression:
423
+ """Build a GenomeSpy ``scale`` expression."""
424
+ return _function_expression("scale", channel, value)
425
+
426
+ @classmethod
427
+ def invert(cls, channel: IntoExpression, range: IntoExpression, /) -> Expression:
428
+ """Build a GenomeSpy ``invert`` expression."""
429
+ return _function_expression("invert", channel, range)
430
+
431
+ @classmethod
432
+ def domain(cls, channel: IntoExpression, /) -> Expression:
433
+ """Build a GenomeSpy ``domain`` expression."""
434
+ return _function_expression("domain", channel)
435
+
436
+ @classmethod
437
+ def range(cls, channel: IntoExpression, /) -> Expression:
438
+ """Build a GenomeSpy ``range`` expression."""
439
+ return _function_expression("range", channel)
440
+
441
+ @classmethod
442
+ def bandwidth(cls, channel: IntoExpression, /) -> Expression:
443
+ """Build a GenomeSpy ``bandwidth`` expression."""
444
+ return _function_expression("bandwidth", channel)
445
+
446
+ @classmethod
447
+ def mapHasKey(cls, map: IntoExpression, key: IntoExpression, /) -> Expression:
448
+ """Build a GenomeSpy ``mapHasKey`` expression."""
449
+ return _function_expression("mapHasKey", map, key)
450
+
451
+ @classmethod
452
+ def lerp(cls, array: IntoExpression, fraction: IntoExpression, /) -> Expression:
453
+ """Build a GenomeSpy ``lerp`` expression."""
454
+ return _function_expression("lerp", array, fraction)
455
+
456
+ @classmethod
457
+ def linearstep(
458
+ cls, edge0: IntoExpression, edge1: IntoExpression, x: IntoExpression, /
459
+ ) -> Expression:
460
+ """Build a GenomeSpy ``linearstep`` expression."""
461
+ return _function_expression("linearstep", edge0, edge1, x)
462
+
463
+ @classmethod
464
+ def smoothstep(
465
+ cls, edge0: IntoExpression, edge1: IntoExpression, x: IntoExpression, /
466
+ ) -> Expression:
467
+ """Build a GenomeSpy ``smoothstep`` expression."""
468
+ return _function_expression("smoothstep", edge0, edge1, x)
469
+
470
+ @classmethod
471
+ def center(cls, array: IntoExpression, /) -> Expression:
472
+ """Build a GenomeSpy ``center`` expression."""
473
+ return _function_expression("center", array)
474
+
475
+
476
+ __all__ = ["Expression", "expr"]