@genspectrum/dashboard-components 0.4.4 → 0.5.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/README.md +2 -2
- package/custom-elements.json +279 -108
- package/dist/dashboard-components.js +495 -283
- package/dist/dashboard-components.js.map +1 -1
- package/dist/genspectrum-components.d.ts +115 -55
- package/dist/style.css +34 -7
- package/package.json +5 -5
- package/src/preact/aggregatedData/aggregate-table.tsx +3 -2
- package/src/preact/aggregatedData/aggregate.stories.tsx +2 -0
- package/src/preact/aggregatedData/aggregate.tsx +8 -3
- package/src/preact/components/table.stories.tsx +51 -1
- package/src/preact/components/table.tsx +4 -3
- package/src/preact/locationFilter/location-filter.stories.tsx +12 -1
- package/src/preact/locationFilter/location-filter.tsx +10 -3
- package/src/preact/mutationComparison/mutation-comparison-table.tsx +7 -2
- package/src/preact/mutationComparison/mutation-comparison-venn.tsx +1 -1
- package/src/preact/mutationComparison/mutation-comparison.stories.tsx +21 -18
- package/src/preact/mutationComparison/mutation-comparison.tsx +30 -8
- package/src/preact/mutationComparison/queryMutationData.ts +4 -4
- package/src/preact/mutations/mutations-grid.tsx +8 -2
- package/src/preact/mutations/mutations-insertions-table.tsx +3 -2
- package/src/preact/mutations/mutations-table.tsx +3 -2
- package/src/preact/mutations/mutations.stories.tsx +6 -3
- package/src/preact/mutations/mutations.tsx +30 -10
- package/src/preact/mutations/queryMutations.ts +3 -3
- package/src/preact/prevalenceOverTime/__mockData__/{denominatorOneVariant.json → denominatorFilterOneDataset.json} +1 -1
- package/src/preact/prevalenceOverTime/__mockData__/{numeratorOneVariant.json → numeratorFilterOneDataset.json} +1 -1
- package/src/preact/prevalenceOverTime/prevalence-over-time-bar-chart.tsx +42 -5
- package/src/preact/prevalenceOverTime/prevalence-over-time-bubble-chart.tsx +26 -7
- package/src/preact/prevalenceOverTime/prevalence-over-time-line-chart.tsx +62 -28
- package/src/preact/prevalenceOverTime/prevalence-over-time-table.tsx +3 -2
- package/src/preact/prevalenceOverTime/prevalence-over-time.stories.tsx +30 -16
- package/src/preact/prevalenceOverTime/prevalence-over-time.tsx +46 -12
- package/src/preact/relativeGrowthAdvantage/relative-growth-advantage-chart.tsx +39 -7
- package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.stories.tsx +10 -4
- package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.tsx +19 -10
- package/src/preact/shared/charts/confideceInterval.ts +7 -2
- package/src/preact/shared/charts/getYAxisMax.ts +24 -0
- package/src/preact/shared/charts/getYAxisScale.ts +1 -3
- package/src/query/queryAggregateData.ts +2 -2
- package/src/query/queryInsertions.ts +7 -2
- package/src/query/querySubstitutionsOrDeletions.ts +2 -2
- package/src/web-components/input/gs-date-range-selector.tsx +1 -1
- package/src/web-components/input/gs-location-filter.stories.ts +11 -0
- package/src/web-components/input/gs-location-filter.tsx +15 -2
- package/src/web-components/input/gs-mutation-filter.tsx +1 -1
- package/src/web-components/input/gs-text-input.tsx +1 -1
- package/src/web-components/visualization/gs-aggregate.stories.ts +4 -0
- package/src/web-components/visualization/gs-aggregate.tsx +10 -2
- package/src/web-components/visualization/gs-mutation-comparison.stories.ts +16 -12
- package/src/web-components/visualization/gs-mutation-comparison.tsx +26 -19
- package/src/web-components/visualization/gs-mutations.stories.ts +8 -4
- package/src/web-components/visualization/gs-mutations.tsx +18 -11
- package/src/web-components/visualization/gs-prevalence-over-time.stories.ts +51 -35
- package/src/web-components/visualization/gs-prevalence-over-time.tsx +66 -24
- package/src/web-components/visualization/gs-relative-growth-advantage.stories.ts +32 -18
- package/src/web-components/visualization/gs-relative-growth-advantage.tsx +51 -13
- /package/src/preact/mutationComparison/__mockData__/{nucleotideMutationsOtherVariant.json → nucleotideMutationsOtherDataset.json} +0 -0
- /package/src/preact/mutationComparison/__mockData__/{nucleotideMutationsSomeVariant.json → nucleotideMutationsSomeDataset.json} +0 -0
- /package/src/preact/prevalenceOverTime/__mockData__/{denominator.json → denominatorFilter.json} +0 -0
- /package/src/preact/prevalenceOverTime/__mockData__/{numeratorEG.json → numeratorFilterEG.json} +0 -0
- /package/src/preact/prevalenceOverTime/__mockData__/{numeratorJN1.json → numeratorFilterJN1.json} +0 -0
- /package/src/preact/relativeGrowthAdvantage/__mockData__/{denominator.json → denominatorFilter.json} +0 -0
- /package/src/preact/relativeGrowthAdvantage/__mockData__/{numerator.json → numeratorFilter.json} +0 -0
|
@@ -48,7 +48,7 @@ export class AggregateComponent extends PreactLitAdapterWithGridJsStyles {
|
|
|
48
48
|
/**
|
|
49
49
|
* The width of the component.
|
|
50
50
|
*
|
|
51
|
-
* Visit https://genspectrum.github.io/
|
|
51
|
+
* Visit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.
|
|
52
52
|
*/
|
|
53
53
|
@property({ type: String })
|
|
54
54
|
width: string = '100%';
|
|
@@ -56,7 +56,7 @@ export class AggregateComponent extends PreactLitAdapterWithGridJsStyles {
|
|
|
56
56
|
/**
|
|
57
57
|
* The height of the component.
|
|
58
58
|
*
|
|
59
|
-
* Visit https://genspectrum.github.io/
|
|
59
|
+
* Visit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.
|
|
60
60
|
*/
|
|
61
61
|
@property({ type: String })
|
|
62
62
|
height: string = '700px';
|
|
@@ -80,6 +80,13 @@ export class AggregateComponent extends PreactLitAdapterWithGridJsStyles {
|
|
|
80
80
|
@property({ type: String })
|
|
81
81
|
initialSortDirection: 'ascending' | 'descending' = 'descending';
|
|
82
82
|
|
|
83
|
+
/**
|
|
84
|
+
* The maximum number of rows to display in the table view.
|
|
85
|
+
* Set to `false` to disable pagination. Set to `true` to enable pagination with a default limit (10).
|
|
86
|
+
*/
|
|
87
|
+
@property({ type: Object })
|
|
88
|
+
pageSize: boolean | number = false;
|
|
89
|
+
|
|
83
90
|
override render() {
|
|
84
91
|
return (
|
|
85
92
|
<Aggregate
|
|
@@ -91,6 +98,7 @@ export class AggregateComponent extends PreactLitAdapterWithGridJsStyles {
|
|
|
91
98
|
headline={this.headline}
|
|
92
99
|
initialSortField={this.initialSortField}
|
|
93
100
|
initialSortDirection={this.initialSortDirection}
|
|
101
|
+
pageSize={this.pageSize}
|
|
94
102
|
/>
|
|
95
103
|
);
|
|
96
104
|
}
|
|
@@ -6,26 +6,27 @@ import './gs-mutation-comparison';
|
|
|
6
6
|
import '../app';
|
|
7
7
|
import { withComponentDocs } from '../../../.storybook/ComponentDocsBlock';
|
|
8
8
|
import { LAPIS_URL, NUCLEOTIDE_MUTATIONS_ENDPOINT } from '../../constants';
|
|
9
|
-
import
|
|
10
|
-
import
|
|
9
|
+
import nucleotideMutationsOtherDataset from '../../preact/mutationComparison/__mockData__/nucleotideMutationsOtherDataset.json';
|
|
10
|
+
import nucleotideMutationsSomeDataset from '../../preact/mutationComparison/__mockData__/nucleotideMutationsSomeDataset.json';
|
|
11
11
|
import { type MutationComparisonProps } from '../../preact/mutationComparison/mutation-comparison';
|
|
12
12
|
import { withinShadowRoot } from '../withinShadowRoot.story';
|
|
13
13
|
|
|
14
14
|
const codeExample = String.raw`
|
|
15
15
|
<gs-mutation-comparison
|
|
16
|
-
|
|
16
|
+
lapisFilters='[{ "displayName": "Data in Switzerland", "lapisFilter": { "country": "Switzerland" }}, { "displayName": "Data in Germany", "lapisFilter": { "country": "Germany" }}]'
|
|
17
17
|
sequenceType="nucleotide"
|
|
18
18
|
views='["table", "venn"]'
|
|
19
19
|
headline="Mutation comparison"
|
|
20
20
|
width='100%'
|
|
21
21
|
height='700px'
|
|
22
|
+
pageSize="10"
|
|
22
23
|
></gs-mutation-comparison>`;
|
|
23
24
|
|
|
24
25
|
const meta: Meta<Required<MutationComparisonProps>> = {
|
|
25
26
|
title: 'Visualization/Mutation comparison',
|
|
26
27
|
component: 'gs-mutation-comparison',
|
|
27
28
|
argTypes: {
|
|
28
|
-
|
|
29
|
+
lapisFilters: { control: 'object' },
|
|
29
30
|
sequenceType: {
|
|
30
31
|
options: ['nucleotide', 'amino acid'],
|
|
31
32
|
control: { type: 'radio' },
|
|
@@ -37,6 +38,7 @@ const meta: Meta<Required<MutationComparisonProps>> = {
|
|
|
37
38
|
width: { control: 'text' },
|
|
38
39
|
height: { control: 'text' },
|
|
39
40
|
headline: { control: 'text' },
|
|
41
|
+
pageSize: { control: 'object' },
|
|
40
42
|
},
|
|
41
43
|
parameters: withComponentDocs({
|
|
42
44
|
componentDocs: {
|
|
@@ -54,12 +56,13 @@ const Template: StoryObj<Required<MutationComparisonProps>> = {
|
|
|
54
56
|
render: (args) => html`
|
|
55
57
|
<gs-app lapis="${LAPIS_URL}">
|
|
56
58
|
<gs-mutation-comparison
|
|
57
|
-
.
|
|
59
|
+
.lapisFilters=${args.lapisFilters}
|
|
58
60
|
.sequenceType=${args.sequenceType}
|
|
59
61
|
.views=${args.views}
|
|
60
62
|
.width=${args.width}
|
|
61
63
|
.height=${args.height}
|
|
62
64
|
.headline=${args.headline}
|
|
65
|
+
.pageSize=${args.pageSize}
|
|
63
66
|
></gs-mutation-comparison>
|
|
64
67
|
</gs-app>
|
|
65
68
|
`,
|
|
@@ -71,13 +74,13 @@ const dateFrom = '2021-01-01';
|
|
|
71
74
|
export const Default: StoryObj<Required<MutationComparisonProps>> = {
|
|
72
75
|
...Template,
|
|
73
76
|
args: {
|
|
74
|
-
|
|
77
|
+
lapisFilters: [
|
|
75
78
|
{
|
|
76
|
-
displayName: 'Some
|
|
79
|
+
displayName: 'Some dataset',
|
|
77
80
|
lapisFilter: { country: 'Switzerland', pangoLineage: 'B.1.1.7', dateTo },
|
|
78
81
|
},
|
|
79
82
|
{
|
|
80
|
-
displayName: 'Other
|
|
83
|
+
displayName: 'Other dataset',
|
|
81
84
|
lapisFilter: {
|
|
82
85
|
country: 'Switzerland',
|
|
83
86
|
pangoLineage: 'B.1.1.7',
|
|
@@ -91,13 +94,14 @@ export const Default: StoryObj<Required<MutationComparisonProps>> = {
|
|
|
91
94
|
width: '100%',
|
|
92
95
|
height: '700px',
|
|
93
96
|
headline: 'Mutation comparison',
|
|
97
|
+
pageSize: 10,
|
|
94
98
|
},
|
|
95
99
|
parameters: {
|
|
96
100
|
fetchMock: {
|
|
97
101
|
mocks: [
|
|
98
102
|
{
|
|
99
103
|
matcher: {
|
|
100
|
-
name: '
|
|
104
|
+
name: 'nucleotideMutationsSomeDataset',
|
|
101
105
|
url: NUCLEOTIDE_MUTATIONS_ENDPOINT,
|
|
102
106
|
body: {
|
|
103
107
|
country: 'Switzerland',
|
|
@@ -108,12 +112,12 @@ export const Default: StoryObj<Required<MutationComparisonProps>> = {
|
|
|
108
112
|
},
|
|
109
113
|
response: {
|
|
110
114
|
status: 200,
|
|
111
|
-
body:
|
|
115
|
+
body: nucleotideMutationsSomeDataset,
|
|
112
116
|
},
|
|
113
117
|
},
|
|
114
118
|
{
|
|
115
119
|
matcher: {
|
|
116
|
-
name: '
|
|
120
|
+
name: 'nucleotideMutationsOtherDataset',
|
|
117
121
|
url: NUCLEOTIDE_MUTATIONS_ENDPOINT,
|
|
118
122
|
body: {
|
|
119
123
|
country: 'Switzerland',
|
|
@@ -125,7 +129,7 @@ export const Default: StoryObj<Required<MutationComparisonProps>> = {
|
|
|
125
129
|
},
|
|
126
130
|
response: {
|
|
127
131
|
status: 200,
|
|
128
|
-
body:
|
|
132
|
+
body: nucleotideMutationsOtherDataset,
|
|
129
133
|
},
|
|
130
134
|
},
|
|
131
135
|
],
|
|
@@ -7,8 +7,8 @@ import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsS
|
|
|
7
7
|
/**
|
|
8
8
|
* ## Context
|
|
9
9
|
*
|
|
10
|
-
* This component allows to compare mutations between different
|
|
11
|
-
*
|
|
10
|
+
* This component allows to compare mutations between two different datasets.
|
|
11
|
+
* The datasets are selected by LAPIS filters.
|
|
12
12
|
*
|
|
13
13
|
* It only shows substitutions and deletions, it does not show insertions.
|
|
14
14
|
*
|
|
@@ -16,34 +16,33 @@ import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsS
|
|
|
16
16
|
*
|
|
17
17
|
* ### Table View
|
|
18
18
|
*
|
|
19
|
-
* The table view shows mutations
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* and where the proportion is within the selected proportion interval for at least one variant.
|
|
19
|
+
* The table view shows mutations and the proportions with which the mutation occurs in the respective data subsets.
|
|
20
|
+
* It only shows mutations that are present in at least one of the data subsets
|
|
21
|
+
* and where the proportion is within the selected proportion interval for at least one data subset.
|
|
23
22
|
*
|
|
24
23
|
* ### Venn View
|
|
25
24
|
*
|
|
26
|
-
* The Venn view shows the overlap of mutations between the
|
|
27
|
-
* A
|
|
28
|
-
*
|
|
29
|
-
* Thus, changing the proportion interval may change a mutations from being "common" between
|
|
30
|
-
* to being "for one
|
|
25
|
+
* The Venn view shows the overlap of mutations between the datasets in a Venn diagram.
|
|
26
|
+
* A dataset is considered to have a certain mutation, if the proportion of the mutation in the dataset is within the
|
|
27
|
+
* selected proportion interval.
|
|
28
|
+
* Thus, changing the proportion interval may change a mutations from being "common" between the datasets
|
|
29
|
+
* to being "for one dataset only".
|
|
31
30
|
*/
|
|
32
31
|
@customElement('gs-mutation-comparison')
|
|
33
32
|
export class MutationComparisonComponent extends PreactLitAdapterWithGridJsStyles {
|
|
34
33
|
/**
|
|
35
34
|
* Required.
|
|
36
35
|
*
|
|
37
|
-
* An array of
|
|
36
|
+
* An array of LAPIS filters to select the data to compare.
|
|
38
37
|
*
|
|
39
38
|
* The `lapisFilter` will be sent as is to LAPIS to filter the mutation data.
|
|
40
39
|
* It must be a valid LAPIS filter object.
|
|
41
40
|
*
|
|
42
|
-
* The `displayName` will be used as the label for the
|
|
41
|
+
* The `displayName` will be used as the label for the filtered dataset in the views.
|
|
43
42
|
* It should be human-readable.
|
|
44
43
|
*/
|
|
45
44
|
@property({ type: Array })
|
|
46
|
-
|
|
45
|
+
lapisFilters: {
|
|
47
46
|
lapisFilter: Record<string, string | number | null | boolean>;
|
|
48
47
|
displayName: string;
|
|
49
48
|
}[] = [];
|
|
@@ -63,7 +62,7 @@ export class MutationComparisonComponent extends PreactLitAdapterWithGridJsStyle
|
|
|
63
62
|
/**
|
|
64
63
|
* The width of the component.
|
|
65
64
|
*
|
|
66
|
-
* Visit https://genspectrum.github.io/
|
|
65
|
+
* Visit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.
|
|
67
66
|
*/
|
|
68
67
|
@property({ type: String })
|
|
69
68
|
width: string = '100%';
|
|
@@ -71,7 +70,7 @@ export class MutationComparisonComponent extends PreactLitAdapterWithGridJsStyle
|
|
|
71
70
|
/**
|
|
72
71
|
* The height of the component.
|
|
73
72
|
*
|
|
74
|
-
* Visit https://genspectrum.github.io/
|
|
73
|
+
* Visit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.
|
|
75
74
|
*/
|
|
76
75
|
@property({ type: String })
|
|
77
76
|
height: string = '700px';
|
|
@@ -82,15 +81,23 @@ export class MutationComparisonComponent extends PreactLitAdapterWithGridJsStyle
|
|
|
82
81
|
@property({ type: String })
|
|
83
82
|
headline: string = 'Mutation comparison';
|
|
84
83
|
|
|
84
|
+
/**
|
|
85
|
+
* The maximum number of rows to display in the table view.
|
|
86
|
+
* Set to `false` to disable pagination. Set to `true` to enable pagination with a default limit (10).
|
|
87
|
+
*/
|
|
88
|
+
@property({ type: Object })
|
|
89
|
+
pageSize: boolean | number = false;
|
|
90
|
+
|
|
85
91
|
override render() {
|
|
86
92
|
return (
|
|
87
93
|
<MutationComparison
|
|
88
|
-
|
|
94
|
+
lapisFilters={this.lapisFilters}
|
|
89
95
|
sequenceType={this.sequenceType}
|
|
90
96
|
views={this.views}
|
|
91
97
|
width={this.width}
|
|
92
98
|
height={this.height}
|
|
93
99
|
headline={this.headline}
|
|
100
|
+
pageSize={this.pageSize}
|
|
94
101
|
/>
|
|
95
102
|
);
|
|
96
103
|
}
|
|
@@ -103,8 +110,8 @@ declare global {
|
|
|
103
110
|
}
|
|
104
111
|
|
|
105
112
|
/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */
|
|
106
|
-
type
|
|
107
|
-
Equals<typeof MutationComparisonComponent.prototype.
|
|
113
|
+
type LapisFiltersMatches = Expect<
|
|
114
|
+
Equals<typeof MutationComparisonComponent.prototype.lapisFilters, MutationComparisonProps['lapisFilters']>
|
|
108
115
|
>;
|
|
109
116
|
type SequenceTypeMatches = Expect<
|
|
110
117
|
Equals<typeof MutationComparisonComponent.prototype.sequenceType, MutationComparisonProps['sequenceType']>
|
|
@@ -13,19 +13,20 @@ import { withinShadowRoot } from '../withinShadowRoot.story';
|
|
|
13
13
|
|
|
14
14
|
const codeExample = String.raw`
|
|
15
15
|
<gs-mutations
|
|
16
|
-
|
|
16
|
+
lapisFilter='{ "country": "Switzerland", "pangoLineage": "B.1.1.7", "dateTo": "2022-01-01" }'
|
|
17
17
|
sequenceType="nucleotide"
|
|
18
18
|
views='["grid", "table", "insertions"]'
|
|
19
19
|
headline="Mutations"
|
|
20
20
|
width='100%'
|
|
21
21
|
height='700px'
|
|
22
|
+
pageSize="10"
|
|
22
23
|
></gs-mutations>`;
|
|
23
24
|
|
|
24
25
|
const meta: Meta<Required<MutationsProps>> = {
|
|
25
26
|
title: 'Visualization/Mutations',
|
|
26
27
|
component: 'gs-mutations',
|
|
27
28
|
argTypes: {
|
|
28
|
-
|
|
29
|
+
lapisFilter: { control: 'object' },
|
|
29
30
|
sequenceType: {
|
|
30
31
|
options: ['nucleotide', 'amino acid'],
|
|
31
32
|
control: { type: 'radio' },
|
|
@@ -37,14 +38,16 @@ const meta: Meta<Required<MutationsProps>> = {
|
|
|
37
38
|
width: { control: 'text' },
|
|
38
39
|
height: { control: 'text' },
|
|
39
40
|
headline: { control: 'text' },
|
|
41
|
+
pageSize: { control: 'object' },
|
|
40
42
|
},
|
|
41
43
|
args: {
|
|
42
|
-
|
|
44
|
+
lapisFilter: { country: 'Switzerland', pangoLineage: 'B.1.1.7', dateTo: '2022-01-01' },
|
|
43
45
|
sequenceType: 'nucleotide',
|
|
44
46
|
views: ['grid', 'table', 'insertions'],
|
|
45
47
|
width: '100%',
|
|
46
48
|
height: '700px',
|
|
47
49
|
headline: 'Mutations',
|
|
50
|
+
pageSize: 10,
|
|
48
51
|
},
|
|
49
52
|
parameters: withComponentDocs({
|
|
50
53
|
componentDocs: {
|
|
@@ -62,12 +65,13 @@ const Template: StoryObj<Required<MutationsProps>> = {
|
|
|
62
65
|
render: (args) => html`
|
|
63
66
|
<gs-app lapis="${LAPIS_URL}">
|
|
64
67
|
<gs-mutations
|
|
65
|
-
.
|
|
68
|
+
.lapisFilter=${args.lapisFilter}
|
|
66
69
|
.sequenceType=${args.sequenceType}
|
|
67
70
|
.views=${args.views}
|
|
68
71
|
.width=${args.width}
|
|
69
72
|
.height=${args.height}
|
|
70
73
|
.headline=${args.headline}
|
|
74
|
+
.pageSize=${args.pageSize}
|
|
71
75
|
></gs-mutations>
|
|
72
76
|
</gs-app>
|
|
73
77
|
`,
|
|
@@ -8,15 +8,15 @@ import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsS
|
|
|
8
8
|
/**
|
|
9
9
|
* ## Context
|
|
10
10
|
*
|
|
11
|
-
* This component displays mutations (substitutions, deletions and insertions) for a
|
|
11
|
+
* This component displays mutations (substitutions, deletions and insertions) for a dataset selected by a LAPIS filter.
|
|
12
12
|
*
|
|
13
13
|
* ## Views
|
|
14
14
|
*
|
|
15
15
|
* ### Table View
|
|
16
16
|
*
|
|
17
|
-
* The table view shows all substitutions and deletions for the
|
|
17
|
+
* The table view shows all substitutions and deletions for the dataset.
|
|
18
18
|
* It shows the type (substitution or deletion), the total count of the mutation
|
|
19
|
-
* and the proportion of the mutation in the
|
|
19
|
+
* and the proportion of the mutation in the dataset.
|
|
20
20
|
* The proportion is relative to the total number of sequences matching
|
|
21
21
|
* the specified sequence filters with non-ambiguous reads at that position.
|
|
22
22
|
*
|
|
@@ -29,7 +29,7 @@ import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsS
|
|
|
29
29
|
*
|
|
30
30
|
* ### Insertions View
|
|
31
31
|
*
|
|
32
|
-
* The insertions view shows the count of all insertions for the
|
|
32
|
+
* The insertions view shows the count of all insertions for the dataset.
|
|
33
33
|
*
|
|
34
34
|
*/
|
|
35
35
|
@customElement('gs-mutations')
|
|
@@ -37,11 +37,10 @@ export class MutationsComponent extends PreactLitAdapterWithGridJsStyles {
|
|
|
37
37
|
/**
|
|
38
38
|
* Required.
|
|
39
39
|
*
|
|
40
|
-
*
|
|
41
|
-
* It must be a valid LAPIS filter object.
|
|
40
|
+
* LAPIS filter to select the displayed data.
|
|
42
41
|
*/
|
|
43
42
|
@property({ type: Object })
|
|
44
|
-
|
|
43
|
+
lapisFilter: Record<string, string | number | null | boolean> = {};
|
|
45
44
|
|
|
46
45
|
/**
|
|
47
46
|
* The type of the sequence for which the mutations should be shown.
|
|
@@ -58,7 +57,7 @@ export class MutationsComponent extends PreactLitAdapterWithGridJsStyles {
|
|
|
58
57
|
/**
|
|
59
58
|
* The width of the component.
|
|
60
59
|
*
|
|
61
|
-
* Visit https://genspectrum.github.io/
|
|
60
|
+
* Visit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.
|
|
62
61
|
*/
|
|
63
62
|
@property({ type: String })
|
|
64
63
|
width: string = '100%';
|
|
@@ -66,7 +65,7 @@ export class MutationsComponent extends PreactLitAdapterWithGridJsStyles {
|
|
|
66
65
|
/**
|
|
67
66
|
* The height of the component.
|
|
68
67
|
*
|
|
69
|
-
* Visit https://genspectrum.github.io/
|
|
68
|
+
* Visit https://genspectrum.github.io/dashboard-components/?path=/docs/components-size-of-components--docs for more information.
|
|
70
69
|
*/
|
|
71
70
|
@property({ type: String })
|
|
72
71
|
height: string = '700px';
|
|
@@ -77,15 +76,23 @@ export class MutationsComponent extends PreactLitAdapterWithGridJsStyles {
|
|
|
77
76
|
@property({ type: String })
|
|
78
77
|
headline: string = 'Mutations';
|
|
79
78
|
|
|
79
|
+
/**
|
|
80
|
+
* The maximum number of rows to display in the table view.
|
|
81
|
+
* Set to `false` to disable pagination. Set to `true` to enable pagination with a default limit (10).
|
|
82
|
+
*/
|
|
83
|
+
@property({ type: Object })
|
|
84
|
+
pageSize: boolean | number = false;
|
|
85
|
+
|
|
80
86
|
override render() {
|
|
81
87
|
return (
|
|
82
88
|
<Mutations
|
|
83
|
-
|
|
89
|
+
lapisFilter={this.lapisFilter}
|
|
84
90
|
sequenceType={this.sequenceType}
|
|
85
91
|
views={this.views}
|
|
86
92
|
width={this.width}
|
|
87
93
|
height={this.height}
|
|
88
94
|
headline={this.headline}
|
|
95
|
+
pageSize={this.pageSize}
|
|
89
96
|
/>
|
|
90
97
|
);
|
|
91
98
|
}
|
|
@@ -98,7 +105,7 @@ declare global {
|
|
|
98
105
|
}
|
|
99
106
|
|
|
100
107
|
/* eslint-disable @typescript-eslint/no-unused-vars, no-unused-vars */
|
|
101
|
-
type
|
|
108
|
+
type LapisFilterMatches = Expect<Equals<typeof MutationsComponent.prototype.lapisFilter, LapisFilter>>;
|
|
102
109
|
type SequenceTypeMatches = Expect<Equals<typeof MutationsComponent.prototype.sequenceType, SequenceType>>;
|
|
103
110
|
type ViewsMatches = Expect<Equals<typeof MutationsComponent.prototype.views, View[]>>;
|
|
104
111
|
/* eslint-enable @typescript-eslint/no-unused-vars, no-unused-vars */
|
|
@@ -4,20 +4,21 @@ import { html } from 'lit';
|
|
|
4
4
|
|
|
5
5
|
import '../app';
|
|
6
6
|
import './gs-prevalence-over-time';
|
|
7
|
+
// eslint-disable-next-line no-duplicate-imports
|
|
8
|
+
import { type PrevalenceOverTimeComponentProps } from './gs-prevalence-over-time';
|
|
7
9
|
import { withComponentDocs } from '../../../.storybook/ComponentDocsBlock';
|
|
8
10
|
import { AGGREGATED_ENDPOINT, LAPIS_URL } from '../../constants';
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import { type PrevalenceOverTimeProps } from '../../preact/prevalenceOverTime/prevalence-over-time';
|
|
11
|
+
import denominatorFilter from '../../preact/prevalenceOverTime/__mockData__/denominatorFilter.json';
|
|
12
|
+
import denominatorFilterOneDataset from '../../preact/prevalenceOverTime/__mockData__/denominatorFilterOneDataset.json';
|
|
13
|
+
import numeratorFilterEG from '../../preact/prevalenceOverTime/__mockData__/numeratorFilterEG.json';
|
|
14
|
+
import numeratorFilterJN1 from '../../preact/prevalenceOverTime/__mockData__/numeratorFilterJN1.json';
|
|
15
|
+
import numeratorFilterOneDataset from '../../preact/prevalenceOverTime/__mockData__/numeratorFilterOneDataset.json';
|
|
15
16
|
import { withinShadowRoot } from '../withinShadowRoot.story';
|
|
16
17
|
|
|
17
18
|
const codeExample = String.raw`
|
|
18
19
|
<gs-prevalence-over-time
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
numeratorFilter='[{ "displayName": "EG", "lapisFilter": { "country": "USA", "pangoLineage": "EG*" }}, { "displayName": "JN.1", "lapisFilter": { "country": "USA", "pangoLineage": "JN.1*" }}]'
|
|
21
|
+
denominatorFilter='{ "country": "USA"}'
|
|
21
22
|
granularity="month"
|
|
22
23
|
smoothingWindow="0"
|
|
23
24
|
views='["bar", "line", "bubble", "table"]'
|
|
@@ -26,14 +27,17 @@ const codeExample = String.raw`
|
|
|
26
27
|
width="100%"
|
|
27
28
|
height="700px"
|
|
28
29
|
lapisDateField="date"
|
|
30
|
+
pageSize="10"
|
|
31
|
+
yAxisMaxLinear="1"
|
|
32
|
+
yAxisMaxLogarithmic="limitTo1"
|
|
29
33
|
></gs-prevalence-over-time>`;
|
|
30
34
|
|
|
31
|
-
const meta: Meta<Required<
|
|
35
|
+
const meta: Meta<Required<PrevalenceOverTimeComponentProps>> = {
|
|
32
36
|
title: 'Visualization/Prevalence over time',
|
|
33
37
|
component: 'gs-prevalence-over-time',
|
|
34
38
|
argTypes: {
|
|
35
|
-
|
|
36
|
-
|
|
39
|
+
numeratorFilter: { control: 'object' },
|
|
40
|
+
denominatorFilter: { control: 'object' },
|
|
37
41
|
granularity: {
|
|
38
42
|
options: ['day', 'week', 'month', 'year'],
|
|
39
43
|
control: { type: 'radio' },
|
|
@@ -50,6 +54,9 @@ const meta: Meta<Required<PrevalenceOverTimeProps>> = {
|
|
|
50
54
|
width: { control: 'text' },
|
|
51
55
|
height: { control: 'text' },
|
|
52
56
|
headline: { control: 'text' },
|
|
57
|
+
pageSize: { control: 'object' },
|
|
58
|
+
yAxisMaxLinear: { control: 'object' },
|
|
59
|
+
yAxisMaxLogarithmic: { control: 'object' },
|
|
53
60
|
},
|
|
54
61
|
parameters: withComponentDocs({
|
|
55
62
|
componentDocs: {
|
|
@@ -63,12 +70,12 @@ const meta: Meta<Required<PrevalenceOverTimeProps>> = {
|
|
|
63
70
|
|
|
64
71
|
export default meta;
|
|
65
72
|
|
|
66
|
-
const Template: StoryObj<Required<
|
|
73
|
+
const Template: StoryObj<Required<PrevalenceOverTimeComponentProps>> = {
|
|
67
74
|
render: (args) => html`
|
|
68
75
|
<gs-app lapis="${LAPIS_URL}">
|
|
69
76
|
<gs-prevalence-over-time
|
|
70
|
-
.
|
|
71
|
-
.
|
|
77
|
+
.numeratorFilter=${args.numeratorFilter}
|
|
78
|
+
.denominatorFilter=${args.denominatorFilter}
|
|
72
79
|
.granularity=${args.granularity}
|
|
73
80
|
.smoothingWindow=${args.smoothingWindow}
|
|
74
81
|
.views=${args.views}
|
|
@@ -77,19 +84,22 @@ const Template: StoryObj<Required<PrevalenceOverTimeProps>> = {
|
|
|
77
84
|
.height=${args.height}
|
|
78
85
|
.headline=${args.headline}
|
|
79
86
|
.lapisDateField=${args.lapisDateField}
|
|
87
|
+
.pageSize=${args.pageSize}
|
|
88
|
+
.yAxisMaxLinear=${args.yAxisMaxLinear}
|
|
89
|
+
.yAxisMaxLogarithmic=${args.yAxisMaxLogarithmic}
|
|
80
90
|
></gs-prevalence-over-time>
|
|
81
91
|
</gs-app>
|
|
82
92
|
`,
|
|
83
93
|
};
|
|
84
94
|
|
|
85
|
-
export const
|
|
95
|
+
export const TwoDatasets: StoryObj<Required<PrevalenceOverTimeComponentProps>> = {
|
|
86
96
|
...Template,
|
|
87
97
|
args: {
|
|
88
|
-
|
|
98
|
+
numeratorFilter: [
|
|
89
99
|
{ displayName: 'EG', lapisFilter: { country: 'USA', pangoLineage: 'EG*', dateFrom: '2023-01-01' } },
|
|
90
100
|
{ displayName: 'JN.1', lapisFilter: { country: 'USA', pangoLineage: 'JN.1*', dateFrom: '2023-01-01' } },
|
|
91
101
|
],
|
|
92
|
-
|
|
102
|
+
denominatorFilter: { country: 'USA', dateFrom: '2023-01-01' },
|
|
93
103
|
granularity: 'month',
|
|
94
104
|
smoothingWindow: 0,
|
|
95
105
|
views: ['bar', 'line', 'bubble', 'table'],
|
|
@@ -98,6 +108,9 @@ export const TwoVariants: StoryObj<Required<PrevalenceOverTimeProps>> = {
|
|
|
98
108
|
height: '700px',
|
|
99
109
|
headline: 'Prevalence over time',
|
|
100
110
|
lapisDateField: 'date',
|
|
111
|
+
pageSize: 10,
|
|
112
|
+
yAxisMaxLinear: 1,
|
|
113
|
+
yAxisMaxLogarithmic: 'limitTo1',
|
|
101
114
|
},
|
|
102
115
|
parameters: {
|
|
103
116
|
fetchMock: {
|
|
@@ -115,7 +128,7 @@ export const TwoVariants: StoryObj<Required<PrevalenceOverTimeProps>> = {
|
|
|
115
128
|
},
|
|
116
129
|
response: {
|
|
117
130
|
status: 200,
|
|
118
|
-
body:
|
|
131
|
+
body: numeratorFilterEG,
|
|
119
132
|
},
|
|
120
133
|
},
|
|
121
134
|
{
|
|
@@ -131,7 +144,7 @@ export const TwoVariants: StoryObj<Required<PrevalenceOverTimeProps>> = {
|
|
|
131
144
|
},
|
|
132
145
|
response: {
|
|
133
146
|
status: 200,
|
|
134
|
-
body:
|
|
147
|
+
body: numeratorFilterJN1,
|
|
135
148
|
},
|
|
136
149
|
},
|
|
137
150
|
{
|
|
@@ -146,7 +159,7 @@ export const TwoVariants: StoryObj<Required<PrevalenceOverTimeProps>> = {
|
|
|
146
159
|
},
|
|
147
160
|
response: {
|
|
148
161
|
status: 200,
|
|
149
|
-
body:
|
|
162
|
+
body: denominatorFilter,
|
|
150
163
|
},
|
|
151
164
|
},
|
|
152
165
|
],
|
|
@@ -154,29 +167,32 @@ export const TwoVariants: StoryObj<Required<PrevalenceOverTimeProps>> = {
|
|
|
154
167
|
},
|
|
155
168
|
};
|
|
156
169
|
|
|
157
|
-
export const
|
|
170
|
+
export const OneDataset: StoryObj<Required<PrevalenceOverTimeComponentProps>> = {
|
|
158
171
|
...Template,
|
|
159
172
|
args: {
|
|
160
|
-
|
|
173
|
+
numeratorFilter: {
|
|
161
174
|
displayName: 'EG',
|
|
162
175
|
lapisFilter: { country: 'USA', pangoLineage: 'BA.2.86*', dateFrom: '2023-10-01' },
|
|
163
176
|
},
|
|
164
|
-
|
|
165
|
-
granularity: '
|
|
166
|
-
smoothingWindow:
|
|
177
|
+
denominatorFilter: { country: 'USA', dateFrom: '2023-10-01' },
|
|
178
|
+
granularity: 'week',
|
|
179
|
+
smoothingWindow: 2,
|
|
167
180
|
views: ['bar', 'line', 'bubble', 'table'],
|
|
168
181
|
confidenceIntervalMethods: ['wilson'],
|
|
169
182
|
width: '100%',
|
|
170
183
|
height: '700px',
|
|
171
184
|
headline: 'Prevalence over time',
|
|
172
185
|
lapisDateField: 'date',
|
|
186
|
+
pageSize: 10,
|
|
187
|
+
yAxisMaxLinear: 1,
|
|
188
|
+
yAxisMaxLogarithmic: 'limitTo1',
|
|
173
189
|
},
|
|
174
190
|
parameters: {
|
|
175
191
|
fetchMock: {
|
|
176
192
|
mocks: [
|
|
177
193
|
{
|
|
178
194
|
matcher: {
|
|
179
|
-
name: '
|
|
195
|
+
name: 'numeratorOneDataset',
|
|
180
196
|
url: AGGREGATED_ENDPOINT,
|
|
181
197
|
body: {
|
|
182
198
|
country: 'USA',
|
|
@@ -187,12 +203,12 @@ export const OneVariant: StoryObj<Required<PrevalenceOverTimeProps>> = {
|
|
|
187
203
|
},
|
|
188
204
|
response: {
|
|
189
205
|
status: 200,
|
|
190
|
-
body:
|
|
206
|
+
body: numeratorFilterOneDataset,
|
|
191
207
|
},
|
|
192
208
|
},
|
|
193
209
|
{
|
|
194
210
|
matcher: {
|
|
195
|
-
name: '
|
|
211
|
+
name: 'denominatorOneDataset',
|
|
196
212
|
url: AGGREGATED_ENDPOINT,
|
|
197
213
|
body: {
|
|
198
214
|
country: 'USA',
|
|
@@ -202,7 +218,7 @@ export const OneVariant: StoryObj<Required<PrevalenceOverTimeProps>> = {
|
|
|
202
218
|
},
|
|
203
219
|
response: {
|
|
204
220
|
status: 200,
|
|
205
|
-
body:
|
|
221
|
+
body: denominatorFilterOneDataset,
|
|
206
222
|
},
|
|
207
223
|
},
|
|
208
224
|
],
|
|
@@ -210,8 +226,8 @@ export const OneVariant: StoryObj<Required<PrevalenceOverTimeProps>> = {
|
|
|
210
226
|
},
|
|
211
227
|
};
|
|
212
228
|
|
|
213
|
-
export const
|
|
214
|
-
...
|
|
229
|
+
export const OneDatasetOnLineTab: StoryObj<Required<PrevalenceOverTimeComponentProps>> = {
|
|
230
|
+
...OneDataset,
|
|
215
231
|
play: async ({ canvasElement }) => {
|
|
216
232
|
const canvas = await withinShadowRoot(canvasElement, 'gs-prevalence-over-time');
|
|
217
233
|
|
|
@@ -221,8 +237,8 @@ export const OneVariantOnLineTab: StoryObj<Required<PrevalenceOverTimeProps>> =
|
|
|
221
237
|
},
|
|
222
238
|
};
|
|
223
239
|
|
|
224
|
-
export const
|
|
225
|
-
...
|
|
240
|
+
export const OneDatasetOnBubbleTab: StoryObj<Required<PrevalenceOverTimeComponentProps>> = {
|
|
241
|
+
...OneDataset,
|
|
226
242
|
play: async ({ canvasElement }) => {
|
|
227
243
|
const canvas = await withinShadowRoot(canvasElement, 'gs-prevalence-over-time');
|
|
228
244
|
|
|
@@ -232,8 +248,8 @@ export const OneVariantOnBubbleTab: StoryObj<Required<PrevalenceOverTimeProps>>
|
|
|
232
248
|
},
|
|
233
249
|
};
|
|
234
250
|
|
|
235
|
-
export const
|
|
236
|
-
...
|
|
251
|
+
export const OneDatasetOnTableTab: StoryObj<Required<PrevalenceOverTimeComponentProps>> = {
|
|
252
|
+
...OneDataset,
|
|
237
253
|
play: async ({ canvasElement }) => {
|
|
238
254
|
const canvas = await withinShadowRoot(canvasElement, 'gs-prevalence-over-time');
|
|
239
255
|
|