@genspectrum/dashboard-components 0.6.17 → 0.6.19

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 (109) hide show
  1. package/README.md +5 -12
  2. package/custom-elements.json +4 -4
  3. package/dist/assets/mutationOverTimeWorker-BdzqDqvO.js.map +1 -0
  4. package/dist/dashboard-components.js +216 -214
  5. package/dist/dashboard-components.js.map +1 -1
  6. package/dist/genspectrum-components.d.ts +40 -40
  7. package/dist/style.css +3 -2
  8. package/package.json +13 -2
  9. package/src/operator/FetchInsertionsOperator.ts +2 -2
  10. package/src/operator/FetchSubstitutionsOrDeletionsOperator.ts +3 -3
  11. package/src/preact/mutationComparison/fetchMutationData.spec.ts +3 -3
  12. package/src/preact/mutationComparison/getMutationComparisonTableData.spec.ts +11 -11
  13. package/src/preact/mutationComparison/getMutationComparisonTableData.ts +4 -4
  14. package/src/preact/mutationComparison/mutation-comparison-table.tsx +2 -2
  15. package/src/preact/mutationFilter/mutation-filter.tsx +27 -18
  16. package/src/preact/mutationFilter/parseAndValidateMutation.ts +4 -4
  17. package/src/preact/mutationFilter/parseMutation.spec.ts +17 -17
  18. package/src/preact/mutations/getInsertionsTableData.spec.ts +3 -3
  19. package/src/preact/mutations/getMutationsGridData.spec.ts +9 -9
  20. package/src/preact/mutations/getMutationsTableData.spec.ts +7 -7
  21. package/src/preact/mutations/mutations-insertions-table.tsx +3 -3
  22. package/src/preact/mutations/mutations-table.tsx +3 -3
  23. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutationsByDay.ts +45686 -0
  24. package/src/preact/mutationsOverTime/__mockData__/byWeek.ts +58989 -0
  25. package/src/preact/mutationsOverTime/__mockData__/defaultMockData.ts +103991 -0
  26. package/src/preact/mutationsOverTime/__mockData__/mockConversion.ts +54 -0
  27. package/src/preact/mutationsOverTime/__mockData__/showsMessageWhenTooManyMutations.ts +63690 -0
  28. package/src/preact/mutationsOverTime/getFilteredMutationsOverTime.spec.ts +176 -159
  29. package/src/preact/mutationsOverTime/getFilteredMutationsOverTimeData.ts +17 -59
  30. package/src/preact/mutationsOverTime/mutationOverTimeWorker.mock.ts +27 -0
  31. package/src/preact/mutationsOverTime/mutationOverTimeWorker.ts +29 -0
  32. package/src/preact/mutationsOverTime/mutations-over-time-grid.tsx +13 -14
  33. package/src/preact/mutationsOverTime/mutations-over-time.stories.tsx +9 -334
  34. package/src/preact/mutationsOverTime/mutations-over-time.tsx +68 -52
  35. package/src/preact/numberSequencesOverTime/getNumberOfSequencesOverTimeTableData.ts +3 -3
  36. package/src/preact/prevalenceOverTime/getPrevalenceOverTimeTableData.spec.ts +5 -5
  37. package/src/preact/prevalenceOverTime/prevalence-over-time-bubble-chart.tsx +1 -1
  38. package/src/preact/relativeGrowthAdvantage/relative-growth-advantage-chart.tsx +2 -2
  39. package/src/preact/shared/sort/sortInsertions.spec.ts +11 -11
  40. package/src/preact/shared/sort/sortInsertions.ts +2 -2
  41. package/src/preact/shared/sort/sortSubstitutionsAndDeletions.spec.ts +13 -13
  42. package/src/preact/shared/sort/sortSubstitutionsAndDeletions.ts +7 -4
  43. package/src/preact/webWorkers/useWebWorker.ts +51 -0
  44. package/src/preact/webWorkers/workerFunction.ts +14 -0
  45. package/src/query/queryAggregatedDataOverTime.ts +3 -3
  46. package/src/query/queryMutationsOverTime.spec.ts +272 -51
  47. package/src/query/queryMutationsOverTime.ts +114 -45
  48. package/src/query/queryPrevalenceOverTime.ts +2 -2
  49. package/src/query/queryRelativeGrowthAdvantage.ts +3 -3
  50. package/src/types.ts +25 -5
  51. package/src/utils/map2d.spec.ts +29 -1
  52. package/src/utils/map2d.ts +22 -1
  53. package/src/utils/mutations.spec.ts +20 -20
  54. package/src/utils/mutations.ts +80 -17
  55. package/src/utils/sort.ts +5 -2
  56. package/src/utils/temporal.spec.ts +27 -24
  57. package/src/utils/{temporal.ts → temporalClass.ts} +170 -72
  58. package/src/utils/temporalTestHelpers.ts +3 -3
  59. package/src/web-components/input/gs-text-input.tsx +1 -1
  60. package/src/web-components/introduction.mdx +46 -0
  61. package/src/web-components/visualization/gs-mutations-over-time.stories.ts +6 -699
  62. package/src/web-components/visualization/gs-mutations-over-time.tsx +2 -2
  63. package/standalone-bundle/dashboard-components.js +13763 -13754
  64. package/standalone-bundle/dashboard-components.js.map +1 -1
  65. package/src/preact/mutationsOverTime/__mockData__/aggregated_2024_01.json +0 -13
  66. package/src/preact/mutationsOverTime/__mockData__/aggregated_2024_02.json +0 -13
  67. package/src/preact/mutationsOverTime/__mockData__/aggregated_2024_03.json +0 -13
  68. package/src/preact/mutationsOverTime/__mockData__/aggregated_2024_04.json +0 -13
  69. package/src/preact/mutationsOverTime/__mockData__/aggregated_2024_05.json +0 -13
  70. package/src/preact/mutationsOverTime/__mockData__/aggregated_2024_06.json +0 -13
  71. package/src/preact/mutationsOverTime/__mockData__/aggregated_2024_07.json +0 -13
  72. package/src/preact/mutationsOverTime/__mockData__/aggregated_20_01_2024.json +0 -13
  73. package/src/preact/mutationsOverTime/__mockData__/aggregated_21_01_2024.json +0 -13
  74. package/src/preact/mutationsOverTime/__mockData__/aggregated_22_01_2024.json +0 -13
  75. package/src/preact/mutationsOverTime/__mockData__/aggregated_23_01_2024.json +0 -13
  76. package/src/preact/mutationsOverTime/__mockData__/aggregated_24_01_2024.json +0 -13
  77. package/src/preact/mutationsOverTime/__mockData__/aggregated_25_01_2024.json +0 -13
  78. package/src/preact/mutationsOverTime/__mockData__/aggregated_26_01_2024.json +0 -13
  79. package/src/preact/mutationsOverTime/__mockData__/aggregated_byDay.json +0 -38
  80. package/src/preact/mutationsOverTime/__mockData__/aggregated_byWeek.json +0 -122
  81. package/src/preact/mutationsOverTime/__mockData__/aggregated_date.json +0 -642
  82. package/src/preact/mutationsOverTime/__mockData__/aggregated_tooManyMutations.json +0 -1470
  83. package/src/preact/mutationsOverTime/__mockData__/aggregated_tooManyMutations_total.json +0 -13
  84. package/src/preact/mutationsOverTime/__mockData__/aggregated_week3_2024.json +0 -13
  85. package/src/preact/mutationsOverTime/__mockData__/aggregated_week4_2024.json +0 -13
  86. package/src/preact/mutationsOverTime/__mockData__/aggregated_week5_2024.json +0 -13
  87. package/src/preact/mutationsOverTime/__mockData__/aggregated_week6_2024.json +0 -13
  88. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutations_20_01_2024.json +0 -6778
  89. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutations_21_01_2024.json +0 -7129
  90. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutations_22_01_2024.json +0 -4681
  91. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutations_23_01_2024.json +0 -10738
  92. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutations_24_01_2024.json +0 -11710
  93. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutations_25_01_2024.json +0 -11557
  94. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutations_26_01_2024.json +0 -8596
  95. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutations_byDayOverall.json +0 -4726
  96. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_2024_01.json +0 -1747
  97. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_2024_02.json +0 -1774
  98. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_2024_03.json +0 -1819
  99. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_2024_04.json +0 -1864
  100. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_2024_05.json +0 -1927
  101. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_2024_06.json +0 -1864
  102. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_2024_07.json +0 -9
  103. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_byMonthOverall.json +0 -11143
  104. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_byWeekOverall.json +0 -9154
  105. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_tooManyMutations.json +0 -16453
  106. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_week3_2024.json +0 -8812
  107. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_week4_2024.json +0 -9730
  108. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_week5_2024.json +0 -9865
  109. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_week6_2024.json +0 -11314
@@ -989,10 +989,7 @@ declare global {
989
989
 
990
990
  declare global {
991
991
  interface HTMLElementTagNameMap {
992
- 'gs-date-range-selector': DateRangeSelectorComponent;
993
- }
994
- interface HTMLElementEventMap {
995
- 'gs-date-range-changed': CustomEvent<Record<string, string>>;
992
+ 'gs-mutation-comparison-component': MutationComparisonComponent;
996
993
  }
997
994
  }
998
995
 
@@ -1000,7 +997,7 @@ declare global {
1000
997
  declare global {
1001
998
  namespace JSX {
1002
999
  interface IntrinsicElements {
1003
- 'gs-date-range-selector': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1000
+ 'gs-mutation-comparison-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1004
1001
  }
1005
1002
  }
1006
1003
  }
@@ -1008,10 +1005,7 @@ declare global {
1008
1005
 
1009
1006
  declare global {
1010
1007
  interface HTMLElementTagNameMap {
1011
- 'gs-location-filter': LocationFilterComponent;
1012
- }
1013
- interface HTMLElementEventMap {
1014
- 'gs-location-changed': CustomEvent<Record<string, string>>;
1008
+ 'gs-mutations-component': MutationsComponent;
1015
1009
  }
1016
1010
  }
1017
1011
 
@@ -1019,7 +1013,7 @@ declare global {
1019
1013
  declare global {
1020
1014
  namespace JSX {
1021
1015
  interface IntrinsicElements {
1022
- 'gs-location-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1016
+ 'gs-mutations-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1023
1017
  }
1024
1018
  }
1025
1019
  }
@@ -1027,10 +1021,7 @@ declare global {
1027
1021
 
1028
1022
  declare global {
1029
1023
  interface HTMLElementTagNameMap {
1030
- 'gs-text-input': TextInputComponent;
1031
- }
1032
- interface HTMLElementEventMap {
1033
- 'gs-text-input-changed': CustomEvent<Record<string, string>>;
1024
+ 'gs-prevalence-over-time': PrevalenceOverTimeComponent;
1034
1025
  }
1035
1026
  }
1036
1027
 
@@ -1038,7 +1029,7 @@ declare global {
1038
1029
  declare global {
1039
1030
  namespace JSX {
1040
1031
  interface IntrinsicElements {
1041
- 'gs-text-input-changed': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1032
+ 'gs-prevalence-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1042
1033
  }
1043
1034
  }
1044
1035
  }
@@ -1046,11 +1037,7 @@ declare global {
1046
1037
 
1047
1038
  declare global {
1048
1039
  interface HTMLElementTagNameMap {
1049
- 'gs-mutation-filter': MutationFilterComponent;
1050
- }
1051
- interface HTMLElementEventMap {
1052
- 'gs-mutation-filter-changed': CustomEvent<SelectedMutationFilterStrings>;
1053
- 'gs-mutation-filter-on-blur': CustomEvent<SelectedMutationFilterStrings>;
1040
+ 'gs-relative-growth-advantage': RelativeGrowthAdvantageComponent;
1054
1041
  }
1055
1042
  }
1056
1043
 
@@ -1058,7 +1045,7 @@ declare global {
1058
1045
  declare global {
1059
1046
  namespace JSX {
1060
1047
  interface IntrinsicElements {
1061
- 'gs-mutation-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1048
+ 'gs-relative-growth-advantage': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1062
1049
  }
1063
1050
  }
1064
1051
  }
@@ -1066,10 +1053,7 @@ declare global {
1066
1053
 
1067
1054
  declare global {
1068
1055
  interface HTMLElementTagNameMap {
1069
- 'gs-lineage-filter': LineageFilterComponent;
1070
- }
1071
- interface HTMLElementEventMap {
1072
- 'gs-lineage-filter-changed': CustomEvent<Record<string, string>>;
1056
+ 'gs-aggregate-component': AggregateComponent;
1073
1057
  }
1074
1058
  }
1075
1059
 
@@ -1077,7 +1061,7 @@ declare global {
1077
1061
  declare global {
1078
1062
  namespace JSX {
1079
1063
  interface IntrinsicElements {
1080
- 'gs-lineage-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1064
+ 'gs-aggregate-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1081
1065
  }
1082
1066
  }
1083
1067
  }
@@ -1085,7 +1069,7 @@ declare global {
1085
1069
 
1086
1070
  declare global {
1087
1071
  interface HTMLElementTagNameMap {
1088
- 'gs-mutation-comparison-component': MutationComparisonComponent;
1072
+ 'gs-number-sequences-over-time': NumberSequencesOverTimeComponent;
1089
1073
  }
1090
1074
  }
1091
1075
 
@@ -1093,7 +1077,7 @@ declare global {
1093
1077
  declare global {
1094
1078
  namespace JSX {
1095
1079
  interface IntrinsicElements {
1096
- 'gs-mutation-comparison-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1080
+ 'gs-number-sequences-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1097
1081
  }
1098
1082
  }
1099
1083
  }
@@ -1101,7 +1085,7 @@ declare global {
1101
1085
 
1102
1086
  declare global {
1103
1087
  interface HTMLElementTagNameMap {
1104
- 'gs-mutations-component': MutationsComponent;
1088
+ 'gs-mutations-over-time': MutationsOverTimeComponent;
1105
1089
  }
1106
1090
  }
1107
1091
 
@@ -1109,7 +1093,7 @@ declare global {
1109
1093
  declare global {
1110
1094
  namespace JSX {
1111
1095
  interface IntrinsicElements {
1112
- 'gs-mutations-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1096
+ 'gs-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1113
1097
  }
1114
1098
  }
1115
1099
  }
@@ -1117,7 +1101,10 @@ declare global {
1117
1101
 
1118
1102
  declare global {
1119
1103
  interface HTMLElementTagNameMap {
1120
- 'gs-prevalence-over-time': PrevalenceOverTimeComponent;
1104
+ 'gs-date-range-selector': DateRangeSelectorComponent;
1105
+ }
1106
+ interface HTMLElementEventMap {
1107
+ 'gs-date-range-changed': CustomEvent<Record<string, string>>;
1121
1108
  }
1122
1109
  }
1123
1110
 
@@ -1125,7 +1112,7 @@ declare global {
1125
1112
  declare global {
1126
1113
  namespace JSX {
1127
1114
  interface IntrinsicElements {
1128
- 'gs-prevalence-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1115
+ 'gs-date-range-selector': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1129
1116
  }
1130
1117
  }
1131
1118
  }
@@ -1133,7 +1120,10 @@ declare global {
1133
1120
 
1134
1121
  declare global {
1135
1122
  interface HTMLElementTagNameMap {
1136
- 'gs-relative-growth-advantage': RelativeGrowthAdvantageComponent;
1123
+ 'gs-location-filter': LocationFilterComponent;
1124
+ }
1125
+ interface HTMLElementEventMap {
1126
+ 'gs-location-changed': CustomEvent<Record<string, string>>;
1137
1127
  }
1138
1128
  }
1139
1129
 
@@ -1141,7 +1131,7 @@ declare global {
1141
1131
  declare global {
1142
1132
  namespace JSX {
1143
1133
  interface IntrinsicElements {
1144
- 'gs-relative-growth-advantage': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1134
+ 'gs-location-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1145
1135
  }
1146
1136
  }
1147
1137
  }
@@ -1149,7 +1139,10 @@ declare global {
1149
1139
 
1150
1140
  declare global {
1151
1141
  interface HTMLElementTagNameMap {
1152
- 'gs-aggregate-component': AggregateComponent;
1142
+ 'gs-text-input': TextInputComponent;
1143
+ }
1144
+ interface HTMLElementEventMap {
1145
+ 'gs-text-input-changed': CustomEvent<Record<string, string>>;
1153
1146
  }
1154
1147
  }
1155
1148
 
@@ -1157,7 +1150,7 @@ declare global {
1157
1150
  declare global {
1158
1151
  namespace JSX {
1159
1152
  interface IntrinsicElements {
1160
- 'gs-aggregate-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1153
+ 'gs-text-input': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1161
1154
  }
1162
1155
  }
1163
1156
  }
@@ -1165,7 +1158,10 @@ declare global {
1165
1158
 
1166
1159
  declare global {
1167
1160
  interface HTMLElementTagNameMap {
1168
- 'gs-number-sequences-over-time': NumberSequencesOverTimeComponent;
1161
+ 'gs-lineage-filter': LineageFilterComponent;
1162
+ }
1163
+ interface HTMLElementEventMap {
1164
+ 'gs-lineage-filter-changed': CustomEvent<Record<string, string>>;
1169
1165
  }
1170
1166
  }
1171
1167
 
@@ -1173,7 +1169,7 @@ declare global {
1173
1169
  declare global {
1174
1170
  namespace JSX {
1175
1171
  interface IntrinsicElements {
1176
- 'gs-number-sequences-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1172
+ 'gs-lineage-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1177
1173
  }
1178
1174
  }
1179
1175
  }
@@ -1181,7 +1177,11 @@ declare global {
1181
1177
 
1182
1178
  declare global {
1183
1179
  interface HTMLElementTagNameMap {
1184
- 'gs-mutations-over-time-component': MutationsOverTimeComponent;
1180
+ 'gs-mutation-filter': MutationFilterComponent;
1181
+ }
1182
+ interface HTMLElementEventMap {
1183
+ 'gs-mutation-filter-changed': CustomEvent<SelectedMutationFilterStrings>;
1184
+ 'gs-mutation-filter-on-blur': CustomEvent<SelectedMutationFilterStrings>;
1185
1185
  }
1186
1186
  }
1187
1187
 
@@ -1189,7 +1189,7 @@ declare global {
1189
1189
  declare global {
1190
1190
  namespace JSX {
1191
1191
  interface IntrinsicElements {
1192
- 'gs-mutations-over-time-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1192
+ 'gs-mutation-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1193
1193
  }
1194
1194
  }
1195
1195
  }
package/dist/style.css CHANGED
@@ -482,7 +482,7 @@ input[type="range"] {
482
482
  --tw-contain-paint: ;
483
483
  --tw-contain-style: ;
484
484
  }/*
485
- ! tailwindcss v3.4.13 | MIT License | https://tailwindcss.com
485
+ ! tailwindcss v3.4.14 | MIT License | https://tailwindcss.com
486
486
  *//*
487
487
  1. Prevent padding and border from affecting element width. (https://github.com/mozdevs/cssremedy/issues/4)
488
488
  2. Allow adding a border to an element by just adding a border-width. (https://github.com/tailwindcss/tailwindcss/pull/116)
@@ -873,7 +873,7 @@ video {
873
873
  }
874
874
 
875
875
  /* Make elements with the HTML hidden attribute stay hidden by default */
876
- [hidden] {
876
+ [hidden]:where(:not([hidden="until-found"])) {
877
877
  display: none;
878
878
  }
879
879
 
@@ -2707,6 +2707,7 @@ input.tab:checked + .tab-content,
2707
2707
  }
2708
2708
  .join.join-horizontal > :where(*:not(:first-child)):is(.btn) {
2709
2709
  margin-inline-start: calc(var(--border-btn) * -1);
2710
+ margin-top: 0px;
2710
2711
  }
2711
2712
  .modal-top :where(.modal-box) {
2712
2713
  width: 100%;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@genspectrum/dashboard-components",
3
- "version": "0.6.17",
3
+ "version": "0.6.19",
4
4
  "description": "GenSpectrum web components for building dashboards",
5
5
  "type": "module",
6
6
  "license": "AGPL-3.0-only",
@@ -10,6 +10,17 @@
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },
13
+ "imports": {
14
+ "#mutationOverTime": {
15
+ "storybook": "./src/preact/mutationsOverTime/mutationOverTimeWorker.mock.ts",
16
+ "default": "./src/preact/mutationsOverTime/mutationOverTimeWorker.ts"
17
+ },
18
+ "#*": [
19
+ "./*",
20
+ "./*.ts",
21
+ "./*.tsx"
22
+ ]
23
+ },
13
24
  "exports": {
14
25
  ".": {
15
26
  "import": "./dist/dashboard-components.js",
@@ -102,7 +113,7 @@
102
113
  "eslint-config-preact": "^1.3.0",
103
114
  "eslint-plugin-import": "^2.29.1",
104
115
  "eslint-plugin-jest": "^28.2.0",
105
- "eslint-plugin-storybook": "^0.8.0",
116
+ "eslint-plugin-storybook": "^0.10.1",
106
117
  "http-server": "^14.1.1",
107
118
  "lit-analyzer": "^2.0.3",
108
119
  "msw": "^2.2.14",
@@ -2,7 +2,7 @@ import { type Dataset } from './Dataset';
2
2
  import { type Operator } from './Operator';
3
3
  import { fetchInsertions } from '../lapisApi/lapisApi';
4
4
  import { type InsertionEntry, type LapisFilter, type SequenceType } from '../types';
5
- import { Insertion } from '../utils/mutations';
5
+ import { InsertionClass } from '../utils/mutations';
6
6
 
7
7
  export class FetchInsertionsOperator implements Operator<InsertionEntry> {
8
8
  constructor(
@@ -15,7 +15,7 @@ export class FetchInsertionsOperator implements Operator<InsertionEntry> {
15
15
 
16
16
  const content: InsertionEntry[] = insertions.map(({ count, insertedSymbols, sequenceName, position }) => ({
17
17
  type: 'insertion',
18
- mutation: new Insertion(sequenceName ?? undefined, position, insertedSymbols),
18
+ mutation: new InsertionClass(sequenceName ?? undefined, position, insertedSymbols),
19
19
  count,
20
20
  }));
21
21
 
@@ -2,7 +2,7 @@ import { type Dataset } from './Dataset';
2
2
  import { type Operator } from './Operator';
3
3
  import { fetchSubstitutionsOrDeletions } from '../lapisApi/lapisApi';
4
4
  import { type LapisFilter, type SequenceType, type SubstitutionOrDeletionEntry } from '../types';
5
- import { Deletion, Substitution } from '../utils/mutations';
5
+ import { DeletionClass, SubstitutionClass } from '../utils/mutations';
6
6
 
7
7
  export class FetchSubstitutionsOrDeletionsOperator implements Operator<SubstitutionOrDeletionEntry> {
8
8
  constructor(
@@ -19,14 +19,14 @@ export class FetchSubstitutionsOrDeletionsOperator implements Operator<Substitut
19
19
  if (mutationTo === '-') {
20
20
  return {
21
21
  type: 'deletion',
22
- mutation: new Deletion(sequenceName ?? undefined, mutationFrom, position),
22
+ mutation: new DeletionClass(sequenceName ?? undefined, mutationFrom, position),
23
23
  count,
24
24
  proportion,
25
25
  };
26
26
  }
27
27
  return {
28
28
  type: 'substitution',
29
- mutation: new Substitution(sequenceName ?? undefined, mutationFrom, mutationTo, position),
29
+ mutation: new SubstitutionClass(sequenceName ?? undefined, mutationFrom, mutationTo, position),
30
30
  count,
31
31
  proportion,
32
32
  };
@@ -2,7 +2,7 @@ import { describe, expect, it } from 'vitest';
2
2
 
3
3
  import { filterMutationData } from './queryMutationData';
4
4
  import { type SubstitutionOrDeletion, type SubstitutionOrDeletionEntry } from '../../types';
5
- import { Deletion, Substitution } from '../../utils/mutations';
5
+ import { DeletionClass, SubstitutionClass } from '../../utils/mutations';
6
6
 
7
7
  const segment = 'testSegment';
8
8
  const displayedSegment = { segment, label: 'label', checked: true };
@@ -19,14 +19,14 @@ describe('filterMutationData', () => {
19
19
  case 'substitution':
20
20
  return {
21
21
  type: 'substitution',
22
- mutation: new Substitution(segment, 'A', 'B', 0),
22
+ mutation: new SubstitutionClass(segment, 'A', 'B', 0),
23
23
  count: 0,
24
24
  proportion: 0,
25
25
  };
26
26
  case 'deletion':
27
27
  return {
28
28
  type: 'deletion',
29
- mutation: new Deletion(segment, 'A', 0),
29
+ mutation: new DeletionClass(segment, 'A', 0),
30
30
  count: 0,
31
31
  proportion: 0,
32
32
  };
@@ -4,7 +4,7 @@ import { getMutationComparisonTableData } from './getMutationComparisonTableData
4
4
  import { type MutationData } from './queryMutationData';
5
5
  import { type Dataset } from '../../operator/Dataset';
6
6
  import { type SubstitutionEntry } from '../../types';
7
- import { Substitution } from '../../utils/mutations';
7
+ import { SubstitutionClass } from '../../utils/mutations';
8
8
 
9
9
  describe('getPrevalenceOverTimeTableData', () => {
10
10
  it('should flatten the data to CSV format', () => {
@@ -15,13 +15,13 @@ describe('getPrevalenceOverTimeTableData', () => {
15
15
  data: [
16
16
  {
17
17
  type: 'substitution',
18
- mutation: new Substitution(undefined, 'A', 'T', 123),
18
+ mutation: new SubstitutionClass(undefined, 'A', 'T', 123),
19
19
  count: 1,
20
20
  proportion: 0.123,
21
21
  },
22
22
  {
23
23
  type: 'substitution',
24
- mutation: new Substitution(undefined, 'G', 'A', 234),
24
+ mutation: new SubstitutionClass(undefined, 'G', 'A', 234),
25
25
  count: 2,
26
26
  proportion: 0.567,
27
27
  },
@@ -32,13 +32,13 @@ describe('getPrevalenceOverTimeTableData', () => {
32
32
  data: [
33
33
  {
34
34
  type: 'substitution',
35
- mutation: new Substitution(undefined, 'A', 'T', 123),
35
+ mutation: new SubstitutionClass(undefined, 'A', 'T', 123),
36
36
  count: 3,
37
37
  proportion: 0.345,
38
38
  },
39
39
  {
40
40
  type: 'substitution',
41
- mutation: new Substitution(undefined, 'G', 'A', 234),
41
+ mutation: new SubstitutionClass(undefined, 'G', 'A', 234),
42
42
  count: 4,
43
43
  proportion: 0.789,
44
44
  },
@@ -51,12 +51,12 @@ describe('getPrevalenceOverTimeTableData', () => {
51
51
 
52
52
  expect(result).toEqual([
53
53
  {
54
- mutation: new Substitution(undefined, 'A', 'T', 123),
54
+ mutation: new SubstitutionClass(undefined, 'A', 'T', 123),
55
55
  'Test 1 prevalence': 0.123,
56
56
  'Test 2 prevalence': 0.345,
57
57
  },
58
58
  {
59
- mutation: new Substitution(undefined, 'G', 'A', 234),
59
+ mutation: new SubstitutionClass(undefined, 'G', 'A', 234),
60
60
  'Test 1 prevalence': 0.567,
61
61
  'Test 2 prevalence': 0.789,
62
62
  },
@@ -67,7 +67,7 @@ describe('getPrevalenceOverTimeTableData', () => {
67
67
  function makeSubstitutionWithProportionAtPosition(proportion: number, position: number): SubstitutionEntry {
68
68
  return {
69
69
  type: 'substitution',
70
- mutation: new Substitution(undefined, 'A', 'T', position),
70
+ mutation: new SubstitutionClass(undefined, 'A', 'T', position),
71
71
  count: 1,
72
72
  proportion,
73
73
  };
@@ -106,17 +106,17 @@ describe('getPrevalenceOverTimeTableData', () => {
106
106
 
107
107
  expect(result).toEqual([
108
108
  {
109
- mutation: new Substitution(undefined, 'A', 'T', 200),
109
+ mutation: new SubstitutionClass(undefined, 'A', 'T', 200),
110
110
  'Test 1 prevalence': inRange,
111
111
  'Test 2 prevalence': belowRange,
112
112
  },
113
113
  {
114
- mutation: new Substitution(undefined, 'A', 'T', 300),
114
+ mutation: new SubstitutionClass(undefined, 'A', 'T', 300),
115
115
  'Test 1 prevalence': inRange,
116
116
  'Test 2 prevalence': inRange,
117
117
  },
118
118
  {
119
- mutation: new Substitution(undefined, 'A', 'T', 400),
119
+ mutation: new SubstitutionClass(undefined, 'A', 'T', 400),
120
120
  'Test 1 prevalence': inRange,
121
121
  'Test 2 prevalence': aboveRange,
122
122
  },
@@ -1,6 +1,6 @@
1
1
  import { type MutationData } from './queryMutationData';
2
2
  import { type Dataset } from '../../operator/Dataset';
3
- import { type Deletion, type Substitution } from '../../utils/mutations';
3
+ import { type DeletionClass, type SubstitutionClass } from '../../utils/mutations';
4
4
  import { type ProportionInterval } from '../components/proportion-selector';
5
5
 
6
6
  type Proportions = {
@@ -8,7 +8,7 @@ type Proportions = {
8
8
  };
9
9
 
10
10
  type MutationComparisonRow = {
11
- mutation: Substitution | Deletion;
11
+ mutation: SubstitutionClass | DeletionClass;
12
12
  proportions: Proportions;
13
13
  };
14
14
 
@@ -47,7 +47,7 @@ export function getMutationComparisonTableData(data: Dataset<MutationData>, prop
47
47
  };
48
48
  })
49
49
  .reduce((acc, val) => ({ ...acc, ...val }), {}),
50
- } as { mutation: Substitution | Deletion } & Proportions;
50
+ } as { mutation: SubstitutionClass | DeletionClass } & Proportions;
51
51
  })
52
52
  .filter((row) =>
53
53
  Object.values(row).some(
@@ -58,7 +58,7 @@ export function getMutationComparisonTableData(data: Dataset<MutationData>, prop
58
58
  }
59
59
 
60
60
  function initializeMutationRow(
61
- mutation: Substitution | Deletion,
61
+ mutation: SubstitutionClass | DeletionClass,
62
62
  displayName: string,
63
63
  proportion: number,
64
64
  ): MutationComparisonRow {
@@ -3,7 +3,7 @@ import { type FunctionComponent } from 'preact';
3
3
  import { getMutationComparisonTableData } from './getMutationComparisonTableData';
4
4
  import { type MutationData } from './queryMutationData';
5
5
  import { type Dataset } from '../../operator/Dataset';
6
- import { type Deletion, type Substitution } from '../../utils/mutations';
6
+ import { type DeletionClass, type SubstitutionClass } from '../../utils/mutations';
7
7
  import { type ProportionInterval } from '../components/proportion-selector';
8
8
  import { Table } from '../components/table';
9
9
  import { sortSubstitutionsAndDeletions } from '../shared/sort/sortSubstitutionsAndDeletions';
@@ -26,7 +26,7 @@ export const MutationComparisonTable: FunctionComponent<MutationsTableProps> = (
26
26
  sort: {
27
27
  compare: sortSubstitutionsAndDeletions,
28
28
  },
29
- formatter: (cell: Substitution | Deletion) => cell.toString(),
29
+ formatter: (cell: SubstitutionClass | DeletionClass) => cell.toString(),
30
30
  },
31
31
  {
32
32
  name: 'Prevalence',
@@ -4,7 +4,12 @@ import { useContext, useRef, useState } from 'preact/hooks';
4
4
  import { MutationFilterInfo } from './mutation-filter-info';
5
5
  import { parseAndValidateMutation } from './parseAndValidateMutation';
6
6
  import { type ReferenceGenome } from '../../lapisApi/ReferenceGenome';
7
- import { type Deletion, type Insertion, type Mutation, type Substitution } from '../../utils/mutations';
7
+ import {
8
+ type DeletionClass,
9
+ type InsertionClass,
10
+ type MutationClass,
11
+ type SubstitutionClass,
12
+ } from '../../utils/mutations';
8
13
  import { ReferenceGenomeContext } from '../ReferenceGenomeContext';
9
14
  import { ErrorBoundary } from '../components/error-boundary';
10
15
  import { singleGraphColorRGBByName } from '../shared/charts/colors';
@@ -18,10 +23,10 @@ export interface MutationFilterProps extends MutationFilterInnerProps {
18
23
  }
19
24
 
20
25
  export type SelectedFilters = {
21
- nucleotideMutations: (Substitution | Deletion)[];
22
- aminoAcidMutations: (Substitution | Deletion)[];
23
- nucleotideInsertions: Insertion[];
24
- aminoAcidInsertions: Insertion[];
26
+ nucleotideMutations: (SubstitutionClass | DeletionClass)[];
27
+ aminoAcidMutations: (SubstitutionClass | DeletionClass)[];
28
+ nucleotideInsertions: InsertionClass[];
29
+ aminoAcidInsertions: InsertionClass[];
25
30
  };
26
31
 
27
32
  export type SelectedMutationFilterStrings = {
@@ -199,14 +204,18 @@ const SelectedMutationDisplay: FunctionComponent<{
199
204
  <SelectedNucleotideMutation
200
205
  key={mutation.toString()}
201
206
  mutation={mutation}
202
- onDelete={(mutation: Substitution | Deletion) => onSelectedRemoved(mutation, 'nucleotideMutations')}
207
+ onDelete={(mutation: SubstitutionClass | DeletionClass) =>
208
+ onSelectedRemoved(mutation, 'nucleotideMutations')
209
+ }
203
210
  />
204
211
  ))}
205
212
  {selectedFilters.aminoAcidMutations.map((mutation) => (
206
213
  <SelectedAminoAcidMutation
207
214
  key={mutation.toString()}
208
215
  mutation={mutation}
209
- onDelete={(mutation: Substitution | Deletion) => onSelectedRemoved(mutation, 'aminoAcidMutations')}
216
+ onDelete={(mutation: SubstitutionClass | DeletionClass) =>
217
+ onSelectedRemoved(mutation, 'aminoAcidMutations')
218
+ }
210
219
  />
211
220
  ))}
212
221
  {selectedFilters.nucleotideInsertions.map((insertion) => (
@@ -220,7 +229,7 @@ const SelectedMutationDisplay: FunctionComponent<{
220
229
  <SelectedAminoAcidInsertion
221
230
  key={insertion.toString()}
222
231
  insertion={insertion}
223
- onDelete={(insertion: Insertion) => onSelectedRemoved(insertion, 'aminoAcidInsertions')}
232
+ onDelete={(insertion: InsertionClass) => onSelectedRemoved(insertion, 'aminoAcidInsertions')}
224
233
  />
225
234
  ))}
226
235
  </>
@@ -228,8 +237,8 @@ const SelectedMutationDisplay: FunctionComponent<{
228
237
  };
229
238
 
230
239
  const SelectedAminoAcidInsertion: FunctionComponent<{
231
- insertion: Insertion;
232
- onDelete: (insertion: Insertion) => void;
240
+ insertion: InsertionClass;
241
+ onDelete: (insertion: InsertionClass) => void;
233
242
  }> = ({ insertion, onDelete }) => {
234
243
  const backgroundColor = singleGraphColorRGBByName('teal', 0.3);
235
244
  const textColor = singleGraphColorRGBByName('teal', 1);
@@ -244,8 +253,8 @@ const SelectedAminoAcidInsertion: FunctionComponent<{
244
253
  };
245
254
 
246
255
  const SelectedAminoAcidMutation: FunctionComponent<{
247
- mutation: Substitution | Deletion;
248
- onDelete: (mutation: Substitution | Deletion) => void;
256
+ mutation: SubstitutionClass | DeletionClass;
257
+ onDelete: (mutation: SubstitutionClass | DeletionClass) => void;
249
258
  }> = ({ mutation, onDelete }) => {
250
259
  const backgroundColor = singleGraphColorRGBByName('rose', 0.3);
251
260
  const textColor = singleGraphColorRGBByName('rose', 1);
@@ -260,8 +269,8 @@ const SelectedAminoAcidMutation: FunctionComponent<{
260
269
  };
261
270
 
262
271
  const SelectedNucleotideMutation: FunctionComponent<{
263
- mutation: Substitution | Deletion;
264
- onDelete: (insertion: Substitution | Deletion) => void;
272
+ mutation: SubstitutionClass | DeletionClass;
273
+ onDelete: (insertion: SubstitutionClass | DeletionClass) => void;
265
274
  }> = ({ mutation, onDelete }) => {
266
275
  const backgroundColor = singleGraphColorRGBByName('indigo', 0.3);
267
276
  const textColor = singleGraphColorRGBByName('indigo', 1);
@@ -276,8 +285,8 @@ const SelectedNucleotideMutation: FunctionComponent<{
276
285
  };
277
286
 
278
287
  const SelectedNucleotideInsertion: FunctionComponent<{
279
- insertion: Insertion;
280
- onDelete: (insertion: Insertion) => void;
288
+ insertion: InsertionClass;
289
+ onDelete: (insertion: InsertionClass) => void;
281
290
  }> = ({ insertion, onDelete }) => {
282
291
  const backgroundColor = singleGraphColorRGBByName('green', 0.3);
283
292
  const textColor = singleGraphColorRGBByName('green', 1);
@@ -292,14 +301,14 @@ const SelectedNucleotideInsertion: FunctionComponent<{
292
301
  );
293
302
  };
294
303
 
295
- type SelectedFilterProps<MutationType extends Mutation> = {
304
+ type SelectedFilterProps<MutationType extends MutationClass> = {
296
305
  mutation: MutationType;
297
306
  onDelete: (mutation: MutationType) => void;
298
307
  backgroundColor: string;
299
308
  textColor: string;
300
309
  };
301
310
 
302
- const SelectedFilter = <MutationType extends Mutation>({
311
+ const SelectedFilter = <MutationType extends MutationClass>({
303
312
  mutation,
304
313
  onDelete,
305
314
  backgroundColor,
@@ -1,7 +1,7 @@
1
1
  import { type SelectedFilters } from './mutation-filter';
2
2
  import { sequenceTypeFromSegment } from './sequenceTypeFromSegment';
3
3
  import type { ReferenceGenome } from '../../lapisApi/ReferenceGenome';
4
- import { Deletion, Insertion, Substitution } from '../../utils/mutations';
4
+ import { DeletionClass, InsertionClass, SubstitutionClass } from '../../utils/mutations';
5
5
 
6
6
  type ParsedMutationFilter = {
7
7
  [MutationType in keyof SelectedFilters]: { type: MutationType; value: SelectedFilters[MutationType][number] };
@@ -11,7 +11,7 @@ export const parseAndValidateMutation = (
11
11
  value: string,
12
12
  referenceGenome: ReferenceGenome,
13
13
  ): ParsedMutationFilter | null => {
14
- const possibleInsertion = Insertion.parse(value);
14
+ const possibleInsertion = InsertionClass.parse(value);
15
15
  if (possibleInsertion !== null) {
16
16
  const sequenceType = sequenceTypeFromSegment(possibleInsertion.segment, referenceGenome);
17
17
  switch (sequenceType) {
@@ -24,7 +24,7 @@ export const parseAndValidateMutation = (
24
24
  }
25
25
  }
26
26
 
27
- const possibleDeletion = Deletion.parse(value);
27
+ const possibleDeletion = DeletionClass.parse(value);
28
28
  if (possibleDeletion !== null) {
29
29
  const sequenceType = sequenceTypeFromSegment(possibleDeletion.segment, referenceGenome);
30
30
  switch (sequenceType) {
@@ -37,7 +37,7 @@ export const parseAndValidateMutation = (
37
37
  }
38
38
  }
39
39
 
40
- const possibleSubstitution = Substitution.parse(value);
40
+ const possibleSubstitution = SubstitutionClass.parse(value);
41
41
  if (possibleSubstitution !== null) {
42
42
  const sequenceType = sequenceTypeFromSegment(possibleSubstitution.segment, referenceGenome);
43
43
  switch (sequenceType) {