@genspectrum/dashboard-components 1.17.0 → 1.18.0
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.
- package/custom-elements.json +4 -4
- package/dist/components.d.ts +141 -41
- package/dist/components.js +77 -47
- package/dist/components.js.map +1 -1
- package/dist/util.d.ts +209 -49
- package/package.json +1 -1
- package/src/preact/MutationAnnotationsContext.spec.tsx +82 -10
- package/src/preact/MutationAnnotationsContext.tsx +92 -44
- package/src/preact/components/annotated-mutation.stories.tsx +31 -0
- package/src/preact/components/annotated-mutation.tsx +5 -5
- package/src/preact/mutationsOverTime/getFilteredMutationCodes.spec.ts +2 -2
- package/src/preact/mutationsOverTime/getFilteredMutationCodes.ts +5 -5
- package/src/web-components/gs-app.ts +8 -4
- package/src/web-components/mutation-annotations-context.ts +13 -5
- package/src/web-components/mutationAnnotations.mdx +29 -0
- package/standalone-bundle/dashboard-components.js +3151 -3120
- package/standalone-bundle/dashboard-components.js.map +1 -1
package/custom-elements.json
CHANGED
|
@@ -246,10 +246,10 @@
|
|
|
246
246
|
"kind": "field",
|
|
247
247
|
"name": "mutationAnnotations",
|
|
248
248
|
"type": {
|
|
249
|
-
"text": "{\n name: string;\n description: string;\n symbol: string;\n nucleotideMutations?: string[];\n nucleotidePositions?: string[];\n aminoAcidMutations?: string[];\n aminoAcidPositions?: string[];\n }[]"
|
|
249
|
+
"text": "{\n name: string;\n description: string;\n symbol: string;\n nucleotideMutations?: (string | { mutation: string; name?: string; description?: string })[];\n nucleotidePositions?: (string | { position: string; name?: string; description?: string })[];\n aminoAcidMutations?: (string | { mutation: string; name?: string; description?: string })[];\n aminoAcidPositions?: (string | { position: string; name?: string; description?: string })[];\n }[]"
|
|
250
250
|
},
|
|
251
251
|
"default": "[]",
|
|
252
|
-
"description": "Supply lists of mutations that are especially relevant for the current organism.\n\nVisit https://genspectrum.github.io/dashboard-components/?path=/docs/concepts-mutation-annotations--docs for more information.",
|
|
252
|
+
"description": "Supply lists of mutations that are especially relevant for the current organism.\n\nEach entry in `nucleotideMutations`, `aminoAcidMutations`, `nucleotidePositions`, and `aminoAcidPositions`\ncan be either a plain string or an object with an optional `name` and `description` that override the\ngroup-level values in the annotation popup for that specific mutation or position.\n\nVisit https://genspectrum.github.io/dashboard-components/?path=/docs/concepts-mutation-annotations--docs for more information.",
|
|
253
253
|
"attribute": "mutationAnnotations"
|
|
254
254
|
},
|
|
255
255
|
{
|
|
@@ -276,10 +276,10 @@
|
|
|
276
276
|
{
|
|
277
277
|
"name": "mutationAnnotations",
|
|
278
278
|
"type": {
|
|
279
|
-
"text": "{\n name: string;\n description: string;\n symbol: string;\n nucleotideMutations?: string[];\n nucleotidePositions?: string[];\n aminoAcidMutations?: string[];\n aminoAcidPositions?: string[];\n }[]"
|
|
279
|
+
"text": "{\n name: string;\n description: string;\n symbol: string;\n nucleotideMutations?: (string | { mutation: string; name?: string; description?: string })[];\n nucleotidePositions?: (string | { position: string; name?: string; description?: string })[];\n aminoAcidMutations?: (string | { mutation: string; name?: string; description?: string })[];\n aminoAcidPositions?: (string | { position: string; name?: string; description?: string })[];\n }[]"
|
|
280
280
|
},
|
|
281
281
|
"default": "[]",
|
|
282
|
-
"description": "Supply lists of mutations that are especially relevant for the current organism.\n\nVisit https://genspectrum.github.io/dashboard-components/?path=/docs/concepts-mutation-annotations--docs for more information.",
|
|
282
|
+
"description": "Supply lists of mutations that are especially relevant for the current organism.\n\nEach entry in `nucleotideMutations`, `aminoAcidMutations`, `nucleotidePositions`, and `aminoAcidPositions`\ncan be either a plain string or an object with an optional `name` and `description` that override the\ngroup-level values in the annotation popup for that specific mutation or position.\n\nVisit https://genspectrum.github.io/dashboard-components/?path=/docs/concepts-mutation-annotations--docs for more information.",
|
|
283
283
|
"fieldName": "mutationAnnotations"
|
|
284
284
|
},
|
|
285
285
|
{
|
package/dist/components.d.ts
CHANGED
|
@@ -118,16 +118,36 @@ export declare class AppComponent extends LitElement {
|
|
|
118
118
|
/**
|
|
119
119
|
* Supply lists of mutations that are especially relevant for the current organism.
|
|
120
120
|
*
|
|
121
|
+
* Each entry in `nucleotideMutations`, `aminoAcidMutations`, `nucleotidePositions`, and `aminoAcidPositions`
|
|
122
|
+
* can be either a plain string or an object with an optional `name` and `description` that override the
|
|
123
|
+
* group-level values in the annotation popup for that specific mutation or position.
|
|
124
|
+
*
|
|
121
125
|
* Visit https://genspectrum.github.io/dashboard-components/?path=/docs/concepts-mutation-annotations--docs for more information.
|
|
122
126
|
*/
|
|
123
127
|
mutationAnnotations: {
|
|
124
128
|
name: string;
|
|
125
129
|
description: string;
|
|
126
130
|
symbol: string;
|
|
127
|
-
nucleotideMutations?: string
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
+
nucleotideMutations?: (string | {
|
|
132
|
+
mutation: string;
|
|
133
|
+
name?: string;
|
|
134
|
+
description?: string;
|
|
135
|
+
})[];
|
|
136
|
+
nucleotidePositions?: (string | {
|
|
137
|
+
position: string;
|
|
138
|
+
name?: string;
|
|
139
|
+
description?: string;
|
|
140
|
+
})[];
|
|
141
|
+
aminoAcidMutations?: (string | {
|
|
142
|
+
mutation: string;
|
|
143
|
+
name?: string;
|
|
144
|
+
description?: string;
|
|
145
|
+
})[];
|
|
146
|
+
aminoAcidPositions?: (string | {
|
|
147
|
+
position: string;
|
|
148
|
+
name?: string;
|
|
149
|
+
description?: string;
|
|
150
|
+
})[];
|
|
131
151
|
}[];
|
|
132
152
|
/**
|
|
133
153
|
* Supply a link template for nucleotide and amino acid mutations.
|
|
@@ -428,26 +448,106 @@ declare const mutationAnnotationsSchema: default_2.ZodArray<default_2.ZodObject<
|
|
|
428
448
|
name: default_2.ZodString;
|
|
429
449
|
description: default_2.ZodString;
|
|
430
450
|
symbol: default_2.ZodString;
|
|
431
|
-
nucleotideMutations: default_2.ZodOptional<default_2.ZodArray<default_2.ZodString,
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
451
|
+
nucleotideMutations: default_2.ZodOptional<default_2.ZodArray<default_2.ZodUnion<[default_2.ZodString, default_2.ZodObject<{
|
|
452
|
+
mutation: default_2.ZodString;
|
|
453
|
+
name: default_2.ZodOptional<default_2.ZodString>;
|
|
454
|
+
description: default_2.ZodOptional<default_2.ZodString>;
|
|
455
|
+
}, "strip", default_2.ZodTypeAny, {
|
|
456
|
+
mutation: string;
|
|
457
|
+
name?: string | undefined;
|
|
458
|
+
description?: string | undefined;
|
|
459
|
+
}, {
|
|
460
|
+
mutation: string;
|
|
461
|
+
name?: string | undefined;
|
|
462
|
+
description?: string | undefined;
|
|
463
|
+
}>]>, "many">>;
|
|
464
|
+
nucleotidePositions: default_2.ZodOptional<default_2.ZodArray<default_2.ZodUnion<[default_2.ZodString, default_2.ZodObject<{
|
|
465
|
+
position: default_2.ZodString;
|
|
466
|
+
name: default_2.ZodOptional<default_2.ZodString>;
|
|
467
|
+
description: default_2.ZodOptional<default_2.ZodString>;
|
|
468
|
+
}, "strip", default_2.ZodTypeAny, {
|
|
469
|
+
position: string;
|
|
470
|
+
name?: string | undefined;
|
|
471
|
+
description?: string | undefined;
|
|
472
|
+
}, {
|
|
473
|
+
position: string;
|
|
474
|
+
name?: string | undefined;
|
|
475
|
+
description?: string | undefined;
|
|
476
|
+
}>]>, "many">>;
|
|
477
|
+
aminoAcidMutations: default_2.ZodOptional<default_2.ZodArray<default_2.ZodUnion<[default_2.ZodString, default_2.ZodObject<{
|
|
478
|
+
mutation: default_2.ZodString;
|
|
479
|
+
name: default_2.ZodOptional<default_2.ZodString>;
|
|
480
|
+
description: default_2.ZodOptional<default_2.ZodString>;
|
|
481
|
+
}, "strip", default_2.ZodTypeAny, {
|
|
482
|
+
mutation: string;
|
|
483
|
+
name?: string | undefined;
|
|
484
|
+
description?: string | undefined;
|
|
485
|
+
}, {
|
|
486
|
+
mutation: string;
|
|
487
|
+
name?: string | undefined;
|
|
488
|
+
description?: string | undefined;
|
|
489
|
+
}>]>, "many">>;
|
|
490
|
+
aminoAcidPositions: default_2.ZodOptional<default_2.ZodArray<default_2.ZodUnion<[default_2.ZodString, default_2.ZodObject<{
|
|
491
|
+
position: default_2.ZodString;
|
|
492
|
+
name: default_2.ZodOptional<default_2.ZodString>;
|
|
493
|
+
description: default_2.ZodOptional<default_2.ZodString>;
|
|
494
|
+
}, "strip", default_2.ZodTypeAny, {
|
|
495
|
+
position: string;
|
|
496
|
+
name?: string | undefined;
|
|
497
|
+
description?: string | undefined;
|
|
498
|
+
}, {
|
|
499
|
+
position: string;
|
|
500
|
+
name?: string | undefined;
|
|
501
|
+
description?: string | undefined;
|
|
502
|
+
}>]>, "many">>;
|
|
435
503
|
}, "strip", default_2.ZodTypeAny, {
|
|
436
504
|
symbol: string;
|
|
437
505
|
name: string;
|
|
438
506
|
description: string;
|
|
439
|
-
nucleotideMutations?: string
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
507
|
+
nucleotideMutations?: (string | {
|
|
508
|
+
mutation: string;
|
|
509
|
+
name?: string | undefined;
|
|
510
|
+
description?: string | undefined;
|
|
511
|
+
})[] | undefined;
|
|
512
|
+
nucleotidePositions?: (string | {
|
|
513
|
+
position: string;
|
|
514
|
+
name?: string | undefined;
|
|
515
|
+
description?: string | undefined;
|
|
516
|
+
})[] | undefined;
|
|
517
|
+
aminoAcidMutations?: (string | {
|
|
518
|
+
mutation: string;
|
|
519
|
+
name?: string | undefined;
|
|
520
|
+
description?: string | undefined;
|
|
521
|
+
})[] | undefined;
|
|
522
|
+
aminoAcidPositions?: (string | {
|
|
523
|
+
position: string;
|
|
524
|
+
name?: string | undefined;
|
|
525
|
+
description?: string | undefined;
|
|
526
|
+
})[] | undefined;
|
|
443
527
|
}, {
|
|
444
528
|
symbol: string;
|
|
445
529
|
name: string;
|
|
446
530
|
description: string;
|
|
447
|
-
nucleotideMutations?: string
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
531
|
+
nucleotideMutations?: (string | {
|
|
532
|
+
mutation: string;
|
|
533
|
+
name?: string | undefined;
|
|
534
|
+
description?: string | undefined;
|
|
535
|
+
})[] | undefined;
|
|
536
|
+
nucleotidePositions?: (string | {
|
|
537
|
+
position: string;
|
|
538
|
+
name?: string | undefined;
|
|
539
|
+
description?: string | undefined;
|
|
540
|
+
})[] | undefined;
|
|
541
|
+
aminoAcidMutations?: (string | {
|
|
542
|
+
mutation: string;
|
|
543
|
+
name?: string | undefined;
|
|
544
|
+
description?: string | undefined;
|
|
545
|
+
})[] | undefined;
|
|
546
|
+
aminoAcidPositions?: (string | {
|
|
547
|
+
position: string;
|
|
548
|
+
name?: string | undefined;
|
|
549
|
+
description?: string | undefined;
|
|
550
|
+
})[] | undefined;
|
|
451
551
|
}>, "many">;
|
|
452
552
|
|
|
453
553
|
/**
|
|
@@ -1920,7 +2020,7 @@ declare global {
|
|
|
1920
2020
|
|
|
1921
2021
|
declare global {
|
|
1922
2022
|
interface HTMLElementTagNameMap {
|
|
1923
|
-
'gs-
|
|
2023
|
+
'gs-sequences-by-location': SequencesByLocationComponent;
|
|
1924
2024
|
}
|
|
1925
2025
|
}
|
|
1926
2026
|
|
|
@@ -1928,7 +2028,7 @@ declare global {
|
|
|
1928
2028
|
declare global {
|
|
1929
2029
|
namespace React.JSX {
|
|
1930
2030
|
interface IntrinsicElements {
|
|
1931
|
-
'gs-
|
|
2031
|
+
'gs-sequences-by-location': SequencesByLocationComponent;
|
|
1932
2032
|
}
|
|
1933
2033
|
}
|
|
1934
2034
|
}
|
|
@@ -1936,7 +2036,7 @@ declare global {
|
|
|
1936
2036
|
|
|
1937
2037
|
declare global {
|
|
1938
2038
|
interface HTMLElementTagNameMap {
|
|
1939
|
-
'gs-
|
|
2039
|
+
'gs-statistics': StatisticsComponent;
|
|
1940
2040
|
}
|
|
1941
2041
|
}
|
|
1942
2042
|
|
|
@@ -1944,7 +2044,7 @@ declare global {
|
|
|
1944
2044
|
declare global {
|
|
1945
2045
|
namespace React.JSX {
|
|
1946
2046
|
interface IntrinsicElements {
|
|
1947
|
-
'gs-
|
|
2047
|
+
'gs-statistics': StatisticsComponent;
|
|
1948
2048
|
}
|
|
1949
2049
|
}
|
|
1950
2050
|
}
|
|
@@ -1952,7 +2052,10 @@ declare global {
|
|
|
1952
2052
|
|
|
1953
2053
|
declare global {
|
|
1954
2054
|
interface HTMLElementTagNameMap {
|
|
1955
|
-
'gs-
|
|
2055
|
+
'gs-location-filter': LocationFilterComponent;
|
|
2056
|
+
}
|
|
2057
|
+
interface HTMLElementEventMap {
|
|
2058
|
+
[gsEventNames.locationChanged]: LocationChangedEvent;
|
|
1956
2059
|
}
|
|
1957
2060
|
}
|
|
1958
2061
|
|
|
@@ -1960,7 +2063,7 @@ declare global {
|
|
|
1960
2063
|
declare global {
|
|
1961
2064
|
namespace React.JSX {
|
|
1962
2065
|
interface IntrinsicElements {
|
|
1963
|
-
'gs-
|
|
2066
|
+
'gs-location-filter': LocationFilterComponent;
|
|
1964
2067
|
}
|
|
1965
2068
|
}
|
|
1966
2069
|
}
|
|
@@ -1968,11 +2071,10 @@ declare global {
|
|
|
1968
2071
|
|
|
1969
2072
|
declare global {
|
|
1970
2073
|
interface HTMLElementTagNameMap {
|
|
1971
|
-
'gs-
|
|
2074
|
+
'gs-text-filter': TextFilterComponent;
|
|
1972
2075
|
}
|
|
1973
2076
|
interface HTMLElementEventMap {
|
|
1974
|
-
[gsEventNames.
|
|
1975
|
-
[gsEventNames.dateRangeOptionChanged]: DateRangeOptionChangedEvent;
|
|
2077
|
+
[gsEventNames.textFilterChanged]: TextFilterChangedEvent;
|
|
1976
2078
|
}
|
|
1977
2079
|
}
|
|
1978
2080
|
|
|
@@ -1980,7 +2082,7 @@ declare global {
|
|
|
1980
2082
|
declare global {
|
|
1981
2083
|
namespace React.JSX {
|
|
1982
2084
|
interface IntrinsicElements {
|
|
1983
|
-
'gs-
|
|
2085
|
+
'gs-text-filter': TextFilterComponent;
|
|
1984
2086
|
}
|
|
1985
2087
|
}
|
|
1986
2088
|
}
|
|
@@ -1988,10 +2090,11 @@ declare global {
|
|
|
1988
2090
|
|
|
1989
2091
|
declare global {
|
|
1990
2092
|
interface HTMLElementTagNameMap {
|
|
1991
|
-
'gs-
|
|
2093
|
+
'gs-date-range-filter': DateRangeFilterComponent;
|
|
1992
2094
|
}
|
|
1993
2095
|
interface HTMLElementEventMap {
|
|
1994
|
-
[gsEventNames.
|
|
2096
|
+
[gsEventNames.dateRangeFilterChanged]: CustomEvent<Record<string, string>>;
|
|
2097
|
+
[gsEventNames.dateRangeOptionChanged]: DateRangeOptionChangedEvent;
|
|
1995
2098
|
}
|
|
1996
2099
|
}
|
|
1997
2100
|
|
|
@@ -1999,7 +2102,7 @@ declare global {
|
|
|
1999
2102
|
declare global {
|
|
2000
2103
|
namespace React.JSX {
|
|
2001
2104
|
interface IntrinsicElements {
|
|
2002
|
-
'gs-
|
|
2105
|
+
'gs-date-range-filter': DateRangeFilterComponent;
|
|
2003
2106
|
}
|
|
2004
2107
|
}
|
|
2005
2108
|
}
|
|
@@ -2007,10 +2110,10 @@ declare global {
|
|
|
2007
2110
|
|
|
2008
2111
|
declare global {
|
|
2009
2112
|
interface HTMLElementTagNameMap {
|
|
2010
|
-
'gs-
|
|
2113
|
+
'gs-mutation-filter': MutationFilterComponent;
|
|
2011
2114
|
}
|
|
2012
2115
|
interface HTMLElementEventMap {
|
|
2013
|
-
[gsEventNames.
|
|
2116
|
+
[gsEventNames.mutationFilterChanged]: CustomEvent<MutationsFilter>;
|
|
2014
2117
|
}
|
|
2015
2118
|
}
|
|
2016
2119
|
|
|
@@ -2018,7 +2121,7 @@ declare global {
|
|
|
2018
2121
|
declare global {
|
|
2019
2122
|
namespace React.JSX {
|
|
2020
2123
|
interface IntrinsicElements {
|
|
2021
|
-
'gs-
|
|
2124
|
+
'gs-mutation-filter': MutationFilterComponent;
|
|
2022
2125
|
}
|
|
2023
2126
|
}
|
|
2024
2127
|
}
|
|
@@ -2026,10 +2129,11 @@ declare global {
|
|
|
2026
2129
|
|
|
2027
2130
|
declare global {
|
|
2028
2131
|
interface HTMLElementTagNameMap {
|
|
2029
|
-
'gs-
|
|
2132
|
+
'gs-number-range-filter': NumberRangeFilterComponent;
|
|
2030
2133
|
}
|
|
2031
2134
|
interface HTMLElementEventMap {
|
|
2032
|
-
[gsEventNames.
|
|
2135
|
+
[gsEventNames.numberRangeFilterChanged]: NumberRangeFilterChangedEvent;
|
|
2136
|
+
[gsEventNames.numberRangeValueChanged]: NumberRangeValueChangedEvent;
|
|
2033
2137
|
}
|
|
2034
2138
|
}
|
|
2035
2139
|
|
|
@@ -2037,7 +2141,7 @@ declare global {
|
|
|
2037
2141
|
declare global {
|
|
2038
2142
|
namespace React.JSX {
|
|
2039
2143
|
interface IntrinsicElements {
|
|
2040
|
-
'gs-
|
|
2144
|
+
'gs-number-range-filter': NumberRangeFilterComponent;
|
|
2041
2145
|
}
|
|
2042
2146
|
}
|
|
2043
2147
|
}
|
|
@@ -2065,11 +2169,7 @@ declare global {
|
|
|
2065
2169
|
|
|
2066
2170
|
declare global {
|
|
2067
2171
|
interface HTMLElementTagNameMap {
|
|
2068
|
-
'gs-
|
|
2069
|
-
}
|
|
2070
|
-
interface HTMLElementEventMap {
|
|
2071
|
-
[gsEventNames.numberRangeFilterChanged]: NumberRangeFilterChangedEvent;
|
|
2072
|
-
[gsEventNames.numberRangeValueChanged]: NumberRangeValueChangedEvent;
|
|
2172
|
+
'gs-wastewater-mutations-over-time': WastewaterMutationsOverTimeComponent;
|
|
2073
2173
|
}
|
|
2074
2174
|
}
|
|
2075
2175
|
|
|
@@ -2077,7 +2177,7 @@ declare global {
|
|
|
2077
2177
|
declare global {
|
|
2078
2178
|
namespace React.JSX {
|
|
2079
2179
|
interface IntrinsicElements {
|
|
2080
|
-
'gs-
|
|
2180
|
+
'gs-wastewater-mutations-over-time': WastewaterMutationsOverTimeComponent;
|
|
2081
2181
|
}
|
|
2082
2182
|
}
|
|
2083
2183
|
}
|
package/dist/components.js
CHANGED
|
@@ -332,15 +332,22 @@ function n$1(t2) {
|
|
|
332
332
|
})(t2, e2, o2);
|
|
333
333
|
}
|
|
334
334
|
const lapisContext = createContext("lapis-context");
|
|
335
|
-
const
|
|
335
|
+
const mutationEntrySchema = z$2.union([
|
|
336
|
+
z$2.string(),
|
|
337
|
+
z$2.object({ mutation: z$2.string(), name: z$2.string().optional(), description: z$2.string().optional() })
|
|
338
|
+
]);
|
|
339
|
+
const positionEntrySchema = z$2.union([
|
|
340
|
+
z$2.string(),
|
|
341
|
+
z$2.object({ position: z$2.string(), name: z$2.string().optional(), description: z$2.string().optional() })
|
|
342
|
+
]);
|
|
336
343
|
const mutationAnnotationSchema = z$2.object({
|
|
337
344
|
name: z$2.string(),
|
|
338
345
|
description: z$2.string(),
|
|
339
346
|
symbol: z$2.string(),
|
|
340
|
-
nucleotideMutations:
|
|
341
|
-
nucleotidePositions:
|
|
342
|
-
aminoAcidMutations:
|
|
343
|
-
aminoAcidPositions:
|
|
347
|
+
nucleotideMutations: z$2.array(mutationEntrySchema).optional(),
|
|
348
|
+
nucleotidePositions: z$2.array(positionEntrySchema).optional(),
|
|
349
|
+
aminoAcidMutations: z$2.array(mutationEntrySchema).optional(),
|
|
350
|
+
aminoAcidPositions: z$2.array(positionEntrySchema).optional()
|
|
344
351
|
});
|
|
345
352
|
const mutationAnnotationsSchema = z$2.array(mutationAnnotationSchema, {
|
|
346
353
|
errorMap: () => ({ message: "invalid mutation annotations" })
|
|
@@ -2152,46 +2159,69 @@ const MutationAnnotationsContext = createContext$1({
|
|
|
2152
2159
|
}
|
|
2153
2160
|
});
|
|
2154
2161
|
const MutationAnnotationsContextProvider = ({ value, children }) => {
|
|
2155
|
-
const parseResult = T$1(() =>
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
if (!parseResult.success) {
|
|
2163
|
-
return /* @__PURE__ */ u$1(ResizeContainer, { size: { width: "100%" }, children: /* @__PURE__ */ u$1(ErrorDisplay, { error: parseResult.error, layout: "vertical" }) });
|
|
2162
|
+
const parseResult = T$1(() => mutationAnnotationsSchema.safeParse(value), [value]);
|
|
2163
|
+
const contextValue = T$1(
|
|
2164
|
+
() => parseResult.success ? { success: true, value: buildAnnotationIndex(parseResult.data) } : { success: false, error: parseResult.error },
|
|
2165
|
+
[parseResult]
|
|
2166
|
+
);
|
|
2167
|
+
if (!contextValue.success) {
|
|
2168
|
+
return /* @__PURE__ */ u$1(ResizeContainer, { size: { width: "100%" }, children: /* @__PURE__ */ u$1(ErrorDisplay, { error: contextValue.error, layout: "vertical" }) });
|
|
2164
2169
|
}
|
|
2165
|
-
return /* @__PURE__ */ u$1(MutationAnnotationsContext.Provider, { value:
|
|
2170
|
+
return /* @__PURE__ */ u$1(MutationAnnotationsContext.Provider, { value: contextValue.value, children });
|
|
2166
2171
|
};
|
|
2167
|
-
function
|
|
2168
|
-
const
|
|
2169
|
-
const
|
|
2170
|
-
const
|
|
2171
|
-
const
|
|
2172
|
+
function buildAnnotationIndex(value) {
|
|
2173
|
+
const nucleotideMutationMap = /* @__PURE__ */ new Map();
|
|
2174
|
+
const nucleotidePositionMap = /* @__PURE__ */ new Map();
|
|
2175
|
+
const aminoAcidMutationMap = /* @__PURE__ */ new Map();
|
|
2176
|
+
const aminoAcidPositionMap = /* @__PURE__ */ new Map();
|
|
2172
2177
|
value.forEach((annotation) => {
|
|
2173
|
-
|
|
2174
|
-
|
|
2178
|
+
var _a, _b, _c, _d;
|
|
2179
|
+
(_a = annotation.nucleotideMutations) == null ? void 0 : _a.forEach((entry) => {
|
|
2180
|
+
addToMap(
|
|
2181
|
+
nucleotideMutationMap,
|
|
2182
|
+
typeof entry === "string" ? entry : entry.mutation,
|
|
2183
|
+
resolve(annotation, entry)
|
|
2184
|
+
);
|
|
2175
2185
|
});
|
|
2176
|
-
|
|
2177
|
-
|
|
2186
|
+
(_b = annotation.aminoAcidMutations) == null ? void 0 : _b.forEach((entry) => {
|
|
2187
|
+
addToMap(
|
|
2188
|
+
aminoAcidMutationMap,
|
|
2189
|
+
typeof entry === "string" ? entry : entry.mutation,
|
|
2190
|
+
resolve(annotation, entry)
|
|
2191
|
+
);
|
|
2178
2192
|
});
|
|
2179
|
-
|
|
2180
|
-
|
|
2193
|
+
(_c = annotation.nucleotidePositions) == null ? void 0 : _c.forEach((entry) => {
|
|
2194
|
+
addToMap(
|
|
2195
|
+
nucleotidePositionMap,
|
|
2196
|
+
typeof entry === "string" ? entry : entry.position,
|
|
2197
|
+
resolve(annotation, entry)
|
|
2198
|
+
);
|
|
2181
2199
|
});
|
|
2182
|
-
|
|
2183
|
-
|
|
2200
|
+
(_d = annotation.aminoAcidPositions) == null ? void 0 : _d.forEach((entry) => {
|
|
2201
|
+
addToMap(
|
|
2202
|
+
aminoAcidPositionMap,
|
|
2203
|
+
typeof entry === "string" ? entry : entry.position,
|
|
2204
|
+
resolve(annotation, entry)
|
|
2205
|
+
);
|
|
2184
2206
|
});
|
|
2185
2207
|
});
|
|
2186
2208
|
return {
|
|
2187
2209
|
rawAnnotations: value,
|
|
2188
|
-
nucleotide: { mutation:
|
|
2189
|
-
"amino acid": { mutation:
|
|
2210
|
+
nucleotide: { mutation: nucleotideMutationMap, position: nucleotidePositionMap },
|
|
2211
|
+
"amino acid": { mutation: aminoAcidMutationMap, position: aminoAcidPositionMap }
|
|
2212
|
+
};
|
|
2213
|
+
}
|
|
2214
|
+
function resolve(annotation, entry) {
|
|
2215
|
+
const overrides = typeof entry === "object" ? entry : void 0;
|
|
2216
|
+
return {
|
|
2217
|
+
annotation,
|
|
2218
|
+
name: (overrides == null ? void 0 : overrides.name) ?? annotation.name,
|
|
2219
|
+
description: (overrides == null ? void 0 : overrides.description) ?? annotation.description
|
|
2190
2220
|
};
|
|
2191
2221
|
}
|
|
2192
|
-
function
|
|
2193
|
-
const
|
|
2194
|
-
map2.set(code.toUpperCase(), [...
|
|
2222
|
+
function addToMap(map2, code, resolved) {
|
|
2223
|
+
const existing = map2.get(code.toUpperCase()) ?? [];
|
|
2224
|
+
map2.set(code.toUpperCase(), [...existing, resolved]);
|
|
2195
2225
|
}
|
|
2196
2226
|
function useRawMutationAnnotations() {
|
|
2197
2227
|
return x$1(MutationAnnotationsContext).rawAnnotations;
|
|
@@ -2203,15 +2233,15 @@ function useMutationAnnotationsProvider() {
|
|
|
2203
2233
|
function getMutationAnnotationsProvider(mutationAnnotations) {
|
|
2204
2234
|
return (mutation, sequenceType) => {
|
|
2205
2235
|
const position = mutation.segment === void 0 ? `${mutation.position}` : `${mutation.segment.toUpperCase()}:${mutation.position}`;
|
|
2206
|
-
const
|
|
2207
|
-
const
|
|
2208
|
-
const
|
|
2209
|
-
const
|
|
2210
|
-
return
|
|
2211
|
-
if (
|
|
2236
|
+
const exactMatches = mutationAnnotations[sequenceType].mutation.get(mutation.code.toUpperCase());
|
|
2237
|
+
const positionMatches = mutationAnnotations[sequenceType].position.get(position);
|
|
2238
|
+
const combined = exactMatches && positionMatches ? [...exactMatches, ...positionMatches] : exactMatches ?? positionMatches;
|
|
2239
|
+
const seenNames = /* @__PURE__ */ new Set();
|
|
2240
|
+
return combined == null ? void 0 : combined.filter((resolved) => {
|
|
2241
|
+
if (seenNames.has(resolved.annotation.name)) {
|
|
2212
2242
|
return false;
|
|
2213
2243
|
}
|
|
2214
|
-
|
|
2244
|
+
seenNames.add(resolved.annotation.name);
|
|
2215
2245
|
return true;
|
|
2216
2246
|
});
|
|
2217
2247
|
};
|
|
@@ -2339,10 +2369,10 @@ const AnnotatedMutationWithoutContext = ({
|
|
|
2339
2369
|
"Annotations for ",
|
|
2340
2370
|
mutation.code
|
|
2341
2371
|
] }),
|
|
2342
|
-
mutationAnnotations.map((
|
|
2343
|
-
/* @__PURE__ */ u$1(InfoHeadline2, { children:
|
|
2344
|
-
/* @__PURE__ */ u$1(InfoParagraph, { children: /* @__PURE__ */ u$1("div", { dangerouslySetInnerHTML: { __html: DOMPurify.sanitize(
|
|
2345
|
-
] }, annotation.name))
|
|
2372
|
+
mutationAnnotations.map((resolved) => /* @__PURE__ */ u$1(Fragment, { children: [
|
|
2373
|
+
/* @__PURE__ */ u$1(InfoHeadline2, { children: resolved.name }),
|
|
2374
|
+
/* @__PURE__ */ u$1(InfoParagraph, { children: /* @__PURE__ */ u$1("div", { dangerouslySetInnerHTML: { __html: DOMPurify.sanitize(resolved.description) } }) })
|
|
2375
|
+
] }, resolved.annotation.name))
|
|
2346
2376
|
] });
|
|
2347
2377
|
return /* @__PURE__ */ u$1(Fragment, { children: [
|
|
2348
2378
|
innerLabel,
|
|
@@ -2352,7 +2382,7 @@ const AnnotatedMutationWithoutContext = ({
|
|
|
2352
2382
|
buttonClassName: "select-text cursor-pointer",
|
|
2353
2383
|
modalContent,
|
|
2354
2384
|
modalRef,
|
|
2355
|
-
children: /* @__PURE__ */ u$1("sup", { className: "hover:underline focus-visible:underline decoration-red-600", children: mutationAnnotations.map((
|
|
2385
|
+
children: /* @__PURE__ */ u$1("sup", { className: "hover:underline focus-visible:underline decoration-red-600", children: mutationAnnotations.map((resolved) => resolved.annotation.symbol).map((symbol, index) => /* @__PURE__ */ u$1(Fragment, { children: [
|
|
2356
2386
|
/* @__PURE__ */ u$1("span", { className: "text-red-600", children: symbol }),
|
|
2357
2387
|
index !== mutationAnnotations.length - 1 && ","
|
|
2358
2388
|
] }, symbol)) })
|
|
@@ -7289,7 +7319,7 @@ function mutationOrAnnotationMatchesTextFilter(mutation, sequenceType, textFilte
|
|
|
7289
7319
|
return false;
|
|
7290
7320
|
}
|
|
7291
7321
|
return mutationAnnotations.some(
|
|
7292
|
-
(
|
|
7322
|
+
(resolved) => resolved.annotation.description.includes(textFilter) || resolved.annotation.name.includes(textFilter) || resolved.annotation.symbol.includes(textFilter)
|
|
7293
7323
|
);
|
|
7294
7324
|
}
|
|
7295
7325
|
function mutationMatchesAnnotationFilter(mutation, sequenceType, annotationNameFilter, annotationProvider) {
|
|
@@ -7300,7 +7330,7 @@ function mutationMatchesAnnotationFilter(mutation, sequenceType, annotationNameF
|
|
|
7300
7330
|
if (mutationAnnotations === void 0 || mutationAnnotations.length === 0) {
|
|
7301
7331
|
return false;
|
|
7302
7332
|
}
|
|
7303
|
-
return mutationAnnotations.some((
|
|
7333
|
+
return mutationAnnotations.some((resolved) => annotationNameFilter.has(resolved.annotation.name));
|
|
7304
7334
|
}
|
|
7305
7335
|
async function queryDatesInDataset(lapisFilter, lapis, granularity, lapisDateField, signal) {
|
|
7306
7336
|
const { dateFrom, dateTo } = getDateRangeFromFilter(lapisFilter, lapisDateField, granularity);
|