@genspectrum/dashboard-components 0.11.6 → 0.12.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.
Files changed (43) hide show
  1. package/custom-elements.json +50 -15
  2. package/dist/{dateRangeOption-Bh2p78z0.js → LocationChangedEvent-CORvQvXv.js} +11 -1
  3. package/dist/LocationChangedEvent-CORvQvXv.js.map +1 -0
  4. package/dist/assets/{mutationOverTimeWorker-CWneD7i5.js.map → mutationOverTimeWorker-DTv93Ere.js.map} +1 -1
  5. package/dist/components.d.ts +79 -51
  6. package/dist/components.js +3951 -621
  7. package/dist/components.js.map +1 -1
  8. package/dist/style.css +151 -4
  9. package/dist/util.d.ts +78 -44
  10. package/dist/util.js +2 -1
  11. package/package.json +2 -1
  12. package/src/preact/components/csv-download-button.tsx +2 -2
  13. package/src/preact/downshift_types.d.ts +3 -0
  14. package/src/preact/locationFilter/LocationChangedEvent.ts +11 -0
  15. package/src/preact/locationFilter/fetchAutocompletionList.spec.ts +5 -5
  16. package/src/preact/locationFilter/fetchAutocompletionList.ts +9 -2
  17. package/src/preact/locationFilter/location-filter.stories.tsx +94 -10
  18. package/src/preact/locationFilter/location-filter.tsx +183 -62
  19. package/src/preact/mutationFilter/mutation-filter-info.tsx +73 -10
  20. package/src/preact/mutations/__mockData__/baselineNucleotideMutations.json +337412 -0
  21. package/src/preact/mutations/__mockData__/overallVariantCount.json +14 -0
  22. package/src/preact/mutations/getMutationsTableData.spec.ts +20 -3
  23. package/src/preact/mutations/getMutationsTableData.ts +37 -2
  24. package/src/preact/mutations/mutations-table.tsx +47 -27
  25. package/src/preact/mutations/mutations.stories.tsx +41 -9
  26. package/src/preact/mutations/mutations.tsx +22 -6
  27. package/src/preact/mutations/queryMutations.ts +28 -8
  28. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutationsByDay.ts +11077 -3062
  29. package/src/preact/mutationsOverTime/__mockData__/byWeek.ts +3883 -6606
  30. package/src/preact/mutationsOverTime/__mockData__/defaultMockData.ts +17624 -2203
  31. package/src/preact/mutationsOverTime/mutations-over-time.tsx +1 -1
  32. package/src/query/queryMutationsOverTime.spec.ts +144 -4
  33. package/src/query/queryMutationsOverTime.ts +17 -1
  34. package/src/utilEntrypoint.ts +2 -0
  35. package/src/web-components/input/gs-location-filter.stories.ts +34 -29
  36. package/src/web-components/input/gs-location-filter.tsx +6 -13
  37. package/src/web-components/visualization/gs-mutations.stories.ts +62 -4
  38. package/src/web-components/visualization/gs-mutations.tsx +44 -0
  39. package/standalone-bundle/assets/{mutationOverTimeWorker-x1ipPFL0.js.map → mutationOverTimeWorker-DEybsZ5r.js.map} +1 -1
  40. package/standalone-bundle/dashboard-components.js +11021 -8621
  41. package/standalone-bundle/dashboard-components.js.map +1 -1
  42. package/standalone-bundle/style.css +1 -1
  43. package/dist/dateRangeOption-Bh2p78z0.js.map +0 -1
@@ -278,11 +278,6 @@ export declare class LineageFilterComponent extends PreactLitAdapter {
278
278
  * The component retrieves a list of all possible values for these fields from the Lapis instance.
279
279
  * This list is then utilized to display autocomplete suggestions and to validate the input.
280
280
  *
281
- * Given `fields` are `['field1', 'field2', ..., 'fieldN']`,
282
- * then valid values for the location filter must be in the form `valueForField1 / valueForField2 / ... / valueForFieldK`,
283
- * where `1 <= K <= N`.
284
- * Values for the fields `i > K` are considered `undefined`.
285
- *
286
281
  * @fires {CustomEvent<Record<string, string>>} gs-location-changed
287
282
  * Fired when a value from the datalist is selected or when a valid value is typed into the field.
288
283
  * The `details` of this event contain an object with all `fields` as keys
@@ -300,9 +295,8 @@ export declare class LineageFilterComponent extends PreactLitAdapter {
300
295
  export declare class LocationFilterComponent extends PreactLitAdapter {
301
296
  /**
302
297
  * The initial value to use for this location filter.
303
- * Must be of the form `valueForField1 / valueForField2 / ... / valueForFieldN`.
304
298
  */
305
- initialValue: string | undefined;
299
+ value: Record<string, string | null | undefined> | undefined;
306
300
  /**
307
301
  * Required.
308
302
  *
@@ -481,6 +475,29 @@ export declare class MutationFilterComponent extends PreactLitAdapter {
481
475
  *
482
476
  * The proportion interval filter can be used to filter the displayed mutations on client side.
483
477
  *
478
+ * #### Jaccard Similarity
479
+ *
480
+ * If the `baselineLapisFilter` attribute is set,
481
+ * the [Jaccard similarity](https://en.wikipedia.org/wiki/Jaccard_index) is computed for each mutation.
482
+ * It is computed as `variantWithMutationCount / (variantCount + mutationCount - variantWithMutationCount)`,
483
+ * - `variantCount` is the number of sequences of the variant (i.e. the number of sequences that match the `lapisFilter`),
484
+ * - `mutationCount` is the number of sequences with the mutation
485
+ * (i.e. the number of sequences matching the `baselineLapisFilter` that have the mutation),
486
+ * - `variantWithMutationCount` is the number of sequences that belong to the variant and have the mutation
487
+ * (i.e. the `count` value that is shown in the table).
488
+ *
489
+ * Typically, this is useful when you query mutations of a certain "variant"
490
+ * (i.e. a certain lineage or a certain set of mutations).
491
+ * Then the `baselineLapisFilter` should be the `lapisFilter` but without the lineage or mutations.
492
+ *
493
+ * For example:
494
+ * You are interested in a certain lineage in a certain country: `lapisFilter={country: 'Switzerland', linage: 'XY.1.2.3'}`.
495
+ * Then the "baseline" should be the same filter but without the lineage: `baselineLapisFilter={country: 'Switzerland'}`.
496
+ *
497
+ * Computing the Jaccard similarity is not always meaningful, because you might not have a "variant"
498
+ * (e.g. when you only query for a certain country).
499
+ * In this case you can simply omit the `baselineLapisFilter`.
500
+ *
484
501
  * ### Grid View
485
502
  *
486
503
  * The grid view shows the proportion of each sequence symbol (nucleotide or amino acid) for each position that has a mutation.
@@ -501,6 +518,17 @@ export declare class MutationsComponent extends PreactLitAdapterWithGridJsStyles
501
518
  nucleotideInsertions?: string[];
502
519
  aminoAcidInsertions?: string[];
503
520
  };
521
+ /**
522
+ * LAPIS filter to select the mutation counts that are used to compute the Jaccard similarity.
523
+ * If not provided, the Jaccard similarity is not computed.
524
+ * For details, see the [Jaccard Similarity](#jaccard-similarity) section in the component description.
525
+ */
526
+ baselineLapisFilter: (Record<string, string | string[] | number | null | boolean | undefined> & {
527
+ nucleotideMutations?: string[];
528
+ aminoAcidMutations?: string[];
529
+ nucleotideInsertions?: string[];
530
+ aminoAcidInsertions?: string[];
531
+ }) | undefined;
504
532
  /**
505
533
  * The type of the sequence for which the mutations should be shown.
506
534
  */
@@ -1235,7 +1263,10 @@ declare global {
1235
1263
 
1236
1264
  declare global {
1237
1265
  interface HTMLElementTagNameMap {
1238
- 'gs-mutation-comparison-component': MutationComparisonComponent;
1266
+ 'gs-location-filter': LocationFilterComponent;
1267
+ }
1268
+ interface HTMLElementEventMap {
1269
+ 'gs-location-changed': LocationChangedEvent;
1239
1270
  }
1240
1271
  }
1241
1272
 
@@ -1243,7 +1274,7 @@ declare global {
1243
1274
  declare global {
1244
1275
  namespace JSX {
1245
1276
  interface IntrinsicElements {
1246
- 'gs-mutation-comparison-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1277
+ 'gs-location-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1247
1278
  }
1248
1279
  }
1249
1280
  }
@@ -1251,7 +1282,11 @@ declare global {
1251
1282
 
1252
1283
  declare global {
1253
1284
  interface HTMLElementTagNameMap {
1254
- 'gs-mutations-component': MutationsComponent;
1285
+ 'gs-date-range-selector': DateRangeSelectorComponent;
1286
+ }
1287
+ interface HTMLElementEventMap {
1288
+ 'gs-date-range-filter-changed': CustomEvent<Record<string, string>>;
1289
+ 'gs-date-range-option-changed': DateRangeOptionChangedEvent;
1255
1290
  }
1256
1291
  }
1257
1292
 
@@ -1259,7 +1294,7 @@ declare global {
1259
1294
  declare global {
1260
1295
  namespace JSX {
1261
1296
  interface IntrinsicElements {
1262
- 'gs-mutations-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1297
+ 'gs-date-range-selector': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1263
1298
  }
1264
1299
  }
1265
1300
  }
@@ -1267,7 +1302,10 @@ declare global {
1267
1302
 
1268
1303
  declare global {
1269
1304
  interface HTMLElementTagNameMap {
1270
- 'gs-prevalence-over-time': PrevalenceOverTimeComponent;
1305
+ 'gs-text-input': TextInputComponent;
1306
+ }
1307
+ interface HTMLElementEventMap {
1308
+ 'gs-text-input-changed': CustomEvent<Record<string, string>>;
1271
1309
  }
1272
1310
  }
1273
1311
 
@@ -1275,7 +1313,7 @@ declare global {
1275
1313
  declare global {
1276
1314
  namespace JSX {
1277
1315
  interface IntrinsicElements {
1278
- 'gs-prevalence-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1316
+ 'gs-text-input': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1279
1317
  }
1280
1318
  }
1281
1319
  }
@@ -1283,7 +1321,10 @@ declare global {
1283
1321
 
1284
1322
  declare global {
1285
1323
  interface HTMLElementTagNameMap {
1286
- 'gs-relative-growth-advantage': RelativeGrowthAdvantageComponent;
1324
+ 'gs-mutation-filter': MutationFilterComponent;
1325
+ }
1326
+ interface HTMLElementEventMap {
1327
+ 'gs-mutation-filter-changed': CustomEvent<MutationsFilter>;
1287
1328
  }
1288
1329
  }
1289
1330
 
@@ -1291,7 +1332,7 @@ declare global {
1291
1332
  declare global {
1292
1333
  namespace JSX {
1293
1334
  interface IntrinsicElements {
1294
- 'gs-relative-growth-advantage': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1335
+ 'gs-mutation-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1295
1336
  }
1296
1337
  }
1297
1338
  }
@@ -1299,7 +1340,10 @@ declare global {
1299
1340
 
1300
1341
  declare global {
1301
1342
  interface HTMLElementTagNameMap {
1302
- 'gs-aggregate': AggregateComponent;
1343
+ 'gs-lineage-filter': LineageFilterComponent;
1344
+ }
1345
+ interface HTMLElementEventMap {
1346
+ 'gs-lineage-filter-changed': CustomEvent<Record<string, string>>;
1303
1347
  }
1304
1348
  }
1305
1349
 
@@ -1307,7 +1351,7 @@ declare global {
1307
1351
  declare global {
1308
1352
  namespace JSX {
1309
1353
  interface IntrinsicElements {
1310
- 'gs-aggregate': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1354
+ 'gs-lineage-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1311
1355
  }
1312
1356
  }
1313
1357
  }
@@ -1315,7 +1359,7 @@ declare global {
1315
1359
 
1316
1360
  declare global {
1317
1361
  interface HTMLElementTagNameMap {
1318
- 'gs-number-sequences-over-time': NumberSequencesOverTimeComponent;
1362
+ 'gs-mutation-comparison-component': MutationComparisonComponent;
1319
1363
  }
1320
1364
  }
1321
1365
 
@@ -1323,7 +1367,7 @@ declare global {
1323
1367
  declare global {
1324
1368
  namespace JSX {
1325
1369
  interface IntrinsicElements {
1326
- 'gs-number-sequences-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1370
+ 'gs-mutation-comparison-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1327
1371
  }
1328
1372
  }
1329
1373
  }
@@ -1331,7 +1375,7 @@ declare global {
1331
1375
 
1332
1376
  declare global {
1333
1377
  interface HTMLElementTagNameMap {
1334
- 'gs-mutations-over-time': MutationsOverTimeComponent;
1378
+ 'gs-mutations-component': MutationsComponent;
1335
1379
  }
1336
1380
  }
1337
1381
 
@@ -1339,7 +1383,7 @@ declare global {
1339
1383
  declare global {
1340
1384
  namespace JSX {
1341
1385
  interface IntrinsicElements {
1342
- 'gs-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1386
+ 'gs-mutations-component': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1343
1387
  }
1344
1388
  }
1345
1389
  }
@@ -1347,7 +1391,7 @@ declare global {
1347
1391
 
1348
1392
  declare global {
1349
1393
  interface HTMLElementTagNameMap {
1350
- 'gs-sequences-by-location': SequencesByLocationComponent;
1394
+ 'gs-prevalence-over-time': PrevalenceOverTimeComponent;
1351
1395
  }
1352
1396
  }
1353
1397
 
@@ -1355,7 +1399,7 @@ declare global {
1355
1399
  declare global {
1356
1400
  namespace JSX {
1357
1401
  interface IntrinsicElements {
1358
- 'gs-sequences-by-location': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1402
+ 'gs-prevalence-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1359
1403
  }
1360
1404
  }
1361
1405
  }
@@ -1363,7 +1407,7 @@ declare global {
1363
1407
 
1364
1408
  declare global {
1365
1409
  interface HTMLElementTagNameMap {
1366
- 'gs-statistics': StatisticsComponent;
1410
+ 'gs-relative-growth-advantage': RelativeGrowthAdvantageComponent;
1367
1411
  }
1368
1412
  }
1369
1413
 
@@ -1371,7 +1415,7 @@ declare global {
1371
1415
  declare global {
1372
1416
  namespace JSX {
1373
1417
  interface IntrinsicElements {
1374
- 'gs-statistics': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1418
+ 'gs-relative-growth-advantage': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1375
1419
  }
1376
1420
  }
1377
1421
  }
@@ -1379,11 +1423,7 @@ declare global {
1379
1423
 
1380
1424
  declare global {
1381
1425
  interface HTMLElementTagNameMap {
1382
- 'gs-date-range-selector': DateRangeSelectorComponent;
1383
- }
1384
- interface HTMLElementEventMap {
1385
- 'gs-date-range-filter-changed': CustomEvent<Record<string, string>>;
1386
- 'gs-date-range-option-changed': DateRangeOptionChangedEvent;
1426
+ 'gs-aggregate': AggregateComponent;
1387
1427
  }
1388
1428
  }
1389
1429
 
@@ -1391,7 +1431,7 @@ declare global {
1391
1431
  declare global {
1392
1432
  namespace JSX {
1393
1433
  interface IntrinsicElements {
1394
- 'gs-date-range-selector': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1434
+ 'gs-aggregate': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1395
1435
  }
1396
1436
  }
1397
1437
  }
@@ -1399,10 +1439,7 @@ declare global {
1399
1439
 
1400
1440
  declare global {
1401
1441
  interface HTMLElementTagNameMap {
1402
- 'gs-location-filter': LocationFilterComponent;
1403
- }
1404
- interface HTMLElementEventMap {
1405
- 'gs-location-changed': CustomEvent<Record<string, string>>;
1442
+ 'gs-number-sequences-over-time': NumberSequencesOverTimeComponent;
1406
1443
  }
1407
1444
  }
1408
1445
 
@@ -1410,7 +1447,7 @@ declare global {
1410
1447
  declare global {
1411
1448
  namespace JSX {
1412
1449
  interface IntrinsicElements {
1413
- 'gs-location-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1450
+ 'gs-number-sequences-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1414
1451
  }
1415
1452
  }
1416
1453
  }
@@ -1418,10 +1455,7 @@ declare global {
1418
1455
 
1419
1456
  declare global {
1420
1457
  interface HTMLElementTagNameMap {
1421
- 'gs-text-input': TextInputComponent;
1422
- }
1423
- interface HTMLElementEventMap {
1424
- 'gs-text-input-changed': CustomEvent<Record<string, string>>;
1458
+ 'gs-mutations-over-time': MutationsOverTimeComponent;
1425
1459
  }
1426
1460
  }
1427
1461
 
@@ -1429,7 +1463,7 @@ declare global {
1429
1463
  declare global {
1430
1464
  namespace JSX {
1431
1465
  interface IntrinsicElements {
1432
- 'gs-text-input': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1466
+ 'gs-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1433
1467
  }
1434
1468
  }
1435
1469
  }
@@ -1437,10 +1471,7 @@ declare global {
1437
1471
 
1438
1472
  declare global {
1439
1473
  interface HTMLElementTagNameMap {
1440
- 'gs-mutation-filter': MutationFilterComponent;
1441
- }
1442
- interface HTMLElementEventMap {
1443
- 'gs-mutation-filter-changed': CustomEvent<MutationsFilter>;
1474
+ 'gs-sequences-by-location': SequencesByLocationComponent;
1444
1475
  }
1445
1476
  }
1446
1477
 
@@ -1448,7 +1479,7 @@ declare global {
1448
1479
  declare global {
1449
1480
  namespace JSX {
1450
1481
  interface IntrinsicElements {
1451
- 'gs-mutation-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1482
+ 'gs-sequences-by-location': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1452
1483
  }
1453
1484
  }
1454
1485
  }
@@ -1456,10 +1487,7 @@ declare global {
1456
1487
 
1457
1488
  declare global {
1458
1489
  interface HTMLElementTagNameMap {
1459
- 'gs-lineage-filter': LineageFilterComponent;
1460
- }
1461
- interface HTMLElementEventMap {
1462
- 'gs-lineage-filter-changed': CustomEvent<Record<string, string>>;
1490
+ 'gs-statistics': StatisticsComponent;
1463
1491
  }
1464
1492
  }
1465
1493
 
@@ -1467,7 +1495,7 @@ declare global {
1467
1495
  declare global {
1468
1496
  namespace JSX {
1469
1497
  interface IntrinsicElements {
1470
- 'gs-lineage-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1498
+ 'gs-statistics': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1471
1499
  }
1472
1500
  }
1473
1501
  }