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.
- genome_spy/__init__.py +199 -0
- genome_spy/_chart_authoring.py +231 -0
- genome_spy/_conditions.py +72 -0
- genome_spy/_embed.py +87 -0
- genome_spy/_expressions.py +271 -0
- genome_spy/_parameters.py +267 -0
- genome_spy/_render.py +207 -0
- genome_spy/_utils.py +75 -0
- genome_spy/_widget.py +262 -0
- genome_spy/api.py +198 -0
- genome_spy/arrow.py +155 -0
- genome_spy/channels.py +193 -0
- genome_spy/chart.py +1240 -0
- genome_spy/data.py +56 -0
- genome_spy/data_transformers.py +267 -0
- genome_spy/datasets/__init__.py +189 -0
- genome_spy/datasets/_airway.py +219 -0
- genome_spy/datasets/_annotations.py +37 -0
- genome_spy/datasets/_gistic.py +43 -0
- genome_spy/datasets/_grammar.py +66 -0
- genome_spy/datasets/_hapmap.py +180 -0
- genome_spy/datasets/_mutation.py +289 -0
- genome_spy/datasets/_oncoprint.py +523 -0
- genome_spy/datasets/data/airway_metadata.csv +9 -0
- genome_spy/datasets/data/airway_scaledcounts.csv +38695 -0
- genome_spy/datasets/data/brca.maf.gz +0 -0
- genome_spy/datasets/data/hapmap_gwas.csv +14413 -0
- genome_spy/datasets/data/mutation_impact_reference.json +27 -0
- genome_spy/datasets/data/oncoprint_dataset3.json +266 -0
- genome_spy/datasets/data/p53_sequence_comparison.json.gz +0 -0
- genome_spy/datasets/data/pik3ca_mutations.json +1 -0
- genome_spy/datasets/data/pik3ca_tcga_brca_lollipop.json +38 -0
- genome_spy/datasets/data/refseq_gene_bodies.csv.gz +0 -0
- genome_spy/datasets/data/tal1_alphagenome_reference.json.gz +0 -0
- genome_spy/datasets/data/tcga.tsv +146 -0
- genome_spy/datasets/data/tcga_laml.maf.gz +0 -0
- genome_spy/datasets/data/tcga_laml_annot.tsv +201 -0
- genome_spy/datasets/data/tcga_laml_combined_oncoplot.json.gz +0 -0
- genome_spy/datasets/data/tcga_ov_gistic_lesions.tsv.gz +0 -0
- genome_spy/datasets/data/tcga_ov_gistic_scores.tsv.gz +0 -0
- genome_spy/helpers.py +185 -0
- genome_spy/jupyter.py +5 -0
- genome_spy/py.typed +0 -0
- genome_spy/schema/__init__.py +784 -0
- genome_spy/schema/_kwds.py +1394 -0
- genome_spy/schema/_typing.py +186 -0
- genome_spy/schema/capabilities.json +593 -0
- genome_spy/schema/channels.py +8943 -0
- genome_spy/schema/composition.py +1064 -0
- genome_spy/schema/core.py +51821 -0
- genome_spy/schema/ergonomics.py +2056 -0
- genome_spy/schema/expressions.py +476 -0
- genome_spy/schema/genome-spy-schema.json +33657 -0
- genome_spy/schema/lazy.py +326 -0
- genome_spy/schema/mixins.py +11684 -0
- genome_spy/schemapi.py +264 -0
- genome_spy/static/widget.js +345 -0
- genome_spy_python-0.1.0.dist-info/METADATA +185 -0
- genome_spy_python-0.1.0.dist-info/RECORD +64 -0
- genome_spy_python-0.1.0.dist-info/WHEEL +4 -0
- genome_spy_python-0.1.0.dist-info/licenses/LICENSE +21 -0
- genome_spy_python-0.1.0.dist-info/licenses/LICENSES/ALTAIR-BSD-3-Clause.txt +27 -0
- genome_spy_python-0.1.0.dist-info/licenses/LICENSES/GALLERY-DATA-MIT.txt +22 -0
- genome_spy_python-0.1.0.dist-info/licenses/THIRD_PARTY_NOTICES.md +42 -0
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Tumor_Sample_Barcode FAB_classification days_to_last_followup Overall_Survival_Status
|
|
2
|
+
TCGA-AB-2802 M4 365 1
|
|
3
|
+
TCGA-AB-2803 M3 792 1
|
|
4
|
+
TCGA-AB-2804 M3 2557 0
|
|
5
|
+
TCGA-AB-2805 M0 577 1
|
|
6
|
+
TCGA-AB-2806 M1 945 1
|
|
7
|
+
TCGA-AB-2807 M1 181 1
|
|
8
|
+
TCGA-AB-2808 M2 2861 0
|
|
9
|
+
TCGA-AB-2809 M3 62 1
|
|
10
|
+
TCGA-AB-2810 M2 31 1
|
|
11
|
+
TCGA-AB-2811 M4 243 1
|
|
12
|
+
TCGA-AB-2812 M2 366 1
|
|
13
|
+
TCGA-AB-2813 M4 31 1
|
|
14
|
+
TCGA-AB-2814 M0 792 1
|
|
15
|
+
TCGA-AB-2815 M4 822 1
|
|
16
|
+
TCGA-AB-2816 M4 245 1
|
|
17
|
+
TCGA-AB-2817 M2 273 1
|
|
18
|
+
TCGA-AB-2818 M2 303 1
|
|
19
|
+
TCGA-AB-2819 M2 2496 0
|
|
20
|
+
TCGA-AB-2820 M0 0 1
|
|
21
|
+
TCGA-AB-2821 M1 822 1
|
|
22
|
+
TCGA-AB-2822 M0 973 1
|
|
23
|
+
TCGA-AB-2823 M3 0 1
|
|
24
|
+
TCGA-AB-2824 M5 30 1
|
|
25
|
+
TCGA-AB-2825 M5 212 1
|
|
26
|
+
TCGA-AB-2826 M4 731 1
|
|
27
|
+
TCGA-AB-2827 M2 273 1
|
|
28
|
+
TCGA-AB-2828 M4 2284 0
|
|
29
|
+
TCGA-AB-2829 M6 273 1
|
|
30
|
+
TCGA-AB-2830 M4 275 1
|
|
31
|
+
TCGA-AB-2831 M0 640 1
|
|
32
|
+
TCGA-AB-2832 M5 365 1
|
|
33
|
+
TCGA-AB-2833 M4 456 1
|
|
34
|
+
TCGA-AB-2834 M4 245 1
|
|
35
|
+
TCGA-AB-2835 M5 1673 0
|
|
36
|
+
TCGA-AB-2836 M4 518 1
|
|
37
|
+
TCGA-AB-2837 M5 0 1
|
|
38
|
+
TCGA-AB-2838 M2 365 1
|
|
39
|
+
TCGA-AB-2839 M2 486 1
|
|
40
|
+
TCGA-AB-2840 M3 28 1
|
|
41
|
+
TCGA-AB-2841 M3 1401 1
|
|
42
|
+
TCGA-AB-2842 M4 0 1
|
|
43
|
+
TCGA-AB-2843 M6 215 1
|
|
44
|
+
TCGA-AB-2844 M2 122 1
|
|
45
|
+
TCGA-AB-2845 M2 304 1
|
|
46
|
+
TCGA-AB-2846 M4 1402 1
|
|
47
|
+
TCGA-AB-2847 M1 608 1
|
|
48
|
+
TCGA-AB-2848 M4 455 1
|
|
49
|
+
TCGA-AB-2849 M0 2220 0
|
|
50
|
+
TCGA-AB-2850 M2 61 1
|
|
51
|
+
TCGA-AB-2851 M5 242 1
|
|
52
|
+
TCGA-AB-2853 M1 89 1
|
|
53
|
+
TCGA-AB-2854 M4 366 1
|
|
54
|
+
TCGA-AB-2855 M1 212 1
|
|
55
|
+
TCGA-AB-2856 M4 150 1
|
|
56
|
+
TCGA-AB-2857 M6 306 1
|
|
57
|
+
TCGA-AB-2858 M2 577 1
|
|
58
|
+
TCGA-AB-2859 M2 304 1
|
|
59
|
+
TCGA-AB-2860 M7 427 1
|
|
60
|
+
TCGA-AB-2861 M5 0 1
|
|
61
|
+
TCGA-AB-2862 M3 1430 0
|
|
62
|
+
TCGA-AB-2863 M1 31 1
|
|
63
|
+
TCGA-AB-2864 M1 577 1
|
|
64
|
+
TCGA-AB-2865 M1 61 1
|
|
65
|
+
TCGA-AB-2866 M1 153 1
|
|
66
|
+
TCGA-AB-2867 M2 184 1
|
|
67
|
+
TCGA-AB-2868 M7 151 1
|
|
68
|
+
TCGA-AB-2869 M2 243 0
|
|
69
|
+
TCGA-AB-2870 M1 153 1
|
|
70
|
+
TCGA-AB-2871 M1 153 0
|
|
71
|
+
TCGA-AB-2872 M3 638 0
|
|
72
|
+
TCGA-AB-2873 M5 273 0
|
|
73
|
+
TCGA-AB-2874 M2 396 0
|
|
74
|
+
TCGA-AB-2875 M2 212 0
|
|
75
|
+
TCGA-AB-2876 M2 1219 0
|
|
76
|
+
TCGA-AB-2877 M1 638 0
|
|
77
|
+
TCGA-AB-2878 M2 365 1
|
|
78
|
+
TCGA-AB-2879 M1 245 0
|
|
79
|
+
TCGA-AB-2880 M1 424 1
|
|
80
|
+
TCGA-AB-2881 M1 393 0
|
|
81
|
+
TCGA-AB-2882 M2 365 1
|
|
82
|
+
TCGA-AB-2883 M5 730 0
|
|
83
|
+
TCGA-AB-2884 M1 731 1
|
|
84
|
+
TCGA-AB-2885 M0 214 1
|
|
85
|
+
TCGA-AB-2886 M2 181 0
|
|
86
|
+
TCGA-AB-2887 M1 -Inf 1
|
|
87
|
+
TCGA-AB-2888 M4 334 0
|
|
88
|
+
TCGA-AB-2889 M4 304 0
|
|
89
|
+
TCGA-AB-2890 M0 0 1
|
|
90
|
+
TCGA-AB-2891 M1 -Inf 1
|
|
91
|
+
TCGA-AB-2892 M4 943 0
|
|
92
|
+
TCGA-AB-2893 M5 212 1
|
|
93
|
+
TCGA-AB-2894 M5 181 1
|
|
94
|
+
TCGA-AB-2895 M1 153 1
|
|
95
|
+
TCGA-AB-2896 M5 214 1
|
|
96
|
+
TCGA-AB-2897 M3 243 0
|
|
97
|
+
TCGA-AB-2898 M1 393 0
|
|
98
|
+
TCGA-AB-2899 M4 671 1
|
|
99
|
+
TCGA-AB-2900 M1 184 1
|
|
100
|
+
TCGA-AB-2901 M2 59 0
|
|
101
|
+
TCGA-AB-2903 M1 0 1
|
|
102
|
+
TCGA-AB-2904 M0 517 1
|
|
103
|
+
TCGA-AB-2905 M3 1611 0
|
|
104
|
+
TCGA-AB-2906 M3 577 0
|
|
105
|
+
TCGA-AB-2907 M0 -Inf 1
|
|
106
|
+
TCGA-AB-2908 M2 31 1
|
|
107
|
+
TCGA-AB-2909 M0 30 0
|
|
108
|
+
TCGA-AB-2910 M5 0 1
|
|
109
|
+
TCGA-AB-2911 M4 1186 0
|
|
110
|
+
TCGA-AB-2912 M4 274 1
|
|
111
|
+
TCGA-AB-2913 M0 1216 0
|
|
112
|
+
TCGA-AB-2914 M2 792 0
|
|
113
|
+
TCGA-AB-2915 M2 0 1
|
|
114
|
+
TCGA-AB-2916 M4 882 0
|
|
115
|
+
TCGA-AB-2917 M0 1216 0
|
|
116
|
+
TCGA-AB-2918 M1 -Inf 1
|
|
117
|
+
TCGA-AB-2919 M1 61 0
|
|
118
|
+
TCGA-AB-2920 M2 366 1
|
|
119
|
+
TCGA-AB-2921 M4 -Inf 1
|
|
120
|
+
TCGA-AB-2922 M0 0 1
|
|
121
|
+
TCGA-AB-2923 M4 31 1
|
|
122
|
+
TCGA-AB-2924 M4 90 0
|
|
123
|
+
TCGA-AB-2925 M5 243 1
|
|
124
|
+
TCGA-AB-2926 M1 457 1
|
|
125
|
+
TCGA-AB-2927 M1 90 1
|
|
126
|
+
TCGA-AB-2928 M1 59 1
|
|
127
|
+
TCGA-AB-2929 M0 123 1
|
|
128
|
+
TCGA-AB-2930 M2 -Inf 1
|
|
129
|
+
TCGA-AB-2931 M2 0 1
|
|
130
|
+
TCGA-AB-2932 M5 0 0
|
|
131
|
+
TCGA-AB-2933 M4 122 1
|
|
132
|
+
TCGA-AB-2934 M1 28 0
|
|
133
|
+
TCGA-AB-2935 M4 61 1
|
|
134
|
+
TCGA-AB-2936 M0 59 0
|
|
135
|
+
TCGA-AB-2937 M1 215 1
|
|
136
|
+
TCGA-AB-2938 M7 304 1
|
|
137
|
+
TCGA-AB-2939 M1 455 0
|
|
138
|
+
TCGA-AB-2940 M2 -Inf 1
|
|
139
|
+
TCGA-AB-2941 NA 0 1
|
|
140
|
+
TCGA-AB-2942 M4 641 0
|
|
141
|
+
TCGA-AB-2943 M1 -Inf 1
|
|
142
|
+
TCGA-AB-2944 M0 -Inf 1
|
|
143
|
+
TCGA-AB-2945 M4 243 1
|
|
144
|
+
TCGA-AB-2946 M2 -Inf 0
|
|
145
|
+
TCGA-AB-2947 M4 31 0
|
|
146
|
+
TCGA-AB-2948 M4 580 1
|
|
147
|
+
TCGA-AB-2949 M0 699 0
|
|
148
|
+
TCGA-AB-2950 M2 306 0
|
|
149
|
+
TCGA-AB-2952 M1 31 1
|
|
150
|
+
TCGA-AB-2954 M4 1492 0
|
|
151
|
+
TCGA-AB-2955 M2 489 1
|
|
152
|
+
TCGA-AB-2956 M5 183 1
|
|
153
|
+
TCGA-AB-2957 M4 609 0
|
|
154
|
+
TCGA-AB-2959 M0 489 1
|
|
155
|
+
TCGA-AB-2963 M1 1642 1
|
|
156
|
+
TCGA-AB-2964 M1 1277 0
|
|
157
|
+
TCGA-AB-2965 M4 335 1
|
|
158
|
+
TCGA-AB-2966 M2 854 1
|
|
159
|
+
TCGA-AB-2967 M4 1035 0
|
|
160
|
+
TCGA-AB-2968 M4 458 1
|
|
161
|
+
TCGA-AB-2969 M5 1127 0
|
|
162
|
+
TCGA-AB-2970 M4 305 1
|
|
163
|
+
TCGA-AB-2971 M4 792 1
|
|
164
|
+
TCGA-AB-2972 M2 30 1
|
|
165
|
+
TCGA-AB-2973 M4 609 1
|
|
166
|
+
TCGA-AB-2974 M5 92 1
|
|
167
|
+
TCGA-AB-2975 M2 -Inf 1
|
|
168
|
+
TCGA-AB-2976 M1 915 1
|
|
169
|
+
TCGA-AB-2977 M2 31 1
|
|
170
|
+
TCGA-AB-2978 M2 699 0
|
|
171
|
+
TCGA-AB-2979 M1 671 0
|
|
172
|
+
TCGA-AB-2980 M3 699 0
|
|
173
|
+
TCGA-AB-2981 M5 487 0
|
|
174
|
+
TCGA-AB-2982 M3 150 0
|
|
175
|
+
TCGA-AB-2983 M0 335 1
|
|
176
|
+
TCGA-AB-2984 M1 1157 0
|
|
177
|
+
TCGA-AB-2985 M5 273 1
|
|
178
|
+
TCGA-AB-2986 M2 212 1
|
|
179
|
+
TCGA-AB-2987 M5 184 1
|
|
180
|
+
TCGA-AB-2988 M1 30 1
|
|
181
|
+
TCGA-AB-2989 M2 365 1
|
|
182
|
+
TCGA-AB-2990 M1 457 0
|
|
183
|
+
TCGA-AB-2991 M3 1826 0
|
|
184
|
+
TCGA-AB-2992 M1 1706 1
|
|
185
|
+
TCGA-AB-2993 M4 761 1
|
|
186
|
+
TCGA-AB-2994 M3 1798 0
|
|
187
|
+
TCGA-AB-2995 M2 1551 0
|
|
188
|
+
TCGA-AB-2996 M2 1581 0
|
|
189
|
+
TCGA-AB-2997 M3 -Inf 1
|
|
190
|
+
TCGA-AB-2998 M3 31 1
|
|
191
|
+
TCGA-AB-2999 M3 1735 0
|
|
192
|
+
TCGA-AB-3000 M2 1249 0
|
|
193
|
+
TCGA-AB-3001 M3 1581 0
|
|
194
|
+
TCGA-AB-3002 M2 1431 1
|
|
195
|
+
TCGA-AB-3005 M5 2100 0
|
|
196
|
+
TCGA-AB-3006 M1 485 1
|
|
197
|
+
TCGA-AB-3007 M3 1581 0
|
|
198
|
+
TCGA-AB-3008 M1 822 1
|
|
199
|
+
TCGA-AB-3009 M4 577 1
|
|
200
|
+
TCGA-AB-3011 M1 1885 0
|
|
201
|
+
TCGA-AB-3012 M3 1887 0
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
genome_spy/helpers.py
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
"""Small ergonomic helpers for common GenomeSpy schema objects.
|
|
2
|
+
|
|
3
|
+
These mirror Altair's pattern of exposing a small handwritten authoring layer
|
|
4
|
+
on top of generated schema wrappers, so docs and examples can avoid repetitive
|
|
5
|
+
raw dictionaries.
|
|
6
|
+
|
|
7
|
+
The module intentionally contains two kinds of helpers:
|
|
8
|
+
|
|
9
|
+
- tiny readability-first constructors such as ``expr(...)`` and ``step(...)``,
|
|
10
|
+
- generated schema-object constructors and the two mapping-shaped helpers
|
|
11
|
+
whose keys are intentionally open-ended.
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
from __future__ import annotations
|
|
15
|
+
|
|
16
|
+
from typing import Any, Unpack, cast, overload
|
|
17
|
+
|
|
18
|
+
from genome_spy._conditions import when
|
|
19
|
+
from genome_spy._parameters import Parameter
|
|
20
|
+
from genome_spy.schema._kwds import AxesKwds, ScalesKwds
|
|
21
|
+
from genome_spy.schema._typing import ParseValue_T
|
|
22
|
+
from genome_spy.schema.core import (
|
|
23
|
+
ConditionalParameterValueDefNumberExprRef,
|
|
24
|
+
ConditionalParameterValueDefStringNullExprRef,
|
|
25
|
+
ExprRef,
|
|
26
|
+
Parse,
|
|
27
|
+
Step,
|
|
28
|
+
)
|
|
29
|
+
from genome_spy.schema.expressions import expr
|
|
30
|
+
from genome_spy.schema.ergonomics import (
|
|
31
|
+
config,
|
|
32
|
+
data_format,
|
|
33
|
+
dynamic_opacity,
|
|
34
|
+
title,
|
|
35
|
+
view,
|
|
36
|
+
view_config,
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
# BEGIN GENERATED INTERACTION IMPORTS
|
|
40
|
+
from genome_spy.schema.ergonomics import (
|
|
41
|
+
binding,
|
|
42
|
+
binding_checkbox,
|
|
43
|
+
binding_radio,
|
|
44
|
+
binding_range,
|
|
45
|
+
binding_select,
|
|
46
|
+
param,
|
|
47
|
+
ruler,
|
|
48
|
+
selection_interval,
|
|
49
|
+
selection_point,
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
# END GENERATED INTERACTION IMPORTS
|
|
53
|
+
from genome_spy.schemapi import Undefined, UndefinedType, normalize_schema_value
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def _normalized_mapping_payload(**kwargs: Any) -> dict[str, Any]:
|
|
57
|
+
"""Return schema-normalized key/value pairs for mapping-style helpers."""
|
|
58
|
+
return {
|
|
59
|
+
key: normalize_schema_value(value, validate=False)
|
|
60
|
+
for key, value in kwargs.items()
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
__all__ = [
|
|
65
|
+
"axes",
|
|
66
|
+
"config",
|
|
67
|
+
"condition",
|
|
68
|
+
"data_format",
|
|
69
|
+
"dynamic_opacity",
|
|
70
|
+
"expr",
|
|
71
|
+
"parse",
|
|
72
|
+
"scales",
|
|
73
|
+
"step",
|
|
74
|
+
"title",
|
|
75
|
+
"view",
|
|
76
|
+
"view_config",
|
|
77
|
+
"when",
|
|
78
|
+
# BEGIN GENERATED INTERACTION EXPORTS
|
|
79
|
+
"binding",
|
|
80
|
+
"binding_checkbox",
|
|
81
|
+
"binding_radio",
|
|
82
|
+
"binding_range",
|
|
83
|
+
"binding_select",
|
|
84
|
+
"param",
|
|
85
|
+
"ruler",
|
|
86
|
+
"selection_interval",
|
|
87
|
+
"selection_point",
|
|
88
|
+
# END GENERATED INTERACTION EXPORTS
|
|
89
|
+
]
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def axes(**kwargs: Unpack[AxesKwds]) -> AxesKwds:
|
|
93
|
+
"""Create top-level shared axis configuration.
|
|
94
|
+
|
|
95
|
+
Args:
|
|
96
|
+
**kwargs: Axis configuration keyed by channel name.
|
|
97
|
+
|
|
98
|
+
Returns:
|
|
99
|
+
A normalized typed axis mapping.
|
|
100
|
+
|
|
101
|
+
Example:
|
|
102
|
+
>>> axes(x=GenomeAxis(orient="top"))
|
|
103
|
+
{'x': {'orient': 'top'}}
|
|
104
|
+
"""
|
|
105
|
+
return cast(AxesKwds, _normalized_mapping_payload(**kwargs))
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
@overload
|
|
109
|
+
def condition(
|
|
110
|
+
param: str | Parameter,
|
|
111
|
+
value: float | ExprRef,
|
|
112
|
+
/,
|
|
113
|
+
*,
|
|
114
|
+
empty: bool | UndefinedType = Undefined,
|
|
115
|
+
) -> ConditionalParameterValueDefNumberExprRef: ...
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
@overload
|
|
119
|
+
def condition(
|
|
120
|
+
param: str | Parameter,
|
|
121
|
+
value: str | None,
|
|
122
|
+
/,
|
|
123
|
+
*,
|
|
124
|
+
empty: bool | UndefinedType = Undefined,
|
|
125
|
+
) -> ConditionalParameterValueDefStringNullExprRef: ...
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
def condition(
|
|
129
|
+
param: str | Parameter,
|
|
130
|
+
value: float | str | None | ExprRef,
|
|
131
|
+
/,
|
|
132
|
+
*,
|
|
133
|
+
empty: bool | UndefinedType = Undefined,
|
|
134
|
+
) -> (
|
|
135
|
+
ConditionalParameterValueDefNumberExprRef
|
|
136
|
+
| ConditionalParameterValueDefStringNullExprRef
|
|
137
|
+
):
|
|
138
|
+
"""Create a parameter predicate for a conditional encoding value.
|
|
139
|
+
|
|
140
|
+
Args:
|
|
141
|
+
param: Name of the parameter to test.
|
|
142
|
+
value: Visual value applied when the parameter predicate matches.
|
|
143
|
+
empty: Whether an empty parameter selection matches.
|
|
144
|
+
|
|
145
|
+
Returns:
|
|
146
|
+
A schema-backed conditional value definition.
|
|
147
|
+
|
|
148
|
+
Example:
|
|
149
|
+
>>> condition("hover", 1, empty=False).to_dict()
|
|
150
|
+
{'empty': False, 'param': 'hover', 'value': 1}
|
|
151
|
+
"""
|
|
152
|
+
if isinstance(param, Parameter):
|
|
153
|
+
if not param.is_selection:
|
|
154
|
+
raise TypeError("condition() requires a selection parameter.")
|
|
155
|
+
parameter_name = param.name
|
|
156
|
+
resolved_empty = param.empty if empty is Undefined else empty
|
|
157
|
+
else:
|
|
158
|
+
parameter_name = param
|
|
159
|
+
resolved_empty = True if empty is Undefined else empty
|
|
160
|
+
if isinstance(value, str) or value is None:
|
|
161
|
+
return ConditionalParameterValueDefStringNullExprRef(
|
|
162
|
+
param=parameter_name, empty=resolved_empty, value=value
|
|
163
|
+
)
|
|
164
|
+
return ConditionalParameterValueDefNumberExprRef(
|
|
165
|
+
param=parameter_name, empty=resolved_empty, value=value
|
|
166
|
+
)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
def step(value: float, /) -> Step:
|
|
170
|
+
"""Create a step-sized dimension wrapper."""
|
|
171
|
+
return Step(step=value)
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
def parse(**kwargs: ParseValue_T) -> Parse:
|
|
175
|
+
"""Create a parse mapping for a data format."""
|
|
176
|
+
return Parse(**kwargs)
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
def scales(**kwargs: Unpack[ScalesKwds]) -> ScalesKwds:
|
|
180
|
+
"""Create top-level shared scale configuration.
|
|
181
|
+
|
|
182
|
+
This remains a small handwritten helper because the schema models shared
|
|
183
|
+
scales as a typed mapping rather than a dedicated wrapper object.
|
|
184
|
+
"""
|
|
185
|
+
return cast(ScalesKwds, _normalized_mapping_payload(**kwargs))
|
genome_spy/jupyter.py
ADDED
genome_spy/py.typed
ADDED
|
File without changes
|