@genspectrum/dashboard-components 0.5.4 → 0.5.5
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 +306 -0
- package/dist/dashboard-components.js +394 -263
- package/dist/dashboard-components.js.map +1 -1
- package/dist/genspectrum-components.d.ts +80 -2
- package/package.json +1 -1
- package/src/preact/aggregatedData/aggregate.tsx +2 -14
- package/src/preact/dateRangeSelector/date-range-selector.tsx +2 -14
- package/src/preact/locationFilter/location-filter.tsx +2 -7
- package/src/preact/mutationComparison/mutation-comparison.tsx +2 -10
- package/src/preact/mutations/mutations.tsx +2 -10
- package/src/preact/numberSequencesOverTime/__mockData__/oneVariantEG.json +1702 -0
- package/src/preact/numberSequencesOverTime/__mockData__/twoVariantsEG.json +1710 -0
- package/src/preact/numberSequencesOverTime/__mockData__/twoVariantsJN1.json +1070 -0
- package/src/preact/numberSequencesOverTime/__mockData__/twoVariantsXBB.json +506 -0
- package/src/preact/numberSequencesOverTime/getNumberOfSequencesOverTimeTableData.spec.ts +75 -0
- package/src/preact/numberSequencesOverTime/getNumberOfSequencesOverTimeTableData.ts +39 -0
- package/src/preact/numberSequencesOverTime/number-sequences-over-time-bar-chart.tsx +58 -0
- package/src/preact/numberSequencesOverTime/number-sequences-over-time-table.tsx +32 -0
- package/src/preact/numberSequencesOverTime/number-sequences-over-time.stories.tsx +133 -0
- package/src/preact/numberSequencesOverTime/number-sequences-over-time.tsx +105 -0
- package/src/preact/prevalenceOverTime/prevalence-over-time-bar-chart.tsx +11 -20
- package/src/preact/prevalenceOverTime/prevalence-over-time.tsx +2 -20
- package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.tsx +2 -14
- package/src/preact/textInput/text-input.tsx +2 -2
- package/src/query/queryAggregatedDataOverTime.ts +78 -0
- package/src/query/queryNumberOfSequencesOverTime.spec.ts +195 -0
- package/src/query/queryNumberOfSequencesOverTime.ts +33 -0
- package/src/query/queryPrevalenceOverTime.ts +10 -86
- package/src/utils/sort.ts +9 -0
- package/src/utils/temporalTestHelpers.ts +9 -0
- package/src/utils/utils.ts +7 -0
- package/src/web-components/visualization/gs-number-sequences-over-time.stories.ts +232 -0
- package/src/web-components/visualization/gs-number-sequences-over-time.tsx +140 -0
- package/src/web-components/visualization/index.ts +1 -0
|
@@ -490,14 +490,14 @@ const substitutionsOrDeletionsEndpoint = (lapisUrl, sequenceType) => {
|
|
|
490
490
|
return sequenceType === "amino acid" ? `${lapisUrl}/sample/aminoAcidMutations` : `${lapisUrl}/sample/nucleotideMutations`;
|
|
491
491
|
};
|
|
492
492
|
const referenceGenomeEndpoint = (lapisUrl) => `${lapisUrl}/sample/referenceGenome`;
|
|
493
|
-
var __defProp$
|
|
494
|
-
var __getOwnPropDesc$
|
|
495
|
-
var __decorateClass$
|
|
496
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
493
|
+
var __defProp$b = Object.defineProperty;
|
|
494
|
+
var __getOwnPropDesc$b = Object.getOwnPropertyDescriptor;
|
|
495
|
+
var __decorateClass$b = (decorators, target, key, kind) => {
|
|
496
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$b(target, key) : target;
|
|
497
497
|
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
498
498
|
if (decorator = decorators[i2])
|
|
499
499
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
500
|
-
if (kind && result) __defProp$
|
|
500
|
+
if (kind && result) __defProp$b(target, key, result);
|
|
501
501
|
return result;
|
|
502
502
|
};
|
|
503
503
|
let App = class extends LitElement {
|
|
@@ -528,14 +528,14 @@ let App = class extends LitElement {
|
|
|
528
528
|
return this;
|
|
529
529
|
}
|
|
530
530
|
};
|
|
531
|
-
__decorateClass$
|
|
531
|
+
__decorateClass$b([
|
|
532
532
|
provide({ context: lapisContext }),
|
|
533
533
|
n2()
|
|
534
534
|
], App.prototype, "lapis", 2);
|
|
535
|
-
__decorateClass$
|
|
535
|
+
__decorateClass$b([
|
|
536
536
|
provide({ context: referenceGenomeContext })
|
|
537
537
|
], App.prototype, "referenceGenome", 2);
|
|
538
|
-
App = __decorateClass$
|
|
538
|
+
App = __decorateClass$b([
|
|
539
539
|
t$2("gs-app")
|
|
540
540
|
], App);
|
|
541
541
|
var f$1 = 0;
|
|
@@ -1689,24 +1689,13 @@ function useQuery(fetchDataCallback, dependencies = []) {
|
|
|
1689
1689
|
return { data, error, isLoading };
|
|
1690
1690
|
}
|
|
1691
1691
|
const MutationComparison = ({
|
|
1692
|
-
lapisFilters,
|
|
1693
|
-
sequenceType,
|
|
1694
|
-
views,
|
|
1695
1692
|
width,
|
|
1696
1693
|
height,
|
|
1697
1694
|
headline = "Mutation comparison",
|
|
1698
|
-
|
|
1695
|
+
...innerProps
|
|
1699
1696
|
}) => {
|
|
1700
1697
|
const size2 = { height, width };
|
|
1701
|
-
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(
|
|
1702
|
-
MutationComparisonInner,
|
|
1703
|
-
{
|
|
1704
|
-
lapisFilters,
|
|
1705
|
-
sequenceType,
|
|
1706
|
-
views,
|
|
1707
|
-
pageSize
|
|
1708
|
-
}
|
|
1709
|
-
) }) }) });
|
|
1698
|
+
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(MutationComparisonInner, { ...innerProps }) }) }) });
|
|
1710
1699
|
};
|
|
1711
1700
|
const MutationComparisonInner = ({
|
|
1712
1701
|
lapisFilters,
|
|
@@ -4616,14 +4605,14 @@ input.tab:checked + .tab-content,
|
|
|
4616
4605
|
--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);
|
|
4617
4606
|
box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);
|
|
4618
4607
|
}`;
|
|
4619
|
-
var __defProp$
|
|
4620
|
-
var __getOwnPropDesc$
|
|
4621
|
-
var __decorateClass$
|
|
4622
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
4608
|
+
var __defProp$a = Object.defineProperty;
|
|
4609
|
+
var __getOwnPropDesc$a = Object.getOwnPropertyDescriptor;
|
|
4610
|
+
var __decorateClass$a = (decorators, target, key, kind) => {
|
|
4611
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$a(target, key) : target;
|
|
4623
4612
|
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
4624
4613
|
if (decorator = decorators[i2])
|
|
4625
4614
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
4626
|
-
if (kind && result) __defProp$
|
|
4615
|
+
if (kind && result) __defProp$a(target, key, result);
|
|
4627
4616
|
return result;
|
|
4628
4617
|
};
|
|
4629
4618
|
const tailwindElementCss = unsafeCSS(tailwindStyle);
|
|
@@ -4645,10 +4634,10 @@ const _PreactLitAdapter = class _PreactLitAdapter extends ReactiveElement {
|
|
|
4645
4634
|
};
|
|
4646
4635
|
_PreactLitAdapter.styles = [tailwindElementCss, minMaxPercentSliderElementCss];
|
|
4647
4636
|
let PreactLitAdapter = _PreactLitAdapter;
|
|
4648
|
-
__decorateClass$
|
|
4637
|
+
__decorateClass$a([
|
|
4649
4638
|
consume({ context: lapisContext })
|
|
4650
4639
|
], PreactLitAdapter.prototype, "lapis", 2);
|
|
4651
|
-
__decorateClass$
|
|
4640
|
+
__decorateClass$a([
|
|
4652
4641
|
consume({ context: referenceGenomeContext, subscribe: true })
|
|
4653
4642
|
], PreactLitAdapter.prototype, "referenceGenome", 2);
|
|
4654
4643
|
const gridJsElementCss = unsafeCSS(gridJsStyle);
|
|
@@ -4656,14 +4645,14 @@ const _PreactLitAdapterWithGridJsStyles = class _PreactLitAdapterWithGridJsStyle
|
|
|
4656
4645
|
};
|
|
4657
4646
|
_PreactLitAdapterWithGridJsStyles.styles = [...PreactLitAdapter.styles, gridJsElementCss];
|
|
4658
4647
|
let PreactLitAdapterWithGridJsStyles = _PreactLitAdapterWithGridJsStyles;
|
|
4659
|
-
var __defProp$
|
|
4660
|
-
var __getOwnPropDesc$
|
|
4661
|
-
var __decorateClass$
|
|
4662
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
4648
|
+
var __defProp$9 = Object.defineProperty;
|
|
4649
|
+
var __getOwnPropDesc$9 = Object.getOwnPropertyDescriptor;
|
|
4650
|
+
var __decorateClass$9 = (decorators, target, key, kind) => {
|
|
4651
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$9(target, key) : target;
|
|
4663
4652
|
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
4664
4653
|
if (decorator = decorators[i2])
|
|
4665
4654
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
4666
|
-
if (kind && result) __defProp$
|
|
4655
|
+
if (kind && result) __defProp$9(target, key, result);
|
|
4667
4656
|
return result;
|
|
4668
4657
|
};
|
|
4669
4658
|
let MutationComparisonComponent = class extends PreactLitAdapterWithGridJsStyles {
|
|
@@ -4692,28 +4681,28 @@ let MutationComparisonComponent = class extends PreactLitAdapterWithGridJsStyles
|
|
|
4692
4681
|
);
|
|
4693
4682
|
}
|
|
4694
4683
|
};
|
|
4695
|
-
__decorateClass$
|
|
4684
|
+
__decorateClass$9([
|
|
4696
4685
|
n2({ type: Array })
|
|
4697
4686
|
], MutationComparisonComponent.prototype, "lapisFilters", 2);
|
|
4698
|
-
__decorateClass$
|
|
4687
|
+
__decorateClass$9([
|
|
4699
4688
|
n2({ type: String })
|
|
4700
4689
|
], MutationComparisonComponent.prototype, "sequenceType", 2);
|
|
4701
|
-
__decorateClass$
|
|
4690
|
+
__decorateClass$9([
|
|
4702
4691
|
n2({ type: Array })
|
|
4703
4692
|
], MutationComparisonComponent.prototype, "views", 2);
|
|
4704
|
-
__decorateClass$
|
|
4693
|
+
__decorateClass$9([
|
|
4705
4694
|
n2({ type: String })
|
|
4706
4695
|
], MutationComparisonComponent.prototype, "width", 2);
|
|
4707
|
-
__decorateClass$
|
|
4696
|
+
__decorateClass$9([
|
|
4708
4697
|
n2({ type: String })
|
|
4709
4698
|
], MutationComparisonComponent.prototype, "height", 2);
|
|
4710
|
-
__decorateClass$
|
|
4699
|
+
__decorateClass$9([
|
|
4711
4700
|
n2({ type: String })
|
|
4712
4701
|
], MutationComparisonComponent.prototype, "headline", 2);
|
|
4713
|
-
__decorateClass$
|
|
4702
|
+
__decorateClass$9([
|
|
4714
4703
|
n2({ type: Object })
|
|
4715
4704
|
], MutationComparisonComponent.prototype, "pageSize", 2);
|
|
4716
|
-
MutationComparisonComponent = __decorateClass$
|
|
4705
|
+
MutationComparisonComponent = __decorateClass$9([
|
|
4717
4706
|
t$2("gs-mutation-comparison")
|
|
4718
4707
|
], MutationComparisonComponent);
|
|
4719
4708
|
function getInsertionsTableData(data) {
|
|
@@ -4980,24 +4969,13 @@ function filterMutationsData(data, displayedSegments, displayedMutationTypes) {
|
|
|
4980
4969
|
};
|
|
4981
4970
|
}
|
|
4982
4971
|
const Mutations = ({
|
|
4983
|
-
lapisFilter,
|
|
4984
|
-
sequenceType,
|
|
4985
|
-
views,
|
|
4986
4972
|
width,
|
|
4987
4973
|
height,
|
|
4988
4974
|
headline = "Mutations",
|
|
4989
|
-
|
|
4975
|
+
...innerProps
|
|
4990
4976
|
}) => {
|
|
4991
4977
|
const size2 = { height, width };
|
|
4992
|
-
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(
|
|
4993
|
-
MutationsInner,
|
|
4994
|
-
{
|
|
4995
|
-
lapisFilter,
|
|
4996
|
-
sequenceType,
|
|
4997
|
-
views,
|
|
4998
|
-
pageSize
|
|
4999
|
-
}
|
|
5000
|
-
) }) }) });
|
|
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(MutationsInner, { ...innerProps }) }) }) });
|
|
5001
4979
|
};
|
|
5002
4980
|
const MutationsInner = ({
|
|
5003
4981
|
lapisFilter,
|
|
@@ -5131,14 +5109,14 @@ const Toolbar$2 = ({
|
|
|
5131
5109
|
/* @__PURE__ */ u$1(Info, { height: "100px", children: "Info for mutations" })
|
|
5132
5110
|
] });
|
|
5133
5111
|
};
|
|
5134
|
-
var __defProp$
|
|
5135
|
-
var __getOwnPropDesc$
|
|
5136
|
-
var __decorateClass$
|
|
5137
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
5112
|
+
var __defProp$8 = Object.defineProperty;
|
|
5113
|
+
var __getOwnPropDesc$8 = Object.getOwnPropertyDescriptor;
|
|
5114
|
+
var __decorateClass$8 = (decorators, target, key, kind) => {
|
|
5115
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$8(target, key) : target;
|
|
5138
5116
|
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
5139
5117
|
if (decorator = decorators[i2])
|
|
5140
5118
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
5141
|
-
if (kind && result) __defProp$
|
|
5119
|
+
if (kind && result) __defProp$8(target, key, result);
|
|
5142
5120
|
return result;
|
|
5143
5121
|
};
|
|
5144
5122
|
let MutationsComponent = class extends PreactLitAdapterWithGridJsStyles {
|
|
@@ -5167,28 +5145,28 @@ let MutationsComponent = class extends PreactLitAdapterWithGridJsStyles {
|
|
|
5167
5145
|
);
|
|
5168
5146
|
}
|
|
5169
5147
|
};
|
|
5170
|
-
__decorateClass$
|
|
5148
|
+
__decorateClass$8([
|
|
5171
5149
|
n2({ type: Object })
|
|
5172
5150
|
], MutationsComponent.prototype, "lapisFilter", 2);
|
|
5173
|
-
__decorateClass$
|
|
5151
|
+
__decorateClass$8([
|
|
5174
5152
|
n2({ type: String })
|
|
5175
5153
|
], MutationsComponent.prototype, "sequenceType", 2);
|
|
5176
|
-
__decorateClass$
|
|
5154
|
+
__decorateClass$8([
|
|
5177
5155
|
n2({ type: Array })
|
|
5178
5156
|
], MutationsComponent.prototype, "views", 2);
|
|
5179
|
-
__decorateClass$
|
|
5157
|
+
__decorateClass$8([
|
|
5180
5158
|
n2({ type: String })
|
|
5181
5159
|
], MutationsComponent.prototype, "width", 2);
|
|
5182
|
-
__decorateClass$
|
|
5160
|
+
__decorateClass$8([
|
|
5183
5161
|
n2({ type: String })
|
|
5184
5162
|
], MutationsComponent.prototype, "height", 2);
|
|
5185
|
-
__decorateClass$
|
|
5163
|
+
__decorateClass$8([
|
|
5186
5164
|
n2({ type: String })
|
|
5187
5165
|
], MutationsComponent.prototype, "headline", 2);
|
|
5188
|
-
__decorateClass$
|
|
5166
|
+
__decorateClass$8([
|
|
5189
5167
|
n2({ type: Object })
|
|
5190
5168
|
], MutationsComponent.prototype, "pageSize", 2);
|
|
5191
|
-
MutationsComponent = __decorateClass$
|
|
5169
|
+
MutationsComponent = __decorateClass$8([
|
|
5192
5170
|
t$2("gs-mutations")
|
|
5193
5171
|
], MutationsComponent);
|
|
5194
5172
|
function getPrevalenceOverTimeTableData(data, granularity) {
|
|
@@ -5204,6 +5182,9 @@ function getPrevalenceOverTimeTableData(data, granularity) {
|
|
|
5204
5182
|
};
|
|
5205
5183
|
});
|
|
5206
5184
|
}
|
|
5185
|
+
function sortNullToBeginningThenByDate(a2, b3) {
|
|
5186
|
+
return a2.dateRange === null ? -1 : b3.dateRange === null ? 1 : a2.dateRange.toString().localeCompare(b3.dateRange.toString());
|
|
5187
|
+
}
|
|
5207
5188
|
const _LogitScale = class _LogitScale extends Scale {
|
|
5208
5189
|
constructor(cfg) {
|
|
5209
5190
|
super(cfg);
|
|
@@ -5333,13 +5314,9 @@ const PrevalenceOverTimeBarChart = ({
|
|
|
5333
5314
|
};
|
|
5334
5315
|
return /* @__PURE__ */ u$1(GsChart, { configuration: config });
|
|
5335
5316
|
};
|
|
5336
|
-
function sortNullToBeginningThenByDate(a2, b3) {
|
|
5337
|
-
return a2.dateRange === null ? -1 : b3.dateRange === null ? 1 : a2.dateRange.toString().localeCompare(b3.dateRange.toString());
|
|
5338
|
-
}
|
|
5339
5317
|
const getDataset$1 = (prevalenceOverTimeVariant, index, confidenceIntervalMethod) => {
|
|
5340
5318
|
return {
|
|
5341
5319
|
borderWidth: 1,
|
|
5342
|
-
pointRadius: 0,
|
|
5343
5320
|
label: prevalenceOverTimeVariant.displayName,
|
|
5344
5321
|
backgroundColor: singleGraphColorRGBAById(index, 0.3),
|
|
5345
5322
|
borderColor: singleGraphColorRGBAById(index),
|
|
@@ -6242,6 +6219,12 @@ function getMinMaxNumber(values) {
|
|
|
6242
6219
|
}
|
|
6243
6220
|
return [min, max];
|
|
6244
6221
|
}
|
|
6222
|
+
function makeArray(arrayOrSingleItem) {
|
|
6223
|
+
if (Array.isArray(arrayOrSingleItem)) {
|
|
6224
|
+
return arrayOrSingleItem;
|
|
6225
|
+
}
|
|
6226
|
+
return [arrayOrSingleItem];
|
|
6227
|
+
}
|
|
6245
6228
|
Chart.register(...registerables, LogitScale);
|
|
6246
6229
|
const PrevalenceOverTimeBubbleChart = ({
|
|
6247
6230
|
data,
|
|
@@ -6471,35 +6454,6 @@ const PrevalenceOverTimeTable = ({ data, granularity, pageSize }) => {
|
|
|
6471
6454
|
};
|
|
6472
6455
|
return /* @__PURE__ */ u$1(Table, { data: getData(data, granularity), columns: getColumns(data), pageSize });
|
|
6473
6456
|
};
|
|
6474
|
-
class DivisionOperator {
|
|
6475
|
-
constructor(numerator, denominator, keyField, valueField, resultField, numeratorField, denominatorField) {
|
|
6476
|
-
this.numerator = numerator;
|
|
6477
|
-
this.denominator = denominator;
|
|
6478
|
-
this.keyField = keyField;
|
|
6479
|
-
this.valueField = valueField;
|
|
6480
|
-
this.resultField = resultField;
|
|
6481
|
-
this.numeratorField = numeratorField;
|
|
6482
|
-
this.denominatorField = denominatorField;
|
|
6483
|
-
}
|
|
6484
|
-
async evaluate(lapis, signal) {
|
|
6485
|
-
const numeratorEvaluated = await this.numerator.evaluate(lapis, signal);
|
|
6486
|
-
const denominatorEvaluated = await this.denominator.evaluate(lapis, signal);
|
|
6487
|
-
const numeratorMap = /* @__PURE__ */ new Map();
|
|
6488
|
-
numeratorEvaluated.content.forEach((row) => {
|
|
6489
|
-
numeratorMap.set(row[this.keyField], row[this.valueField]);
|
|
6490
|
-
});
|
|
6491
|
-
const content = denominatorEvaluated.content.map((row) => {
|
|
6492
|
-
const numeratorValue = numeratorMap.get(row[this.keyField]) ?? 0;
|
|
6493
|
-
return {
|
|
6494
|
-
[this.keyField]: row[this.keyField],
|
|
6495
|
-
[this.numeratorField]: numeratorValue,
|
|
6496
|
-
[this.denominatorField]: row[this.valueField],
|
|
6497
|
-
[this.resultField]: numeratorValue / row[this.valueField]
|
|
6498
|
-
};
|
|
6499
|
-
});
|
|
6500
|
-
return { content };
|
|
6501
|
-
}
|
|
6502
|
-
}
|
|
6503
6457
|
class FetchAggregatedOperator {
|
|
6504
6458
|
constructor(filter, fields) {
|
|
6505
6459
|
this.filter = filter;
|
|
@@ -6632,36 +6586,7 @@ class SlidingOperator {
|
|
|
6632
6586
|
return { content };
|
|
6633
6587
|
}
|
|
6634
6588
|
}
|
|
6635
|
-
function
|
|
6636
|
-
const numeratorFilters = makeArray(numeratorFilter);
|
|
6637
|
-
const denominatorData = fetchAndPrepare(denominatorFilter, granularity, smoothingWindow, lapisDateField);
|
|
6638
|
-
const subQueries = numeratorFilters.map(async (namedLapisFilter) => {
|
|
6639
|
-
const { displayName, lapisFilter } = namedLapisFilter;
|
|
6640
|
-
const numeratorData = fetchAndPrepare(lapisFilter, granularity, smoothingWindow, lapisDateField);
|
|
6641
|
-
const divide = new DivisionOperator(
|
|
6642
|
-
numeratorData,
|
|
6643
|
-
denominatorData,
|
|
6644
|
-
"dateRange",
|
|
6645
|
-
"count",
|
|
6646
|
-
"prevalence",
|
|
6647
|
-
"count",
|
|
6648
|
-
"total"
|
|
6649
|
-
);
|
|
6650
|
-
const dataset = await divide.evaluate(lapis, signal);
|
|
6651
|
-
return {
|
|
6652
|
-
displayName,
|
|
6653
|
-
content: dataset.content
|
|
6654
|
-
};
|
|
6655
|
-
});
|
|
6656
|
-
return Promise.all(subQueries);
|
|
6657
|
-
}
|
|
6658
|
-
function makeArray(arrayOrSingleItem) {
|
|
6659
|
-
if (Array.isArray(arrayOrSingleItem)) {
|
|
6660
|
-
return arrayOrSingleItem;
|
|
6661
|
-
}
|
|
6662
|
-
return [arrayOrSingleItem];
|
|
6663
|
-
}
|
|
6664
|
-
function fetchAndPrepare(filter, granularity, smoothingWindow, lapisDateField) {
|
|
6589
|
+
function queryAggregatedDataOverTime(filter, granularity, smoothingWindow, lapisDateField) {
|
|
6665
6590
|
const fetchData = new FetchAggregatedOperator(filter, [lapisDateField]);
|
|
6666
6591
|
const dataWithFixedDateKey = new RenameFieldOperator(fetchData, lapisDateField, "date");
|
|
6667
6592
|
const mapData = new MapOperator(dataWithFixedDateKey, (d2) => mapDateToGranularityRange(d2, granularity));
|
|
@@ -6714,6 +6639,63 @@ function averageSmoothing(slidingWindow) {
|
|
|
6714
6639
|
const centerIndex = Math.floor(slidingWindow.length / 2);
|
|
6715
6640
|
return { dateRange: slidingWindow[centerIndex].dateRange, count: average };
|
|
6716
6641
|
}
|
|
6642
|
+
class DivisionOperator {
|
|
6643
|
+
constructor(numerator, denominator, keyField, valueField, resultField, numeratorField, denominatorField) {
|
|
6644
|
+
this.numerator = numerator;
|
|
6645
|
+
this.denominator = denominator;
|
|
6646
|
+
this.keyField = keyField;
|
|
6647
|
+
this.valueField = valueField;
|
|
6648
|
+
this.resultField = resultField;
|
|
6649
|
+
this.numeratorField = numeratorField;
|
|
6650
|
+
this.denominatorField = denominatorField;
|
|
6651
|
+
}
|
|
6652
|
+
async evaluate(lapis, signal) {
|
|
6653
|
+
const numeratorEvaluated = await this.numerator.evaluate(lapis, signal);
|
|
6654
|
+
const denominatorEvaluated = await this.denominator.evaluate(lapis, signal);
|
|
6655
|
+
const numeratorMap = /* @__PURE__ */ new Map();
|
|
6656
|
+
numeratorEvaluated.content.forEach((row) => {
|
|
6657
|
+
numeratorMap.set(row[this.keyField], row[this.valueField]);
|
|
6658
|
+
});
|
|
6659
|
+
const content = denominatorEvaluated.content.map((row) => {
|
|
6660
|
+
const numeratorValue = numeratorMap.get(row[this.keyField]) ?? 0;
|
|
6661
|
+
return {
|
|
6662
|
+
[this.keyField]: row[this.keyField],
|
|
6663
|
+
[this.numeratorField]: numeratorValue,
|
|
6664
|
+
[this.denominatorField]: row[this.valueField],
|
|
6665
|
+
[this.resultField]: numeratorValue / row[this.valueField]
|
|
6666
|
+
};
|
|
6667
|
+
});
|
|
6668
|
+
return { content };
|
|
6669
|
+
}
|
|
6670
|
+
}
|
|
6671
|
+
function queryPrevalenceOverTime(numeratorFilter, denominatorFilter, granularity, smoothingWindow, lapis, lapisDateField, signal) {
|
|
6672
|
+
const numeratorFilters = makeArray(numeratorFilter);
|
|
6673
|
+
const denominatorData = queryAggregatedDataOverTime(
|
|
6674
|
+
denominatorFilter,
|
|
6675
|
+
granularity,
|
|
6676
|
+
smoothingWindow,
|
|
6677
|
+
lapisDateField
|
|
6678
|
+
);
|
|
6679
|
+
const subQueries = numeratorFilters.map(async (namedLapisFilter) => {
|
|
6680
|
+
const { displayName, lapisFilter } = namedLapisFilter;
|
|
6681
|
+
const numeratorData = queryAggregatedDataOverTime(lapisFilter, granularity, smoothingWindow, lapisDateField);
|
|
6682
|
+
const divide = new DivisionOperator(
|
|
6683
|
+
numeratorData,
|
|
6684
|
+
denominatorData,
|
|
6685
|
+
"dateRange",
|
|
6686
|
+
"count",
|
|
6687
|
+
"prevalence",
|
|
6688
|
+
"count",
|
|
6689
|
+
"total"
|
|
6690
|
+
);
|
|
6691
|
+
const dataset = await divide.evaluate(lapis, signal);
|
|
6692
|
+
return {
|
|
6693
|
+
displayName,
|
|
6694
|
+
content: dataset.content
|
|
6695
|
+
};
|
|
6696
|
+
});
|
|
6697
|
+
return Promise.all(subQueries);
|
|
6698
|
+
}
|
|
6717
6699
|
const Select = ({ items, selected, onChange, selectStyle }) => {
|
|
6718
6700
|
return /* @__PURE__ */ u$1("select", { class: `select select-bordered ${selectStyle}`, value: selected, onChange, children: items.map((item) => /* @__PURE__ */ u$1("option", { value: item.value, disabled: item.disabled, children: item.label }, item.value)) });
|
|
6719
6701
|
};
|
|
@@ -6776,34 +6758,13 @@ const ScalingSelector = ({
|
|
|
6776
6758
|
);
|
|
6777
6759
|
};
|
|
6778
6760
|
const PrevalenceOverTime = ({
|
|
6779
|
-
numeratorFilter,
|
|
6780
|
-
denominatorFilter,
|
|
6781
|
-
granularity,
|
|
6782
|
-
smoothingWindow,
|
|
6783
|
-
views,
|
|
6784
|
-
confidenceIntervalMethods,
|
|
6785
6761
|
width,
|
|
6786
6762
|
height,
|
|
6787
6763
|
headline = "Prevalence over time",
|
|
6788
|
-
|
|
6789
|
-
pageSize,
|
|
6790
|
-
yAxisMaxConfig
|
|
6764
|
+
...innerProps
|
|
6791
6765
|
}) => {
|
|
6792
6766
|
const size2 = { height, width };
|
|
6793
|
-
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(
|
|
6794
|
-
PrevalenceOverTimeInner,
|
|
6795
|
-
{
|
|
6796
|
-
numeratorFilter,
|
|
6797
|
-
denominatorFilter,
|
|
6798
|
-
granularity,
|
|
6799
|
-
smoothingWindow,
|
|
6800
|
-
views,
|
|
6801
|
-
confidenceIntervalMethods,
|
|
6802
|
-
lapisDateField,
|
|
6803
|
-
pageSize,
|
|
6804
|
-
yAxisMaxConfig
|
|
6805
|
-
}
|
|
6806
|
-
) }) }) });
|
|
6767
|
+
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(PrevalenceOverTimeInner, { ...innerProps }) }) }) });
|
|
6807
6768
|
};
|
|
6808
6769
|
const PrevalenceOverTimeInner = ({
|
|
6809
6770
|
numeratorFilter,
|
|
@@ -6962,14 +6923,14 @@ const PrevalenceOverTimeInfo = () => {
|
|
|
6962
6923
|
] });
|
|
6963
6924
|
};
|
|
6964
6925
|
const maxInData = (data) => Math.max(...data.flatMap((variant) => variant.content.map((dataPoint) => dataPoint.prevalence)));
|
|
6965
|
-
var __defProp$
|
|
6966
|
-
var __getOwnPropDesc$
|
|
6967
|
-
var __decorateClass$
|
|
6968
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
6926
|
+
var __defProp$7 = Object.defineProperty;
|
|
6927
|
+
var __getOwnPropDesc$7 = Object.getOwnPropertyDescriptor;
|
|
6928
|
+
var __decorateClass$7 = (decorators, target, key, kind) => {
|
|
6929
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$7(target, key) : target;
|
|
6969
6930
|
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
6970
6931
|
if (decorator = decorators[i2])
|
|
6971
6932
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
6972
|
-
if (kind && result) __defProp$
|
|
6933
|
+
if (kind && result) __defProp$7(target, key, result);
|
|
6973
6934
|
return result;
|
|
6974
6935
|
};
|
|
6975
6936
|
let PrevalenceOverTimeComponent = class extends PreactLitAdapterWithGridJsStyles {
|
|
@@ -7012,46 +6973,46 @@ let PrevalenceOverTimeComponent = class extends PreactLitAdapterWithGridJsStyles
|
|
|
7012
6973
|
);
|
|
7013
6974
|
}
|
|
7014
6975
|
};
|
|
7015
|
-
__decorateClass$
|
|
6976
|
+
__decorateClass$7([
|
|
7016
6977
|
n2({ type: Object })
|
|
7017
6978
|
], PrevalenceOverTimeComponent.prototype, "numeratorFilter", 2);
|
|
7018
|
-
__decorateClass$
|
|
6979
|
+
__decorateClass$7([
|
|
7019
6980
|
n2({ type: Object })
|
|
7020
6981
|
], PrevalenceOverTimeComponent.prototype, "denominatorFilter", 2);
|
|
7021
|
-
__decorateClass$
|
|
6982
|
+
__decorateClass$7([
|
|
7022
6983
|
n2({ type: String })
|
|
7023
6984
|
], PrevalenceOverTimeComponent.prototype, "granularity", 2);
|
|
7024
|
-
__decorateClass$
|
|
6985
|
+
__decorateClass$7([
|
|
7025
6986
|
n2({ type: Number })
|
|
7026
6987
|
], PrevalenceOverTimeComponent.prototype, "smoothingWindow", 2);
|
|
7027
|
-
__decorateClass$
|
|
6988
|
+
__decorateClass$7([
|
|
7028
6989
|
n2({ type: Array })
|
|
7029
6990
|
], PrevalenceOverTimeComponent.prototype, "views", 2);
|
|
7030
|
-
__decorateClass$
|
|
6991
|
+
__decorateClass$7([
|
|
7031
6992
|
n2({ type: Array })
|
|
7032
6993
|
], PrevalenceOverTimeComponent.prototype, "confidenceIntervalMethods", 2);
|
|
7033
|
-
__decorateClass$
|
|
6994
|
+
__decorateClass$7([
|
|
7034
6995
|
n2({ type: String })
|
|
7035
6996
|
], PrevalenceOverTimeComponent.prototype, "headline", 2);
|
|
7036
|
-
__decorateClass$
|
|
6997
|
+
__decorateClass$7([
|
|
7037
6998
|
n2({ type: String })
|
|
7038
6999
|
], PrevalenceOverTimeComponent.prototype, "width", 2);
|
|
7039
|
-
__decorateClass$
|
|
7000
|
+
__decorateClass$7([
|
|
7040
7001
|
n2({ type: String })
|
|
7041
7002
|
], PrevalenceOverTimeComponent.prototype, "height", 2);
|
|
7042
|
-
__decorateClass$
|
|
7003
|
+
__decorateClass$7([
|
|
7043
7004
|
n2({ type: String })
|
|
7044
7005
|
], PrevalenceOverTimeComponent.prototype, "lapisDateField", 2);
|
|
7045
|
-
__decorateClass$
|
|
7006
|
+
__decorateClass$7([
|
|
7046
7007
|
n2({ type: Object })
|
|
7047
7008
|
], PrevalenceOverTimeComponent.prototype, "pageSize", 2);
|
|
7048
|
-
__decorateClass$
|
|
7009
|
+
__decorateClass$7([
|
|
7049
7010
|
n2({ type: String })
|
|
7050
7011
|
], PrevalenceOverTimeComponent.prototype, "yAxisMaxLinear", 2);
|
|
7051
|
-
__decorateClass$
|
|
7012
|
+
__decorateClass$7([
|
|
7052
7013
|
n2({ type: String })
|
|
7053
7014
|
], PrevalenceOverTimeComponent.prototype, "yAxisMaxLogarithmic", 2);
|
|
7054
|
-
PrevalenceOverTimeComponent = __decorateClass$
|
|
7015
|
+
PrevalenceOverTimeComponent = __decorateClass$7([
|
|
7055
7016
|
t$2("gs-prevalence-over-time")
|
|
7056
7017
|
], PrevalenceOverTimeComponent);
|
|
7057
7018
|
Chart.register(...registerables, LogitScale);
|
|
@@ -7264,28 +7225,13 @@ function toYearMonthDay(d2) {
|
|
|
7264
7225
|
};
|
|
7265
7226
|
}
|
|
7266
7227
|
const RelativeGrowthAdvantage = ({
|
|
7267
|
-
views,
|
|
7268
7228
|
width,
|
|
7269
7229
|
height,
|
|
7270
|
-
numeratorFilter,
|
|
7271
|
-
denominatorFilter,
|
|
7272
|
-
generationTime,
|
|
7273
7230
|
headline = "Relative growth advantage",
|
|
7274
|
-
|
|
7275
|
-
yAxisMaxConfig
|
|
7231
|
+
...innerProps
|
|
7276
7232
|
}) => {
|
|
7277
7233
|
const size2 = { height, width };
|
|
7278
|
-
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(
|
|
7279
|
-
RelativeGrowthAdvantageInner,
|
|
7280
|
-
{
|
|
7281
|
-
views,
|
|
7282
|
-
numeratorFilter,
|
|
7283
|
-
denominatorFilter,
|
|
7284
|
-
generationTime,
|
|
7285
|
-
lapisDateField,
|
|
7286
|
-
yAxisMaxConfig
|
|
7287
|
-
}
|
|
7288
|
-
) }) }) });
|
|
7234
|
+
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(RelativeGrowthAdvantageInner, { ...innerProps }) }) }) });
|
|
7289
7235
|
};
|
|
7290
7236
|
const RelativeGrowthAdvantageInner = ({
|
|
7291
7237
|
numeratorFilter,
|
|
@@ -7392,14 +7338,14 @@ const RelativeGrowthAdvantageInfo = ({ generationTime }) => {
|
|
|
7392
7338
|
] })
|
|
7393
7339
|
] });
|
|
7394
7340
|
};
|
|
7395
|
-
var __defProp$
|
|
7396
|
-
var __getOwnPropDesc$
|
|
7397
|
-
var __decorateClass$
|
|
7398
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
7341
|
+
var __defProp$6 = Object.defineProperty;
|
|
7342
|
+
var __getOwnPropDesc$6 = Object.getOwnPropertyDescriptor;
|
|
7343
|
+
var __decorateClass$6 = (decorators, target, key, kind) => {
|
|
7344
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$6(target, key) : target;
|
|
7399
7345
|
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
7400
7346
|
if (decorator = decorators[i2])
|
|
7401
7347
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7402
|
-
if (kind && result) __defProp$
|
|
7348
|
+
if (kind && result) __defProp$6(target, key, result);
|
|
7403
7349
|
return result;
|
|
7404
7350
|
};
|
|
7405
7351
|
let RelativeGrowthAdvantageComponent = class extends PreactLitAdapter {
|
|
@@ -7436,37 +7382,37 @@ let RelativeGrowthAdvantageComponent = class extends PreactLitAdapter {
|
|
|
7436
7382
|
);
|
|
7437
7383
|
}
|
|
7438
7384
|
};
|
|
7439
|
-
__decorateClass$
|
|
7385
|
+
__decorateClass$6([
|
|
7440
7386
|
n2({ type: Object })
|
|
7441
7387
|
], RelativeGrowthAdvantageComponent.prototype, "numeratorFilter", 2);
|
|
7442
|
-
__decorateClass$
|
|
7388
|
+
__decorateClass$6([
|
|
7443
7389
|
n2({ type: Object })
|
|
7444
7390
|
], RelativeGrowthAdvantageComponent.prototype, "denominatorFilter", 2);
|
|
7445
|
-
__decorateClass$
|
|
7391
|
+
__decorateClass$6([
|
|
7446
7392
|
n2({ type: Number })
|
|
7447
7393
|
], RelativeGrowthAdvantageComponent.prototype, "generationTime", 2);
|
|
7448
|
-
__decorateClass$
|
|
7394
|
+
__decorateClass$6([
|
|
7449
7395
|
n2({ type: Array })
|
|
7450
7396
|
], RelativeGrowthAdvantageComponent.prototype, "views", 2);
|
|
7451
|
-
__decorateClass$
|
|
7397
|
+
__decorateClass$6([
|
|
7452
7398
|
n2({ type: String })
|
|
7453
7399
|
], RelativeGrowthAdvantageComponent.prototype, "headline", 2);
|
|
7454
|
-
__decorateClass$
|
|
7400
|
+
__decorateClass$6([
|
|
7455
7401
|
n2({ type: String })
|
|
7456
7402
|
], RelativeGrowthAdvantageComponent.prototype, "width", 2);
|
|
7457
|
-
__decorateClass$
|
|
7403
|
+
__decorateClass$6([
|
|
7458
7404
|
n2({ type: String })
|
|
7459
7405
|
], RelativeGrowthAdvantageComponent.prototype, "height", 2);
|
|
7460
|
-
__decorateClass$
|
|
7406
|
+
__decorateClass$6([
|
|
7461
7407
|
n2({ type: String })
|
|
7462
7408
|
], RelativeGrowthAdvantageComponent.prototype, "lapisDateField", 2);
|
|
7463
|
-
__decorateClass$
|
|
7409
|
+
__decorateClass$6([
|
|
7464
7410
|
n2({ type: String })
|
|
7465
7411
|
], RelativeGrowthAdvantageComponent.prototype, "yAxisMaxLinear", 2);
|
|
7466
|
-
__decorateClass$
|
|
7412
|
+
__decorateClass$6([
|
|
7467
7413
|
n2({ type: String })
|
|
7468
7414
|
], RelativeGrowthAdvantageComponent.prototype, "yAxisMaxLogarithmic", 2);
|
|
7469
|
-
RelativeGrowthAdvantageComponent = __decorateClass$
|
|
7415
|
+
RelativeGrowthAdvantageComponent = __decorateClass$6([
|
|
7470
7416
|
t$2("gs-relative-growth-advantage")
|
|
7471
7417
|
], RelativeGrowthAdvantageComponent);
|
|
7472
7418
|
const compareAscending = (a2, b3) => {
|
|
@@ -7518,28 +7464,13 @@ const AggregateTable = ({ data, fields, pageSize }) => {
|
|
|
7518
7464
|
return /* @__PURE__ */ u$1(Table, { data, columns: headers, pageSize });
|
|
7519
7465
|
};
|
|
7520
7466
|
const Aggregate = ({
|
|
7521
|
-
views,
|
|
7522
7467
|
width,
|
|
7523
7468
|
height,
|
|
7524
7469
|
headline = "Mutations",
|
|
7525
|
-
|
|
7526
|
-
fields,
|
|
7527
|
-
pageSize,
|
|
7528
|
-
initialSortField,
|
|
7529
|
-
initialSortDirection
|
|
7470
|
+
...innerProps
|
|
7530
7471
|
}) => {
|
|
7531
7472
|
const size2 = { height, width };
|
|
7532
|
-
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(
|
|
7533
|
-
AggregateInner,
|
|
7534
|
-
{
|
|
7535
|
-
fields,
|
|
7536
|
-
filter,
|
|
7537
|
-
views,
|
|
7538
|
-
initialSortField,
|
|
7539
|
-
initialSortDirection,
|
|
7540
|
-
pageSize
|
|
7541
|
-
}
|
|
7542
|
-
) }) }) });
|
|
7473
|
+
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(AggregateInner, { ...innerProps }) }) }) });
|
|
7543
7474
|
};
|
|
7544
7475
|
const AggregateInner = ({
|
|
7545
7476
|
fields,
|
|
@@ -7583,14 +7514,14 @@ const Toolbar = ({ data }) => {
|
|
|
7583
7514
|
/* @__PURE__ */ u$1(Info, { height: "100px", children: "Info for aggregate" })
|
|
7584
7515
|
] });
|
|
7585
7516
|
};
|
|
7586
|
-
var __defProp$
|
|
7587
|
-
var __getOwnPropDesc$
|
|
7588
|
-
var __decorateClass$
|
|
7589
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$
|
|
7517
|
+
var __defProp$5 = Object.defineProperty;
|
|
7518
|
+
var __getOwnPropDesc$5 = Object.getOwnPropertyDescriptor;
|
|
7519
|
+
var __decorateClass$5 = (decorators, target, key, kind) => {
|
|
7520
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$5(target, key) : target;
|
|
7590
7521
|
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
7591
7522
|
if (decorator = decorators[i2])
|
|
7592
7523
|
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7593
|
-
if (kind && result) __defProp$
|
|
7524
|
+
if (kind && result) __defProp$5(target, key, result);
|
|
7594
7525
|
return result;
|
|
7595
7526
|
};
|
|
7596
7527
|
let AggregateComponent = class extends PreactLitAdapterWithGridJsStyles {
|
|
@@ -7623,36 +7554,255 @@ let AggregateComponent = class extends PreactLitAdapterWithGridJsStyles {
|
|
|
7623
7554
|
);
|
|
7624
7555
|
}
|
|
7625
7556
|
};
|
|
7626
|
-
__decorateClass$
|
|
7557
|
+
__decorateClass$5([
|
|
7627
7558
|
n2({ type: Array })
|
|
7628
7559
|
], AggregateComponent.prototype, "fields", 2);
|
|
7629
|
-
__decorateClass$
|
|
7560
|
+
__decorateClass$5([
|
|
7630
7561
|
n2({ type: Array })
|
|
7631
7562
|
], AggregateComponent.prototype, "views", 2);
|
|
7632
|
-
__decorateClass$
|
|
7563
|
+
__decorateClass$5([
|
|
7633
7564
|
n2({ type: Object })
|
|
7634
7565
|
], AggregateComponent.prototype, "filter", 2);
|
|
7635
|
-
__decorateClass$
|
|
7566
|
+
__decorateClass$5([
|
|
7636
7567
|
n2({ type: String })
|
|
7637
7568
|
], AggregateComponent.prototype, "width", 2);
|
|
7638
|
-
__decorateClass$
|
|
7569
|
+
__decorateClass$5([
|
|
7639
7570
|
n2({ type: String })
|
|
7640
7571
|
], AggregateComponent.prototype, "height", 2);
|
|
7641
|
-
__decorateClass$
|
|
7572
|
+
__decorateClass$5([
|
|
7642
7573
|
n2({ type: String })
|
|
7643
7574
|
], AggregateComponent.prototype, "headline", 2);
|
|
7644
|
-
__decorateClass$
|
|
7575
|
+
__decorateClass$5([
|
|
7645
7576
|
n2({ type: String })
|
|
7646
7577
|
], AggregateComponent.prototype, "initialSortField", 2);
|
|
7647
|
-
__decorateClass$
|
|
7578
|
+
__decorateClass$5([
|
|
7648
7579
|
n2({ type: String })
|
|
7649
7580
|
], AggregateComponent.prototype, "initialSortDirection", 2);
|
|
7650
|
-
__decorateClass$
|
|
7581
|
+
__decorateClass$5([
|
|
7651
7582
|
n2({ type: Object })
|
|
7652
7583
|
], AggregateComponent.prototype, "pageSize", 2);
|
|
7653
|
-
AggregateComponent = __decorateClass$
|
|
7584
|
+
AggregateComponent = __decorateClass$5([
|
|
7654
7585
|
t$2("gs-aggregate")
|
|
7655
7586
|
], AggregateComponent);
|
|
7587
|
+
const getNumberOfSequencesOverTimeTableData = (data, dateRangeKey) => {
|
|
7588
|
+
const datasetsWithCountByDate = data.map(({ displayName, content }) => ({
|
|
7589
|
+
displayName,
|
|
7590
|
+
content: new Map(content.map((datum) => {
|
|
7591
|
+
var _a;
|
|
7592
|
+
return [(_a = datum.dateRange) == null ? void 0 : _a.toString(), datum];
|
|
7593
|
+
}))
|
|
7594
|
+
}));
|
|
7595
|
+
const allDateRangesThatOccurInData = datasetsWithCountByDate.map(({ content }) => [...content.values()].map((datum) => datum.dateRange)).reduce((acc, keys) => /* @__PURE__ */ new Set([...acc, ...keys]), /* @__PURE__ */ new Set());
|
|
7596
|
+
const minMax = getMinMaxTemporal(allDateRangesThatOccurInData);
|
|
7597
|
+
if (minMax === null) {
|
|
7598
|
+
return [];
|
|
7599
|
+
}
|
|
7600
|
+
const allDateRanges = generateAllInRange(...minMax);
|
|
7601
|
+
if (allDateRangesThatOccurInData.has(null)) {
|
|
7602
|
+
allDateRanges.unshift(null);
|
|
7603
|
+
}
|
|
7604
|
+
return allDateRanges.map((dateRange) => {
|
|
7605
|
+
return datasetsWithCountByDate.reduce(
|
|
7606
|
+
(acc, dataset) => {
|
|
7607
|
+
var _a;
|
|
7608
|
+
return {
|
|
7609
|
+
...acc,
|
|
7610
|
+
[dataset.displayName]: ((_a = dataset.content.get(dateRange == null ? void 0 : dateRange.toString())) == null ? void 0 : _a.count) ?? 0
|
|
7611
|
+
};
|
|
7612
|
+
},
|
|
7613
|
+
{ [dateRangeKey]: (dateRange == null ? void 0 : dateRange.toString()) ?? "Unknown" }
|
|
7614
|
+
);
|
|
7615
|
+
});
|
|
7616
|
+
};
|
|
7617
|
+
Chart.register(...registerables);
|
|
7618
|
+
const NumberSequencesOverTimeBarChart = ({ data }) => {
|
|
7619
|
+
const config = T(
|
|
7620
|
+
() => ({
|
|
7621
|
+
type: "bar",
|
|
7622
|
+
data: {
|
|
7623
|
+
datasets: getDatasets(data)
|
|
7624
|
+
},
|
|
7625
|
+
options: {
|
|
7626
|
+
maintainAspectRatio: false,
|
|
7627
|
+
animation: false,
|
|
7628
|
+
plugins: {
|
|
7629
|
+
legend: {
|
|
7630
|
+
display: false
|
|
7631
|
+
},
|
|
7632
|
+
tooltip: {
|
|
7633
|
+
mode: "index",
|
|
7634
|
+
intersect: false
|
|
7635
|
+
}
|
|
7636
|
+
}
|
|
7637
|
+
}
|
|
7638
|
+
}),
|
|
7639
|
+
[data]
|
|
7640
|
+
);
|
|
7641
|
+
return /* @__PURE__ */ u$1(GsChart, { configuration: config });
|
|
7642
|
+
};
|
|
7643
|
+
const getDatasets = (data) => {
|
|
7644
|
+
const tableData = getNumberOfSequencesOverTimeTableData(data, "date");
|
|
7645
|
+
return data.map(
|
|
7646
|
+
({ displayName }, index) => ({
|
|
7647
|
+
borderWidth: 1,
|
|
7648
|
+
label: displayName,
|
|
7649
|
+
backgroundColor: singleGraphColorRGBAById(index, 0.3),
|
|
7650
|
+
borderColor: singleGraphColorRGBAById(index),
|
|
7651
|
+
data: tableData.map((row) => ({
|
|
7652
|
+
x: row.date,
|
|
7653
|
+
y: row[displayName]
|
|
7654
|
+
}))
|
|
7655
|
+
})
|
|
7656
|
+
);
|
|
7657
|
+
};
|
|
7658
|
+
const NumberSequencesOverTimeTable = ({ data, granularity, pageSize }) => {
|
|
7659
|
+
const columns = [
|
|
7660
|
+
{
|
|
7661
|
+
name: granularity,
|
|
7662
|
+
sort: true
|
|
7663
|
+
},
|
|
7664
|
+
...data.map((dataset) => ({
|
|
7665
|
+
name: dataset.displayName,
|
|
7666
|
+
sort: true
|
|
7667
|
+
}))
|
|
7668
|
+
];
|
|
7669
|
+
const flatTableData = T(() => {
|
|
7670
|
+
const tableData = getNumberOfSequencesOverTimeTableData(data, granularity);
|
|
7671
|
+
return Object.values(tableData).map((row) => Object.values(row));
|
|
7672
|
+
}, [data, granularity]);
|
|
7673
|
+
return /* @__PURE__ */ u$1(Table, { data: flatTableData, columns, pageSize });
|
|
7674
|
+
};
|
|
7675
|
+
async function queryNumberOfSequencesOverTime(lapis, lapisFilter, lapisDateField, granularity, smoothingWindow) {
|
|
7676
|
+
const lapisFilters = makeArray(lapisFilter);
|
|
7677
|
+
const queries = lapisFilters.map(async ({ displayName, lapisFilter: lapisFilter2 }) => {
|
|
7678
|
+
const { content } = await queryAggregatedDataOverTime(
|
|
7679
|
+
lapisFilter2,
|
|
7680
|
+
granularity,
|
|
7681
|
+
smoothingWindow,
|
|
7682
|
+
lapisDateField
|
|
7683
|
+
).evaluate(lapis);
|
|
7684
|
+
return {
|
|
7685
|
+
displayName,
|
|
7686
|
+
content: content.sort(sortNullToBeginningThenByDate)
|
|
7687
|
+
};
|
|
7688
|
+
});
|
|
7689
|
+
return Promise.all(queries);
|
|
7690
|
+
}
|
|
7691
|
+
const NumberSequencesOverTime = ({ width, height, headline, ...innerProps }) => {
|
|
7692
|
+
const size2 = { height, width };
|
|
7693
|
+
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(NumberSequencesOverTimeInner, { ...innerProps }) }) }) });
|
|
7694
|
+
};
|
|
7695
|
+
const NumberSequencesOverTimeInner = ({
|
|
7696
|
+
lapisFilter,
|
|
7697
|
+
granularity,
|
|
7698
|
+
smoothingWindow,
|
|
7699
|
+
lapisDateField,
|
|
7700
|
+
views,
|
|
7701
|
+
pageSize
|
|
7702
|
+
}) => {
|
|
7703
|
+
const lapis = x(LapisUrlContext);
|
|
7704
|
+
const { data, error, isLoading } = useQuery(
|
|
7705
|
+
() => queryNumberOfSequencesOverTime(lapis, lapisFilter, lapisDateField, granularity, smoothingWindow)
|
|
7706
|
+
);
|
|
7707
|
+
if (isLoading) {
|
|
7708
|
+
return /* @__PURE__ */ u$1(LoadingDisplay, {});
|
|
7709
|
+
}
|
|
7710
|
+
if (error !== null) {
|
|
7711
|
+
return /* @__PURE__ */ u$1(ErrorDisplay, { error });
|
|
7712
|
+
}
|
|
7713
|
+
if (data === null) {
|
|
7714
|
+
return /* @__PURE__ */ u$1(NoDataDisplay, {});
|
|
7715
|
+
}
|
|
7716
|
+
return /* @__PURE__ */ u$1(NumberSequencesOverTimeTabs, { views, data, granularity, pageSize });
|
|
7717
|
+
};
|
|
7718
|
+
const NumberSequencesOverTimeTabs = ({ views, data, granularity, pageSize }) => {
|
|
7719
|
+
const getTab = (view) => {
|
|
7720
|
+
switch (view) {
|
|
7721
|
+
case "bar":
|
|
7722
|
+
return { title: "Bar", content: /* @__PURE__ */ u$1(NumberSequencesOverTimeBarChart, { data }) };
|
|
7723
|
+
case "line":
|
|
7724
|
+
return { title: "Line", content: /* @__PURE__ */ u$1("div", { children: "not implemented, TODO #317" }) };
|
|
7725
|
+
case "table":
|
|
7726
|
+
return {
|
|
7727
|
+
title: "Table",
|
|
7728
|
+
content: /* @__PURE__ */ u$1(NumberSequencesOverTimeTable, { data, granularity, pageSize })
|
|
7729
|
+
};
|
|
7730
|
+
default:
|
|
7731
|
+
throw new Error(`Unknown view: ${view}`);
|
|
7732
|
+
}
|
|
7733
|
+
};
|
|
7734
|
+
return /* @__PURE__ */ u$1(Tabs, { tabs: views.map((view) => getTab(view)) });
|
|
7735
|
+
};
|
|
7736
|
+
var __defProp$4 = Object.defineProperty;
|
|
7737
|
+
var __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor;
|
|
7738
|
+
var __decorateClass$4 = (decorators, target, key, kind) => {
|
|
7739
|
+
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target;
|
|
7740
|
+
for (var i2 = decorators.length - 1, decorator; i2 >= 0; i2--)
|
|
7741
|
+
if (decorator = decorators[i2])
|
|
7742
|
+
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
7743
|
+
if (kind && result) __defProp$4(target, key, result);
|
|
7744
|
+
return result;
|
|
7745
|
+
};
|
|
7746
|
+
let NumberSequencesOverTimeComponent = class extends PreactLitAdapterWithGridJsStyles {
|
|
7747
|
+
constructor() {
|
|
7748
|
+
super(...arguments);
|
|
7749
|
+
this.lapisFilter = { displayName: "", lapisFilter: {} };
|
|
7750
|
+
this.lapisDateField = "date";
|
|
7751
|
+
this.views = ["bar", "line", "table"];
|
|
7752
|
+
this.headline = "Number of sequences of time";
|
|
7753
|
+
this.width = "100%";
|
|
7754
|
+
this.height = "700px";
|
|
7755
|
+
this.granularity = "day";
|
|
7756
|
+
this.smoothingWindow = 0;
|
|
7757
|
+
this.pageSize = false;
|
|
7758
|
+
}
|
|
7759
|
+
render() {
|
|
7760
|
+
return /* @__PURE__ */ u$1(
|
|
7761
|
+
NumberSequencesOverTime,
|
|
7762
|
+
{
|
|
7763
|
+
lapisFilter: this.lapisFilter,
|
|
7764
|
+
lapisDateField: this.lapisDateField,
|
|
7765
|
+
views: this.views,
|
|
7766
|
+
headline: this.headline,
|
|
7767
|
+
width: this.width,
|
|
7768
|
+
height: this.height,
|
|
7769
|
+
granularity: this.granularity,
|
|
7770
|
+
smoothingWindow: this.smoothingWindow,
|
|
7771
|
+
pageSize: this.pageSize
|
|
7772
|
+
}
|
|
7773
|
+
);
|
|
7774
|
+
}
|
|
7775
|
+
};
|
|
7776
|
+
__decorateClass$4([
|
|
7777
|
+
n2({ type: Object })
|
|
7778
|
+
], NumberSequencesOverTimeComponent.prototype, "lapisFilter", 2);
|
|
7779
|
+
__decorateClass$4([
|
|
7780
|
+
n2({ type: String })
|
|
7781
|
+
], NumberSequencesOverTimeComponent.prototype, "lapisDateField", 2);
|
|
7782
|
+
__decorateClass$4([
|
|
7783
|
+
n2({ type: Array })
|
|
7784
|
+
], NumberSequencesOverTimeComponent.prototype, "views", 2);
|
|
7785
|
+
__decorateClass$4([
|
|
7786
|
+
n2({ type: String })
|
|
7787
|
+
], NumberSequencesOverTimeComponent.prototype, "headline", 2);
|
|
7788
|
+
__decorateClass$4([
|
|
7789
|
+
n2({ type: String })
|
|
7790
|
+
], NumberSequencesOverTimeComponent.prototype, "width", 2);
|
|
7791
|
+
__decorateClass$4([
|
|
7792
|
+
n2({ type: String })
|
|
7793
|
+
], NumberSequencesOverTimeComponent.prototype, "height", 2);
|
|
7794
|
+
__decorateClass$4([
|
|
7795
|
+
n2({ type: String })
|
|
7796
|
+
], NumberSequencesOverTimeComponent.prototype, "granularity", 2);
|
|
7797
|
+
__decorateClass$4([
|
|
7798
|
+
n2({ type: Number })
|
|
7799
|
+
], NumberSequencesOverTimeComponent.prototype, "smoothingWindow", 2);
|
|
7800
|
+
__decorateClass$4([
|
|
7801
|
+
n2({ type: Object })
|
|
7802
|
+
], NumberSequencesOverTimeComponent.prototype, "pageSize", 2);
|
|
7803
|
+
NumberSequencesOverTimeComponent = __decorateClass$4([
|
|
7804
|
+
t$2("gs-number-sequences-over-time")
|
|
7805
|
+
], NumberSequencesOverTimeComponent);
|
|
7656
7806
|
const PRESET_VALUE_CUSTOM = "custom";
|
|
7657
7807
|
const PRESET_VALUE_ALL_TIMES = "allTimes";
|
|
7658
7808
|
const PRESET_VALUE_LAST_2_WEEKS = "last2Weeks";
|
|
@@ -7766,26 +7916,11 @@ const toYYYYMMDD = (date) => {
|
|
|
7766
7916
|
return date.toLocaleDateString("en-CA", options2);
|
|
7767
7917
|
};
|
|
7768
7918
|
const DateRangeSelector = ({
|
|
7769
|
-
customSelectOptions,
|
|
7770
|
-
earliestDate = "1900-01-01",
|
|
7771
|
-
initialValue,
|
|
7772
7919
|
width,
|
|
7773
|
-
|
|
7774
|
-
initialDateFrom,
|
|
7775
|
-
initialDateTo
|
|
7920
|
+
...innerProps
|
|
7776
7921
|
}) => {
|
|
7777
7922
|
const size2 = { width, height: "3rem" };
|
|
7778
|
-
return /* @__PURE__ */ u$1(ErrorBoundary, { size: size2, children: /* @__PURE__ */ u$1("div", { style: { width }, children: /* @__PURE__ */ u$1(
|
|
7779
|
-
DateRangeSelectorInner,
|
|
7780
|
-
{
|
|
7781
|
-
customSelectOptions,
|
|
7782
|
-
earliestDate,
|
|
7783
|
-
initialValue,
|
|
7784
|
-
dateColumn,
|
|
7785
|
-
initialDateFrom,
|
|
7786
|
-
initialDateTo
|
|
7787
|
-
}
|
|
7788
|
-
) }) });
|
|
7923
|
+
return /* @__PURE__ */ u$1(ErrorBoundary, { size: size2, children: /* @__PURE__ */ u$1("div", { style: { width }, children: /* @__PURE__ */ u$1(DateRangeSelectorInner, { ...innerProps }) }) });
|
|
7789
7924
|
};
|
|
7790
7925
|
const DateRangeSelectorInner = ({
|
|
7791
7926
|
customSelectOptions,
|
|
@@ -8031,14 +8166,9 @@ function compareLocationEntries(fields) {
|
|
|
8031
8166
|
return 0;
|
|
8032
8167
|
};
|
|
8033
8168
|
}
|
|
8034
|
-
const LocationFilter = ({
|
|
8035
|
-
width,
|
|
8036
|
-
initialValue,
|
|
8037
|
-
fields,
|
|
8038
|
-
placeholderText
|
|
8039
|
-
}) => {
|
|
8169
|
+
const LocationFilter = ({ width, ...innerProps }) => {
|
|
8040
8170
|
const size2 = { width, height: "3rem" };
|
|
8041
|
-
return /* @__PURE__ */ u$1(ErrorBoundary, { size: size2, children: /* @__PURE__ */ u$1(ResizeContainer, { size: size2, children: /* @__PURE__ */ u$1(LocationFilterInner, {
|
|
8171
|
+
return /* @__PURE__ */ u$1(ErrorBoundary, { size: size2, children: /* @__PURE__ */ u$1(ResizeContainer, { size: size2, children: /* @__PURE__ */ u$1(LocationFilterInner, { ...innerProps }) }) });
|
|
8042
8172
|
};
|
|
8043
8173
|
const LocationFilterInner = ({ initialValue, fields, placeholderText }) => {
|
|
8044
8174
|
const lapis = x(LapisUrlContext);
|
|
@@ -8156,9 +8286,9 @@ async function fetchAutocompleteList(lapis, field, signal) {
|
|
|
8156
8286
|
const data = (await fetchAggregatedOperator.evaluate(lapis, signal)).content;
|
|
8157
8287
|
return data.map((item) => item[field]);
|
|
8158
8288
|
}
|
|
8159
|
-
const TextInput = ({ width,
|
|
8289
|
+
const TextInput = ({ width, ...innerProps }) => {
|
|
8160
8290
|
const size2 = { width, height: "3rem" };
|
|
8161
|
-
return /* @__PURE__ */ u$1(ErrorBoundary, { size: size2, children: /* @__PURE__ */ u$1(ResizeContainer, { size: size2, children: /* @__PURE__ */ u$1(TextInputInner, {
|
|
8291
|
+
return /* @__PURE__ */ u$1(ErrorBoundary, { size: size2, children: /* @__PURE__ */ u$1(ResizeContainer, { size: size2, children: /* @__PURE__ */ u$1(TextInputInner, { ...innerProps }) }) });
|
|
8162
8292
|
};
|
|
8163
8293
|
const TextInputInner = ({
|
|
8164
8294
|
lapisField,
|
|
@@ -8827,6 +8957,7 @@ export {
|
|
|
8827
8957
|
MutationComparisonComponent,
|
|
8828
8958
|
MutationFilterComponent,
|
|
8829
8959
|
MutationsComponent,
|
|
8960
|
+
NumberSequencesOverTimeComponent,
|
|
8830
8961
|
PrevalenceOverTimeComponent,
|
|
8831
8962
|
RelativeGrowthAdvantageComponent,
|
|
8832
8963
|
TextInputComponent
|