@genspectrum/dashboard-components 0.4.5 → 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 +178 -102
- package/dist/dashboard-components.js +318 -147
- package/dist/dashboard-components.js.map +1 -1
- package/dist/genspectrum-components.d.ts +91 -55
- package/dist/style.css +34 -7
- package/package.json +5 -5
- package/src/preact/mutationComparison/mutation-comparison-venn.tsx +1 -1
- package/src/preact/mutationComparison/mutation-comparison.stories.tsx +18 -18
- package/src/preact/mutationComparison/mutation-comparison.tsx +6 -6
- package/src/preact/mutationComparison/queryMutationData.ts +4 -4
- package/src/preact/mutations/mutations.stories.tsx +3 -3
- package/src/preact/mutations/mutations.tsx +16 -6
- 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.stories.tsx +26 -16
- package/src/preact/prevalenceOverTime/prevalence-over-time.tsx +38 -11
- 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.tsx +1 -1
- 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.tsx +2 -2
- package/src/web-components/visualization/gs-mutation-comparison.stories.ts +12 -12
- package/src/web-components/visualization/gs-mutation-comparison.tsx +18 -19
- package/src/web-components/visualization/gs-mutations.stories.ts +4 -4
- package/src/web-components/visualization/gs-mutations.tsx +10 -11
- package/src/web-components/visualization/gs-prevalence-over-time.stories.ts +46 -35
- package/src/web-components/visualization/gs-prevalence-over-time.tsx +54 -20
- 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
|
@@ -1053,7 +1053,7 @@ const MutationComparisonVenn = ({
|
|
|
1053
1053
|
[sets]
|
|
1054
1054
|
);
|
|
1055
1055
|
if (data.content.length > 5) {
|
|
1056
|
-
return /* @__PURE__ */ u$1("div", { children: "Too many
|
|
1056
|
+
return /* @__PURE__ */ u$1("div", { children: "Too many datasets to display. Maximum are five. " });
|
|
1057
1057
|
}
|
|
1058
1058
|
return /* @__PURE__ */ u$1("div", { className: "h-full flex flex-col", children: [
|
|
1059
1059
|
/* @__PURE__ */ u$1("div", { className: "flex-1", children: /* @__PURE__ */ u$1(GsChart, { configuration: config }) }),
|
|
@@ -1110,8 +1110,8 @@ class SortOperator {
|
|
|
1110
1110
|
};
|
|
1111
1111
|
}
|
|
1112
1112
|
}
|
|
1113
|
-
function querySubstitutionsOrDeletions(
|
|
1114
|
-
const fetchData = new FetchSubstitutionsOrDeletionsOperator(
|
|
1113
|
+
function querySubstitutionsOrDeletions(lapisFilter, sequenceType, lapis, signal) {
|
|
1114
|
+
const fetchData = new FetchSubstitutionsOrDeletionsOperator(lapisFilter, sequenceType, 0);
|
|
1115
1115
|
const sortData = new SortOperator(fetchData, (a2, b3) => {
|
|
1116
1116
|
if (a2.mutation.segment !== b3.mutation.segment) {
|
|
1117
1117
|
return (a2.mutation.segment ?? "").localeCompare(b3.mutation.segment ?? "");
|
|
@@ -1120,12 +1120,12 @@ function querySubstitutionsOrDeletions(variant, sequenceType, lapis, signal) {
|
|
|
1120
1120
|
});
|
|
1121
1121
|
return sortData.evaluate(lapis, signal);
|
|
1122
1122
|
}
|
|
1123
|
-
async function queryMutationData(
|
|
1123
|
+
async function queryMutationData(lapisFilters, sequenceType, lapis) {
|
|
1124
1124
|
const mutationData = await Promise.all(
|
|
1125
|
-
|
|
1125
|
+
lapisFilters.map(async (filter) => {
|
|
1126
1126
|
return {
|
|
1127
|
-
displayName:
|
|
1128
|
-
data: (await querySubstitutionsOrDeletions(
|
|
1127
|
+
displayName: filter.displayName,
|
|
1128
|
+
data: (await querySubstitutionsOrDeletions(filter.lapisFilter, sequenceType, lapis)).content
|
|
1129
1129
|
};
|
|
1130
1130
|
})
|
|
1131
1131
|
);
|
|
@@ -1688,7 +1688,7 @@ function useQuery(fetchDataCallback, dependencies = []) {
|
|
|
1688
1688
|
return { data, error, isLoading };
|
|
1689
1689
|
}
|
|
1690
1690
|
const MutationComparison = ({
|
|
1691
|
-
|
|
1691
|
+
lapisFilters,
|
|
1692
1692
|
sequenceType,
|
|
1693
1693
|
views,
|
|
1694
1694
|
width,
|
|
@@ -1700,7 +1700,7 @@ const MutationComparison = ({
|
|
|
1700
1700
|
return /* @__PURE__ */ u$1(ErrorBoundary, { size: size2, headline, children: /* @__PURE__ */ u$1(ResizeContainer, { size: size2, children: /* @__PURE__ */ u$1(Headline, { heading: headline, children: /* @__PURE__ */ u$1(
|
|
1701
1701
|
MutationComparisonInner,
|
|
1702
1702
|
{
|
|
1703
|
-
|
|
1703
|
+
lapisFilters,
|
|
1704
1704
|
sequenceType,
|
|
1705
1705
|
views,
|
|
1706
1706
|
pageSize
|
|
@@ -1708,15 +1708,15 @@ const MutationComparison = ({
|
|
|
1708
1708
|
) }) }) });
|
|
1709
1709
|
};
|
|
1710
1710
|
const MutationComparisonInner = ({
|
|
1711
|
-
|
|
1711
|
+
lapisFilters,
|
|
1712
1712
|
sequenceType,
|
|
1713
1713
|
views,
|
|
1714
1714
|
pageSize
|
|
1715
1715
|
}) => {
|
|
1716
1716
|
const lapis = P(LapisUrlContext);
|
|
1717
1717
|
const { data, error, isLoading } = useQuery(async () => {
|
|
1718
|
-
return queryMutationData(
|
|
1719
|
-
}, [
|
|
1718
|
+
return queryMutationData(lapisFilters, sequenceType, lapis);
|
|
1719
|
+
}, [lapisFilters, sequenceType, lapis]);
|
|
1720
1720
|
if (isLoading) {
|
|
1721
1721
|
return /* @__PURE__ */ u$1(LoadingDisplay, {});
|
|
1722
1722
|
}
|
|
@@ -2931,8 +2931,8 @@ html {
|
|
|
2931
2931
|
appearance: none;
|
|
2932
2932
|
height: 3rem;
|
|
2933
2933
|
min-height: 3rem;
|
|
2934
|
-
padding-
|
|
2935
|
-
padding-
|
|
2934
|
+
padding-inline-start: 1rem;
|
|
2935
|
+
padding-inline-end: 2.5rem;
|
|
2936
2936
|
font-size: 0.875rem;
|
|
2937
2937
|
line-height: 1.25rem;
|
|
2938
2938
|
line-height: 2;
|
|
@@ -2974,7 +2974,9 @@ html {
|
|
|
2974
2974
|
display: grid;
|
|
2975
2975
|
align-items: flex-end;
|
|
2976
2976
|
}
|
|
2977
|
-
.tabs-lifted:has(.tab-content[class^="rounded-"])
|
|
2977
|
+
.tabs-lifted:has(.tab-content[class^="rounded-"])
|
|
2978
|
+
.tab:first-child:not(:is(.tab-active, [aria-selected="true"])), .tabs-lifted:has(.tab-content[class*=" rounded-"])
|
|
2979
|
+
.tab:first-child:not(:is(.tab-active, [aria-selected="true"])) {
|
|
2978
2980
|
border-bottom-color: transparent;
|
|
2979
2981
|
}
|
|
2980
2982
|
.tab {
|
|
@@ -3812,7 +3814,7 @@ input.tab:checked + .tab-content,
|
|
|
3812
3814
|
.tabs-boxed .tab {
|
|
3813
3815
|
border-radius: var(--rounded-btn, 0.5rem);
|
|
3814
3816
|
}
|
|
3815
|
-
:
|
|
3817
|
+
.table:where([dir="rtl"], [dir="rtl"] *) {
|
|
3816
3818
|
text-align: right;
|
|
3817
3819
|
}
|
|
3818
3820
|
.table :where(th, td) {
|
|
@@ -3828,7 +3830,7 @@ input.tab:checked + .tab-content,
|
|
|
3828
3830
|
--tw-bg-opacity: 1;
|
|
3829
3831
|
background-color: var(--fallback-b2,oklch(var(--b2)/var(--tw-bg-opacity)));
|
|
3830
3832
|
}
|
|
3831
|
-
.table :where(thead tr, tbody tr:not(:last-child),tbody tr:first-child:last-child) {
|
|
3833
|
+
.table :where(thead tr, tbody tr:not(:last-child), tbody tr:first-child:last-child) {
|
|
3832
3834
|
border-bottom-width: 1px;
|
|
3833
3835
|
--tw-border-opacity: 1;
|
|
3834
3836
|
border-bottom-color: var(--fallback-b2,oklch(var(--b2)/var(--tw-border-opacity)));
|
|
@@ -4112,7 +4114,7 @@ input.tab:checked + .tab-content,
|
|
|
4112
4114
|
content: "";
|
|
4113
4115
|
margin-inline-start: -100%;
|
|
4114
4116
|
}
|
|
4115
|
-
:
|
|
4117
|
+
.steps-horizontal .step:where([dir="rtl"], [dir="rtl"] *):before {
|
|
4116
4118
|
--tw-translate-x: 0px;
|
|
4117
4119
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
4118
4120
|
}
|
|
@@ -4131,7 +4133,7 @@ input.tab:checked + .tab-content,
|
|
|
4131
4133
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
4132
4134
|
margin-inline-start: 50%;
|
|
4133
4135
|
}
|
|
4134
|
-
:
|
|
4136
|
+
.steps-vertical .step:where([dir="rtl"], [dir="rtl"] *):before {
|
|
4135
4137
|
--tw-translate-x: 50%;
|
|
4136
4138
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
4137
4139
|
}
|
|
@@ -4165,6 +4167,7 @@ input.tab:checked + .tab-content,
|
|
|
4165
4167
|
}
|
|
4166
4168
|
.tooltip:before {
|
|
4167
4169
|
max-width: 20rem;
|
|
4170
|
+
white-space: normal;
|
|
4168
4171
|
border-radius: 0.25rem;
|
|
4169
4172
|
padding-left: 0.5rem;
|
|
4170
4173
|
padding-right: 0.5rem;
|
|
@@ -4257,6 +4260,10 @@ input.tab:checked + .tab-content,
|
|
|
4257
4260
|
margin-left: 0.25rem;
|
|
4258
4261
|
margin-right: 0.25rem;
|
|
4259
4262
|
}
|
|
4263
|
+
.mx-auto {
|
|
4264
|
+
margin-left: auto;
|
|
4265
|
+
margin-right: auto;
|
|
4266
|
+
}
|
|
4260
4267
|
.my-1 {
|
|
4261
4268
|
margin-top: 0.25rem;
|
|
4262
4269
|
margin-bottom: 0.25rem;
|
|
@@ -4268,6 +4275,15 @@ input.tab:checked + .tab-content,
|
|
|
4268
4275
|
.mb-2 {
|
|
4269
4276
|
margin-bottom: 0.5rem;
|
|
4270
4277
|
}
|
|
4278
|
+
.ml-2 {
|
|
4279
|
+
margin-left: 0.5rem;
|
|
4280
|
+
}
|
|
4281
|
+
.ml-2\\.5 {
|
|
4282
|
+
margin-left: 0.625rem;
|
|
4283
|
+
}
|
|
4284
|
+
.ml-3 {
|
|
4285
|
+
margin-left: 0.75rem;
|
|
4286
|
+
}
|
|
4271
4287
|
.mr-2 {
|
|
4272
4288
|
margin-right: 0.5rem;
|
|
4273
4289
|
}
|
|
@@ -4341,6 +4357,9 @@ input.tab:checked + .tab-content,
|
|
|
4341
4357
|
.flex-wrap {
|
|
4342
4358
|
flex-wrap: wrap;
|
|
4343
4359
|
}
|
|
4360
|
+
.items-end {
|
|
4361
|
+
align-items: flex-end;
|
|
4362
|
+
}
|
|
4344
4363
|
.items-center {
|
|
4345
4364
|
align-items: center;
|
|
4346
4365
|
}
|
|
@@ -4470,6 +4489,10 @@ input.tab:checked + .tab-content,
|
|
|
4470
4489
|
.text-justify {
|
|
4471
4490
|
text-align: justify;
|
|
4472
4491
|
}
|
|
4492
|
+
.text-2xl {
|
|
4493
|
+
font-size: 1.5rem;
|
|
4494
|
+
line-height: 2rem;
|
|
4495
|
+
}
|
|
4473
4496
|
.text-base {
|
|
4474
4497
|
font-size: 1rem;
|
|
4475
4498
|
line-height: 1.5rem;
|
|
@@ -4499,6 +4522,10 @@ input.tab:checked + .tab-content,
|
|
|
4499
4522
|
.leading-5 {
|
|
4500
4523
|
line-height: 1.25rem;
|
|
4501
4524
|
}
|
|
4525
|
+
.text-\\[\\#606060\\] {
|
|
4526
|
+
--tw-text-opacity: 1;
|
|
4527
|
+
color: rgb(96 96 96 / var(--tw-text-opacity));
|
|
4528
|
+
}
|
|
4502
4529
|
.text-blue-600 {
|
|
4503
4530
|
--tw-text-opacity: 1;
|
|
4504
4531
|
color: rgb(37 99 235 / var(--tw-text-opacity));
|
|
@@ -4628,7 +4655,7 @@ var __decorateClass$8 = (decorators, target, key, kind) => {
|
|
|
4628
4655
|
let MutationComparisonComponent = class extends PreactLitAdapterWithGridJsStyles {
|
|
4629
4656
|
constructor() {
|
|
4630
4657
|
super(...arguments);
|
|
4631
|
-
this.
|
|
4658
|
+
this.lapisFilters = [];
|
|
4632
4659
|
this.sequenceType = "nucleotide";
|
|
4633
4660
|
this.views = ["table"];
|
|
4634
4661
|
this.width = "100%";
|
|
@@ -4640,7 +4667,7 @@ let MutationComparisonComponent = class extends PreactLitAdapterWithGridJsStyles
|
|
|
4640
4667
|
return /* @__PURE__ */ u$1(
|
|
4641
4668
|
MutationComparison,
|
|
4642
4669
|
{
|
|
4643
|
-
|
|
4670
|
+
lapisFilters: this.lapisFilters,
|
|
4644
4671
|
sequenceType: this.sequenceType,
|
|
4645
4672
|
views: this.views,
|
|
4646
4673
|
width: this.width,
|
|
@@ -4653,7 +4680,7 @@ let MutationComparisonComponent = class extends PreactLitAdapterWithGridJsStyles
|
|
|
4653
4680
|
};
|
|
4654
4681
|
__decorateClass$8([
|
|
4655
4682
|
n2({ type: Array })
|
|
4656
|
-
], MutationComparisonComponent.prototype, "
|
|
4683
|
+
], MutationComparisonComponent.prototype, "lapisFilters", 2);
|
|
4657
4684
|
__decorateClass$8([
|
|
4658
4685
|
n2({ type: String })
|
|
4659
4686
|
], MutationComparisonComponent.prototype, "sequenceType", 2);
|
|
@@ -4899,8 +4926,8 @@ class FetchInsertionsOperator {
|
|
|
4899
4926
|
return { content };
|
|
4900
4927
|
}
|
|
4901
4928
|
}
|
|
4902
|
-
function queryInsertions(
|
|
4903
|
-
const fetchData = new FetchInsertionsOperator(
|
|
4929
|
+
function queryInsertions(lapisFilter, sequenceType, lapis, signal) {
|
|
4930
|
+
const fetchData = new FetchInsertionsOperator(lapisFilter, sequenceType);
|
|
4904
4931
|
const sortData = new SortOperator(fetchData, (a2, b3) => {
|
|
4905
4932
|
if (a2.mutation.segment !== b3.mutation.segment) {
|
|
4906
4933
|
return (a2.mutation.segment ?? "").localeCompare(b3.mutation.segment ?? "");
|
|
@@ -4909,9 +4936,9 @@ function queryInsertions(variant, sequenceType, lapis, signal) {
|
|
|
4909
4936
|
});
|
|
4910
4937
|
return sortData.evaluate(lapis, signal);
|
|
4911
4938
|
}
|
|
4912
|
-
async function queryMutationsData(
|
|
4913
|
-
const substitutionsOrDeletions = (await querySubstitutionsOrDeletions(
|
|
4914
|
-
const insertions = (await queryInsertions(
|
|
4939
|
+
async function queryMutationsData(lapisFilter, sequenceType, lapis) {
|
|
4940
|
+
const substitutionsOrDeletions = (await querySubstitutionsOrDeletions(lapisFilter, sequenceType, lapis)).content;
|
|
4941
|
+
const insertions = (await queryInsertions(lapisFilter, sequenceType, lapis)).content;
|
|
4915
4942
|
return {
|
|
4916
4943
|
substitutionsOrDeletions,
|
|
4917
4944
|
insertions
|
|
@@ -4939,7 +4966,7 @@ function filterMutationsData(data, displayedSegments, displayedMutationTypes) {
|
|
|
4939
4966
|
};
|
|
4940
4967
|
}
|
|
4941
4968
|
const Mutations = ({
|
|
4942
|
-
|
|
4969
|
+
lapisFilter,
|
|
4943
4970
|
sequenceType,
|
|
4944
4971
|
views,
|
|
4945
4972
|
width,
|
|
@@ -4948,13 +4975,26 @@ const Mutations = ({
|
|
|
4948
4975
|
pageSize
|
|
4949
4976
|
}) => {
|
|
4950
4977
|
const size2 = { height, width };
|
|
4951
|
-
return /* @__PURE__ */ u$1(ErrorBoundary, { size: size2, headline, children: /* @__PURE__ */ u$1(ResizeContainer, { size: size2, children: /* @__PURE__ */ u$1(Headline, { heading: headline, children: /* @__PURE__ */ u$1(
|
|
4978
|
+
return /* @__PURE__ */ u$1(ErrorBoundary, { size: size2, headline, children: /* @__PURE__ */ u$1(ResizeContainer, { size: size2, children: /* @__PURE__ */ u$1(Headline, { heading: headline, children: /* @__PURE__ */ u$1(
|
|
4979
|
+
MutationsInner,
|
|
4980
|
+
{
|
|
4981
|
+
lapisFilter,
|
|
4982
|
+
sequenceType,
|
|
4983
|
+
views,
|
|
4984
|
+
pageSize
|
|
4985
|
+
}
|
|
4986
|
+
) }) }) });
|
|
4952
4987
|
};
|
|
4953
|
-
const MutationsInner = ({
|
|
4988
|
+
const MutationsInner = ({
|
|
4989
|
+
lapisFilter,
|
|
4990
|
+
sequenceType,
|
|
4991
|
+
views,
|
|
4992
|
+
pageSize
|
|
4993
|
+
}) => {
|
|
4954
4994
|
const lapis = P(LapisUrlContext);
|
|
4955
4995
|
const { data, error, isLoading } = useQuery(async () => {
|
|
4956
|
-
return queryMutationsData(
|
|
4957
|
-
}, [
|
|
4996
|
+
return queryMutationsData(lapisFilter, sequenceType, lapis);
|
|
4997
|
+
}, [lapisFilter, sequenceType, lapis]);
|
|
4958
4998
|
if (isLoading) {
|
|
4959
4999
|
return /* @__PURE__ */ u$1(LoadingDisplay, {});
|
|
4960
5000
|
}
|
|
@@ -5090,7 +5130,7 @@ var __decorateClass$7 = (decorators, target, key, kind) => {
|
|
|
5090
5130
|
let MutationsComponent = class extends PreactLitAdapterWithGridJsStyles {
|
|
5091
5131
|
constructor() {
|
|
5092
5132
|
super(...arguments);
|
|
5093
|
-
this.
|
|
5133
|
+
this.lapisFilter = {};
|
|
5094
5134
|
this.sequenceType = "nucleotide";
|
|
5095
5135
|
this.views = ["table", "grid"];
|
|
5096
5136
|
this.width = "100%";
|
|
@@ -5102,7 +5142,7 @@ let MutationsComponent = class extends PreactLitAdapterWithGridJsStyles {
|
|
|
5102
5142
|
return /* @__PURE__ */ u$1(
|
|
5103
5143
|
Mutations,
|
|
5104
5144
|
{
|
|
5105
|
-
|
|
5145
|
+
lapisFilter: this.lapisFilter,
|
|
5106
5146
|
sequenceType: this.sequenceType,
|
|
5107
5147
|
views: this.views,
|
|
5108
5148
|
width: this.width,
|
|
@@ -5115,7 +5155,7 @@ let MutationsComponent = class extends PreactLitAdapterWithGridJsStyles {
|
|
|
5115
5155
|
};
|
|
5116
5156
|
__decorateClass$7([
|
|
5117
5157
|
n2({ type: Object })
|
|
5118
|
-
], MutationsComponent.prototype, "
|
|
5158
|
+
], MutationsComponent.prototype, "lapisFilter", 2);
|
|
5119
5159
|
__decorateClass$7([
|
|
5120
5160
|
n2({ type: String })
|
|
5121
5161
|
], MutationsComponent.prototype, "sequenceType", 2);
|
|
@@ -5213,7 +5253,23 @@ function wilson95PercentConfidenceInterval(observed, sample) {
|
|
|
5213
5253
|
}
|
|
5214
5254
|
const confidenceIntervalDataLabel = (value, lowerLimit, upperLimit, prefix) => {
|
|
5215
5255
|
const label = prefix ? `${prefix}: ` : "";
|
|
5216
|
-
return `${label}${value.toFixed(3)} (${lowerLimit.toFixed(3)} - ${upperLimit.toFixed(3)})`;
|
|
5256
|
+
return `${label}${value.toFixed(3)} (${lowerLimit == null ? void 0 : lowerLimit.toFixed(3)} - ${upperLimit == null ? void 0 : upperLimit.toFixed(3)})`;
|
|
5257
|
+
};
|
|
5258
|
+
const getYAxisMax = (maxInData2, axisMax) => {
|
|
5259
|
+
if (!axisMax) {
|
|
5260
|
+
return 1;
|
|
5261
|
+
}
|
|
5262
|
+
switch (axisMax) {
|
|
5263
|
+
case "limitTo1": {
|
|
5264
|
+
return maxInData2 > 1 ? 1 : maxInData2;
|
|
5265
|
+
}
|
|
5266
|
+
case "maxInData": {
|
|
5267
|
+
return maxInData2;
|
|
5268
|
+
}
|
|
5269
|
+
default: {
|
|
5270
|
+
return axisMax;
|
|
5271
|
+
}
|
|
5272
|
+
}
|
|
5217
5273
|
};
|
|
5218
5274
|
function getYAxisScale(scaleType) {
|
|
5219
5275
|
switch (scaleType) {
|
|
@@ -5221,35 +5277,37 @@ function getYAxisScale(scaleType) {
|
|
|
5221
5277
|
return { beginAtZero: true, type: "linear", min: 0, max: 1 };
|
|
5222
5278
|
}
|
|
5223
5279
|
case "logarithmic": {
|
|
5224
|
-
return { type: "logarithmic" };
|
|
5280
|
+
return { type: "logarithmic", max: 1 };
|
|
5225
5281
|
}
|
|
5226
5282
|
case "logit":
|
|
5227
5283
|
return { type: "logit" };
|
|
5228
|
-
default:
|
|
5229
|
-
return { beginAtZero: true, type: "linear" };
|
|
5230
5284
|
}
|
|
5231
5285
|
}
|
|
5232
5286
|
Chart.register(...registerables, LogitScale, BarWithErrorBarsController, BarWithErrorBar);
|
|
5233
5287
|
const PrevalenceOverTimeBarChart = ({
|
|
5234
5288
|
data,
|
|
5235
5289
|
yAxisScaleType,
|
|
5236
|
-
confidenceIntervalMethod
|
|
5290
|
+
confidenceIntervalMethod,
|
|
5291
|
+
yAxisMaxConfig
|
|
5237
5292
|
}) => {
|
|
5238
|
-
|
|
5293
|
+
const nullFirstData = data.map((variantData) => {
|
|
5294
|
+
return {
|
|
5295
|
+
content: variantData.content.sort(sortNullToBeginningThenByDate),
|
|
5296
|
+
displayName: variantData.displayName
|
|
5297
|
+
};
|
|
5298
|
+
});
|
|
5299
|
+
const datasets2 = nullFirstData.map((graphData, index) => getDataset$1(graphData, index, confidenceIntervalMethod));
|
|
5300
|
+
const maxY = yAxisScaleType !== "logit" ? getYAxisMax(maxInData(nullFirstData), yAxisMaxConfig == null ? void 0 : yAxisMaxConfig[yAxisScaleType]) : void 0;
|
|
5239
5301
|
const config = {
|
|
5240
5302
|
type: BarWithErrorBarsController.id,
|
|
5241
5303
|
data: {
|
|
5242
|
-
|
|
5243
|
-
var _a2;
|
|
5244
|
-
return ((_a2 = dateRange.dateRange) == null ? void 0 : _a2.toString()) ?? "Unknown";
|
|
5245
|
-
})) || [],
|
|
5246
|
-
datasets: data.map((graphData, index) => datasets$1(graphData, index, confidenceIntervalMethod))
|
|
5304
|
+
datasets: datasets2
|
|
5247
5305
|
},
|
|
5248
5306
|
options: {
|
|
5249
5307
|
maintainAspectRatio: false,
|
|
5250
5308
|
animation: false,
|
|
5251
5309
|
scales: {
|
|
5252
|
-
y: getYAxisScale(yAxisScaleType)
|
|
5310
|
+
y: { ...getYAxisScale(yAxisScaleType), max: maxY }
|
|
5253
5311
|
},
|
|
5254
5312
|
plugins: {
|
|
5255
5313
|
legend: {
|
|
@@ -5261,7 +5319,10 @@ const PrevalenceOverTimeBarChart = ({
|
|
|
5261
5319
|
};
|
|
5262
5320
|
return /* @__PURE__ */ u$1(GsChart, { configuration: config });
|
|
5263
5321
|
};
|
|
5264
|
-
|
|
5322
|
+
function sortNullToBeginningThenByDate(a2, b3) {
|
|
5323
|
+
return a2.dateRange === null ? -1 : b3.dateRange === null ? 1 : a2.dateRange.toString().localeCompare(b3.dateRange.toString());
|
|
5324
|
+
}
|
|
5325
|
+
const getDataset$1 = (prevalenceOverTimeVariant, index, confidenceIntervalMethod) => {
|
|
5265
5326
|
const generalConfig = {
|
|
5266
5327
|
borderWidth: 1,
|
|
5267
5328
|
pointRadius: 0,
|
|
@@ -5273,16 +5334,22 @@ const datasets$1 = (prevalenceOverTimeVariant, index, confidenceIntervalMethod)
|
|
|
5273
5334
|
case "wilson":
|
|
5274
5335
|
return {
|
|
5275
5336
|
...generalConfig,
|
|
5276
|
-
data: prevalenceOverTimeVariant.content.map((dataPoint) =>
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5337
|
+
data: prevalenceOverTimeVariant.content.map((dataPoint) => {
|
|
5338
|
+
var _a;
|
|
5339
|
+
return {
|
|
5340
|
+
y: dataPoint.prevalence,
|
|
5341
|
+
yMin: wilson95PercentConfidenceInterval(dataPoint.count, dataPoint.total).lowerLimit,
|
|
5342
|
+
yMax: wilson95PercentConfidenceInterval(dataPoint.count, dataPoint.total).upperLimit,
|
|
5343
|
+
x: ((_a = dataPoint.dateRange) == null ? void 0 : _a.toString()) ?? "Unknown"
|
|
5344
|
+
};
|
|
5345
|
+
})
|
|
5281
5346
|
};
|
|
5282
5347
|
default:
|
|
5283
5348
|
return {
|
|
5284
5349
|
...generalConfig,
|
|
5285
|
-
data: prevalenceOverTimeVariant.content.map((dataPoint) =>
|
|
5350
|
+
data: prevalenceOverTimeVariant.content.map((dataPoint) => {
|
|
5351
|
+
return { y: dataPoint.prevalence, x: dataPoint.dateRange };
|
|
5352
|
+
})
|
|
5286
5353
|
};
|
|
5287
5354
|
}
|
|
5288
5355
|
};
|
|
@@ -6163,17 +6230,28 @@ function getMinMaxNumber(values) {
|
|
|
6163
6230
|
return [min, max];
|
|
6164
6231
|
}
|
|
6165
6232
|
Chart.register(...registerables, LogitScale);
|
|
6166
|
-
const PrevalenceOverTimeBubbleChart = ({
|
|
6167
|
-
|
|
6168
|
-
|
|
6233
|
+
const PrevalenceOverTimeBubbleChart = ({
|
|
6234
|
+
data,
|
|
6235
|
+
yAxisScaleType,
|
|
6236
|
+
yAxisMaxConfig
|
|
6237
|
+
}) => {
|
|
6238
|
+
const nonNullDateRangeData = data.map((variantData) => {
|
|
6239
|
+
return {
|
|
6240
|
+
content: variantData.content.filter((dataPoint) => dataPoint.dateRange !== null),
|
|
6241
|
+
displayName: variantData.displayName
|
|
6242
|
+
};
|
|
6243
|
+
});
|
|
6244
|
+
const firstDate = nonNullDateRangeData[0].content[0].dateRange;
|
|
6245
|
+
const total = nonNullDateRangeData.map((graphData) => graphData.content.map((dataPoint) => dataPoint.total)).flat();
|
|
6169
6246
|
const [minTotal, maxTotal] = getMinMaxNumber(total);
|
|
6170
6247
|
const scaleBubble = (value) => {
|
|
6171
6248
|
return (value - minTotal) / (maxTotal - minTotal) * 4.5 + 0.5;
|
|
6172
6249
|
};
|
|
6250
|
+
const maxY = yAxisScaleType !== "logit" ? getYAxisMax(maxInData(nonNullDateRangeData), yAxisMaxConfig == null ? void 0 : yAxisMaxConfig[yAxisScaleType]) : void 0;
|
|
6173
6251
|
const config = {
|
|
6174
6252
|
type: "bubble",
|
|
6175
6253
|
data: {
|
|
6176
|
-
datasets:
|
|
6254
|
+
datasets: nonNullDateRangeData.map((graphData, index) => ({
|
|
6177
6255
|
label: graphData.displayName,
|
|
6178
6256
|
data: graphData.content.filter((dataPoint) => dataPoint.dateRange !== null).map((dataPoint) => ({
|
|
6179
6257
|
x: minusTemporal(dataPoint.dateRange, firstDate),
|
|
@@ -6195,7 +6273,7 @@ const PrevalenceOverTimeBubbleChart = ({ data, yAxisScaleType }) => {
|
|
|
6195
6273
|
callback: (value) => addUnit(firstDate, value).toString()
|
|
6196
6274
|
}
|
|
6197
6275
|
},
|
|
6198
|
-
y: getYAxisScale(yAxisScaleType)
|
|
6276
|
+
y: { ...getYAxisScale(yAxisScaleType), max: maxY }
|
|
6199
6277
|
},
|
|
6200
6278
|
plugins: {
|
|
6201
6279
|
legend: {
|
|
@@ -6207,12 +6285,12 @@ const PrevalenceOverTimeBubbleChart = ({ data, yAxisScaleType }) => {
|
|
|
6207
6285
|
callbacks: {
|
|
6208
6286
|
title: (context) => {
|
|
6209
6287
|
var _a;
|
|
6210
|
-
const dataset =
|
|
6288
|
+
const dataset = nonNullDateRangeData[context[0].datasetIndex];
|
|
6211
6289
|
const dataPoint = dataset.content[context[0].dataIndex];
|
|
6212
6290
|
return (_a = dataPoint.dateRange) == null ? void 0 : _a.toString();
|
|
6213
6291
|
},
|
|
6214
6292
|
label: (context) => {
|
|
6215
|
-
const dataset =
|
|
6293
|
+
const dataset = nonNullDateRangeData[context.datasetIndex];
|
|
6216
6294
|
const dataPoint = dataset.content[context.dataIndex];
|
|
6217
6295
|
const percentage = (dataPoint.prevalence * 100).toFixed(2);
|
|
6218
6296
|
const count = dataPoint.count.toFixed(0);
|
|
@@ -6230,25 +6308,27 @@ Chart.register(...registerables, LogitScale);
|
|
|
6230
6308
|
const PrevalenceOverTimeLineChart = ({
|
|
6231
6309
|
data,
|
|
6232
6310
|
yAxisScaleType,
|
|
6233
|
-
confidenceIntervalMethod
|
|
6311
|
+
confidenceIntervalMethod,
|
|
6312
|
+
yAxisMaxConfig
|
|
6234
6313
|
}) => {
|
|
6235
|
-
|
|
6236
|
-
|
|
6237
|
-
|
|
6238
|
-
|
|
6239
|
-
|
|
6240
|
-
})
|
|
6314
|
+
const nonNullDateRangeData = data.map((variantData) => {
|
|
6315
|
+
return {
|
|
6316
|
+
content: variantData.content.filter((dataPoint) => dataPoint.dateRange !== null),
|
|
6317
|
+
displayName: variantData.displayName
|
|
6318
|
+
};
|
|
6319
|
+
});
|
|
6320
|
+
const datasets2 = nonNullDateRangeData.map((graphData, index) => getDataset(graphData, index, confidenceIntervalMethod)).flat();
|
|
6321
|
+
const maxY = yAxisScaleType !== "logit" ? getYAxisMax(maxInData(nonNullDateRangeData), yAxisMaxConfig == null ? void 0 : yAxisMaxConfig[yAxisScaleType]) : void 0;
|
|
6241
6322
|
const config = {
|
|
6242
6323
|
type: "line",
|
|
6243
6324
|
data: {
|
|
6244
|
-
labels,
|
|
6245
6325
|
datasets: datasets2
|
|
6246
6326
|
},
|
|
6247
6327
|
options: {
|
|
6248
6328
|
animation: false,
|
|
6249
6329
|
maintainAspectRatio: false,
|
|
6250
6330
|
scales: {
|
|
6251
|
-
y: getYAxisScale(yAxisScaleType)
|
|
6331
|
+
y: { ...getYAxisScale(yAxisScaleType), max: maxY }
|
|
6252
6332
|
},
|
|
6253
6333
|
plugins: {
|
|
6254
6334
|
legend: {
|
|
@@ -6274,9 +6354,13 @@ const getDataset = (prevalenceOverTimeVariant, dataIndex, confidenceIntervalMeth
|
|
|
6274
6354
|
};
|
|
6275
6355
|
const getDatasetCIUpper = (prevalenceOverTimeVariant, dataIndex) => ({
|
|
6276
6356
|
label: `${prevalenceOverTimeVariant.displayName} CI upper`,
|
|
6277
|
-
data: prevalenceOverTimeVariant.content.map(
|
|
6278
|
-
|
|
6279
|
-
|
|
6357
|
+
data: prevalenceOverTimeVariant.content.map((dataPoint) => {
|
|
6358
|
+
var _a;
|
|
6359
|
+
return {
|
|
6360
|
+
y: wilson95PercentConfidenceInterval(dataPoint.count, dataPoint.total).upperLimit,
|
|
6361
|
+
x: (_a = dataPoint.dateRange) == null ? void 0 : _a.toString()
|
|
6362
|
+
};
|
|
6363
|
+
}),
|
|
6280
6364
|
borderWidth: 0,
|
|
6281
6365
|
pointRadius: 0,
|
|
6282
6366
|
fill: "+1",
|
|
@@ -6284,9 +6368,13 @@ const getDatasetCIUpper = (prevalenceOverTimeVariant, dataIndex) => ({
|
|
|
6284
6368
|
});
|
|
6285
6369
|
const getDatasetCILower = (prevalenceOverTimeVariant, dataIndex) => ({
|
|
6286
6370
|
label: `${prevalenceOverTimeVariant.displayName} CI lower`,
|
|
6287
|
-
data: prevalenceOverTimeVariant.content.map(
|
|
6288
|
-
|
|
6289
|
-
|
|
6371
|
+
data: prevalenceOverTimeVariant.content.map((dataPoint) => {
|
|
6372
|
+
var _a;
|
|
6373
|
+
return {
|
|
6374
|
+
y: wilson95PercentConfidenceInterval(dataPoint.count, dataPoint.total).lowerLimit,
|
|
6375
|
+
x: (_a = dataPoint.dateRange) == null ? void 0 : _a.toString()
|
|
6376
|
+
};
|
|
6377
|
+
}),
|
|
6290
6378
|
borderWidth: 0,
|
|
6291
6379
|
pointRadius: 0,
|
|
6292
6380
|
fill: "-1",
|
|
@@ -6294,7 +6382,16 @@ const getDatasetCILower = (prevalenceOverTimeVariant, dataIndex) => ({
|
|
|
6294
6382
|
});
|
|
6295
6383
|
const getDatasetLine = (prevalenceOverTimeVariant, dataIndex) => ({
|
|
6296
6384
|
label: prevalenceOverTimeVariant.displayName,
|
|
6297
|
-
data: prevalenceOverTimeVariant.content.map((dataPoint) =>
|
|
6385
|
+
data: prevalenceOverTimeVariant.content.map((dataPoint) => {
|
|
6386
|
+
var _a;
|
|
6387
|
+
const ciLimits = wilson95PercentConfidenceInterval(dataPoint.count, dataPoint.total);
|
|
6388
|
+
return {
|
|
6389
|
+
y: dataPoint.prevalence,
|
|
6390
|
+
x: (_a = dataPoint.dateRange) == null ? void 0 : _a.toString(),
|
|
6391
|
+
yCiUpper: ciLimits.upperLimit,
|
|
6392
|
+
yCiLower: ciLimits.lowerLimit
|
|
6393
|
+
};
|
|
6394
|
+
}),
|
|
6298
6395
|
borderWidth: 1,
|
|
6299
6396
|
pointRadius: 0,
|
|
6300
6397
|
borderColor: singleGraphColorRGBAById(dataIndex),
|
|
@@ -6310,20 +6407,17 @@ const tooltip$1 = (confidenceIntervalMethod) => {
|
|
|
6310
6407
|
return {
|
|
6311
6408
|
...generalConfig,
|
|
6312
6409
|
filter: ({ datasetIndex }) => {
|
|
6313
|
-
return datasetIndex
|
|
6410
|
+
return isNotCiIndex(datasetIndex);
|
|
6314
6411
|
},
|
|
6315
6412
|
callbacks: {
|
|
6316
6413
|
label: (context) => {
|
|
6317
|
-
|
|
6318
|
-
|
|
6319
|
-
|
|
6320
|
-
|
|
6321
|
-
|
|
6322
|
-
|
|
6323
|
-
|
|
6324
|
-
return confidenceIntervalDataLabel(value, ciLower, ciUpper, context.dataset.label);
|
|
6325
|
-
}
|
|
6326
|
-
return context.dataset.label;
|
|
6414
|
+
const dataPoint = context.dataset.data[context.dataIndex];
|
|
6415
|
+
return confidenceIntervalDataLabel(
|
|
6416
|
+
dataPoint.y,
|
|
6417
|
+
dataPoint.yCiLower,
|
|
6418
|
+
dataPoint.yCiUpper,
|
|
6419
|
+
context.dataset.label
|
|
6420
|
+
);
|
|
6327
6421
|
}
|
|
6328
6422
|
}
|
|
6329
6423
|
};
|
|
@@ -6331,6 +6425,9 @@ const tooltip$1 = (confidenceIntervalMethod) => {
|
|
|
6331
6425
|
return generalConfig;
|
|
6332
6426
|
}
|
|
6333
6427
|
};
|
|
6428
|
+
function isNotCiIndex(datasetIndex) {
|
|
6429
|
+
return datasetIndex % 3 === 1;
|
|
6430
|
+
}
|
|
6334
6431
|
const PrevalenceOverTimeTable = ({ data, granularity, pageSize }) => {
|
|
6335
6432
|
const getSplitColumns = (data2) => {
|
|
6336
6433
|
return data2.map((dataset) => ({
|
|
@@ -6666,8 +6763,8 @@ const ScalingSelector = ({
|
|
|
6666
6763
|
);
|
|
6667
6764
|
};
|
|
6668
6765
|
const PrevalenceOverTime = ({
|
|
6669
|
-
|
|
6670
|
-
|
|
6766
|
+
numeratorFilter,
|
|
6767
|
+
denominatorFilter,
|
|
6671
6768
|
granularity,
|
|
6672
6769
|
smoothingWindow,
|
|
6673
6770
|
views,
|
|
@@ -6676,37 +6773,47 @@ const PrevalenceOverTime = ({
|
|
|
6676
6773
|
height,
|
|
6677
6774
|
headline = "Prevalence over time",
|
|
6678
6775
|
lapisDateField,
|
|
6679
|
-
pageSize
|
|
6776
|
+
pageSize,
|
|
6777
|
+
yAxisMaxConfig
|
|
6680
6778
|
}) => {
|
|
6681
6779
|
const size2 = { height, width };
|
|
6682
6780
|
return /* @__PURE__ */ u$1(ErrorBoundary, { size: size2, headline, children: /* @__PURE__ */ u$1(ResizeContainer, { size: size2, children: /* @__PURE__ */ u$1(Headline, { heading: headline, children: /* @__PURE__ */ u$1(
|
|
6683
6781
|
PrevalenceOverTimeInner,
|
|
6684
6782
|
{
|
|
6685
|
-
|
|
6686
|
-
|
|
6783
|
+
numeratorFilter,
|
|
6784
|
+
denominatorFilter,
|
|
6687
6785
|
granularity,
|
|
6688
6786
|
smoothingWindow,
|
|
6689
6787
|
views,
|
|
6690
6788
|
confidenceIntervalMethods,
|
|
6691
6789
|
lapisDateField,
|
|
6692
|
-
pageSize
|
|
6790
|
+
pageSize,
|
|
6791
|
+
yAxisMaxConfig
|
|
6693
6792
|
}
|
|
6694
6793
|
) }) }) });
|
|
6695
6794
|
};
|
|
6696
6795
|
const PrevalenceOverTimeInner = ({
|
|
6697
|
-
|
|
6698
|
-
|
|
6796
|
+
numeratorFilter,
|
|
6797
|
+
denominatorFilter,
|
|
6699
6798
|
granularity,
|
|
6700
6799
|
smoothingWindow,
|
|
6701
6800
|
views,
|
|
6702
6801
|
confidenceIntervalMethods,
|
|
6703
6802
|
lapisDateField,
|
|
6704
|
-
pageSize
|
|
6803
|
+
pageSize,
|
|
6804
|
+
yAxisMaxConfig
|
|
6705
6805
|
}) => {
|
|
6706
6806
|
const lapis = P(LapisUrlContext);
|
|
6707
6807
|
const { data, error, isLoading } = useQuery(
|
|
6708
|
-
() => queryPrevalenceOverTime(
|
|
6709
|
-
|
|
6808
|
+
() => queryPrevalenceOverTime(
|
|
6809
|
+
numeratorFilter,
|
|
6810
|
+
denominatorFilter,
|
|
6811
|
+
granularity,
|
|
6812
|
+
smoothingWindow,
|
|
6813
|
+
lapis,
|
|
6814
|
+
lapisDateField
|
|
6815
|
+
),
|
|
6816
|
+
[lapis, numeratorFilter, denominatorFilter, granularity, smoothingWindow]
|
|
6710
6817
|
);
|
|
6711
6818
|
if (isLoading) {
|
|
6712
6819
|
return /* @__PURE__ */ u$1(LoadingDisplay, {});
|
|
@@ -6724,7 +6831,8 @@ const PrevalenceOverTimeInner = ({
|
|
|
6724
6831
|
data,
|
|
6725
6832
|
granularity,
|
|
6726
6833
|
confidenceIntervalMethods,
|
|
6727
|
-
pageSize
|
|
6834
|
+
pageSize,
|
|
6835
|
+
yAxisMaxConfig
|
|
6728
6836
|
}
|
|
6729
6837
|
);
|
|
6730
6838
|
};
|
|
@@ -6733,7 +6841,8 @@ const PrevalenceOverTimeTabs = ({
|
|
|
6733
6841
|
data,
|
|
6734
6842
|
granularity,
|
|
6735
6843
|
confidenceIntervalMethods,
|
|
6736
|
-
pageSize
|
|
6844
|
+
pageSize,
|
|
6845
|
+
yAxisMaxConfig
|
|
6737
6846
|
}) => {
|
|
6738
6847
|
const [yAxisScaleType, setYAxisScaleType] = p("linear");
|
|
6739
6848
|
const [confidenceIntervalMethod, setConfidenceIntervalMethod] = p(
|
|
@@ -6749,7 +6858,8 @@ const PrevalenceOverTimeTabs = ({
|
|
|
6749
6858
|
{
|
|
6750
6859
|
data,
|
|
6751
6860
|
yAxisScaleType,
|
|
6752
|
-
confidenceIntervalMethod
|
|
6861
|
+
confidenceIntervalMethod,
|
|
6862
|
+
yAxisMaxConfig
|
|
6753
6863
|
}
|
|
6754
6864
|
)
|
|
6755
6865
|
};
|
|
@@ -6761,14 +6871,22 @@ const PrevalenceOverTimeTabs = ({
|
|
|
6761
6871
|
{
|
|
6762
6872
|
data,
|
|
6763
6873
|
yAxisScaleType,
|
|
6764
|
-
confidenceIntervalMethod
|
|
6874
|
+
confidenceIntervalMethod,
|
|
6875
|
+
yAxisMaxConfig
|
|
6765
6876
|
}
|
|
6766
6877
|
)
|
|
6767
6878
|
};
|
|
6768
6879
|
case "bubble":
|
|
6769
6880
|
return {
|
|
6770
6881
|
title: "Bubble",
|
|
6771
|
-
content: /* @__PURE__ */ u$1(
|
|
6882
|
+
content: /* @__PURE__ */ u$1(
|
|
6883
|
+
PrevalenceOverTimeBubbleChart,
|
|
6884
|
+
{
|
|
6885
|
+
data,
|
|
6886
|
+
yAxisScaleType,
|
|
6887
|
+
yAxisMaxConfig
|
|
6888
|
+
}
|
|
6889
|
+
)
|
|
6772
6890
|
};
|
|
6773
6891
|
case "table":
|
|
6774
6892
|
return {
|
|
@@ -6830,6 +6948,7 @@ const PrevalenceOverTimeInfo = () => {
|
|
|
6830
6948
|
/* @__PURE__ */ u$1(InfoParagraph, { children: "Prevalence over time info." })
|
|
6831
6949
|
] });
|
|
6832
6950
|
};
|
|
6951
|
+
const maxInData = (data) => Math.max(...data.flatMap((variant) => variant.content.map((dataPoint) => dataPoint.prevalence)));
|
|
6833
6952
|
var __defProp$6 = Object.defineProperty;
|
|
6834
6953
|
var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
|
|
6835
6954
|
var __decorateClass$6 = (decorators, target, key, kind) => {
|
|
@@ -6843,8 +6962,8 @@ var __decorateClass$6 = (decorators, target, key, kind) => {
|
|
|
6843
6962
|
let PrevalenceOverTimeComponent = class extends PreactLitAdapterWithGridJsStyles {
|
|
6844
6963
|
constructor() {
|
|
6845
6964
|
super(...arguments);
|
|
6846
|
-
this.
|
|
6847
|
-
this.
|
|
6965
|
+
this.numeratorFilter = { displayName: "", lapisFilter: {} };
|
|
6966
|
+
this.denominatorFilter = {};
|
|
6848
6967
|
this.granularity = "day";
|
|
6849
6968
|
this.smoothingWindow = 0;
|
|
6850
6969
|
this.views = ["bar", "line", "bubble", "table"];
|
|
@@ -6854,13 +6973,15 @@ let PrevalenceOverTimeComponent = class extends PreactLitAdapterWithGridJsStyles
|
|
|
6854
6973
|
this.height = "700px";
|
|
6855
6974
|
this.lapisDateField = "date";
|
|
6856
6975
|
this.pageSize = false;
|
|
6976
|
+
this.yAxisMaxLinear = 1;
|
|
6977
|
+
this.yAxisMaxLogarithmic = 1;
|
|
6857
6978
|
}
|
|
6858
6979
|
render() {
|
|
6859
6980
|
return /* @__PURE__ */ u$1(
|
|
6860
6981
|
PrevalenceOverTime,
|
|
6861
6982
|
{
|
|
6862
|
-
|
|
6863
|
-
|
|
6983
|
+
numeratorFilter: this.numeratorFilter,
|
|
6984
|
+
denominatorFilter: this.denominatorFilter,
|
|
6864
6985
|
granularity: this.granularity,
|
|
6865
6986
|
smoothingWindow: this.smoothingWindow,
|
|
6866
6987
|
views: this.views,
|
|
@@ -6869,17 +6990,21 @@ let PrevalenceOverTimeComponent = class extends PreactLitAdapterWithGridJsStyles
|
|
|
6869
6990
|
height: this.height,
|
|
6870
6991
|
headline: this.headline,
|
|
6871
6992
|
lapisDateField: this.lapisDateField,
|
|
6872
|
-
pageSize: this.pageSize
|
|
6993
|
+
pageSize: this.pageSize,
|
|
6994
|
+
yAxisMaxConfig: {
|
|
6995
|
+
linear: this.yAxisMaxLinear,
|
|
6996
|
+
logarithmic: this.yAxisMaxLogarithmic
|
|
6997
|
+
}
|
|
6873
6998
|
}
|
|
6874
6999
|
);
|
|
6875
7000
|
}
|
|
6876
7001
|
};
|
|
6877
7002
|
__decorateClass$6([
|
|
6878
7003
|
n2({ type: Object })
|
|
6879
|
-
], PrevalenceOverTimeComponent.prototype, "
|
|
7004
|
+
], PrevalenceOverTimeComponent.prototype, "numeratorFilter", 2);
|
|
6880
7005
|
__decorateClass$6([
|
|
6881
7006
|
n2({ type: Object })
|
|
6882
|
-
], PrevalenceOverTimeComponent.prototype, "
|
|
7007
|
+
], PrevalenceOverTimeComponent.prototype, "denominatorFilter", 2);
|
|
6883
7008
|
__decorateClass$6([
|
|
6884
7009
|
n2({ type: String })
|
|
6885
7010
|
], PrevalenceOverTimeComponent.prototype, "granularity", 2);
|
|
@@ -6907,11 +7032,18 @@ __decorateClass$6([
|
|
|
6907
7032
|
__decorateClass$6([
|
|
6908
7033
|
n2({ type: Object })
|
|
6909
7034
|
], PrevalenceOverTimeComponent.prototype, "pageSize", 2);
|
|
7035
|
+
__decorateClass$6([
|
|
7036
|
+
n2({ type: String })
|
|
7037
|
+
], PrevalenceOverTimeComponent.prototype, "yAxisMaxLinear", 2);
|
|
7038
|
+
__decorateClass$6([
|
|
7039
|
+
n2({ type: String })
|
|
7040
|
+
], PrevalenceOverTimeComponent.prototype, "yAxisMaxLogarithmic", 2);
|
|
6910
7041
|
PrevalenceOverTimeComponent = __decorateClass$6([
|
|
6911
7042
|
t$2("gs-prevalence-over-time")
|
|
6912
7043
|
], PrevalenceOverTimeComponent);
|
|
6913
7044
|
Chart.register(...registerables, LogitScale);
|
|
6914
|
-
const RelativeGrowthAdvantageChart = ({ data, yAxisScaleType }) => {
|
|
7045
|
+
const RelativeGrowthAdvantageChart = ({ data, yAxisScaleType, yAxisMaxConfig }) => {
|
|
7046
|
+
const maxY = yAxisScaleType !== "logit" ? getYAxisMax(Math.max(...data.proportion), yAxisMaxConfig == null ? void 0 : yAxisMaxConfig[yAxisScaleType]) : void 0;
|
|
6915
7047
|
const config = {
|
|
6916
7048
|
type: "line",
|
|
6917
7049
|
data: {
|
|
@@ -6922,7 +7054,7 @@ const RelativeGrowthAdvantageChart = ({ data, yAxisScaleType }) => {
|
|
|
6922
7054
|
maintainAspectRatio: false,
|
|
6923
7055
|
animation: false,
|
|
6924
7056
|
scales: {
|
|
6925
|
-
y: getYAxisScale(yAxisScaleType)
|
|
7057
|
+
y: { ...getYAxisScale(yAxisScaleType), max: maxY }
|
|
6926
7058
|
},
|
|
6927
7059
|
plugins: {
|
|
6928
7060
|
legend: {
|
|
@@ -6932,17 +7064,38 @@ const RelativeGrowthAdvantageChart = ({ data, yAxisScaleType }) => {
|
|
|
6932
7064
|
}
|
|
6933
7065
|
}
|
|
6934
7066
|
};
|
|
6935
|
-
return /* @__PURE__ */ u$1("div", { className: "flex flex-col
|
|
6936
|
-
/* @__PURE__ */ u$1(
|
|
6937
|
-
|
|
6938
|
-
|
|
6939
|
-
|
|
6940
|
-
|
|
6941
|
-
|
|
6942
|
-
|
|
6943
|
-
|
|
6944
|
-
|
|
6945
|
-
|
|
7067
|
+
return /* @__PURE__ */ u$1("div", { className: "flex h-full flex-col", children: [
|
|
7068
|
+
/* @__PURE__ */ u$1(
|
|
7069
|
+
RelativeGrowthAdvantageDisplay,
|
|
7070
|
+
{
|
|
7071
|
+
relativeAdvantage: data.params.fd.value,
|
|
7072
|
+
relativeAdvantageLowerBound: data.params.fd.ciLower,
|
|
7073
|
+
relativeAdvantageUpperBound: data.params.fd.ciUpper
|
|
7074
|
+
}
|
|
7075
|
+
),
|
|
7076
|
+
/* @__PURE__ */ u$1("div", { className: "flex-1", children: /* @__PURE__ */ u$1(GsChart, { configuration: config }) })
|
|
7077
|
+
] });
|
|
7078
|
+
};
|
|
7079
|
+
const RelativeGrowthAdvantageDisplay = ({
|
|
7080
|
+
relativeAdvantage,
|
|
7081
|
+
relativeAdvantageLowerBound,
|
|
7082
|
+
relativeAdvantageUpperBound
|
|
7083
|
+
}) => {
|
|
7084
|
+
return /* @__PURE__ */ u$1("div", { class: "mx-auto flex items-end flex-wrap", children: [
|
|
7085
|
+
/* @__PURE__ */ u$1("span", { class: "text-[#606060]", children: "Relative advantage:" }),
|
|
7086
|
+
/* @__PURE__ */ u$1("div", { children: [
|
|
7087
|
+
/* @__PURE__ */ u$1("span", { class: "text-2xl ml-3", children: [
|
|
7088
|
+
" ",
|
|
7089
|
+
formatProportion(relativeAdvantage),
|
|
7090
|
+
" "
|
|
7091
|
+
] }),
|
|
7092
|
+
/* @__PURE__ */ u$1("span", { class: "ml-2.5", children: [
|
|
7093
|
+
"(",
|
|
7094
|
+
formatProportion(relativeAdvantageLowerBound),
|
|
7095
|
+
" - ",
|
|
7096
|
+
formatProportion(relativeAdvantageUpperBound),
|
|
7097
|
+
")"
|
|
7098
|
+
] })
|
|
6946
7099
|
] })
|
|
6947
7100
|
] });
|
|
6948
7101
|
};
|
|
@@ -7101,36 +7254,39 @@ const RelativeGrowthAdvantage = ({
|
|
|
7101
7254
|
views,
|
|
7102
7255
|
width,
|
|
7103
7256
|
height,
|
|
7104
|
-
|
|
7105
|
-
|
|
7257
|
+
numeratorFilter,
|
|
7258
|
+
denominatorFilter,
|
|
7106
7259
|
generationTime,
|
|
7107
7260
|
headline = "Relative growth advantage",
|
|
7108
|
-
lapisDateField
|
|
7261
|
+
lapisDateField,
|
|
7262
|
+
yAxisMaxConfig
|
|
7109
7263
|
}) => {
|
|
7110
7264
|
const size2 = { height, width };
|
|
7111
7265
|
return /* @__PURE__ */ u$1(ErrorBoundary, { size: size2, headline, children: /* @__PURE__ */ u$1(ResizeContainer, { size: size2, children: /* @__PURE__ */ u$1(Headline, { heading: headline, children: /* @__PURE__ */ u$1(
|
|
7112
7266
|
RelativeGrowthAdvantageInner,
|
|
7113
7267
|
{
|
|
7114
7268
|
views,
|
|
7115
|
-
|
|
7116
|
-
|
|
7269
|
+
numeratorFilter,
|
|
7270
|
+
denominatorFilter,
|
|
7117
7271
|
generationTime,
|
|
7118
|
-
lapisDateField
|
|
7272
|
+
lapisDateField,
|
|
7273
|
+
yAxisMaxConfig
|
|
7119
7274
|
}
|
|
7120
7275
|
) }) }) });
|
|
7121
7276
|
};
|
|
7122
7277
|
const RelativeGrowthAdvantageInner = ({
|
|
7123
|
-
|
|
7124
|
-
|
|
7278
|
+
numeratorFilter,
|
|
7279
|
+
denominatorFilter,
|
|
7125
7280
|
generationTime,
|
|
7126
7281
|
views,
|
|
7127
|
-
lapisDateField
|
|
7282
|
+
lapisDateField,
|
|
7283
|
+
yAxisMaxConfig
|
|
7128
7284
|
}) => {
|
|
7129
7285
|
const lapis = P(LapisUrlContext);
|
|
7130
7286
|
const [yAxisScaleType, setYAxisScaleType] = p("linear");
|
|
7131
7287
|
const { data, error, isLoading } = useQuery(
|
|
7132
|
-
() => queryRelativeGrowthAdvantage(
|
|
7133
|
-
[lapis,
|
|
7288
|
+
() => queryRelativeGrowthAdvantage(numeratorFilter, denominatorFilter, generationTime, lapis, lapisDateField),
|
|
7289
|
+
[lapis, numeratorFilter, denominatorFilter, generationTime, views]
|
|
7134
7290
|
);
|
|
7135
7291
|
if (isLoading) {
|
|
7136
7292
|
return /* @__PURE__ */ u$1(LoadingDisplay, {});
|
|
@@ -7148,7 +7304,8 @@ const RelativeGrowthAdvantageInner = ({
|
|
|
7148
7304
|
yAxisScaleType,
|
|
7149
7305
|
setYAxisScaleType,
|
|
7150
7306
|
views,
|
|
7151
|
-
generationTime
|
|
7307
|
+
generationTime,
|
|
7308
|
+
yAxisMaxConfig
|
|
7152
7309
|
}
|
|
7153
7310
|
);
|
|
7154
7311
|
};
|
|
@@ -7157,7 +7314,8 @@ const RelativeGrowthAdvantageTabs = ({
|
|
|
7157
7314
|
yAxisScaleType,
|
|
7158
7315
|
setYAxisScaleType,
|
|
7159
7316
|
views,
|
|
7160
|
-
generationTime
|
|
7317
|
+
generationTime,
|
|
7318
|
+
yAxisMaxConfig
|
|
7161
7319
|
}) => {
|
|
7162
7320
|
const getTab = (view) => {
|
|
7163
7321
|
switch (view) {
|
|
@@ -7172,7 +7330,8 @@ const RelativeGrowthAdvantageTabs = ({
|
|
|
7172
7330
|
observed: data.observedProportions,
|
|
7173
7331
|
params: data.params
|
|
7174
7332
|
},
|
|
7175
|
-
yAxisScaleType
|
|
7333
|
+
yAxisScaleType,
|
|
7334
|
+
yAxisMaxConfig
|
|
7176
7335
|
}
|
|
7177
7336
|
)
|
|
7178
7337
|
};
|
|
@@ -7233,37 +7392,43 @@ var __decorateClass$5 = (decorators, target, key, kind) => {
|
|
|
7233
7392
|
let RelativeGrowthAdvantageComponent = class extends PreactLitAdapter {
|
|
7234
7393
|
constructor() {
|
|
7235
7394
|
super(...arguments);
|
|
7236
|
-
this.
|
|
7237
|
-
this.
|
|
7395
|
+
this.numeratorFilter = {};
|
|
7396
|
+
this.denominatorFilter = {};
|
|
7238
7397
|
this.generationTime = 7;
|
|
7239
7398
|
this.views = ["line"];
|
|
7240
7399
|
this.headline = "Relative growth advantage";
|
|
7241
7400
|
this.width = "100%";
|
|
7242
7401
|
this.height = "700px";
|
|
7243
7402
|
this.lapisDateField = "date";
|
|
7403
|
+
this.yAxisMaxLinear = 1;
|
|
7404
|
+
this.yAxisMaxLogarithmic = 1;
|
|
7244
7405
|
}
|
|
7245
7406
|
render() {
|
|
7246
7407
|
return /* @__PURE__ */ u$1(
|
|
7247
7408
|
RelativeGrowthAdvantage,
|
|
7248
7409
|
{
|
|
7249
|
-
|
|
7250
|
-
|
|
7410
|
+
numeratorFilter: this.numeratorFilter,
|
|
7411
|
+
denominatorFilter: this.denominatorFilter,
|
|
7251
7412
|
generationTime: this.generationTime,
|
|
7252
7413
|
views: this.views,
|
|
7253
7414
|
width: this.width,
|
|
7254
7415
|
height: this.height,
|
|
7255
7416
|
headline: this.headline,
|
|
7256
|
-
lapisDateField: this.lapisDateField
|
|
7417
|
+
lapisDateField: this.lapisDateField,
|
|
7418
|
+
yAxisMaxConfig: {
|
|
7419
|
+
linear: this.yAxisMaxLinear,
|
|
7420
|
+
logarithmic: this.yAxisMaxLogarithmic
|
|
7421
|
+
}
|
|
7257
7422
|
}
|
|
7258
7423
|
);
|
|
7259
7424
|
}
|
|
7260
7425
|
};
|
|
7261
7426
|
__decorateClass$5([
|
|
7262
7427
|
n2({ type: Object })
|
|
7263
|
-
], RelativeGrowthAdvantageComponent.prototype, "
|
|
7428
|
+
], RelativeGrowthAdvantageComponent.prototype, "numeratorFilter", 2);
|
|
7264
7429
|
__decorateClass$5([
|
|
7265
7430
|
n2({ type: Object })
|
|
7266
|
-
], RelativeGrowthAdvantageComponent.prototype, "
|
|
7431
|
+
], RelativeGrowthAdvantageComponent.prototype, "denominatorFilter", 2);
|
|
7267
7432
|
__decorateClass$5([
|
|
7268
7433
|
n2({ type: Number })
|
|
7269
7434
|
], RelativeGrowthAdvantageComponent.prototype, "generationTime", 2);
|
|
@@ -7282,6 +7447,12 @@ __decorateClass$5([
|
|
|
7282
7447
|
__decorateClass$5([
|
|
7283
7448
|
n2({ type: String })
|
|
7284
7449
|
], RelativeGrowthAdvantageComponent.prototype, "lapisDateField", 2);
|
|
7450
|
+
__decorateClass$5([
|
|
7451
|
+
n2({ type: String })
|
|
7452
|
+
], RelativeGrowthAdvantageComponent.prototype, "yAxisMaxLinear", 2);
|
|
7453
|
+
__decorateClass$5([
|
|
7454
|
+
n2({ type: String })
|
|
7455
|
+
], RelativeGrowthAdvantageComponent.prototype, "yAxisMaxLogarithmic", 2);
|
|
7285
7456
|
RelativeGrowthAdvantageComponent = __decorateClass$5([
|
|
7286
7457
|
t$2("gs-relative-growth-advantage")
|
|
7287
7458
|
], RelativeGrowthAdvantageComponent);
|
|
@@ -7313,12 +7484,12 @@ const compareAscending = (a2, b3) => {
|
|
|
7313
7484
|
const strB = b3 != null ? String(b3) : "";
|
|
7314
7485
|
return strA.localeCompare(strB);
|
|
7315
7486
|
};
|
|
7316
|
-
async function queryAggregateData(
|
|
7487
|
+
async function queryAggregateData(lapisFilter, fields, lapis, initialSort = { field: "count", direction: "descending" }, signal) {
|
|
7317
7488
|
const validSortFields = ["count", "proportion", ...fields];
|
|
7318
7489
|
if (!validSortFields.includes(initialSort.field)) {
|
|
7319
7490
|
throw new Error(`InitialSort field not in fields. Valid fields are: ${validSortFields.join(", ")}`);
|
|
7320
7491
|
}
|
|
7321
|
-
const fetchData = new FetchAggregatedOperator(
|
|
7492
|
+
const fetchData = new FetchAggregatedOperator(lapisFilter, fields);
|
|
7322
7493
|
const sortData = new SortOperator(fetchData, (a2, b3) => {
|
|
7323
7494
|
return initialSort.direction === "ascending" ? compareAscending(a2[initialSort.field], b3[initialSort.field]) : compareAscending(b3[initialSort.field], a2[initialSort.field]);
|
|
7324
7495
|
});
|