@genspectrum/dashboard-components 0.10.3 → 0.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/custom-elements.json +384 -56
- package/dist/assets/mutationOverTimeWorker-BjjkMGzd.js.map +1 -0
- package/dist/components.d.ts +250 -31
- package/dist/components.js +1220 -198
- package/dist/components.js.map +1 -1
- package/dist/{dateRangeOption-DjtcAEWq.js → dateRangeOption-Bh2p78z0.js} +11 -5
- package/dist/dateRangeOption-Bh2p78z0.js.map +1 -0
- package/dist/style.css +5 -1
- package/dist/util.d.ts +626 -16
- package/dist/util.js +1 -1
- package/package.json +13 -7
- package/src/preact/aggregatedData/aggregate.stories.tsx +2 -2
- package/src/preact/aggregatedData/aggregate.tsx +11 -8
- package/src/preact/dateRangeSelector/date-range-selector.stories.tsx +4 -12
- package/src/preact/dateRangeSelector/date-range-selector.tsx +4 -4
- package/src/preact/lineageFilter/lineage-filter.stories.tsx +1 -1
- package/src/preact/locationFilter/location-filter.stories.tsx +1 -1
- package/src/preact/map/__mockData__/aggregatedGermany.json +83 -0
- package/src/preact/map/__mockData__/aggregatedWorld.json +259 -0
- package/src/preact/map/__mockData__/germanyMap.json +9083 -0
- package/src/preact/map/__mockData__/howToGenerateWorldMap.md +9 -0
- package/src/preact/map/__mockData__/worldAtlas.json +497127 -0
- package/src/preact/map/leafletStyleModifications.css +3 -0
- package/src/preact/map/sequences-by-location-map.tsx +202 -0
- package/src/preact/map/sequences-by-location-table.tsx +18 -0
- package/src/preact/map/sequences-by-location.stories.tsx +144 -0
- package/src/preact/map/sequences-by-location.tsx +151 -0
- package/src/preact/map/useGeoJsonMap.tsx +62 -0
- package/src/preact/mutationComparison/mutation-comparison.tsx +5 -7
- package/src/preact/mutationFilter/mutation-filter.tsx +4 -13
- package/src/preact/mutations/mutations.tsx +4 -4
- package/src/preact/mutationsOverTime/mutations-over-time.stories.tsx +1 -1
- package/src/preact/mutationsOverTime/mutations-over-time.tsx +4 -4
- package/src/preact/numberSequencesOverTime/number-sequences-over-time.stories.tsx +5 -14
- package/src/preact/numberSequencesOverTime/number-sequences-over-time.tsx +4 -4
- package/src/preact/prevalenceOverTime/prevalence-over-time.stories.tsx +15 -26
- package/src/preact/prevalenceOverTime/prevalence-over-time.tsx +8 -8
- package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.stories.tsx +4 -15
- package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.tsx +11 -7
- package/src/preact/shared/stories/expectErrorMessage.ts +21 -0
- package/src/preact/textInput/text-input.stories.tsx +1 -1
- package/src/preact/useQuery.ts +9 -1
- package/src/query/queryNumberOfSequencesOverTime.spec.ts +4 -4
- package/src/query/queryNumberOfSequencesOverTime.ts +1 -4
- package/src/query/queryPrevalenceOverTime.ts +1 -4
- package/src/styles/tailwind.css +1 -1
- package/src/types.ts +12 -4
- package/src/utilEntrypoint.ts +16 -4
- package/src/utils/utils.ts +0 -29
- package/src/web-components/app.ts +1 -1
- package/src/web-components/input/gs-date-range-selector.stories.ts +4 -4
- package/src/web-components/input/gs-date-range-selector.tsx +5 -5
- package/src/web-components/input/gs-lineage-filter.tsx +1 -1
- package/src/web-components/input/gs-location-filter.tsx +1 -1
- package/src/web-components/input/gs-mutation-filter.tsx +5 -8
- package/src/web-components/input/gs-text-input.tsx +1 -1
- package/src/web-components/visualization/gs-aggregate.stories.ts +3 -3
- package/src/web-components/visualization/gs-aggregate.tsx +10 -6
- package/src/web-components/visualization/gs-mutation-comparison.tsx +7 -2
- package/src/web-components/visualization/gs-mutations-over-time.tsx +7 -2
- package/src/web-components/visualization/gs-mutations.tsx +7 -2
- package/src/web-components/visualization/gs-number-sequences-over-time.stories.ts +5 -5
- package/src/web-components/visualization/gs-number-sequences-over-time.tsx +13 -15
- package/src/web-components/visualization/gs-prevalence-over-time.stories.ts +8 -8
- package/src/web-components/visualization/gs-prevalence-over-time.tsx +17 -14
- package/src/web-components/visualization/gs-relative-growth-advantage.stories.ts +4 -5
- package/src/web-components/visualization/gs-relative-growth-advantage.tsx +17 -15
- package/src/web-components/visualization/gs-sequences-by-location.stories.ts +234 -0
- package/src/web-components/visualization/gs-sequences-by-location.tsx +258 -0
- package/src/web-components/visualization/gs-statistics.tsx +12 -3
- package/src/web-components/visualization/index.ts +1 -0
- package/standalone-bundle/assets/mutationOverTimeWorker-DoUBht2e.js.map +1 -0
- package/standalone-bundle/dashboard-components.js +16208 -9408
- package/standalone-bundle/dashboard-components.js.map +1 -1
- package/standalone-bundle/style.css +1 -1
- package/dist/assets/mutationOverTimeWorker-CNg_ztNp.js.map +0 -1
- package/dist/dateRangeOption-DjtcAEWq.js.map +0 -1
- package/src/preact/shared/stories/expectInvalidAttributesErrorMessage.ts +0 -13
- package/src/utils/utils.spec.ts +0 -16
- package/standalone-bundle/assets/mutationOverTimeWorker-cIyshfj_.js.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { customElement, property } from 'lit/decorators.js';
|
|
2
|
-
import {
|
|
2
|
+
import type { DetailedHTMLProps, HTMLAttributes } from 'react';
|
|
3
3
|
|
|
4
4
|
import { DateRangeSelector, type DateRangeSelectorProps } from '../../preact/dateRangeSelector/date-range-selector';
|
|
5
5
|
import { type DateRangeOptionChangedEvent } from '../../preact/dateRangeSelector/dateRangeOption';
|
|
@@ -103,10 +103,10 @@ export class DateRangeSelectorComponent extends PreactLitAdapter {
|
|
|
103
103
|
width: string = '100%';
|
|
104
104
|
|
|
105
105
|
/**
|
|
106
|
-
* The name of the
|
|
106
|
+
* The name of the metadata field in LAPIS that contains the date information.
|
|
107
107
|
*/
|
|
108
108
|
@property({ type: String })
|
|
109
|
-
|
|
109
|
+
lapisDateField: string = '';
|
|
110
110
|
|
|
111
111
|
override render() {
|
|
112
112
|
return (
|
|
@@ -116,7 +116,7 @@ export class DateRangeSelectorComponent extends PreactLitAdapter {
|
|
|
116
116
|
initialValue={this.initialValue}
|
|
117
117
|
initialDateFrom={this.initialDateFrom}
|
|
118
118
|
initialDateTo={this.initialDateTo}
|
|
119
|
-
|
|
119
|
+
lapisDateField={this.lapisDateField}
|
|
120
120
|
width={this.width}
|
|
121
121
|
/>
|
|
122
122
|
);
|
|
@@ -161,6 +161,6 @@ type InitialDateToMatches = Expect<
|
|
|
161
161
|
>;
|
|
162
162
|
type WidthMatches = Expect<Equals<typeof DateRangeSelectorComponent.prototype.width, DateRangeSelectorProps['width']>>;
|
|
163
163
|
type DateColumnMatches = Expect<
|
|
164
|
-
Equals<typeof DateRangeSelectorComponent.prototype.
|
|
164
|
+
Equals<typeof DateRangeSelectorComponent.prototype.lapisDateField, DateRangeSelectorProps['lapisDateField']>
|
|
165
165
|
>;
|
|
166
166
|
/* eslint-enable @typescript-eslint/no-unused-vars, no-unused-vars */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { customElement, property } from 'lit/decorators.js';
|
|
2
|
-
import {
|
|
2
|
+
import type { DetailedHTMLProps, HTMLAttributes } from 'react';
|
|
3
3
|
|
|
4
4
|
import { LineageFilter, type LineageFilterProps } from '../../preact/lineageFilter/lineage-filter';
|
|
5
5
|
import type { Equals, Expect } from '../../utils/typeAssertions';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { customElement, property } from 'lit/decorators.js';
|
|
2
|
-
import {
|
|
2
|
+
import type { DetailedHTMLProps, HTMLAttributes } from 'react';
|
|
3
3
|
|
|
4
4
|
import { LocationFilter, type LocationFilterProps } from '../../preact/locationFilter/location-filter';
|
|
5
5
|
import type { Equals, Expect } from '../../utils/typeAssertions';
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
import { customElement, property } from 'lit/decorators.js';
|
|
2
|
-
import {
|
|
2
|
+
import type { DetailedHTMLProps, HTMLAttributes } from 'react';
|
|
3
3
|
|
|
4
4
|
import { ReferenceGenomesAwaiter } from '../../preact/components/ReferenceGenomesAwaiter';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
type MutationFilterProps,
|
|
8
|
-
type SelectedMutationFilterStrings,
|
|
9
|
-
} from '../../preact/mutationFilter/mutation-filter';
|
|
5
|
+
import { MutationFilter, type MutationFilterProps } from '../../preact/mutationFilter/mutation-filter';
|
|
6
|
+
import type { MutationsFilter } from '../../types';
|
|
10
7
|
import type { Equals, Expect } from '../../utils/typeAssertions';
|
|
11
8
|
import { PreactLitAdapter } from '../PreactLitAdapter';
|
|
12
9
|
|
|
@@ -64,7 +61,7 @@ export class MutationFilterComponent extends PreactLitAdapter {
|
|
|
64
61
|
* All values provided must be valid mutations or insertions.
|
|
65
62
|
* Invalid values will be ignored.
|
|
66
63
|
*/
|
|
67
|
-
@property({
|
|
64
|
+
@property({type: Object})
|
|
68
65
|
initialValue:
|
|
69
66
|
{
|
|
70
67
|
nucleotideMutations: string[];
|
|
@@ -98,7 +95,7 @@ declare global {
|
|
|
98
95
|
}
|
|
99
96
|
|
|
100
97
|
interface HTMLElementEventMap {
|
|
101
|
-
'gs-mutation-filter-changed': CustomEvent<
|
|
98
|
+
'gs-mutation-filter-changed': CustomEvent<MutationsFilter>;
|
|
102
99
|
}
|
|
103
100
|
}
|
|
104
101
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { customElement, property } from 'lit/decorators.js';
|
|
2
|
-
import {
|
|
2
|
+
import type { DetailedHTMLProps, HTMLAttributes } from 'react';
|
|
3
3
|
|
|
4
4
|
import { TextInput, type TextInputProps } from '../../preact/textInput/text-input';
|
|
5
5
|
import type { Equals, Expect } from '../../utils/typeAssertions';
|
|
@@ -12,7 +12,7 @@ import '../app';
|
|
|
12
12
|
const codeExample = `
|
|
13
13
|
<gs-aggregate
|
|
14
14
|
fields='["division", "host"]'
|
|
15
|
-
|
|
15
|
+
lapisFilter='{"country": "USA"}'
|
|
16
16
|
views='["table"]'
|
|
17
17
|
width='100%'
|
|
18
18
|
height='700px'
|
|
@@ -74,7 +74,7 @@ export const Table: StoryObj<Required<AggregateProps>> = {
|
|
|
74
74
|
<gs-app lapis="${LAPIS_URL}">
|
|
75
75
|
<gs-aggregate
|
|
76
76
|
.fields=${args.fields}
|
|
77
|
-
.
|
|
77
|
+
.lapisFilter=${args.lapisFilter}
|
|
78
78
|
.views=${args.views}
|
|
79
79
|
.width=${args.width}
|
|
80
80
|
.height=${args.height}
|
|
@@ -87,7 +87,7 @@ export const Table: StoryObj<Required<AggregateProps>> = {
|
|
|
87
87
|
args: {
|
|
88
88
|
fields: ['division', 'host'],
|
|
89
89
|
views: ['table'],
|
|
90
|
-
|
|
90
|
+
lapisFilter: {
|
|
91
91
|
country: 'USA',
|
|
92
92
|
},
|
|
93
93
|
width: '100%',
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { customElement, property } from 'lit/decorators.js';
|
|
2
2
|
import type { DetailedHTMLProps, HTMLAttributes } from 'react';
|
|
3
3
|
|
|
4
|
-
import { Aggregate, type AggregateProps, type
|
|
5
|
-
import { type LapisFilter } from '../../types';
|
|
4
|
+
import { Aggregate, type AggregateProps, type AggregateView } from '../../preact/aggregatedData/aggregate';
|
|
6
5
|
import { type Equals, type Expect } from '../../utils/typeAssertions';
|
|
7
6
|
import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsStyles';
|
|
8
7
|
|
|
@@ -38,14 +37,19 @@ export class AggregateComponent extends PreactLitAdapterWithGridJsStyles {
|
|
|
38
37
|
* A list of tabs with views that this component should provide.
|
|
39
38
|
*/
|
|
40
39
|
@property({ type: Array })
|
|
41
|
-
views:
|
|
40
|
+
views: AggregateView[] = ['table'];
|
|
42
41
|
|
|
43
42
|
/**
|
|
44
43
|
* The filter to apply to the data.
|
|
45
44
|
* It must be a valid LAPIS filter object.
|
|
46
45
|
*/
|
|
47
46
|
@property({ type: Object })
|
|
48
|
-
|
|
47
|
+
lapisFilter: Record<string, string | string[] | number | null | boolean | undefined> & {
|
|
48
|
+
nucleotideMutations?: string[];
|
|
49
|
+
aminoAcidMutations?: string[];
|
|
50
|
+
nucleotideInsertions?: string[];
|
|
51
|
+
aminoAcidInsertions?: string[];
|
|
52
|
+
} = {};
|
|
49
53
|
|
|
50
54
|
/**
|
|
51
55
|
* The width of the component.
|
|
@@ -88,7 +92,7 @@ export class AggregateComponent extends PreactLitAdapterWithGridJsStyles {
|
|
|
88
92
|
<Aggregate
|
|
89
93
|
fields={this.fields}
|
|
90
94
|
views={this.views}
|
|
91
|
-
|
|
95
|
+
lapisFilter={this.lapisFilter}
|
|
92
96
|
width={this.width}
|
|
93
97
|
height={this.height}
|
|
94
98
|
initialSortField={this.initialSortField}
|
|
@@ -117,7 +121,7 @@ declare global {
|
|
|
117
121
|
/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */
|
|
118
122
|
type FieldsMatches = Expect<Equals<typeof AggregateComponent.prototype.fields, AggregateProps['fields']>>;
|
|
119
123
|
type ViewsMatches = Expect<Equals<typeof AggregateComponent.prototype.views, AggregateProps['views']>>;
|
|
120
|
-
type FilterMatches = Expect<Equals<typeof AggregateComponent.prototype.
|
|
124
|
+
type FilterMatches = Expect<Equals<typeof AggregateComponent.prototype.lapisFilter, AggregateProps['lapisFilter']>>;
|
|
121
125
|
type WidthMatches = Expect<Equals<typeof AggregateComponent.prototype.width, AggregateProps['width']>>;
|
|
122
126
|
type HeightMatches = Expect<Equals<typeof AggregateComponent.prototype.height, AggregateProps['height']>>;
|
|
123
127
|
type InitialSortFieldMatches = Expect<
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { customElement, property } from 'lit/decorators.js';
|
|
2
|
-
import {
|
|
2
|
+
import type { DetailedHTMLProps, HTMLAttributes } from 'react';
|
|
3
3
|
|
|
4
4
|
import { MutationComparison, type MutationComparisonProps } from '../../preact/mutationComparison/mutation-comparison';
|
|
5
5
|
import { type Equals, type Expect } from '../../utils/typeAssertions';
|
|
@@ -44,7 +44,12 @@ export class MutationComparisonComponent extends PreactLitAdapterWithGridJsStyle
|
|
|
44
44
|
*/
|
|
45
45
|
@property({ type: Array })
|
|
46
46
|
lapisFilters: {
|
|
47
|
-
lapisFilter: Record<string, string | number | null | boolean
|
|
47
|
+
lapisFilter: Record<string, string | string[] | number | null | boolean | undefined> & {
|
|
48
|
+
nucleotideMutations?: string[];
|
|
49
|
+
aminoAcidMutations?: string[];
|
|
50
|
+
nucleotideInsertions?: string[];
|
|
51
|
+
aminoAcidInsertions?: string[];
|
|
52
|
+
};
|
|
48
53
|
displayName: string;
|
|
49
54
|
}[] = [];
|
|
50
55
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { customElement, property } from 'lit/decorators.js';
|
|
2
|
-
import {
|
|
2
|
+
import type { DetailedHTMLProps, HTMLAttributes } from 'react';
|
|
3
3
|
|
|
4
4
|
import { MutationsOverTime, type MutationsOverTimeProps } from '../../preact/mutationsOverTime/mutations-over-time';
|
|
5
5
|
import type { Equals, Expect } from '../../utils/typeAssertions';
|
|
@@ -36,7 +36,12 @@ export class MutationsOverTimeComponent extends PreactLitAdapterWithGridJsStyles
|
|
|
36
36
|
* LAPIS filter to select the displayed data. If not provided, all data is displayed.
|
|
37
37
|
*/
|
|
38
38
|
@property({ type: Object })
|
|
39
|
-
lapisFilter: Record<string, string | number | null | boolean>
|
|
39
|
+
lapisFilter: Record<string, string | string[] | number | null | boolean | undefined> & {
|
|
40
|
+
nucleotideMutations?: string[];
|
|
41
|
+
aminoAcidMutations?: string[];
|
|
42
|
+
nucleotideInsertions?: string[];
|
|
43
|
+
aminoAcidInsertions?: string[];
|
|
44
|
+
} = {};
|
|
40
45
|
|
|
41
46
|
/**
|
|
42
47
|
* The type of the sequence for which the mutations should be shown.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { customElement, property } from 'lit/decorators.js';
|
|
2
|
-
import {
|
|
2
|
+
import type { DetailedHTMLProps, HTMLAttributes } from 'react';
|
|
3
3
|
|
|
4
4
|
import { Mutations, type MutationsProps } from '../../preact/mutations/mutations';
|
|
5
5
|
import type { Equals, Expect } from '../../utils/typeAssertions';
|
|
@@ -38,7 +38,12 @@ export class MutationsComponent extends PreactLitAdapterWithGridJsStyles {
|
|
|
38
38
|
* LAPIS filter to select the displayed data. If not provided, all data is displayed.
|
|
39
39
|
*/
|
|
40
40
|
@property({ type: Object })
|
|
41
|
-
lapisFilter: Record<string, string | number | null | boolean>
|
|
41
|
+
lapisFilter: Record<string, string | string[] | number | null | boolean | undefined> & {
|
|
42
|
+
nucleotideMutations?: string[];
|
|
43
|
+
aminoAcidMutations?: string[];
|
|
44
|
+
nucleotideInsertions?: string[];
|
|
45
|
+
aminoAcidInsertions?: string[];
|
|
46
|
+
} = {};
|
|
42
47
|
|
|
43
48
|
/**
|
|
44
49
|
* The type of the sequence for which the mutations should be shown.
|
|
@@ -15,7 +15,7 @@ import { withinShadowRoot } from '../withinShadowRoot.story';
|
|
|
15
15
|
|
|
16
16
|
const codeExample = String.raw`
|
|
17
17
|
<gs-number-sequences-over-time
|
|
18
|
-
|
|
18
|
+
lapisFilters='[{ "displayName": "EG", "lapisFilter": { "country": "USA", "pangoLineage": "EG*" }}, { "displayName": "JN.1", "lapisFilter": { "country": "USA", "pangoLineage": "JN.1*" }}]'
|
|
19
19
|
lapisDateField="date"
|
|
20
20
|
views='["bar", "line", "table"]'
|
|
21
21
|
width="100%"
|
|
@@ -55,7 +55,7 @@ const Template: StoryObj<NumberSequencesOverTimeProps> = {
|
|
|
55
55
|
render: (args) => html`
|
|
56
56
|
<gs-app lapis="${LAPIS_URL}">
|
|
57
57
|
<gs-number-sequences-over-time
|
|
58
|
-
.
|
|
58
|
+
.lapisFilters=${args.lapisFilters}
|
|
59
59
|
.lapisDateField=${args.lapisDateField}
|
|
60
60
|
.views=${args.views}
|
|
61
61
|
.width=${args.width}
|
|
@@ -68,7 +68,7 @@ const Template: StoryObj<NumberSequencesOverTimeProps> = {
|
|
|
68
68
|
`,
|
|
69
69
|
args: {
|
|
70
70
|
views: ['bar', 'line', 'table'],
|
|
71
|
-
|
|
71
|
+
lapisFilters: [
|
|
72
72
|
{ displayName: 'EG', lapisFilter: { country: 'USA', pangoLineage: 'EG*', dateFrom: '2022-12-01' } },
|
|
73
73
|
],
|
|
74
74
|
lapisDateField: 'date',
|
|
@@ -139,7 +139,7 @@ export const TwoDatasets: StoryObj<NumberSequencesOverTimeProps> = {
|
|
|
139
139
|
...Template,
|
|
140
140
|
args: {
|
|
141
141
|
...Template.args,
|
|
142
|
-
|
|
142
|
+
lapisFilters: [
|
|
143
143
|
{
|
|
144
144
|
displayName: 'EG',
|
|
145
145
|
lapisFilter: { country: 'USA', pangoLineage: 'EG*', dateFrom: '2022-10-01' },
|
|
@@ -191,7 +191,7 @@ export const TwoDatasetsWithNonOverlappingDates: StoryObj<NumberSequencesOverTim
|
|
|
191
191
|
...Template,
|
|
192
192
|
args: {
|
|
193
193
|
...Template.args,
|
|
194
|
-
|
|
194
|
+
lapisFilters: [
|
|
195
195
|
{
|
|
196
196
|
displayName: 'XBB',
|
|
197
197
|
lapisFilter: { country: 'USA', pangoLineage: 'XBB*', dateFrom: '2022-01-01', dateTo: '2022-12-31' },
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { customElement, property } from 'lit/decorators.js';
|
|
2
|
-
import {
|
|
2
|
+
import type { DetailedHTMLProps, HTMLAttributes } from 'react';
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
NumberSequencesOverTime,
|
|
@@ -22,8 +22,6 @@ import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsS
|
|
|
22
22
|
*/
|
|
23
23
|
@customElement('gs-number-sequences-over-time')
|
|
24
24
|
export class NumberSequencesOverTimeComponent extends PreactLitAdapterWithGridJsStyles {
|
|
25
|
-
// prettier-ignore
|
|
26
|
-
// The multiline union type must not start with `|` because it looks weird in the Storybook docs
|
|
27
25
|
/**
|
|
28
26
|
* Either a LAPIS filter or an array of LAPIS filters to fetch the number of sequences for.
|
|
29
27
|
*
|
|
@@ -33,16 +31,16 @@ export class NumberSequencesOverTimeComponent extends PreactLitAdapterWithGridJs
|
|
|
33
31
|
* The `displayName` will be used to label the component views.
|
|
34
32
|
* It should be human-readable.
|
|
35
33
|
*
|
|
36
|
-
*/ @property({type: Object})
|
|
37
|
-
|
|
38
|
-
{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
34
|
+
*/ @property({ type: Object })
|
|
35
|
+
lapisFilters: {
|
|
36
|
+
lapisFilter: Record<string, string | string[] | number | null | boolean | undefined> & {
|
|
37
|
+
nucleotideMutations?: string[];
|
|
38
|
+
aminoAcidMutations?: string[];
|
|
39
|
+
nucleotideInsertions?: string[];
|
|
40
|
+
aminoAcidInsertions?: string[];
|
|
41
|
+
};
|
|
42
|
+
displayName: string;
|
|
43
|
+
}[] = [];
|
|
46
44
|
|
|
47
45
|
/**
|
|
48
46
|
* Required.
|
|
@@ -104,7 +102,7 @@ export class NumberSequencesOverTimeComponent extends PreactLitAdapterWithGridJs
|
|
|
104
102
|
override render() {
|
|
105
103
|
return (
|
|
106
104
|
<NumberSequencesOverTime
|
|
107
|
-
|
|
105
|
+
lapisFilters={this.lapisFilters}
|
|
108
106
|
lapisDateField={this.lapisDateField}
|
|
109
107
|
views={this.views}
|
|
110
108
|
width={this.width}
|
|
@@ -134,7 +132,7 @@ declare global {
|
|
|
134
132
|
|
|
135
133
|
/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */
|
|
136
134
|
type LapisFilterMatches = Expect<
|
|
137
|
-
Equals<typeof NumberSequencesOverTimeComponent.prototype.
|
|
135
|
+
Equals<typeof NumberSequencesOverTimeComponent.prototype.lapisFilters, NumberSequencesOverTimeProps['lapisFilters']>
|
|
138
136
|
>;
|
|
139
137
|
type LapisDateFieldMatches = Expect<
|
|
140
138
|
Equals<
|
|
@@ -34,8 +34,6 @@ const meta: Meta<Required<PrevalenceOverTimeProps>> = {
|
|
|
34
34
|
title: 'Visualization/Prevalence over time',
|
|
35
35
|
component: 'gs-prevalence-over-time',
|
|
36
36
|
argTypes: {
|
|
37
|
-
numeratorFilter: { control: 'object' },
|
|
38
|
-
denominatorFilter: { control: 'object' },
|
|
39
37
|
granularity: {
|
|
40
38
|
options: ['day', 'week', 'month', 'year'],
|
|
41
39
|
control: { type: 'radio' },
|
|
@@ -71,7 +69,7 @@ const Template: StoryObj<Required<PrevalenceOverTimeProps>> = {
|
|
|
71
69
|
render: (args) => html`
|
|
72
70
|
<gs-app lapis="${LAPIS_URL}">
|
|
73
71
|
<gs-prevalence-over-time
|
|
74
|
-
.
|
|
72
|
+
.numeratorFilters=${args.numeratorFilters}
|
|
75
73
|
.denominatorFilter=${args.denominatorFilter}
|
|
76
74
|
.granularity=${args.granularity}
|
|
77
75
|
.smoothingWindow=${args.smoothingWindow}
|
|
@@ -91,7 +89,7 @@ const Template: StoryObj<Required<PrevalenceOverTimeProps>> = {
|
|
|
91
89
|
export const TwoDatasets: StoryObj<Required<PrevalenceOverTimeProps>> = {
|
|
92
90
|
...Template,
|
|
93
91
|
args: {
|
|
94
|
-
|
|
92
|
+
numeratorFilters: [
|
|
95
93
|
{ displayName: 'EG', lapisFilter: { country: 'USA', pangoLineage: 'EG*', dateFrom: '2023-01-01' } },
|
|
96
94
|
{ displayName: 'JN.1', lapisFilter: { country: 'USA', pangoLineage: 'JN.1*', dateFrom: '2023-01-01' } },
|
|
97
95
|
],
|
|
@@ -165,10 +163,12 @@ export const TwoDatasets: StoryObj<Required<PrevalenceOverTimeProps>> = {
|
|
|
165
163
|
export const OneDataset: StoryObj<Required<PrevalenceOverTimeProps>> = {
|
|
166
164
|
...Template,
|
|
167
165
|
args: {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
166
|
+
numeratorFilters: [
|
|
167
|
+
{
|
|
168
|
+
displayName: 'EG',
|
|
169
|
+
lapisFilter: { country: 'USA', pangoLineage: 'BA.2.86*', dateFrom: '2023-10-01' },
|
|
170
|
+
},
|
|
171
|
+
],
|
|
172
172
|
denominatorFilter: { country: 'USA', dateFrom: '2023-10-01' },
|
|
173
173
|
granularity: 'week',
|
|
174
174
|
smoothingWindow: 2,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { customElement, property } from 'lit/decorators.js';
|
|
2
|
-
import {
|
|
2
|
+
import type { DetailedHTMLProps, HTMLAttributes } from 'react';
|
|
3
3
|
|
|
4
4
|
import { PrevalenceOverTime, type PrevalenceOverTimeProps } from '../../preact/prevalenceOverTime/prevalence-over-time';
|
|
5
5
|
import { type Equals, type Expect } from '../../utils/typeAssertions';
|
|
@@ -44,8 +44,6 @@ import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsS
|
|
|
44
44
|
*/
|
|
45
45
|
@customElement('gs-prevalence-over-time')
|
|
46
46
|
export class PrevalenceOverTimeComponent extends PreactLitAdapterWithGridJsStyles {
|
|
47
|
-
// prettier-ignore
|
|
48
|
-
// The multiline union type must not start with `|` because it looks weird in the Storybook docs
|
|
49
47
|
/**
|
|
50
48
|
* Either a LAPIS filter or an array of LAPIS filters to calculate the prevalence for.
|
|
51
49
|
*
|
|
@@ -57,22 +55,27 @@ export class PrevalenceOverTimeComponent extends PreactLitAdapterWithGridJsStyle
|
|
|
57
55
|
*
|
|
58
56
|
*/
|
|
59
57
|
@property({ type: Object })
|
|
60
|
-
|
|
61
|
-
{
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
58
|
+
numeratorFilters: {
|
|
59
|
+
lapisFilter: Record<string, string | string[] | number | null | boolean | undefined> & {
|
|
60
|
+
nucleotideMutations?: string[];
|
|
61
|
+
aminoAcidMutations?: string[];
|
|
62
|
+
nucleotideInsertions?: string[];
|
|
63
|
+
aminoAcidInsertions?: string[];
|
|
64
|
+
};
|
|
67
65
|
displayName: string;
|
|
68
|
-
}[] =
|
|
66
|
+
}[] = [];
|
|
69
67
|
|
|
70
68
|
/**
|
|
71
69
|
* The LAPIS filter, to select the data of the reference.
|
|
72
70
|
* It must be a valid LAPIS filter object.
|
|
73
71
|
*/
|
|
74
72
|
@property({ type: Object })
|
|
75
|
-
denominatorFilter: Record<string, string | number | null | boolean>
|
|
73
|
+
denominatorFilter: Record<string, string | string[] | number | null | boolean | undefined> & {
|
|
74
|
+
nucleotideMutations?: string[];
|
|
75
|
+
aminoAcidMutations?: string[];
|
|
76
|
+
nucleotideInsertions?: string[];
|
|
77
|
+
aminoAcidInsertions?: string[];
|
|
78
|
+
} = {};
|
|
76
79
|
|
|
77
80
|
/**
|
|
78
81
|
* The granularity of the time axis.
|
|
@@ -162,7 +165,7 @@ export class PrevalenceOverTimeComponent extends PreactLitAdapterWithGridJsStyle
|
|
|
162
165
|
override render() {
|
|
163
166
|
return (
|
|
164
167
|
<PrevalenceOverTime
|
|
165
|
-
|
|
168
|
+
numeratorFilters={this.numeratorFilters}
|
|
166
169
|
denominatorFilter={this.denominatorFilter}
|
|
167
170
|
granularity={this.granularity}
|
|
168
171
|
smoothingWindow={this.smoothingWindow}
|
|
@@ -196,7 +199,7 @@ declare global {
|
|
|
196
199
|
|
|
197
200
|
/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */
|
|
198
201
|
type NumeratorMatches = Expect<
|
|
199
|
-
Equals<typeof PrevalenceOverTimeComponent.prototype.
|
|
202
|
+
Equals<typeof PrevalenceOverTimeComponent.prototype.numeratorFilters, PrevalenceOverTimeProps['numeratorFilters']>
|
|
200
203
|
>;
|
|
201
204
|
type DenominatorMatches = Expect<
|
|
202
205
|
Equals<typeof PrevalenceOverTimeComponent.prototype.denominatorFilter, PrevalenceOverTimeProps['denominatorFilter']>
|
|
@@ -3,12 +3,11 @@ import { html } from 'lit';
|
|
|
3
3
|
|
|
4
4
|
import './gs-relative-growth-advantage';
|
|
5
5
|
import '../app';
|
|
6
|
-
// eslint-disable-next-line no-duplicate-imports
|
|
7
|
-
import { type RelativeGrowthAdvantageComponentProps } from './gs-relative-growth-advantage';
|
|
8
6
|
import { withComponentDocs } from '../../../.storybook/ComponentDocsBlock';
|
|
9
7
|
import { AGGREGATED_ENDPOINT, LAPIS_URL } from '../../constants';
|
|
10
8
|
import denominatorFilter from '../../preact/relativeGrowthAdvantage/__mockData__/denominatorFilter.json';
|
|
11
9
|
import numeratorFilter from '../../preact/relativeGrowthAdvantage/__mockData__/numeratorFilter.json';
|
|
10
|
+
import type { RelativeGrowthAdvantageProps } from '../../preact/relativeGrowthAdvantage/relative-growth-advantage';
|
|
12
11
|
|
|
13
12
|
const codeExample = String.raw`
|
|
14
13
|
<gs-relative-growth-advantage
|
|
@@ -23,7 +22,7 @@ const codeExample = String.raw`
|
|
|
23
22
|
yAxisMaxLogarithmic="limitTo1"
|
|
24
23
|
></gs-relative-growth-advantage>`;
|
|
25
24
|
|
|
26
|
-
const meta: Meta<
|
|
25
|
+
const meta: Meta<RelativeGrowthAdvantageProps> = {
|
|
27
26
|
title: 'Visualization/Relative growth advantage',
|
|
28
27
|
component: 'gs-relative-growth-advantage',
|
|
29
28
|
argTypes: {
|
|
@@ -51,7 +50,7 @@ const meta: Meta<RelativeGrowthAdvantageComponentProps> = {
|
|
|
51
50
|
|
|
52
51
|
export default meta;
|
|
53
52
|
|
|
54
|
-
const Template: StoryObj<Required<
|
|
53
|
+
const Template: StoryObj<Required<RelativeGrowthAdvantageProps>> = {
|
|
55
54
|
render: (args) => html`
|
|
56
55
|
<gs-app lapis="${LAPIS_URL}">
|
|
57
56
|
<gs-relative-growth-advantage
|
|
@@ -69,7 +68,7 @@ const Template: StoryObj<Required<RelativeGrowthAdvantageComponentProps>> = {
|
|
|
69
68
|
`,
|
|
70
69
|
};
|
|
71
70
|
|
|
72
|
-
export const Default: StoryObj<Required<
|
|
71
|
+
export const Default: StoryObj<Required<RelativeGrowthAdvantageProps>> = {
|
|
73
72
|
...Template,
|
|
74
73
|
args: {
|
|
75
74
|
numeratorFilter: {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { customElement, property } from 'lit/decorators.js';
|
|
2
|
-
import {
|
|
2
|
+
import type { DetailedHTMLProps, HTMLAttributes } from 'react';
|
|
3
3
|
|
|
4
4
|
import {
|
|
5
5
|
RelativeGrowthAdvantage,
|
|
6
6
|
type RelativeGrowthAdvantageProps,
|
|
7
7
|
} from '../../preact/relativeGrowthAdvantage/relative-growth-advantage';
|
|
8
|
-
import { type AxisMax } from '../../preact/shared/charts/getYAxisMax';
|
|
9
8
|
import { type Equals, type Expect } from '../../utils/typeAssertions';
|
|
10
9
|
import { PreactLitAdapter } from '../PreactLitAdapter';
|
|
11
10
|
|
|
@@ -42,14 +41,24 @@ export class RelativeGrowthAdvantageComponent extends PreactLitAdapter {
|
|
|
42
41
|
* It must be a valid LAPIS filter object.
|
|
43
42
|
*/
|
|
44
43
|
@property({ type: Object })
|
|
45
|
-
numeratorFilter: Record<string, string | number | null | boolean>
|
|
44
|
+
numeratorFilter: Record<string, string | string[] | number | null | boolean | undefined> & {
|
|
45
|
+
nucleotideMutations?: string[];
|
|
46
|
+
aminoAcidMutations?: string[];
|
|
47
|
+
nucleotideInsertions?: string[];
|
|
48
|
+
aminoAcidInsertions?: string[];
|
|
49
|
+
} = {};
|
|
46
50
|
|
|
47
51
|
/**
|
|
48
52
|
* LAPIS filter to select the data of the baseline variant.
|
|
49
53
|
* It must be a valid LAPIS filter object.
|
|
50
54
|
*/
|
|
51
55
|
@property({ type: Object })
|
|
52
|
-
denominatorFilter: Record<string, string | number | null | boolean>
|
|
56
|
+
denominatorFilter: Record<string, string | string[] | number | null | boolean | undefined> & {
|
|
57
|
+
nucleotideMutations?: string[];
|
|
58
|
+
aminoAcidMutations?: string[];
|
|
59
|
+
nucleotideInsertions?: string[];
|
|
60
|
+
aminoAcidInsertions?: string[];
|
|
61
|
+
} = {};
|
|
53
62
|
|
|
54
63
|
/**
|
|
55
64
|
* The generation time represents the number of days over which the variant's relative growth advantage is measured.
|
|
@@ -120,20 +129,13 @@ export class RelativeGrowthAdvantageComponent extends PreactLitAdapter {
|
|
|
120
129
|
width={this.width}
|
|
121
130
|
height={this.height}
|
|
122
131
|
lapisDateField={this.lapisDateField}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
logarithmic: this.yAxisMaxLogarithmic,
|
|
126
|
-
}}
|
|
132
|
+
yAxisMaxLinear={this.yAxisMaxLinear}
|
|
133
|
+
yAxisMaxLogarithmic={this.yAxisMaxLogarithmic}
|
|
127
134
|
/>
|
|
128
135
|
);
|
|
129
136
|
}
|
|
130
137
|
}
|
|
131
138
|
|
|
132
|
-
export interface RelativeGrowthAdvantageComponentProps extends Omit<RelativeGrowthAdvantageProps, 'yAxisMaxConfig'> {
|
|
133
|
-
yAxisMaxLinear?: AxisMax;
|
|
134
|
-
yAxisMaxLogarithmic?: AxisMax;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
139
|
declare global {
|
|
138
140
|
interface HTMLElementTagNameMap {
|
|
139
141
|
'gs-relative-growth-advantage': RelativeGrowthAdvantageComponent;
|
|
@@ -186,13 +188,13 @@ type LapisDateFieldMatches = Expect<
|
|
|
186
188
|
type YAxisMaxLinearMatches = Expect<
|
|
187
189
|
Equals<
|
|
188
190
|
typeof RelativeGrowthAdvantageComponent.prototype.yAxisMaxLinear,
|
|
189
|
-
|
|
191
|
+
RelativeGrowthAdvantageProps['yAxisMaxLinear']
|
|
190
192
|
>
|
|
191
193
|
>;
|
|
192
194
|
type YAxisMaxLogarithmicMatches = Expect<
|
|
193
195
|
Equals<
|
|
194
196
|
typeof RelativeGrowthAdvantageComponent.prototype.yAxisMaxLogarithmic,
|
|
195
|
-
|
|
197
|
+
RelativeGrowthAdvantageProps['yAxisMaxLogarithmic']
|
|
196
198
|
>
|
|
197
199
|
>;
|
|
198
200
|
/* eslint-enable @typescript-eslint/no-unused-vars, no-unused-vars */
|