@genspectrum/dashboard-components 0.6.13 → 0.6.15

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 (78) hide show
  1. package/README.md +29 -0
  2. package/custom-elements.json +23 -17
  3. package/dist/dashboard-components.js +8237 -37898
  4. package/dist/dashboard-components.js.map +1 -1
  5. package/dist/genspectrum-components.d.ts +26 -8
  6. package/dist/style.css +3 -3
  7. package/package.json +9 -8
  8. package/src/index.ts +8 -0
  9. package/src/lapisApi/lapisApi.ts +15 -7
  10. package/src/operator/FetchAggregatedOperator.ts +2 -7
  11. package/src/preact/components/color-scale-selector-dropdown.stories.tsx +1 -1
  12. package/src/preact/components/error-boundary.stories.tsx +21 -4
  13. package/src/preact/components/error-display.stories.tsx +20 -2
  14. package/src/preact/components/error-display.tsx +64 -10
  15. package/src/preact/components/info.stories.tsx +5 -5
  16. package/src/preact/components/info.tsx +2 -4
  17. package/src/preact/components/percent-intput.tsx +7 -2
  18. package/src/preact/components/proportion-selector.tsx +12 -2
  19. package/src/preact/dateRangeSelector/date-range-selector.stories.tsx +2 -3
  20. package/src/preact/dateRangeSelector/date-range-selector.tsx +4 -4
  21. package/src/preact/lineageFilter/lineage-filter.stories.tsx +2 -3
  22. package/src/preact/lineageFilter/lineage-filter.tsx +2 -2
  23. package/src/preact/locationFilter/fetchAutocompletionList.ts +1 -14
  24. package/src/preact/locationFilter/location-filter.stories.tsx +2 -3
  25. package/src/preact/locationFilter/location-filter.tsx +2 -2
  26. package/src/preact/mutationFilter/mutation-filter.stories.tsx +2 -3
  27. package/src/preact/mutationsOverTime/__mockData__/aggregated_2024_01.json +13 -0
  28. package/src/preact/mutationsOverTime/__mockData__/aggregated_2024_02.json +13 -0
  29. package/src/preact/mutationsOverTime/__mockData__/aggregated_2024_03.json +13 -0
  30. package/src/preact/mutationsOverTime/__mockData__/aggregated_2024_04.json +13 -0
  31. package/src/preact/mutationsOverTime/__mockData__/aggregated_2024_05.json +13 -0
  32. package/src/preact/mutationsOverTime/__mockData__/aggregated_2024_06.json +13 -0
  33. package/src/preact/mutationsOverTime/__mockData__/aggregated_2024_07.json +13 -0
  34. package/src/preact/mutationsOverTime/__mockData__/aggregated_20_01_2024.json +13 -0
  35. package/src/preact/mutationsOverTime/__mockData__/aggregated_21_01_2024.json +13 -0
  36. package/src/preact/mutationsOverTime/__mockData__/aggregated_22_01_2024.json +13 -0
  37. package/src/preact/mutationsOverTime/__mockData__/aggregated_23_01_2024.json +13 -0
  38. package/src/preact/mutationsOverTime/__mockData__/aggregated_24_01_2024.json +13 -0
  39. package/src/preact/mutationsOverTime/__mockData__/aggregated_25_01_2024.json +13 -0
  40. package/src/preact/mutationsOverTime/__mockData__/aggregated_26_01_2024.json +13 -0
  41. package/src/preact/mutationsOverTime/__mockData__/aggregated_tooManyMutations_total.json +13 -0
  42. package/src/preact/mutationsOverTime/__mockData__/aggregated_week3_2024.json +13 -0
  43. package/src/preact/mutationsOverTime/__mockData__/aggregated_week4_2024.json +13 -0
  44. package/src/preact/mutationsOverTime/__mockData__/aggregated_week5_2024.json +13 -0
  45. package/src/preact/mutationsOverTime/__mockData__/aggregated_week6_2024.json +13 -0
  46. package/src/preact/mutationsOverTime/getFilteredMutationsOverTime.spec.ts +56 -8
  47. package/src/preact/mutationsOverTime/mutations-over-time-grid.tsx +4 -2
  48. package/src/preact/mutationsOverTime/mutations-over-time.stories.tsx +135 -0
  49. package/src/preact/prevalenceOverTime/prevalence-over-time.tsx +3 -3
  50. package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.tsx +1 -1
  51. package/src/preact/shared/floating-ui/hooks.ts +1 -1
  52. package/src/preact/textInput/text-input.stories.tsx +2 -3
  53. package/src/preact/textInput/text-input.tsx +2 -2
  54. package/src/query/queryMutationsOverTime.spec.ts +210 -64
  55. package/src/query/queryMutationsOverTime.ts +10 -2
  56. package/src/web-components/app.stories.ts +0 -2
  57. package/src/web-components/errorHandling.mdx +8 -0
  58. package/src/web-components/input/gs-date-range-selector.stories.ts +2 -3
  59. package/src/web-components/input/gs-date-range-selector.tsx +24 -4
  60. package/src/web-components/input/gs-lineage-filter.stories.ts +2 -3
  61. package/src/web-components/input/gs-lineage-filter.tsx +15 -1
  62. package/src/web-components/input/gs-location-filter.stories.ts +2 -3
  63. package/src/web-components/input/gs-location-filter.tsx +13 -1
  64. package/src/web-components/input/gs-mutation-filter.stories.ts +2 -3
  65. package/src/web-components/input/gs-mutation-filter.tsx +1 -0
  66. package/src/web-components/input/gs-text-input.stories.ts +2 -3
  67. package/src/web-components/input/gs-text-input.tsx +13 -1
  68. package/src/web-components/visualization/gs-aggregate.tsx +17 -1
  69. package/src/web-components/visualization/gs-mutation-comparison.tsx +9 -0
  70. package/src/web-components/visualization/gs-mutations-over-time.stories.ts +271 -0
  71. package/src/web-components/visualization/gs-mutations-over-time.tsx +7 -0
  72. package/src/web-components/visualization/gs-mutations.tsx +11 -5
  73. package/src/web-components/visualization/gs-number-sequences-over-time.tsx +15 -0
  74. package/src/web-components/visualization/gs-prevalence-over-time.stories.ts +8 -9
  75. package/src/web-components/visualization/gs-prevalence-over-time.tsx +26 -8
  76. package/src/web-components/visualization/gs-relative-growth-advantage.tsx +43 -5
  77. package/standalone-bundle/dashboard-components.js +30920 -0
  78. package/standalone-bundle/dashboard-components.js.map +1 -0
@@ -12,8 +12,8 @@ import { useQuery } from '../useQuery';
12
12
 
13
13
  export interface LineageFilterInnerProps {
14
14
  lapisField: string;
15
- placeholderText?: string;
16
- initialValue?: string;
15
+ placeholderText: string;
16
+ initialValue: string;
17
17
  }
18
18
 
19
19
  export interface LineageFilterProps extends LineageFilterInnerProps {
@@ -1,6 +1,4 @@
1
- import { LapisError } from '../../lapisApi/lapisApi';
2
1
  import { FetchAggregatedOperator } from '../../operator/FetchAggregatedOperator';
3
- import { UserFacingError } from '../components/error-display';
4
2
 
5
3
  export async function fetchAutocompletionList(fields: string[], lapis: string, signal?: AbortSignal) {
6
4
  const toAncestorInHierarchyOverwriteValues = Array(fields.length - 1)
@@ -10,18 +8,7 @@ export async function fetchAutocompletionList(fields: string[], lapis: string, s
10
8
 
11
9
  const fetchAggregatedOperator = new FetchAggregatedOperator<Record<string, string | null>>({}, fields);
12
10
 
13
- let data;
14
- try {
15
- data = (await fetchAggregatedOperator.evaluate(lapis, signal)).content;
16
- } catch (error) {
17
- if (error instanceof LapisError) {
18
- throw new UserFacingError(
19
- `Failed to fetch autocomplete list from LAPIS: ${error.problemDetail.status} ${error.problemDetail.title ?? ''}`,
20
- error.problemDetail.detail ?? error.message,
21
- );
22
- }
23
- throw error;
24
- }
11
+ const data = (await fetchAggregatedOperator.evaluate(lapis, signal)).content;
25
12
 
26
13
  const locationValues = data
27
14
  .map((entry) => fields.reduce((acc, field) => ({ ...acc, [field]: entry[field] }), {}))
@@ -1,8 +1,8 @@
1
- import { withActions } from '@storybook/addon-actions/decorator';
2
1
  import { type Meta, type StoryObj } from '@storybook/preact';
3
2
 
4
3
  import data from './__mockData__/aggregated.json';
5
4
  import { LocationFilter, type LocationFilterProps } from './location-filter';
5
+ import { previewHandles } from '../../../.storybook/preview';
6
6
  import { AGGREGATED_ENDPOINT, LAPIS_URL } from '../../constants';
7
7
  import { LapisUrlContext } from '../LapisUrlContext';
8
8
 
@@ -28,7 +28,7 @@ const meta: Meta<LocationFilterProps> = {
28
28
  ],
29
29
  },
30
30
  actions: {
31
- handles: ['gs-location-changed'],
31
+ handles: ['gs-location-changed', ...previewHandles],
32
32
  },
33
33
  },
34
34
  args: {
@@ -59,7 +59,6 @@ const meta: Meta<LocationFilterProps> = {
59
59
  },
60
60
  },
61
61
  },
62
- decorators: [withActions],
63
62
  };
64
63
 
65
64
  export default meta;
@@ -11,8 +11,8 @@ import { ResizeContainer } from '../components/resize-container';
11
11
  import { useQuery } from '../useQuery';
12
12
 
13
13
  export interface LocationFilterInnerProps {
14
- initialValue?: string;
15
- placeholderText?: string;
14
+ initialValue: string;
15
+ placeholderText: string;
16
16
  fields: string[];
17
17
  }
18
18
 
@@ -1,9 +1,9 @@
1
- import { withActions } from '@storybook/addon-actions/decorator';
2
1
  import { type Meta, type PreactRenderer, type StoryObj } from '@storybook/preact';
3
2
  import { expect, fireEvent, fn, userEvent, waitFor, within } from '@storybook/test';
4
3
  import { type StepFunction } from '@storybook/types';
5
4
 
6
5
  import { MutationFilter, type MutationFilterProps } from './mutation-filter';
6
+ import { previewHandles } from '../../../.storybook/preview';
7
7
  import { LAPIS_URL } from '../../constants';
8
8
  import referenceGenome from '../../lapisApi/__mockData__/referenceGenome.json';
9
9
  import { LapisUrlContext } from '../LapisUrlContext';
@@ -14,7 +14,7 @@ const meta: Meta<MutationFilterProps> = {
14
14
  component: MutationFilter,
15
15
  parameters: {
16
16
  actions: {
17
- handles: ['gs-mutation-filter-changed', 'gs-mutation-filter-on-blur'],
17
+ handles: ['gs-mutation-filter-changed', 'gs-mutation-filter-on-blur', ...previewHandles],
18
18
  },
19
19
  fetchMock: {},
20
20
  },
@@ -26,7 +26,6 @@ const meta: Meta<MutationFilterProps> = {
26
26
  },
27
27
  },
28
28
  },
29
- decorators: [withActions],
30
29
  };
31
30
 
32
31
  export default meta;
@@ -0,0 +1,13 @@
1
+ {
2
+ "data": [
3
+ {
4
+ "count": 25800
5
+ }
6
+ ],
7
+ "info": {
8
+ "dataVersion": "1722452937",
9
+ "requestId": "aede768e-d9d1-4273-9a74-992986554995",
10
+ "requestInfo": "sars_cov-2_nextstrain_open on lapis.cov-spectrum.org at 2024-08-02T06:57:09.319474043",
11
+ "reportTo": "Please report to https://github.com/GenSpectrum/LAPIS/issues in case you encounter any unexpected issues. Please include the request ID and the requestInfo in your report."
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "data": [
3
+ {
4
+ "count": 16673
5
+ }
6
+ ],
7
+ "info": {
8
+ "dataVersion": "1722452937",
9
+ "requestId": "aede768e-d9d1-4273-9a74-992986554995",
10
+ "requestInfo": "sars_cov-2_nextstrain_open on lapis.cov-spectrum.org at 2024-08-02T06:57:09.319474043",
11
+ "reportTo": "Please report to https://github.com/GenSpectrum/LAPIS/issues in case you encounter any unexpected issues. Please include the request ID and the requestInfo in your report."
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "data": [
3
+ {
4
+ "count": 7931
5
+ }
6
+ ],
7
+ "info": {
8
+ "dataVersion": "1722452937",
9
+ "requestId": "aede768e-d9d1-4273-9a74-992986554995",
10
+ "requestInfo": "sars_cov-2_nextstrain_open on lapis.cov-spectrum.org at 2024-08-02T06:57:09.319474043",
11
+ "reportTo": "Please report to https://github.com/GenSpectrum/LAPIS/issues in case you encounter any unexpected issues. Please include the request ID and the requestInfo in your report."
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "data": [
3
+ {
4
+ "count": 2947
5
+ }
6
+ ],
7
+ "info": {
8
+ "dataVersion": "1722452937",
9
+ "requestId": "aede768e-d9d1-4273-9a74-992986554995",
10
+ "requestInfo": "sars_cov-2_nextstrain_open on lapis.cov-spectrum.org at 2024-08-02T06:57:09.319474043",
11
+ "reportTo": "Please report to https://github.com/GenSpectrum/LAPIS/issues in case you encounter any unexpected issues. Please include the request ID and the requestInfo in your report."
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "data": [
3
+ {
4
+ "count": 2424
5
+ }
6
+ ],
7
+ "info": {
8
+ "dataVersion": "1722452937",
9
+ "requestId": "aede768e-d9d1-4273-9a74-992986554995",
10
+ "requestInfo": "sars_cov-2_nextstrain_open on lapis.cov-spectrum.org at 2024-08-02T06:57:09.319474043",
11
+ "reportTo": "Please report to https://github.com/GenSpectrum/LAPIS/issues in case you encounter any unexpected issues. Please include the request ID and the requestInfo in your report."
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "data": [
3
+ {
4
+ "count": 2890
5
+ }
6
+ ],
7
+ "info": {
8
+ "dataVersion": "1722452937",
9
+ "requestId": "aede768e-d9d1-4273-9a74-992986554995",
10
+ "requestInfo": "sars_cov-2_nextstrain_open on lapis.cov-spectrum.org at 2024-08-02T06:57:09.319474043",
11
+ "reportTo": "Please report to https://github.com/GenSpectrum/LAPIS/issues in case you encounter any unexpected issues. Please include the request ID and the requestInfo in your report."
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "data": [
3
+ {
4
+ "count": 0
5
+ }
6
+ ],
7
+ "info": {
8
+ "dataVersion": "1722452937",
9
+ "requestId": "aede768e-d9d1-4273-9a74-992986554995",
10
+ "requestInfo": "sars_cov-2_nextstrain_open on lapis.cov-spectrum.org at 2024-08-02T06:57:09.319474043",
11
+ "reportTo": "Please report to https://github.com/GenSpectrum/LAPIS/issues in case you encounter any unexpected issues. Please include the request ID and the requestInfo in your report."
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "data": [
3
+ {
4
+ "count": 456
5
+ }
6
+ ],
7
+ "info": {
8
+ "dataVersion": "1722452937",
9
+ "requestId": "aede768e-d9d1-4273-9a74-992986554995",
10
+ "requestInfo": "sars_cov-2_nextstrain_open on lapis.cov-spectrum.org at 2024-08-02T06:57:09.319474043",
11
+ "reportTo": "Please report to https://github.com/GenSpectrum/LAPIS/issues in case you encounter any unexpected issues. Please include the request ID and the requestInfo in your report."
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "data": [
3
+ {
4
+ "count": 533
5
+ }
6
+ ],
7
+ "info": {
8
+ "dataVersion": "1722452937",
9
+ "requestId": "aede768e-d9d1-4273-9a74-992986554995",
10
+ "requestInfo": "sars_cov-2_nextstrain_open on lapis.cov-spectrum.org at 2024-08-02T06:57:09.319474043",
11
+ "reportTo": "Please report to https://github.com/GenSpectrum/LAPIS/issues in case you encounter any unexpected issues. Please include the request ID and the requestInfo in your report."
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "data": [
3
+ {
4
+ "count": 1107
5
+ }
6
+ ],
7
+ "info": {
8
+ "dataVersion": "1722452937",
9
+ "requestId": "aede768e-d9d1-4273-9a74-992986554995",
10
+ "requestInfo": "sars_cov-2_nextstrain_open on lapis.cov-spectrum.org at 2024-08-02T06:57:09.319474043",
11
+ "reportTo": "Please report to https://github.com/GenSpectrum/LAPIS/issues in case you encounter any unexpected issues. Please include the request ID and the requestInfo in your report."
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "data": [
3
+ {
4
+ "count": 1020
5
+ }
6
+ ],
7
+ "info": {
8
+ "dataVersion": "1722452937",
9
+ "requestId": "aede768e-d9d1-4273-9a74-992986554995",
10
+ "requestInfo": "sars_cov-2_nextstrain_open on lapis.cov-spectrum.org at 2024-08-02T06:57:09.319474043",
11
+ "reportTo": "Please report to https://github.com/GenSpectrum/LAPIS/issues in case you encounter any unexpected issues. Please include the request ID and the requestInfo in your report."
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "data": [
3
+ {
4
+ "count": 880
5
+ }
6
+ ],
7
+ "info": {
8
+ "dataVersion": "1722452937",
9
+ "requestId": "aede768e-d9d1-4273-9a74-992986554995",
10
+ "requestInfo": "sars_cov-2_nextstrain_open on lapis.cov-spectrum.org at 2024-08-02T06:57:09.319474043",
11
+ "reportTo": "Please report to https://github.com/GenSpectrum/LAPIS/issues in case you encounter any unexpected issues. Please include the request ID and the requestInfo in your report."
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "data": [
3
+ {
4
+ "count": 832
5
+ }
6
+ ],
7
+ "info": {
8
+ "dataVersion": "1722452937",
9
+ "requestId": "aede768e-d9d1-4273-9a74-992986554995",
10
+ "requestInfo": "sars_cov-2_nextstrain_open on lapis.cov-spectrum.org at 2024-08-02T06:57:09.319474043",
11
+ "reportTo": "Please report to https://github.com/GenSpectrum/LAPIS/issues in case you encounter any unexpected issues. Please include the request ID and the requestInfo in your report."
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "data": [
3
+ {
4
+ "count": 635
5
+ }
6
+ ],
7
+ "info": {
8
+ "dataVersion": "1722452937",
9
+ "requestId": "aede768e-d9d1-4273-9a74-992986554995",
10
+ "requestInfo": "sars_cov-2_nextstrain_open on lapis.cov-spectrum.org at 2024-08-02T06:57:09.319474043",
11
+ "reportTo": "Please report to https://github.com/GenSpectrum/LAPIS/issues in case you encounter any unexpected issues. Please include the request ID and the requestInfo in your report."
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "data": [
3
+ {
4
+ "count": 503198
5
+ }
6
+ ],
7
+ "info": {
8
+ "dataVersion": "1722452937",
9
+ "requestId": "aede768e-d9d1-4273-9a74-992986554995",
10
+ "requestInfo": "sars_cov-2_nextstrain_open on lapis.cov-spectrum.org at 2024-08-02T06:57:09.319474043",
11
+ "reportTo": "Please report to https://github.com/GenSpectrum/LAPIS/issues in case you encounter any unexpected issues. Please include the request ID and the requestInfo in your report."
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "data": [
3
+ {
4
+ "count": 5213
5
+ }
6
+ ],
7
+ "info": {
8
+ "dataVersion": "1722452937",
9
+ "requestId": "aede768e-d9d1-4273-9a74-992986554995",
10
+ "requestInfo": "sars_cov-2_nextstrain_open on lapis.cov-spectrum.org at 2024-08-02T06:57:09.319474043",
11
+ "reportTo": "Please report to https://github.com/GenSpectrum/LAPIS/issues in case you encounter any unexpected issues. Please include the request ID and the requestInfo in your report."
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "data": [
3
+ {
4
+ "count": 5311
5
+ }
6
+ ],
7
+ "info": {
8
+ "dataVersion": "1722452937",
9
+ "requestId": "aede768e-d9d1-4273-9a74-992986554995",
10
+ "requestInfo": "sars_cov-2_nextstrain_open on lapis.cov-spectrum.org at 2024-08-02T06:57:09.319474043",
11
+ "reportTo": "Please report to https://github.com/GenSpectrum/LAPIS/issues in case you encounter any unexpected issues. Please include the request ID and the requestInfo in your report."
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "data": [
3
+ {
4
+ "count": 5264
5
+ }
6
+ ],
7
+ "info": {
8
+ "dataVersion": "1722452937",
9
+ "requestId": "aede768e-d9d1-4273-9a74-992986554995",
10
+ "requestInfo": "sars_cov-2_nextstrain_open on lapis.cov-spectrum.org at 2024-08-02T06:57:09.319474043",
11
+ "reportTo": "Please report to https://github.com/GenSpectrum/LAPIS/issues in case you encounter any unexpected issues. Please include the request ID and the requestInfo in your report."
12
+ }
13
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "data": [
3
+ {
4
+ "count": 4954
5
+ }
6
+ ],
7
+ "info": {
8
+ "dataVersion": "1722452937",
9
+ "requestId": "aede768e-d9d1-4273-9a74-992986554995",
10
+ "requestInfo": "sars_cov-2_nextstrain_open on lapis.cov-spectrum.org at 2024-08-02T06:57:09.319474043",
11
+ "reportTo": "Please report to https://github.com/GenSpectrum/LAPIS/issues in case you encounter any unexpected issues. Please include the request ID and the requestInfo in your report."
12
+ }
13
+ }
@@ -15,10 +15,12 @@ describe('getFilteredMutationOverTimeData', () => {
15
15
  data.set(new Substitution('someSegment', 'A', 'T', 123), yearMonthDay('2021-01-01'), {
16
16
  count: 1,
17
17
  proportion: 0.1,
18
+ totalCount: 10,
18
19
  });
19
20
  data.set(new Substitution('someOtherSegment', 'A', 'T', 123), yearMonthDay('2021-01-01'), {
20
21
  count: 2,
21
22
  proportion: 0.2,
23
+ totalCount: 10,
22
24
  });
23
25
 
24
26
  filterDisplayedSegments(
@@ -41,10 +43,12 @@ describe('getFilteredMutationOverTimeData', () => {
41
43
  data.set(new Substitution('someSegment', 'A', 'T', 123), yearMonthDay('2021-01-01'), {
42
44
  count: 1,
43
45
  proportion: 0.1,
46
+ totalCount: 10,
44
47
  });
45
48
  data.set(new Deletion('someOtherSegment', 'A', 123), yearMonthDay('2021-01-01'), {
46
49
  count: 2,
47
50
  proportion: 0.2,
51
+ totalCount: 10,
48
52
  });
49
53
 
50
54
  filterMutationTypes(
@@ -76,7 +80,13 @@ describe('getFilteredMutationOverTimeData', () => {
76
80
 
77
81
  filterProportion(data, getOverallMutationData(belowFilter), proportionInterval);
78
82
 
79
- expect(data.getAsArray({ count: 0, proportion: 0 })).to.toHaveLength(0);
83
+ expect(
84
+ data.getAsArray({
85
+ count: 0,
86
+ proportion: 0,
87
+ totalCount: 10,
88
+ }),
89
+ ).to.toHaveLength(0);
80
90
  });
81
91
 
82
92
  it('should remove mutations where overall proportion is above filter', () => {
@@ -84,7 +94,13 @@ describe('getFilteredMutationOverTimeData', () => {
84
94
 
85
95
  filterProportion(data, getOverallMutationData(aboveFilter), proportionInterval);
86
96
 
87
- expect(data.getAsArray({ count: 0, proportion: 0 })).to.toHaveLength(0);
97
+ expect(
98
+ data.getAsArray({
99
+ count: 0,
100
+ proportion: 0,
101
+ totalCount: 10,
102
+ }),
103
+ ).to.toHaveLength(0);
88
104
  });
89
105
 
90
106
  it('should remove mutations where overall proportion is missing', () => {
@@ -92,7 +108,13 @@ describe('getFilteredMutationOverTimeData', () => {
92
108
 
93
109
  filterProportion(data, getOverallMutationData(aboveFilter, someOtherMutation), proportionInterval);
94
110
 
95
- expect(data.getAsArray({ count: 0, proportion: 0 })).to.toHaveLength(0);
111
+ expect(
112
+ data.getAsArray({
113
+ count: 0,
114
+ proportion: 0,
115
+ totalCount: 10,
116
+ }),
117
+ ).to.toHaveLength(0);
96
118
  });
97
119
 
98
120
  it('should not remove mutation where overall proportion is at lower border of filter', () => {
@@ -100,7 +122,13 @@ describe('getFilteredMutationOverTimeData', () => {
100
122
 
101
123
  filterProportion(data, getOverallMutationData(inFilter), proportionInterval);
102
124
 
103
- expect(data.getRow(someSubstitution, { count: 0, proportion: 0 })).to.toHaveLength(2);
125
+ expect(
126
+ data.getRow(someSubstitution, {
127
+ count: 0,
128
+ proportion: 0,
129
+ totalCount: 10,
130
+ }),
131
+ ).to.toHaveLength(2);
104
132
  });
105
133
 
106
134
  it('should not remove mutation where overall proportion is within filter', () => {
@@ -108,7 +136,13 @@ describe('getFilteredMutationOverTimeData', () => {
108
136
 
109
137
  filterProportion(data, getOverallMutationData(inFilter), proportionInterval);
110
138
 
111
- expect(data.getRow(someSubstitution, { count: 0, proportion: 0 })).to.toHaveLength(2);
139
+ expect(
140
+ data.getRow(someSubstitution, {
141
+ count: 0,
142
+ proportion: 0,
143
+ totalCount: 10,
144
+ }),
145
+ ).to.toHaveLength(2);
112
146
  });
113
147
 
114
148
  it('should not remove mutation where overall proportion is at upper border of filter', () => {
@@ -116,13 +150,27 @@ describe('getFilteredMutationOverTimeData', () => {
116
150
 
117
151
  filterProportion(data, getOverallMutationData(inFilter), proportionInterval);
118
152
 
119
- expect(data.getRow(someSubstitution, { count: 0, proportion: 0 })).to.toHaveLength(2);
153
+ expect(
154
+ data.getRow(someSubstitution, {
155
+ count: 0,
156
+ proportion: 0,
157
+ totalCount: 10,
158
+ }),
159
+ ).to.toHaveLength(2);
120
160
  });
121
161
 
122
162
  function getMutationOverTimeData() {
123
163
  const data = new Map2dBase<Substitution | Deletion, Temporal, MutationOverTimeMutationValue>();
124
- data.set(someSubstitution, yearMonthDay('2021-01-01'), { count: 1, proportion: 0.1 });
125
- data.set(someSubstitution, yearMonthDay('2021-02-02'), { count: 99, proportion: 0.99 });
164
+ data.set(someSubstitution, yearMonthDay('2021-01-01'), {
165
+ count: 1,
166
+ proportion: 0.1,
167
+ totalCount: 10,
168
+ });
169
+ data.set(someSubstitution, yearMonthDay('2021-02-02'), {
170
+ count: 99,
171
+ proportion: 0.99,
172
+ totalCount: 10,
173
+ });
126
174
  return data;
127
175
  }
128
176
 
@@ -56,7 +56,7 @@ const MutationsOverTimeGrid: FunctionComponent<MutationsOverTimeGridProps> = ({
56
56
  <MutationCell mutation={mutation} />
57
57
  </div>
58
58
  {dates.map((date, columnIndex) => {
59
- const value = data.get(mutation, date) ?? { proportion: 0, count: 0 };
59
+ const value = data.get(mutation, date) ?? { proportion: 0, count: 0, totalCount: 0 };
60
60
  const tooltipPosition = getTooltipPosition(
61
61
  rowIndex,
62
62
  shownMutations.length,
@@ -136,7 +136,9 @@ const ProportionCell: FunctionComponent<{
136
136
  <p>({timeIntervalDisplay(date)})</p>
137
137
  <p>{mutation.code}</p>
138
138
  <p>Proportion: {formatProportion(value.proportion)}</p>
139
- <p>Count: {value.count}</p>
139
+ <p>
140
+ Count: {value.count} / {value.totalCount} total
141
+ </p>
140
142
  </div>
141
143
  );
142
144