@genspectrum/dashboard-components 0.6.2 → 0.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +220 -0
- package/dist/dashboard-components.js +675 -178
- package/dist/dashboard-components.js.map +1 -1
- package/dist/genspectrum-components.d.ts +70 -2
- package/dist/style.css +10 -4
- package/package.json +3 -1
- package/src/constants.ts +1 -1
- package/src/lapisApi/lapisTypes.ts +1 -0
- package/src/operator/FillMissingOperator.spec.ts +3 -1
- package/src/operator/FillMissingOperator.ts +4 -2
- package/src/preact/components/tooltip.stories.tsx +54 -0
- package/src/preact/components/tooltip.tsx +31 -0
- package/src/preact/mutationComparison/queryMutationData.ts +12 -4
- package/src/preact/mutationsOverTime/__mockData__/aggregated_date.json +642 -0
- package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_2024_01.json +1747 -0
- package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_2024_02.json +1774 -0
- package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_2024_03.json +1819 -0
- package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_2024_04.json +1864 -0
- package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_2024_05.json +1927 -0
- package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_2024_06.json +1864 -0
- package/src/preact/mutationsOverTime/__mockData__/nucleotideMutations_2024_07.json +9 -0
- package/src/preact/mutationsOverTime/getFilteredMutationsOverTime.spec.ts +98 -0
- package/src/preact/mutationsOverTime/getFilteredMutationsOverTimeData.ts +66 -0
- package/src/preact/mutationsOverTime/mutations-over-time-grid.tsx +127 -0
- package/src/preact/mutationsOverTime/mutations-over-time.stories.tsx +206 -0
- package/src/preact/mutationsOverTime/mutations-over-time.tsx +170 -0
- package/src/preact/numberSequencesOverTime/getNumberOfSequencesOverTimeTableData.ts +1 -1
- package/src/preact/prevalenceOverTime/prevalence-over-time.stories.tsx +1 -0
- package/src/preact/shared/table/formatProportion.ts +2 -2
- package/src/query/queryAggregatedDataOverTime.ts +8 -33
- package/src/query/queryMutationsOverTime.spec.ts +378 -0
- package/src/query/queryMutationsOverTime.ts +179 -0
- package/src/query/queryNumberOfSequencesOverTime.ts +0 -1
- package/src/query/queryRelativeGrowthAdvantage.ts +3 -3
- package/src/utils/Map2d.ts +75 -0
- package/src/utils/map2d.spec.ts +94 -0
- package/src/utils/mutations.ts +5 -1
- package/src/utils/temporal.spec.ts +5 -0
- package/src/utils/temporal.ts +88 -5
- package/src/web-components/visualization/gs-mutations-over-time.stories.ts +225 -0
- package/src/web-components/visualization/gs-mutations-over-time.tsx +112 -0
- package/src/web-components/visualization/index.ts +1 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
2
|
+
|
|
3
|
+
import { MutationsOverTime, type MutationsOverTimeProps } from '../../preact/mutationsOverTime/mutations-over-time';
|
|
4
|
+
import type { Equals, Expect } from '../../utils/typeAssertions';
|
|
5
|
+
import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsStyles';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* ## Context
|
|
9
|
+
*
|
|
10
|
+
* This component displays mutations (substitutions and deletions) over time for a dataset selected by a LAPIS filter.
|
|
11
|
+
* The shown date range is determined by the date field in the LAPIS filter.
|
|
12
|
+
* If the date field is not set, the date range is determined by all available dates in the dataset.
|
|
13
|
+
*
|
|
14
|
+
* ## Views
|
|
15
|
+
*
|
|
16
|
+
* ### Grid View
|
|
17
|
+
*
|
|
18
|
+
* The grid view shows the proportion for each mutation over date ranges.
|
|
19
|
+
*
|
|
20
|
+
* The grid will show at max 100 rows and 200 columns for browser performance reasons.
|
|
21
|
+
* More data might make the browser unresponsive.
|
|
22
|
+
* If the numbers are exceeded, an error message will be shown.
|
|
23
|
+
* In both cases, the `lapisFilter` should be narrowed down to reduce the number of mutations or date ranges.
|
|
24
|
+
* The number of date ranges can also be reduced by selecting a larger granularity (months instead of weeks).
|
|
25
|
+
*/
|
|
26
|
+
@customElement('gs-mutations-over-time')
|
|
27
|
+
export class MutationsOverTimeComponent extends PreactLitAdapterWithGridJsStyles {
|
|
28
|
+
/**
|
|
29
|
+
* Required.
|
|
30
|
+
*
|
|
31
|
+
* LAPIS filter to select the displayed data.
|
|
32
|
+
*/
|
|
33
|
+
@property({ type: Object })
|
|
34
|
+
lapisFilter: Record<string, string | number | null | boolean> = {};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* The type of the sequence for which the mutations should be shown.
|
|
38
|
+
*/
|
|
39
|
+
@property({ type: String })
|
|
40
|
+
sequenceType: 'nucleotide' | 'amino acid' = 'nucleotide';
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* A list of tabs with views that this component should provide.
|
|
44
|
+
*/
|
|
45
|
+
@property({ type: Array })
|
|
46
|
+
views: 'grid'[] = ['grid'];
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* The width of the component.
|
|
50
|
+
*
|
|
51
|
+
* Visit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.
|
|
52
|
+
*/
|
|
53
|
+
@property({ type: String })
|
|
54
|
+
width: string = '100%';
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* The height of the component.
|
|
58
|
+
*
|
|
59
|
+
* Visit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.
|
|
60
|
+
*/
|
|
61
|
+
@property({ type: String })
|
|
62
|
+
height: string = '700px';
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* The granularity of the time axis.
|
|
66
|
+
*/
|
|
67
|
+
@property({ type: String })
|
|
68
|
+
granularity: 'day' | 'week' | 'month' | 'year' = 'week';
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Required.
|
|
72
|
+
*
|
|
73
|
+
* The LAPIS field that the data should be aggregated by.
|
|
74
|
+
* The values will be used for the columns of the grid.
|
|
75
|
+
* Must be a field of type `date` in LAPIS.
|
|
76
|
+
*/
|
|
77
|
+
@property({ type: String })
|
|
78
|
+
lapisDateField: string = 'date';
|
|
79
|
+
|
|
80
|
+
override render() {
|
|
81
|
+
return (
|
|
82
|
+
<MutationsOverTime
|
|
83
|
+
lapisFilter={this.lapisFilter}
|
|
84
|
+
sequenceType={this.sequenceType}
|
|
85
|
+
views={this.views}
|
|
86
|
+
width={this.width}
|
|
87
|
+
height={this.height}
|
|
88
|
+
granularity={this.granularity}
|
|
89
|
+
lapisDateField={this.lapisDateField}
|
|
90
|
+
/>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
declare global {
|
|
96
|
+
interface HTMLElementTagNameMap {
|
|
97
|
+
'gs-mutations-over-time-component': MutationsOverTimeComponent;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */
|
|
102
|
+
type LapisFilterMatches = Expect<
|
|
103
|
+
Equals<typeof MutationsOverTimeComponent.prototype.lapisFilter, MutationsOverTimeProps['lapisFilter']>
|
|
104
|
+
>;
|
|
105
|
+
type SequenceTypeMatches = Expect<
|
|
106
|
+
Equals<typeof MutationsOverTimeComponent.prototype.sequenceType, MutationsOverTimeProps['sequenceType']>
|
|
107
|
+
>;
|
|
108
|
+
type ViewsMatches = Expect<Equals<typeof MutationsOverTimeComponent.prototype.views, MutationsOverTimeProps['views']>>;
|
|
109
|
+
type GranularityMatches = Expect<
|
|
110
|
+
Equals<typeof MutationsOverTimeComponent.prototype.granularity, MutationsOverTimeProps['granularity']>
|
|
111
|
+
>;
|
|
112
|
+
/* eslint-enable @typescript-eslint/no-unused-vars, no-unused-vars */
|
|
@@ -4,3 +4,4 @@ export { PrevalenceOverTimeComponent } from './gs-prevalence-over-time';
|
|
|
4
4
|
export { RelativeGrowthAdvantageComponent } from './gs-relative-growth-advantage';
|
|
5
5
|
export { AggregateComponent } from './gs-aggregate';
|
|
6
6
|
export { NumberSequencesOverTimeComponent } from './gs-number-sequences-over-time';
|
|
7
|
+
export { MutationsOverTimeComponent } from './gs-mutations-over-time';
|