@genspectrum/dashboard-components 0.11.5 → 0.11.7

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.
Files changed (41) hide show
  1. package/custom-elements.json +92 -6
  2. package/dist/assets/{mutationOverTimeWorker-CWneD7i5.js.map → mutationOverTimeWorker-DTv93Ere.js.map} +1 -1
  3. package/dist/components.d.ts +67 -19
  4. package/dist/components.js +301 -90
  5. package/dist/components.js.map +1 -1
  6. package/dist/style.css +3 -0
  7. package/dist/util.d.ts +53 -22
  8. package/package.json +1 -1
  9. package/src/preact/aggregatedData/__mockData__/aggregatedWith1Field.json +399 -0
  10. package/src/preact/aggregatedData/__mockData__/aggregatedWith2Fields.json +1771 -0
  11. package/src/preact/aggregatedData/aggregate-bar-chart.tsx +177 -0
  12. package/src/preact/aggregatedData/aggregate-table.tsx +24 -2
  13. package/src/preact/aggregatedData/aggregate.stories.tsx +61 -2
  14. package/src/preact/aggregatedData/aggregate.tsx +18 -6
  15. package/src/preact/mutations/__mockData__/baselineNucleotideMutations.json +337412 -0
  16. package/src/preact/mutations/__mockData__/overallVariantCount.json +14 -0
  17. package/src/preact/mutations/getMutationsTableData.spec.ts +20 -3
  18. package/src/preact/mutations/getMutationsTableData.ts +37 -2
  19. package/src/preact/mutations/mutations-table.tsx +47 -27
  20. package/src/preact/mutations/mutations.stories.tsx +41 -9
  21. package/src/preact/mutations/mutations.tsx +22 -6
  22. package/src/preact/mutations/queryMutations.ts +28 -8
  23. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutationsByDay.ts +11077 -3062
  24. package/src/preact/mutationsOverTime/__mockData__/byWeek.ts +3883 -6606
  25. package/src/preact/mutationsOverTime/__mockData__/defaultMockData.ts +17624 -2203
  26. package/src/preact/mutationsOverTime/mutations-over-time-grid.tsx +1 -1
  27. package/src/preact/mutationsOverTime/mutations-over-time.tsx +1 -1
  28. package/src/preact/shared/charts/colors.ts +1 -1
  29. package/src/query/queryAggregateData.spec.ts +16 -109
  30. package/src/query/queryAggregateData.ts +2 -12
  31. package/src/query/queryGeneralStatistics.ts +2 -2
  32. package/src/query/queryMutationsOverTime.spec.ts +144 -4
  33. package/src/query/queryMutationsOverTime.ts +17 -1
  34. package/src/web-components/visualization/gs-aggregate.stories.ts +90 -20
  35. package/src/web-components/visualization/gs-aggregate.tsx +20 -0
  36. package/src/web-components/visualization/gs-mutations.stories.ts +62 -4
  37. package/src/web-components/visualization/gs-mutations.tsx +44 -0
  38. package/standalone-bundle/assets/{mutationOverTimeWorker-x1ipPFL0.js.map → mutationOverTimeWorker-DEybsZ5r.js.map} +1 -1
  39. package/standalone-bundle/dashboard-components.js +4136 -3956
  40. package/standalone-bundle/dashboard-components.js.map +1 -1
  41. package/standalone-bundle/style.css +1 -1
@@ -22,6 +22,16 @@ import { TemplateResult } from 'lit-html';
22
22
  * along with the aggregated value and its proportion.
23
23
  * The proportion represents the ratio of the aggregated value to the total count of the data
24
24
  * (considering the applied filter).
25
+ *
26
+ * ### Bar Chart View
27
+ *
28
+ * In the bar chart view, the data is presented in vertical bars.
29
+ * The bar chart is supported when `fields` contains one or two entries.
30
+ * The first field will be used as the y-axis.
31
+ * If a second field is provided, it's values will be stacked along the x-axis for each key on the y-axis.
32
+ *
33
+ * The chart shows the bars with the highest aggregated `count`.
34
+ * The number of bars can be adjusted with the `maxNumberOfBars` property.
25
35
  */
26
36
  export declare class AggregateComponent extends PreactLitAdapterWithGridJsStyles {
27
37
  /**
@@ -72,12 +82,16 @@ export declare class AggregateComponent extends PreactLitAdapterWithGridJsStyles
72
82
  * Set to `false` to disable pagination. Set to `true` to enable pagination with a default limit (10).
73
83
  */
74
84
  pageSize: boolean | number;
85
+ /**
86
+ * The maximum number of bars to display in the bar chart view.
87
+ */
88
+ maxNumberOfBars: number;
75
89
  render(): JSX_2.Element;
76
90
  }
77
91
 
78
92
  declare type AggregateView = default_2.infer<typeof aggregateViewSchema>;
79
93
 
80
- declare const aggregateViewSchema: default_2.ZodLiteral<"table">;
94
+ declare const aggregateViewSchema: default_2.ZodUnion<[default_2.ZodLiteral<"table">, default_2.ZodLiteral<"bar">]>;
81
95
 
82
96
  /**
83
97
  * ## Context
@@ -467,6 +481,29 @@ export declare class MutationFilterComponent extends PreactLitAdapter {
467
481
  *
468
482
  * The proportion interval filter can be used to filter the displayed mutations on client side.
469
483
  *
484
+ * #### Jaccard Similarity
485
+ *
486
+ * If the `baselineLapisFilter` attribute is set,
487
+ * the [Jaccard similarity](https://en.wikipedia.org/wiki/Jaccard_index) is computed for each mutation.
488
+ * It is computed as `variantWithMutationCount / (variantCount + mutationCount - variantWithMutationCount)`,
489
+ * - `variantCount` is the number of sequences of the variant (i.e. the number of sequences that match the `lapisFilter`),
490
+ * - `mutationCount` is the number of sequences with the mutation
491
+ * (i.e. the number of sequences matching the `baselineLapisFilter` that have the mutation),
492
+ * - `variantWithMutationCount` is the number of sequences that belong to the variant and have the mutation
493
+ * (i.e. the `count` value that is shown in the table).
494
+ *
495
+ * Typically, this is useful when you query mutations of a certain "variant"
496
+ * (i.e. a certain lineage or a certain set of mutations).
497
+ * Then the `baselineLapisFilter` should be the `lapisFilter` but without the lineage or mutations.
498
+ *
499
+ * For example:
500
+ * You are interested in a certain lineage in a certain country: `lapisFilter={country: 'Switzerland', linage: 'XY.1.2.3'}`.
501
+ * Then the "baseline" should be the same filter but without the lineage: `baselineLapisFilter={country: 'Switzerland'}`.
502
+ *
503
+ * Computing the Jaccard similarity is not always meaningful, because you might not have a "variant"
504
+ * (e.g. when you only query for a certain country).
505
+ * In this case you can simply omit the `baselineLapisFilter`.
506
+ *
470
507
  * ### Grid View
471
508
  *
472
509
  * The grid view shows the proportion of each sequence symbol (nucleotide or amino acid) for each position that has a mutation.
@@ -487,6 +524,17 @@ export declare class MutationsComponent extends PreactLitAdapterWithGridJsStyles
487
524
  nucleotideInsertions?: string[];
488
525
  aminoAcidInsertions?: string[];
489
526
  };
527
+ /**
528
+ * LAPIS filter to select the mutation counts that are used to compute the Jaccard similarity.
529
+ * If not provided, the Jaccard similarity is not computed.
530
+ * For details, see the [Jaccard Similarity](#jaccard-similarity) section in the component description.
531
+ */
532
+ baselineLapisFilter: (Record<string, string | string[] | number | null | boolean | undefined> & {
533
+ nucleotideMutations?: string[];
534
+ aminoAcidMutations?: string[];
535
+ nucleotideInsertions?: string[];
536
+ aminoAcidInsertions?: string[];
537
+ }) | undefined;
490
538
  /**
491
539
  * The type of the sequence for which the mutations should be shown.
492
540
  */
@@ -1301,7 +1349,7 @@ declare global {
1301
1349
 
1302
1350
  declare global {
1303
1351
  interface HTMLElementTagNameMap {
1304
- 'gs-mutations-over-time': MutationsOverTimeComponent;
1352
+ 'gs-number-sequences-over-time': NumberSequencesOverTimeComponent;
1305
1353
  }
1306
1354
  }
1307
1355
 
@@ -1309,7 +1357,7 @@ declare global {
1309
1357
  declare global {
1310
1358
  namespace JSX {
1311
1359
  interface IntrinsicElements {
1312
- 'gs-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1360
+ 'gs-number-sequences-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1313
1361
  }
1314
1362
  }
1315
1363
  }
@@ -1317,7 +1365,7 @@ declare global {
1317
1365
 
1318
1366
  declare global {
1319
1367
  interface HTMLElementTagNameMap {
1320
- 'gs-number-sequences-over-time': NumberSequencesOverTimeComponent;
1368
+ 'gs-sequences-by-location': SequencesByLocationComponent;
1321
1369
  }
1322
1370
  }
1323
1371
 
@@ -1325,7 +1373,7 @@ declare global {
1325
1373
  declare global {
1326
1374
  namespace JSX {
1327
1375
  interface IntrinsicElements {
1328
- 'gs-number-sequences-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1376
+ 'gs-sequences-by-location': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1329
1377
  }
1330
1378
  }
1331
1379
  }
@@ -1333,7 +1381,7 @@ declare global {
1333
1381
 
1334
1382
  declare global {
1335
1383
  interface HTMLElementTagNameMap {
1336
- 'gs-sequences-by-location': SequencesByLocationComponent;
1384
+ 'gs-statistics': StatisticsComponent;
1337
1385
  }
1338
1386
  }
1339
1387
 
@@ -1341,7 +1389,7 @@ declare global {
1341
1389
  declare global {
1342
1390
  namespace JSX {
1343
1391
  interface IntrinsicElements {
1344
- 'gs-sequences-by-location': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1392
+ 'gs-statistics': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1345
1393
  }
1346
1394
  }
1347
1395
  }
@@ -1349,7 +1397,7 @@ declare global {
1349
1397
 
1350
1398
  declare global {
1351
1399
  interface HTMLElementTagNameMap {
1352
- 'gs-statistics': StatisticsComponent;
1400
+ 'gs-mutations-over-time': MutationsOverTimeComponent;
1353
1401
  }
1354
1402
  }
1355
1403
 
@@ -1357,7 +1405,7 @@ declare global {
1357
1405
  declare global {
1358
1406
  namespace JSX {
1359
1407
  interface IntrinsicElements {
1360
- 'gs-statistics': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1408
+ 'gs-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1361
1409
  }
1362
1410
  }
1363
1411
  }
@@ -1365,11 +1413,10 @@ declare global {
1365
1413
 
1366
1414
  declare global {
1367
1415
  interface HTMLElementTagNameMap {
1368
- 'gs-date-range-selector': DateRangeSelectorComponent;
1416
+ 'gs-text-input': TextInputComponent;
1369
1417
  }
1370
1418
  interface HTMLElementEventMap {
1371
- 'gs-date-range-filter-changed': CustomEvent<Record<string, string>>;
1372
- 'gs-date-range-option-changed': DateRangeOptionChangedEvent;
1419
+ 'gs-text-input-changed': CustomEvent<Record<string, string>>;
1373
1420
  }
1374
1421
  }
1375
1422
 
@@ -1377,7 +1424,7 @@ declare global {
1377
1424
  declare global {
1378
1425
  namespace JSX {
1379
1426
  interface IntrinsicElements {
1380
- 'gs-date-range-selector': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1427
+ 'gs-text-input': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1381
1428
  }
1382
1429
  }
1383
1430
  }
@@ -1385,10 +1432,11 @@ declare global {
1385
1432
 
1386
1433
  declare global {
1387
1434
  interface HTMLElementTagNameMap {
1388
- 'gs-location-filter': LocationFilterComponent;
1435
+ 'gs-date-range-selector': DateRangeSelectorComponent;
1389
1436
  }
1390
1437
  interface HTMLElementEventMap {
1391
- 'gs-location-changed': CustomEvent<Record<string, string>>;
1438
+ 'gs-date-range-filter-changed': CustomEvent<Record<string, string>>;
1439
+ 'gs-date-range-option-changed': DateRangeOptionChangedEvent;
1392
1440
  }
1393
1441
  }
1394
1442
 
@@ -1396,7 +1444,7 @@ declare global {
1396
1444
  declare global {
1397
1445
  namespace JSX {
1398
1446
  interface IntrinsicElements {
1399
- 'gs-location-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1447
+ 'gs-date-range-selector': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1400
1448
  }
1401
1449
  }
1402
1450
  }
@@ -1404,10 +1452,10 @@ declare global {
1404
1452
 
1405
1453
  declare global {
1406
1454
  interface HTMLElementTagNameMap {
1407
- 'gs-text-input': TextInputComponent;
1455
+ 'gs-location-filter': LocationFilterComponent;
1408
1456
  }
1409
1457
  interface HTMLElementEventMap {
1410
- 'gs-text-input-changed': CustomEvent<Record<string, string>>;
1458
+ 'gs-location-changed': CustomEvent<Record<string, string>>;
1411
1459
  }
1412
1460
  }
1413
1461
 
@@ -1415,7 +1463,7 @@ declare global {
1415
1463
  declare global {
1416
1464
  namespace JSX {
1417
1465
  interface IntrinsicElements {
1418
- 'gs-text-input': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1466
+ 'gs-location-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1419
1467
  }
1420
1468
  }
1421
1469
  }