@genspectrum/dashboard-components 0.6.18 → 0.7.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.
Files changed (118) hide show
  1. package/README.md +5 -12
  2. package/custom-elements.json +22 -22
  3. package/dist/assets/mutationOverTimeWorker-BOCXtKzd.js.map +1 -0
  4. package/dist/dashboard-components.js +301 -302
  5. package/dist/dashboard-components.js.map +1 -1
  6. package/dist/genspectrum-components.d.ts +60 -10
  7. package/dist/style.css +3 -2
  8. package/package.json +13 -4
  9. package/src/index.ts +1 -0
  10. package/src/operator/FetchInsertionsOperator.ts +2 -2
  11. package/src/operator/FetchSubstitutionsOrDeletionsOperator.ts +3 -3
  12. package/src/preact/dateRangeSelector/computeInitialValues.spec.ts +53 -38
  13. package/src/preact/dateRangeSelector/computeInitialValues.ts +17 -23
  14. package/src/preact/dateRangeSelector/date-range-selector.stories.tsx +46 -32
  15. package/src/preact/dateRangeSelector/date-range-selector.tsx +24 -26
  16. package/src/preact/dateRangeSelector/dateRangeOption.ts +65 -0
  17. package/src/preact/dateRangeSelector/selectableOptions.ts +17 -66
  18. package/src/preact/mutationComparison/fetchMutationData.spec.ts +3 -3
  19. package/src/preact/mutationComparison/getMutationComparisonTableData.spec.ts +11 -11
  20. package/src/preact/mutationComparison/getMutationComparisonTableData.ts +4 -4
  21. package/src/preact/mutationComparison/mutation-comparison-table.tsx +2 -2
  22. package/src/preact/mutationFilter/mutation-filter.tsx +27 -18
  23. package/src/preact/mutationFilter/parseAndValidateMutation.ts +4 -4
  24. package/src/preact/mutationFilter/parseMutation.spec.ts +17 -17
  25. package/src/preact/mutations/getInsertionsTableData.spec.ts +3 -3
  26. package/src/preact/mutations/getMutationsGridData.spec.ts +9 -9
  27. package/src/preact/mutations/getMutationsTableData.spec.ts +7 -7
  28. package/src/preact/mutations/mutations-insertions-table.tsx +3 -3
  29. package/src/preact/mutations/mutations-table.tsx +3 -3
  30. package/src/preact/mutationsOverTime/MutationOverTimeData.ts +20 -0
  31. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutationsByDay.ts +45686 -0
  32. package/src/preact/mutationsOverTime/__mockData__/byWeek.ts +58989 -0
  33. package/src/preact/mutationsOverTime/__mockData__/defaultMockData.ts +103991 -0
  34. package/src/preact/mutationsOverTime/__mockData__/mockConversion.ts +54 -0
  35. package/src/preact/mutationsOverTime/__mockData__/showsMessageWhenTooManyMutations.ts +63690 -0
  36. package/src/preact/mutationsOverTime/getFilteredMutationsOverTime.spec.ts +177 -161
  37. package/src/preact/mutationsOverTime/getFilteredMutationsOverTimeData.ts +17 -59
  38. package/src/preact/mutationsOverTime/mutationOverTimeWorker.mock.ts +27 -0
  39. package/src/preact/mutationsOverTime/mutationOverTimeWorker.ts +29 -0
  40. package/src/preact/mutationsOverTime/mutations-over-time-grid.tsx +13 -14
  41. package/src/preact/mutationsOverTime/mutations-over-time.stories.tsx +9 -334
  42. package/src/preact/mutationsOverTime/mutations-over-time.tsx +59 -54
  43. package/src/preact/numberSequencesOverTime/getNumberOfSequencesOverTimeTableData.ts +3 -3
  44. package/src/preact/prevalenceOverTime/getPrevalenceOverTimeTableData.spec.ts +5 -5
  45. package/src/preact/prevalenceOverTime/prevalence-over-time-bubble-chart.tsx +1 -1
  46. package/src/preact/relativeGrowthAdvantage/relative-growth-advantage-chart.tsx +2 -2
  47. package/src/preact/shared/sort/sortInsertions.spec.ts +11 -11
  48. package/src/preact/shared/sort/sortInsertions.ts +2 -2
  49. package/src/preact/shared/sort/sortSubstitutionsAndDeletions.spec.ts +13 -13
  50. package/src/preact/shared/sort/sortSubstitutionsAndDeletions.ts +7 -4
  51. package/src/preact/webWorkers/useWebWorker.ts +51 -0
  52. package/src/preact/webWorkers/workerFunction.ts +14 -0
  53. package/src/query/queryAggregatedDataOverTime.ts +3 -3
  54. package/src/query/queryMutationsOverTime.spec.ts +272 -51
  55. package/src/query/queryMutationsOverTime.ts +114 -47
  56. package/src/query/queryPrevalenceOverTime.ts +2 -2
  57. package/src/query/queryRelativeGrowthAdvantage.ts +3 -3
  58. package/src/types.ts +25 -5
  59. package/src/utils/map2d.spec.ts +79 -12
  60. package/src/utils/map2d.ts +25 -5
  61. package/src/utils/mutations.spec.ts +20 -20
  62. package/src/utils/mutations.ts +80 -17
  63. package/src/utils/sort.ts +5 -2
  64. package/src/utils/temporal.spec.ts +27 -24
  65. package/src/utils/{temporal.ts → temporalClass.ts} +170 -72
  66. package/src/utils/temporalTestHelpers.ts +3 -3
  67. package/src/web-components/input/gs-date-range-selector.stories.ts +16 -28
  68. package/src/web-components/input/gs-date-range-selector.tsx +17 -32
  69. package/src/web-components/introduction.mdx +46 -0
  70. package/src/web-components/visualization/gs-mutations-over-time.stories.ts +6 -699
  71. package/src/web-components/visualization/gs-mutations-over-time.tsx +2 -2
  72. package/standalone-bundle/dashboard-components.js +12011 -12778
  73. package/standalone-bundle/dashboard-components.js.map +1 -1
  74. package/src/preact/mutationsOverTime/__mockData__/aggregated_2024_01.json +0 -13
  75. package/src/preact/mutationsOverTime/__mockData__/aggregated_2024_02.json +0 -13
  76. package/src/preact/mutationsOverTime/__mockData__/aggregated_2024_03.json +0 -13
  77. package/src/preact/mutationsOverTime/__mockData__/aggregated_2024_04.json +0 -13
  78. package/src/preact/mutationsOverTime/__mockData__/aggregated_2024_05.json +0 -13
  79. package/src/preact/mutationsOverTime/__mockData__/aggregated_2024_06.json +0 -13
  80. package/src/preact/mutationsOverTime/__mockData__/aggregated_2024_07.json +0 -13
  81. package/src/preact/mutationsOverTime/__mockData__/aggregated_20_01_2024.json +0 -13
  82. package/src/preact/mutationsOverTime/__mockData__/aggregated_21_01_2024.json +0 -13
  83. package/src/preact/mutationsOverTime/__mockData__/aggregated_22_01_2024.json +0 -13
  84. package/src/preact/mutationsOverTime/__mockData__/aggregated_23_01_2024.json +0 -13
  85. package/src/preact/mutationsOverTime/__mockData__/aggregated_24_01_2024.json +0 -13
  86. package/src/preact/mutationsOverTime/__mockData__/aggregated_25_01_2024.json +0 -13
  87. package/src/preact/mutationsOverTime/__mockData__/aggregated_26_01_2024.json +0 -13
  88. package/src/preact/mutationsOverTime/__mockData__/aggregated_byDay.json +0 -38
  89. package/src/preact/mutationsOverTime/__mockData__/aggregated_byWeek.json +0 -122
  90. package/src/preact/mutationsOverTime/__mockData__/aggregated_date.json +0 -642
  91. package/src/preact/mutationsOverTime/__mockData__/aggregated_tooManyMutations.json +0 -1470
  92. package/src/preact/mutationsOverTime/__mockData__/aggregated_tooManyMutations_total.json +0 -13
  93. package/src/preact/mutationsOverTime/__mockData__/aggregated_week3_2024.json +0 -13
  94. package/src/preact/mutationsOverTime/__mockData__/aggregated_week4_2024.json +0 -13
  95. package/src/preact/mutationsOverTime/__mockData__/aggregated_week5_2024.json +0 -13
  96. package/src/preact/mutationsOverTime/__mockData__/aggregated_week6_2024.json +0 -13
  97. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutations_20_01_2024.json +0 -6778
  98. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutations_21_01_2024.json +0 -7129
  99. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutations_22_01_2024.json +0 -4681
  100. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutations_23_01_2024.json +0 -10738
  101. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutations_24_01_2024.json +0 -11710
  102. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutations_25_01_2024.json +0 -11557
  103. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutations_26_01_2024.json +0 -8596
  104. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutations_byDayOverall.json +0 -4726
  105. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_2024_01.json +0 -1747
  106. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_2024_02.json +0 -1774
  107. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_2024_03.json +0 -1819
  108. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_2024_04.json +0 -1864
  109. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_2024_05.json +0 -1927
  110. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_2024_06.json +0 -1864
  111. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_2024_07.json +0 -9
  112. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_byMonthOverall.json +0 -11143
  113. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_byWeekOverall.json +0 -9154
  114. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_tooManyMutations.json +0 -16453
  115. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_week3_2024.json +0 -8812
  116. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_week4_2024.json +0 -9730
  117. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_week5_2024.json +0 -9865
  118. package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_week6_2024.json +0 -11314
@@ -1,7 +1,7 @@
1
1
  import { describe, expect, it } from 'vitest';
2
2
 
3
3
  import { parseAndValidateMutation } from './parseAndValidateMutation';
4
- import { Deletion, Insertion, Substitution } from '../../utils/mutations';
4
+ import { DeletionClass, InsertionClass, SubstitutionClass } from '../../utils/mutations';
5
5
 
6
6
  describe('parseMutation', () => {
7
7
  const singleSegmentedReferenceGenome = {
@@ -28,22 +28,22 @@ describe('parseMutation', () => {
28
28
  {
29
29
  name: 'should parse nucleotide insertions',
30
30
  input: 'ins_10:ACGT',
31
- expected: { type: 'nucleotideInsertions', value: new Insertion(undefined, 10, 'ACGT') },
31
+ expected: { type: 'nucleotideInsertions', value: new InsertionClass(undefined, 10, 'ACGT') },
32
32
  },
33
33
  {
34
34
  name: 'should parse amino acid insertions',
35
35
  input: 'ins_gene1:10:ACGT',
36
- expected: { type: 'aminoAcidInsertions', value: new Insertion('gene1', 10, 'ACGT') },
36
+ expected: { type: 'aminoAcidInsertions', value: new InsertionClass('gene1', 10, 'ACGT') },
37
37
  },
38
38
  {
39
39
  name: 'should parse amino acid insertion with LAPIS-style wildcard',
40
40
  input: 'ins_gene1:10:?AC?GT',
41
- expected: { type: 'aminoAcidInsertions', value: new Insertion('gene1', 10, '?AC?GT') },
41
+ expected: { type: 'aminoAcidInsertions', value: new InsertionClass('gene1', 10, '?AC?GT') },
42
42
  },
43
43
  {
44
44
  name: 'should parse amino acid insertion with SILO-style wildcard',
45
45
  input: 'ins_gene1:10:.*AC.*GT',
46
- expected: { type: 'aminoAcidInsertions', value: new Insertion('gene1', 10, '.*AC.*GT') },
46
+ expected: { type: 'aminoAcidInsertions', value: new InsertionClass('gene1', 10, '.*AC.*GT') },
47
47
  },
48
48
  {
49
49
  name: 'should return null for insertion with segment not in reference genome',
@@ -56,32 +56,32 @@ describe('parseMutation', () => {
56
56
  {
57
57
  name: 'should parse nucleotide deletion in single segmented reference genome, when no segment is given',
58
58
  input: 'A123-',
59
- expected: { type: 'nucleotideMutations', value: new Deletion(undefined, 'A', 123) },
59
+ expected: { type: 'nucleotideMutations', value: new DeletionClass(undefined, 'A', 123) },
60
60
  },
61
61
  {
62
62
  name: 'should parse nucleotide deletion without valueAtReference when no segment is given',
63
63
  input: '123-',
64
- expected: { type: 'nucleotideMutations', value: new Deletion(undefined, undefined, 123) },
64
+ expected: { type: 'nucleotideMutations', value: new DeletionClass(undefined, undefined, 123) },
65
65
  },
66
66
  {
67
67
  name: 'should parse nucleotide deletion',
68
68
  input: 'nuc1:A123-',
69
- expected: { type: 'nucleotideMutations', value: new Deletion('nuc1', 'A', 123) },
69
+ expected: { type: 'nucleotideMutations', value: new DeletionClass('nuc1', 'A', 123) },
70
70
  },
71
71
  {
72
72
  name: 'should parse nucleotide deletion without valueAtReference',
73
73
  input: 'nuc1:123-',
74
- expected: { type: 'nucleotideMutations', value: new Deletion('nuc1', undefined, 123) },
74
+ expected: { type: 'nucleotideMutations', value: new DeletionClass('nuc1', undefined, 123) },
75
75
  },
76
76
  {
77
77
  name: 'should parse amino acid deletion',
78
78
  input: 'gene1:A123-',
79
- expected: { type: 'aminoAcidMutations', value: new Deletion('gene1', 'A', 123) },
79
+ expected: { type: 'aminoAcidMutations', value: new DeletionClass('gene1', 'A', 123) },
80
80
  },
81
81
  {
82
82
  name: 'should parse amino acid deletion without valueAtReference',
83
83
  input: 'gene1:123-',
84
- expected: { type: 'aminoAcidMutations', value: new Deletion('gene1', undefined, 123) },
84
+ expected: { type: 'aminoAcidMutations', value: new DeletionClass('gene1', undefined, 123) },
85
85
  },
86
86
  {
87
87
  name: 'should return null for deletion with segment not in reference genome',
@@ -93,35 +93,35 @@ describe('parseMutation', () => {
93
93
  {
94
94
  name: 'should parse nucleotide substitution in single segmented reference genome, when no segment is given',
95
95
  input: 'A123T',
96
- expected: { type: 'nucleotideMutations', value: new Substitution(undefined, 'A', 'T', 123) },
96
+ expected: { type: 'nucleotideMutations', value: new SubstitutionClass(undefined, 'A', 'T', 123) },
97
97
  },
98
98
  {
99
99
  name: 'should parse substitution without valueAtReference',
100
100
  input: '123T',
101
- expected: { type: 'nucleotideMutations', value: new Substitution(undefined, undefined, 'T', 123) },
101
+ expected: { type: 'nucleotideMutations', value: new SubstitutionClass(undefined, undefined, 'T', 123) },
102
102
  },
103
103
  {
104
104
  name: 'should parse substitution with neither valueAtReference not substitutionValue',
105
105
  input: '123',
106
106
  expected: {
107
107
  type: 'nucleotideMutations',
108
- value: new Substitution(undefined, undefined, undefined, 123),
108
+ value: new SubstitutionClass(undefined, undefined, undefined, 123),
109
109
  },
110
110
  },
111
111
  {
112
112
  name: 'should parse a "no mutation" substitution',
113
113
  input: '123.',
114
- expected: { type: 'nucleotideMutations', value: new Substitution(undefined, undefined, '.', 123) },
114
+ expected: { type: 'nucleotideMutations', value: new SubstitutionClass(undefined, undefined, '.', 123) },
115
115
  },
116
116
  {
117
117
  name: 'should parse nucleotide substitution',
118
118
  input: 'nuc1:A123T',
119
- expected: { type: 'nucleotideMutations', value: new Substitution('nuc1', 'A', 'T', 123) },
119
+ expected: { type: 'nucleotideMutations', value: new SubstitutionClass('nuc1', 'A', 'T', 123) },
120
120
  },
121
121
  {
122
122
  name: 'should parse amino acid substitution',
123
123
  input: 'gene1:A123T',
124
- expected: { type: 'aminoAcidMutations', value: new Substitution('gene1', 'A', 'T', 123) },
124
+ expected: { type: 'aminoAcidMutations', value: new SubstitutionClass('gene1', 'A', 'T', 123) },
125
125
  },
126
126
  {
127
127
  name: 'should return null for substitution with segment not in reference genome',
@@ -1,12 +1,12 @@
1
1
  import { describe, expect, test } from 'vitest';
2
2
 
3
3
  import { getInsertionsTableData } from './getInsertionsTableData';
4
- import { Insertion } from '../../utils/mutations';
4
+ import { InsertionClass } from '../../utils/mutations';
5
5
 
6
6
  describe('getInsertionsTableData', () => {
7
7
  test('should return the correct data', () => {
8
- const insertion1 = new Insertion('segment1', 123, 'T');
9
- const insertion2 = new Insertion('segment2', 234, 'AAA');
8
+ const insertion1 = new InsertionClass('segment1', 123, 'T');
9
+ const insertion2 = new InsertionClass('segment2', 234, 'AAA');
10
10
  const data = [
11
11
  {
12
12
  type: 'insertion' as const,
@@ -1,32 +1,32 @@
1
1
  import { describe, expect, test } from 'vitest';
2
2
 
3
3
  import { type BasesData, getMutationsGridData, type MutationsGridDataRow } from './getMutationsGridData';
4
- import { Deletion, Substitution } from '../../utils/mutations';
4
+ import { DeletionClass, SubstitutionClass } from '../../utils/mutations';
5
5
 
6
6
  describe('getMutationsGridData', () => {
7
7
  test('should return the correct data', () => {
8
8
  const data = [
9
9
  {
10
10
  type: 'substitution' as const,
11
- mutation: new Substitution(undefined, 'T', 'C', 123),
11
+ mutation: new SubstitutionClass(undefined, 'T', 'C', 123),
12
12
  count: 1,
13
13
  proportion: 0.9,
14
14
  },
15
15
  {
16
16
  type: 'substitution' as const,
17
- mutation: new Substitution(undefined, 'T', 'C', 234),
17
+ mutation: new SubstitutionClass(undefined, 'T', 'C', 234),
18
18
  count: 1,
19
19
  proportion: 0.8,
20
20
  },
21
21
  {
22
22
  type: 'substitution' as const,
23
- mutation: new Substitution(undefined, 'T', 'G', 234),
23
+ mutation: new SubstitutionClass(undefined, 'T', 'G', 234),
24
24
  count: 1,
25
25
  proportion: 0.05,
26
26
  },
27
27
  {
28
28
  type: 'deletion' as const,
29
- mutation: new Deletion(undefined, 'T', 234),
29
+ mutation: new DeletionClass(undefined, 'T', 234),
30
30
  count: 2,
31
31
  proportion: 0.1,
32
32
  },
@@ -70,25 +70,25 @@ describe('getMutationsGridData', () => {
70
70
  const data = [
71
71
  {
72
72
  type: 'substitution' as const,
73
- mutation: new Substitution(undefined, 'T', 'C', 123),
73
+ mutation: new SubstitutionClass(undefined, 'T', 'C', 123),
74
74
  count: 1,
75
75
  proportion: aboveInterval,
76
76
  },
77
77
  {
78
78
  type: 'substitution' as const,
79
- mutation: new Substitution(undefined, 'T', 'C', 234),
79
+ mutation: new SubstitutionClass(undefined, 'T', 'C', 234),
80
80
  count: 1,
81
81
  proportion: inInterval,
82
82
  },
83
83
  {
84
84
  type: 'substitution' as const,
85
- mutation: new Substitution(undefined, 'T', 'G', 234),
85
+ mutation: new SubstitutionClass(undefined, 'T', 'G', 234),
86
86
  count: 1,
87
87
  proportion: belowInterval,
88
88
  },
89
89
  {
90
90
  type: 'deletion' as const,
91
- mutation: new Deletion(undefined, 'T', 234),
91
+ mutation: new DeletionClass(undefined, 'T', 234),
92
92
  count: 2,
93
93
  proportion: belowInterval,
94
94
  },
@@ -1,20 +1,20 @@
1
1
  import { describe, expect, test } from 'vitest';
2
2
 
3
3
  import { getMutationsTableData } from './getMutationsTableData';
4
- import { Deletion, Substitution } from '../../utils/mutations';
4
+ import { DeletionClass, SubstitutionClass } from '../../utils/mutations';
5
5
 
6
6
  describe('getMutationsTableData', () => {
7
7
  test('should not filter anything, when proportions are in interval', () => {
8
8
  const data = [
9
9
  {
10
10
  type: 'substitution' as const,
11
- mutation: new Substitution('segment1', 'A', 'T', 123),
11
+ mutation: new SubstitutionClass('segment1', 'A', 'T', 123),
12
12
  count: 1,
13
13
  proportion: 0.1,
14
14
  },
15
15
  {
16
16
  type: 'deletion' as const,
17
- mutation: new Deletion('segment2', 'C', 123),
17
+ mutation: new DeletionClass('segment2', 'C', 123),
18
18
  count: 2,
19
19
  proportion: 0.2,
20
20
  },
@@ -32,8 +32,8 @@ describe('getMutationsTableData', () => {
32
32
  const aboveInterval = 0.95;
33
33
  const inInterval = 0.5;
34
34
 
35
- const substitutionInInterval = new Substitution('segment1', 'A', 'T', 123);
36
- const deletionInInterval = new Deletion('segment2', 'C', 123);
35
+ const substitutionInInterval = new SubstitutionClass('segment1', 'A', 'T', 123);
36
+ const deletionInInterval = new DeletionClass('segment2', 'C', 123);
37
37
 
38
38
  const data = [
39
39
  {
@@ -44,7 +44,7 @@ describe('getMutationsTableData', () => {
44
44
  },
45
45
  {
46
46
  type: 'substitution' as const,
47
- mutation: new Substitution('segment1', 'A', 'T', 234),
47
+ mutation: new SubstitutionClass('segment1', 'A', 'T', 234),
48
48
  count: 1,
49
49
  proportion: belowInterval,
50
50
  },
@@ -56,7 +56,7 @@ describe('getMutationsTableData', () => {
56
56
  },
57
57
  {
58
58
  type: 'deletion' as const,
59
- mutation: new Deletion('segment2', 'C', 456),
59
+ mutation: new DeletionClass('segment2', 'C', 456),
60
60
  count: 2,
61
61
  proportion: aboveInterval,
62
62
  },
@@ -2,7 +2,7 @@ import { type FunctionComponent } from 'preact';
2
2
 
3
3
  import { getInsertionsTableData } from './getInsertionsTableData';
4
4
  import { type InsertionEntry } from '../../types';
5
- import { type Insertion } from '../../utils/mutations';
5
+ import { type InsertionClass } from '../../utils/mutations';
6
6
  import { Table } from '../components/table';
7
7
  import { sortInsertions } from '../shared/sort/sortInsertions';
8
8
 
@@ -17,11 +17,11 @@ export const InsertionsTable: FunctionComponent<InsertionsTableProps> = ({ data,
17
17
  {
18
18
  name: 'Insertion',
19
19
  sort: {
20
- compare: (a: Insertion, b: Insertion) => {
20
+ compare: (a: InsertionClass, b: InsertionClass) => {
21
21
  return sortInsertions(a, b);
22
22
  },
23
23
  },
24
- formatter: (cell: Insertion) => cell.toString(),
24
+ formatter: (cell: InsertionClass) => cell.toString(),
25
25
  },
26
26
  {
27
27
  name: 'Count',
@@ -2,7 +2,7 @@ import { type FunctionComponent } from 'preact';
2
2
 
3
3
  import { getMutationsTableData } from './getMutationsTableData';
4
4
  import { type SubstitutionOrDeletionEntry } from '../../types';
5
- import { type Deletion, type Substitution } from '../../utils/mutations';
5
+ import { type DeletionClass, type SubstitutionClass } from '../../utils/mutations';
6
6
  import type { ProportionInterval } from '../components/proportion-selector';
7
7
  import { Table } from '../components/table';
8
8
  import { sortSubstitutionsAndDeletions } from '../shared/sort/sortSubstitutionsAndDeletions';
@@ -20,11 +20,11 @@ const MutationsTable: FunctionComponent<MutationsTableProps> = ({ data, proporti
20
20
  {
21
21
  name: 'Mutation',
22
22
  sort: {
23
- compare: (a: Substitution | Deletion, b: Substitution | Deletion) => {
23
+ compare: (a: SubstitutionClass | DeletionClass, b: SubstitutionClass | DeletionClass) => {
24
24
  return sortSubstitutionsAndDeletions(a, b);
25
25
  },
26
26
  },
27
- formatter: (cell: Substitution | Deletion) => cell.toString(),
27
+ formatter: (cell: SubstitutionClass | DeletionClass) => cell.toString(),
28
28
  },
29
29
  {
30
30
  name: 'Type',
@@ -0,0 +1,20 @@
1
+ import {
2
+ type MutationOverTimeMutationValue,
3
+ serializeSubstitutionOrDeletion,
4
+ serializeTemporal,
5
+ } from '../../query/queryMutationsOverTime';
6
+ import { type Map2d, Map2dBase, type Map2DContents } from '../../utils/map2d';
7
+ import type { Deletion, Substitution } from '../../utils/mutations';
8
+ import type { Temporal } from '../../utils/temporalClass';
9
+
10
+ export type MutationOverTimeDataMap = Map2d<Substitution | Deletion, Temporal, MutationOverTimeMutationValue>;
11
+
12
+ export class BaseMutationOverTimeDataMap extends Map2dBase<
13
+ Substitution | Deletion,
14
+ Temporal,
15
+ MutationOverTimeMutationValue
16
+ > {
17
+ constructor(initialContent?: Map2DContents<Substitution | Deletion, Temporal, MutationOverTimeMutationValue>) {
18
+ super(serializeSubstitutionOrDeletion, serializeTemporal, initialContent);
19
+ }
20
+ }