@genspectrum/dashboard-components 1.3.0 → 1.4.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/README.md +9 -0
- package/dist/assets/{mutationOverTimeWorker-C7saVShx.js.map → mutationOverTimeWorker-CQxrFo53.js.map} +1 -1
- package/dist/components.d.ts +25 -25
- package/dist/components.js +5 -11
- package/dist/components.js.map +1 -1
- package/dist/util.d.ts +25 -25
- package/package.json +1 -1
- package/src/preact/mutationsOverTime/__mockData__/withDisplayMutations.ts +352 -0
- package/src/preact/mutationsOverTime/getFilteredMutationsOverTime.spec.ts +0 -24
- package/src/preact/mutationsOverTime/getFilteredMutationsOverTimeData.ts +1 -9
- package/src/preact/mutationsOverTime/mutationOverTimeWorker.mock.ts +2 -0
- package/src/preact/mutationsOverTime/mutations-over-time.tsx +3 -4
- package/src/query/queryMutationsOverTime.spec.ts +98 -0
- package/src/query/queryMutationsOverTime.ts +72 -6
- package/src/query/queryMutationsOverTimeNewEndpoint.spec.ts +122 -0
- package/standalone-bundle/assets/{mutationOverTimeWorker-DRRi3aMG.js.map → mutationOverTimeWorker-CDACUs6w.js.map} +1 -1
- package/standalone-bundle/dashboard-components.js +22 -24
- package/standalone-bundle/dashboard-components.js.map +1 -1
package/dist/util.d.ts
CHANGED
|
@@ -917,7 +917,7 @@ declare global {
|
|
|
917
917
|
|
|
918
918
|
declare global {
|
|
919
919
|
interface HTMLElementTagNameMap {
|
|
920
|
-
'gs-
|
|
920
|
+
'gs-wastewater-mutations-over-time': WastewaterMutationsOverTimeComponent;
|
|
921
921
|
}
|
|
922
922
|
}
|
|
923
923
|
|
|
@@ -925,7 +925,7 @@ declare global {
|
|
|
925
925
|
declare global {
|
|
926
926
|
namespace JSX {
|
|
927
927
|
interface IntrinsicElements {
|
|
928
|
-
'gs-
|
|
928
|
+
'gs-wastewater-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
929
929
|
}
|
|
930
930
|
}
|
|
931
931
|
}
|
|
@@ -933,7 +933,7 @@ declare global {
|
|
|
933
933
|
|
|
934
934
|
declare global {
|
|
935
935
|
interface HTMLElementTagNameMap {
|
|
936
|
-
'gs-
|
|
936
|
+
'gs-genome-data-viewer': GenomeDataViewerComponent;
|
|
937
937
|
}
|
|
938
938
|
}
|
|
939
939
|
|
|
@@ -941,7 +941,7 @@ declare global {
|
|
|
941
941
|
declare global {
|
|
942
942
|
namespace JSX {
|
|
943
943
|
interface IntrinsicElements {
|
|
944
|
-
'gs-
|
|
944
|
+
'gs-genome-data-viewer': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
945
945
|
}
|
|
946
946
|
}
|
|
947
947
|
}
|
|
@@ -949,7 +949,7 @@ declare global {
|
|
|
949
949
|
|
|
950
950
|
declare global {
|
|
951
951
|
interface HTMLElementTagNameMap {
|
|
952
|
-
'gs-
|
|
952
|
+
'gs-mutation-comparison-component': MutationComparisonComponent;
|
|
953
953
|
}
|
|
954
954
|
}
|
|
955
955
|
|
|
@@ -957,7 +957,7 @@ declare global {
|
|
|
957
957
|
declare global {
|
|
958
958
|
namespace JSX {
|
|
959
959
|
interface IntrinsicElements {
|
|
960
|
-
'gs-
|
|
960
|
+
'gs-mutation-comparison-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
961
961
|
}
|
|
962
962
|
}
|
|
963
963
|
}
|
|
@@ -965,7 +965,7 @@ declare global {
|
|
|
965
965
|
|
|
966
966
|
declare global {
|
|
967
967
|
interface HTMLElementTagNameMap {
|
|
968
|
-
'gs-
|
|
968
|
+
'gs-mutations': MutationsComponent;
|
|
969
969
|
}
|
|
970
970
|
}
|
|
971
971
|
|
|
@@ -973,7 +973,7 @@ declare global {
|
|
|
973
973
|
declare global {
|
|
974
974
|
namespace JSX {
|
|
975
975
|
interface IntrinsicElements {
|
|
976
|
-
'gs-
|
|
976
|
+
'gs-mutations': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
977
977
|
}
|
|
978
978
|
}
|
|
979
979
|
}
|
|
@@ -981,7 +981,7 @@ declare global {
|
|
|
981
981
|
|
|
982
982
|
declare global {
|
|
983
983
|
interface HTMLElementTagNameMap {
|
|
984
|
-
'gs-
|
|
984
|
+
'gs-prevalence-over-time': PrevalenceOverTimeComponent;
|
|
985
985
|
}
|
|
986
986
|
}
|
|
987
987
|
|
|
@@ -989,7 +989,7 @@ declare global {
|
|
|
989
989
|
declare global {
|
|
990
990
|
namespace JSX {
|
|
991
991
|
interface IntrinsicElements {
|
|
992
|
-
'gs-
|
|
992
|
+
'gs-prevalence-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
993
993
|
}
|
|
994
994
|
}
|
|
995
995
|
}
|
|
@@ -997,7 +997,7 @@ declare global {
|
|
|
997
997
|
|
|
998
998
|
declare global {
|
|
999
999
|
interface HTMLElementTagNameMap {
|
|
1000
|
-
'gs-
|
|
1000
|
+
'gs-relative-growth-advantage': RelativeGrowthAdvantageComponent;
|
|
1001
1001
|
}
|
|
1002
1002
|
}
|
|
1003
1003
|
|
|
@@ -1005,7 +1005,7 @@ declare global {
|
|
|
1005
1005
|
declare global {
|
|
1006
1006
|
namespace JSX {
|
|
1007
1007
|
interface IntrinsicElements {
|
|
1008
|
-
'gs-
|
|
1008
|
+
'gs-relative-growth-advantage': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
1009
1009
|
}
|
|
1010
1010
|
}
|
|
1011
1011
|
}
|
|
@@ -1013,7 +1013,7 @@ declare global {
|
|
|
1013
1013
|
|
|
1014
1014
|
declare global {
|
|
1015
1015
|
interface HTMLElementTagNameMap {
|
|
1016
|
-
'gs-
|
|
1016
|
+
'gs-aggregate': AggregateComponent;
|
|
1017
1017
|
}
|
|
1018
1018
|
}
|
|
1019
1019
|
|
|
@@ -1021,7 +1021,7 @@ declare global {
|
|
|
1021
1021
|
declare global {
|
|
1022
1022
|
namespace JSX {
|
|
1023
1023
|
interface IntrinsicElements {
|
|
1024
|
-
'gs-
|
|
1024
|
+
'gs-aggregate': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
1025
1025
|
}
|
|
1026
1026
|
}
|
|
1027
1027
|
}
|
|
@@ -1045,7 +1045,7 @@ declare global {
|
|
|
1045
1045
|
|
|
1046
1046
|
declare global {
|
|
1047
1047
|
interface HTMLElementTagNameMap {
|
|
1048
|
-
'gs-
|
|
1048
|
+
'gs-mutations-over-time': MutationsOverTimeComponent;
|
|
1049
1049
|
}
|
|
1050
1050
|
}
|
|
1051
1051
|
|
|
@@ -1053,7 +1053,7 @@ declare global {
|
|
|
1053
1053
|
declare global {
|
|
1054
1054
|
namespace JSX {
|
|
1055
1055
|
interface IntrinsicElements {
|
|
1056
|
-
'gs-
|
|
1056
|
+
'gs-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
1057
1057
|
}
|
|
1058
1058
|
}
|
|
1059
1059
|
}
|
|
@@ -1061,7 +1061,7 @@ declare global {
|
|
|
1061
1061
|
|
|
1062
1062
|
declare global {
|
|
1063
1063
|
interface HTMLElementTagNameMap {
|
|
1064
|
-
'gs-
|
|
1064
|
+
'gs-sequences-by-location': SequencesByLocationComponent;
|
|
1065
1065
|
}
|
|
1066
1066
|
}
|
|
1067
1067
|
|
|
@@ -1069,7 +1069,7 @@ declare global {
|
|
|
1069
1069
|
declare global {
|
|
1070
1070
|
namespace JSX {
|
|
1071
1071
|
interface IntrinsicElements {
|
|
1072
|
-
'gs-
|
|
1072
|
+
'gs-sequences-by-location': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
1073
1073
|
}
|
|
1074
1074
|
}
|
|
1075
1075
|
}
|
|
@@ -1093,11 +1093,10 @@ declare global {
|
|
|
1093
1093
|
|
|
1094
1094
|
declare global {
|
|
1095
1095
|
interface HTMLElementTagNameMap {
|
|
1096
|
-
'gs-
|
|
1096
|
+
'gs-location-filter': LocationFilterComponent;
|
|
1097
1097
|
}
|
|
1098
1098
|
interface HTMLElementEventMap {
|
|
1099
|
-
[gsEventNames.
|
|
1100
|
-
[gsEventNames.dateRangeOptionChanged]: DateRangeOptionChangedEvent;
|
|
1099
|
+
[gsEventNames.locationChanged]: LocationChangedEvent;
|
|
1101
1100
|
}
|
|
1102
1101
|
}
|
|
1103
1102
|
|
|
@@ -1105,7 +1104,7 @@ declare global {
|
|
|
1105
1104
|
declare global {
|
|
1106
1105
|
namespace JSX {
|
|
1107
1106
|
interface IntrinsicElements {
|
|
1108
|
-
'gs-
|
|
1107
|
+
'gs-location-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
1109
1108
|
}
|
|
1110
1109
|
}
|
|
1111
1110
|
}
|
|
@@ -1113,10 +1112,11 @@ declare global {
|
|
|
1113
1112
|
|
|
1114
1113
|
declare global {
|
|
1115
1114
|
interface HTMLElementTagNameMap {
|
|
1116
|
-
'gs-
|
|
1115
|
+
'gs-date-range-filter': DateRangeFilterComponent;
|
|
1117
1116
|
}
|
|
1118
1117
|
interface HTMLElementEventMap {
|
|
1119
|
-
[gsEventNames.
|
|
1118
|
+
[gsEventNames.dateRangeFilterChanged]: CustomEvent<Record<string, string>>;
|
|
1119
|
+
[gsEventNames.dateRangeOptionChanged]: DateRangeOptionChangedEvent;
|
|
1120
1120
|
}
|
|
1121
1121
|
}
|
|
1122
1122
|
|
|
@@ -1124,7 +1124,7 @@ declare global {
|
|
|
1124
1124
|
declare global {
|
|
1125
1125
|
namespace JSX {
|
|
1126
1126
|
interface IntrinsicElements {
|
|
1127
|
-
'gs-
|
|
1127
|
+
'gs-date-range-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
1128
1128
|
}
|
|
1129
1129
|
}
|
|
1130
1130
|
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
import { type MutationOverTimeMockData } from './mockConversion';
|
|
2
|
+
|
|
3
|
+
export const withDisplayMutations: MutationOverTimeMockData = {
|
|
4
|
+
query: {
|
|
5
|
+
lapisFilter: {
|
|
6
|
+
pangoLineage: 'JN.1*',
|
|
7
|
+
dateFrom: '2024-01-15',
|
|
8
|
+
dateTo: '2024-07-10',
|
|
9
|
+
},
|
|
10
|
+
sequenceType: 'nucleotide',
|
|
11
|
+
granularity: 'month',
|
|
12
|
+
lapisDateField: 'date',
|
|
13
|
+
lapis: 'https://lapis.cov-spectrum.org/open/v2',
|
|
14
|
+
displayMutations: ['A19722G', 'G21641T', 'T21653-'],
|
|
15
|
+
useNewEndpoint: false,
|
|
16
|
+
},
|
|
17
|
+
response: {
|
|
18
|
+
overallMutationData: [
|
|
19
|
+
{
|
|
20
|
+
type: 'substitution',
|
|
21
|
+
mutation: {
|
|
22
|
+
valueAtReference: 'A',
|
|
23
|
+
substitutionValue: 'G',
|
|
24
|
+
position: 19722,
|
|
25
|
+
type: 'substitution',
|
|
26
|
+
code: 'A19722G',
|
|
27
|
+
},
|
|
28
|
+
count: 10234,
|
|
29
|
+
proportion: 0.09900453714363107,
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
type: 'substitution',
|
|
33
|
+
mutation: {
|
|
34
|
+
valueAtReference: 'G',
|
|
35
|
+
substitutionValue: 'T',
|
|
36
|
+
position: 21641,
|
|
37
|
+
type: 'substitution',
|
|
38
|
+
code: 'G21641T',
|
|
39
|
+
},
|
|
40
|
+
count: 4485,
|
|
41
|
+
proportion: 0.05001951709139575,
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
type: 'deletion',
|
|
45
|
+
mutation: {
|
|
46
|
+
valueAtReference: 'T',
|
|
47
|
+
position: 21653,
|
|
48
|
+
type: 'deletion',
|
|
49
|
+
code: 'T21653-',
|
|
50
|
+
},
|
|
51
|
+
count: 17169,
|
|
52
|
+
proportion: 0.16814713976514833,
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
mutationOverTimeSerializedAsArray: {
|
|
56
|
+
data: [
|
|
57
|
+
[
|
|
58
|
+
'A19722G',
|
|
59
|
+
[
|
|
60
|
+
[
|
|
61
|
+
'2024-01',
|
|
62
|
+
{
|
|
63
|
+
type: 'belowThreshold',
|
|
64
|
+
totalCount: 26387,
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
[
|
|
68
|
+
'2024-02',
|
|
69
|
+
{
|
|
70
|
+
type: 'belowThreshold',
|
|
71
|
+
totalCount: 17340,
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
[
|
|
75
|
+
'2024-03',
|
|
76
|
+
{
|
|
77
|
+
type: 'value',
|
|
78
|
+
count: 36,
|
|
79
|
+
proportion: 0.0043859649122807015,
|
|
80
|
+
totalCount: 8236,
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
[
|
|
84
|
+
'2024-04',
|
|
85
|
+
{
|
|
86
|
+
type: 'value',
|
|
87
|
+
count: 194,
|
|
88
|
+
proportion: 0.030082183284230114,
|
|
89
|
+
totalCount: 6488,
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
[
|
|
93
|
+
'2024-05',
|
|
94
|
+
{
|
|
95
|
+
type: 'value',
|
|
96
|
+
count: 759,
|
|
97
|
+
proportion: 0.08675277174534232,
|
|
98
|
+
totalCount: 8799,
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
[
|
|
102
|
+
'2024-06',
|
|
103
|
+
{
|
|
104
|
+
type: 'value',
|
|
105
|
+
count: 2921,
|
|
106
|
+
proportion: 0.19071559153826065,
|
|
107
|
+
totalCount: 15400,
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
[
|
|
111
|
+
'2024-07',
|
|
112
|
+
{
|
|
113
|
+
type: 'value',
|
|
114
|
+
count: 6318,
|
|
115
|
+
proportion: 0.2995448511283899,
|
|
116
|
+
totalCount: 21234,
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
],
|
|
120
|
+
],
|
|
121
|
+
[
|
|
122
|
+
'G21641T',
|
|
123
|
+
[
|
|
124
|
+
[
|
|
125
|
+
'2024-01',
|
|
126
|
+
{
|
|
127
|
+
type: 'value',
|
|
128
|
+
count: 1625,
|
|
129
|
+
proportion: 0.07085858806087297,
|
|
130
|
+
totalCount: 26387,
|
|
131
|
+
},
|
|
132
|
+
],
|
|
133
|
+
[
|
|
134
|
+
'2024-02',
|
|
135
|
+
{
|
|
136
|
+
type: 'value',
|
|
137
|
+
count: 419,
|
|
138
|
+
proportion: 0.027931471235250985,
|
|
139
|
+
totalCount: 17340,
|
|
140
|
+
},
|
|
141
|
+
],
|
|
142
|
+
[
|
|
143
|
+
'2024-03',
|
|
144
|
+
{
|
|
145
|
+
type: 'value',
|
|
146
|
+
count: 228,
|
|
147
|
+
proportion: 0.03451930355791068,
|
|
148
|
+
totalCount: 8236,
|
|
149
|
+
},
|
|
150
|
+
],
|
|
151
|
+
[
|
|
152
|
+
'2024-04',
|
|
153
|
+
{
|
|
154
|
+
type: 'value',
|
|
155
|
+
count: 545,
|
|
156
|
+
proportion: 0.10551790900290416,
|
|
157
|
+
totalCount: 6488,
|
|
158
|
+
},
|
|
159
|
+
],
|
|
160
|
+
[
|
|
161
|
+
'2024-05',
|
|
162
|
+
{
|
|
163
|
+
type: 'value',
|
|
164
|
+
count: 666,
|
|
165
|
+
proportion: 0.09498003422703936,
|
|
166
|
+
totalCount: 8799,
|
|
167
|
+
},
|
|
168
|
+
],
|
|
169
|
+
[
|
|
170
|
+
'2024-06',
|
|
171
|
+
{
|
|
172
|
+
type: 'value',
|
|
173
|
+
count: 732,
|
|
174
|
+
proportion: 0.05598470363288719,
|
|
175
|
+
totalCount: 15400,
|
|
176
|
+
},
|
|
177
|
+
],
|
|
178
|
+
[
|
|
179
|
+
'2024-07',
|
|
180
|
+
{
|
|
181
|
+
type: 'value',
|
|
182
|
+
count: 270,
|
|
183
|
+
proportion: 0.013585589212035825,
|
|
184
|
+
totalCount: 21234,
|
|
185
|
+
},
|
|
186
|
+
],
|
|
187
|
+
],
|
|
188
|
+
],
|
|
189
|
+
[
|
|
190
|
+
'T21653-',
|
|
191
|
+
[
|
|
192
|
+
[
|
|
193
|
+
'2024-01',
|
|
194
|
+
{
|
|
195
|
+
type: 'belowThreshold',
|
|
196
|
+
totalCount: 26387,
|
|
197
|
+
},
|
|
198
|
+
],
|
|
199
|
+
[
|
|
200
|
+
'2024-02',
|
|
201
|
+
{
|
|
202
|
+
type: 'belowThreshold',
|
|
203
|
+
totalCount: 17340,
|
|
204
|
+
},
|
|
205
|
+
],
|
|
206
|
+
[
|
|
207
|
+
'2024-03',
|
|
208
|
+
{
|
|
209
|
+
type: 'value',
|
|
210
|
+
count: 40,
|
|
211
|
+
proportion: 0.004921259842519685,
|
|
212
|
+
totalCount: 8236,
|
|
213
|
+
},
|
|
214
|
+
],
|
|
215
|
+
[
|
|
216
|
+
'2024-04',
|
|
217
|
+
{
|
|
218
|
+
type: 'value',
|
|
219
|
+
count: 228,
|
|
220
|
+
proportion: 0.03576470588235294,
|
|
221
|
+
totalCount: 6488,
|
|
222
|
+
},
|
|
223
|
+
],
|
|
224
|
+
[
|
|
225
|
+
'2024-05',
|
|
226
|
+
{
|
|
227
|
+
type: 'value',
|
|
228
|
+
count: 1304,
|
|
229
|
+
proportion: 0.151504589287789,
|
|
230
|
+
totalCount: 8799,
|
|
231
|
+
},
|
|
232
|
+
],
|
|
233
|
+
[
|
|
234
|
+
'2024-06',
|
|
235
|
+
{
|
|
236
|
+
type: 'value',
|
|
237
|
+
count: 4744,
|
|
238
|
+
proportion: 0.31656212464967304,
|
|
239
|
+
totalCount: 15400,
|
|
240
|
+
},
|
|
241
|
+
],
|
|
242
|
+
[
|
|
243
|
+
'2024-07',
|
|
244
|
+
{
|
|
245
|
+
type: 'value',
|
|
246
|
+
count: 10815,
|
|
247
|
+
proportion: 0.5221610660486674,
|
|
248
|
+
totalCount: 21234,
|
|
249
|
+
},
|
|
250
|
+
],
|
|
251
|
+
],
|
|
252
|
+
],
|
|
253
|
+
],
|
|
254
|
+
keysFirstAxis: [
|
|
255
|
+
[
|
|
256
|
+
'A19722G',
|
|
257
|
+
{
|
|
258
|
+
type: 'substitution',
|
|
259
|
+
code: 'A19722G',
|
|
260
|
+
position: 19722,
|
|
261
|
+
valueAtReference: 'A',
|
|
262
|
+
substitutionValue: 'G',
|
|
263
|
+
},
|
|
264
|
+
],
|
|
265
|
+
[
|
|
266
|
+
'G21641T',
|
|
267
|
+
{
|
|
268
|
+
type: 'substitution',
|
|
269
|
+
code: 'G21641T',
|
|
270
|
+
position: 21641,
|
|
271
|
+
valueAtReference: 'G',
|
|
272
|
+
substitutionValue: 'T',
|
|
273
|
+
},
|
|
274
|
+
],
|
|
275
|
+
[
|
|
276
|
+
'T21653-',
|
|
277
|
+
{
|
|
278
|
+
type: 'deletion',
|
|
279
|
+
code: 'T21653-',
|
|
280
|
+
position: 21653,
|
|
281
|
+
valueAtReference: 'T',
|
|
282
|
+
},
|
|
283
|
+
],
|
|
284
|
+
],
|
|
285
|
+
keysSecondAxis: [
|
|
286
|
+
[
|
|
287
|
+
'2024-01',
|
|
288
|
+
{
|
|
289
|
+
type: 'YearMonth',
|
|
290
|
+
yearNumber: 2024,
|
|
291
|
+
monthNumber: 1,
|
|
292
|
+
dateString: '2024-01',
|
|
293
|
+
},
|
|
294
|
+
],
|
|
295
|
+
[
|
|
296
|
+
'2024-02',
|
|
297
|
+
{
|
|
298
|
+
type: 'YearMonth',
|
|
299
|
+
yearNumber: 2024,
|
|
300
|
+
monthNumber: 2,
|
|
301
|
+
dateString: '2024-02',
|
|
302
|
+
},
|
|
303
|
+
],
|
|
304
|
+
[
|
|
305
|
+
'2024-03',
|
|
306
|
+
{
|
|
307
|
+
type: 'YearMonth',
|
|
308
|
+
yearNumber: 2024,
|
|
309
|
+
monthNumber: 3,
|
|
310
|
+
dateString: '2024-03',
|
|
311
|
+
},
|
|
312
|
+
],
|
|
313
|
+
[
|
|
314
|
+
'2024-04',
|
|
315
|
+
{
|
|
316
|
+
type: 'YearMonth',
|
|
317
|
+
yearNumber: 2024,
|
|
318
|
+
monthNumber: 4,
|
|
319
|
+
dateString: '2024-04',
|
|
320
|
+
},
|
|
321
|
+
],
|
|
322
|
+
[
|
|
323
|
+
'2024-05',
|
|
324
|
+
{
|
|
325
|
+
type: 'YearMonth',
|
|
326
|
+
yearNumber: 2024,
|
|
327
|
+
monthNumber: 5,
|
|
328
|
+
dateString: '2024-05',
|
|
329
|
+
},
|
|
330
|
+
],
|
|
331
|
+
[
|
|
332
|
+
'2024-06',
|
|
333
|
+
{
|
|
334
|
+
type: 'YearMonth',
|
|
335
|
+
yearNumber: 2024,
|
|
336
|
+
monthNumber: 6,
|
|
337
|
+
dateString: '2024-06',
|
|
338
|
+
},
|
|
339
|
+
],
|
|
340
|
+
[
|
|
341
|
+
'2024-07',
|
|
342
|
+
{
|
|
343
|
+
type: 'YearMonth',
|
|
344
|
+
yearNumber: 2024,
|
|
345
|
+
monthNumber: 7,
|
|
346
|
+
dateString: '2024-07',
|
|
347
|
+
},
|
|
348
|
+
],
|
|
349
|
+
],
|
|
350
|
+
},
|
|
351
|
+
},
|
|
352
|
+
};
|
|
@@ -211,30 +211,6 @@ describe('getFilteredMutationOverTimeData', () => {
|
|
|
211
211
|
expect(result.getFirstAxisKeys()).to.deep.equal([someSubstitution, anotherSubstitution, someDeletion]);
|
|
212
212
|
});
|
|
213
213
|
|
|
214
|
-
it('should filter by displayMutations', () => {
|
|
215
|
-
const { data, overallMutationData } = prepareMutationOverTimeData([
|
|
216
|
-
someSubstitutionEntry,
|
|
217
|
-
anotherSubstitutionEntry,
|
|
218
|
-
someDeletionEntry,
|
|
219
|
-
]);
|
|
220
|
-
|
|
221
|
-
const result = getFilteredMutationOverTimeData({
|
|
222
|
-
data,
|
|
223
|
-
overallMutationData,
|
|
224
|
-
displayedSegments: [],
|
|
225
|
-
displayedMutationTypes: [],
|
|
226
|
-
proportionInterval,
|
|
227
|
-
displayMutations: [anotherSubstitution.code, someDeletion.code],
|
|
228
|
-
mutationFilterValue: { textFilter: '', annotationNameFilter: new Set() },
|
|
229
|
-
sequenceType: 'nucleotide',
|
|
230
|
-
annotationProvider: () => {
|
|
231
|
-
return [];
|
|
232
|
-
},
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
expect(result.getFirstAxisKeys()).to.deep.equal([anotherSubstitution, someDeletion]);
|
|
236
|
-
});
|
|
237
|
-
|
|
238
214
|
it('should filter by mutation filter text value', () => {
|
|
239
215
|
const { data, overallMutationData } = prepareMutationOverTimeData([
|
|
240
216
|
someSubstitutionEntry,
|
|
@@ -8,7 +8,7 @@ import { type useMutationAnnotationsProvider } from '../MutationAnnotationsConte
|
|
|
8
8
|
import type { DisplayedMutationType } from '../components/mutation-type-selector';
|
|
9
9
|
import type { DisplayedSegment } from '../components/segment-selector';
|
|
10
10
|
|
|
11
|
-
export const displayMutationsSchema = z.array(z.string())
|
|
11
|
+
export const displayMutationsSchema = z.array(z.string());
|
|
12
12
|
export type DisplayMutations = z.infer<typeof displayMutationsSchema>;
|
|
13
13
|
|
|
14
14
|
export type MutationFilter = {
|
|
@@ -34,16 +34,12 @@ export function getFilteredMutationOverTimeData({
|
|
|
34
34
|
displayedSegments,
|
|
35
35
|
displayedMutationTypes,
|
|
36
36
|
proportionInterval,
|
|
37
|
-
displayMutations,
|
|
38
37
|
mutationFilterValue,
|
|
39
38
|
sequenceType,
|
|
40
39
|
annotationProvider,
|
|
41
40
|
}: GetFilteredMutationOverTimeDataArgs) {
|
|
42
41
|
const filteredData = new Map2dView(data);
|
|
43
42
|
|
|
44
|
-
const displayMutationsSet =
|
|
45
|
-
displayMutations === undefined ? null : new Set(displayMutations.map((it) => it.toUpperCase()));
|
|
46
|
-
|
|
47
43
|
const mutationsToFilterOut = overallMutationData.filter((entry) => {
|
|
48
44
|
if (entry.proportion < proportionInterval.min || entry.proportion > proportionInterval.max) {
|
|
49
45
|
return true;
|
|
@@ -52,10 +48,6 @@ export function getFilteredMutationOverTimeData({
|
|
|
52
48
|
return true;
|
|
53
49
|
}
|
|
54
50
|
|
|
55
|
-
if (displayMutationsSet !== null && !displayMutationsSet.has(entry.mutation.code.toUpperCase())) {
|
|
56
|
-
return true;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
51
|
if (
|
|
60
52
|
mutationOrAnnotationDoNotMatchFilter(entry.mutation, sequenceType, mutationFilterValue, annotationProvider)
|
|
61
53
|
) {
|
|
@@ -7,11 +7,13 @@ import { defaultMockData } from './__mockData__/defaultMockData';
|
|
|
7
7
|
import { getMutationOverTimeMock } from './__mockData__/mockConversion';
|
|
8
8
|
import { noDataWhenNoMutationsAreInFilter } from './__mockData__/noDataWhenNoMutationsAreInFilter';
|
|
9
9
|
import { showsMessageWhenTooManyMutations } from './__mockData__/showsMessageWhenTooManyMutations';
|
|
10
|
+
import { withDisplayMutations } from './__mockData__/withDisplayMutations';
|
|
10
11
|
|
|
11
12
|
const mockQueries: { query: MutationOverTimeQuery; response: MutationOverTimeWorkerResponse }[] = [
|
|
12
13
|
getMutationOverTimeMock(defaultMockData),
|
|
13
14
|
getMutationOverTimeMock(showsMessageWhenTooManyMutations),
|
|
14
15
|
getMutationOverTimeMock(byWeek),
|
|
16
|
+
getMutationOverTimeMock(withDisplayMutations),
|
|
15
17
|
getMutationOverTimeMock(aminoAcidMutationsByDay),
|
|
16
18
|
getMutationOverTimeMock(noDataWhenNoMutationsAreInFilter),
|
|
17
19
|
];
|
|
@@ -83,7 +83,7 @@ export const MutationsOverTimeInner: FunctionComponent<MutationsOverTimeProps> =
|
|
|
83
83
|
...componentProps
|
|
84
84
|
}) => {
|
|
85
85
|
const lapis = useLapisUrl();
|
|
86
|
-
const { lapisFilter, sequenceType, granularity, lapisDateField } = componentProps;
|
|
86
|
+
const { lapisFilter, sequenceType, granularity, lapisDateField, displayMutations } = componentProps;
|
|
87
87
|
|
|
88
88
|
const messageToWorker: MutationOverTimeQuery = useMemo(() => {
|
|
89
89
|
return {
|
|
@@ -92,9 +92,10 @@ export const MutationsOverTimeInner: FunctionComponent<MutationsOverTimeProps> =
|
|
|
92
92
|
granularity,
|
|
93
93
|
lapisDateField,
|
|
94
94
|
lapis,
|
|
95
|
+
displayMutations,
|
|
95
96
|
useNewEndpoint,
|
|
96
97
|
};
|
|
97
|
-
}, [granularity, lapis, lapisDateField, lapisFilter, sequenceType, useNewEndpoint]);
|
|
98
|
+
}, [granularity, lapis, lapisDateField, lapisFilter, sequenceType, displayMutations, useNewEndpoint]);
|
|
98
99
|
|
|
99
100
|
const { data, error, isLoading } = useWebWorker<MutationOverTimeWorkerResponse>(
|
|
100
101
|
messageToWorker,
|
|
@@ -160,7 +161,6 @@ const MutationsOverTimeTabs: FunctionComponent<MutationOverTimeTabsProps> = ({
|
|
|
160
161
|
displayedSegments,
|
|
161
162
|
displayedMutationTypes,
|
|
162
163
|
proportionInterval,
|
|
163
|
-
displayMutations: originalComponentProps.displayMutations,
|
|
164
164
|
mutationFilterValue,
|
|
165
165
|
sequenceType: originalComponentProps.sequenceType,
|
|
166
166
|
annotationProvider,
|
|
@@ -171,7 +171,6 @@ const MutationsOverTimeTabs: FunctionComponent<MutationOverTimeTabsProps> = ({
|
|
|
171
171
|
displayedSegments,
|
|
172
172
|
displayedMutationTypes,
|
|
173
173
|
proportionInterval,
|
|
174
|
-
originalComponentProps.displayMutations,
|
|
175
174
|
originalComponentProps.sequenceType,
|
|
176
175
|
mutationFilterValue,
|
|
177
176
|
annotationProvider,
|