@genspectrum/dashboard-components 0.11.6 → 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 (26) hide show
  1. package/custom-elements.json +38 -3
  2. package/dist/assets/{mutationOverTimeWorker-CWneD7i5.js.map → mutationOverTimeWorker-DTv93Ere.js.map} +1 -1
  3. package/dist/components.d.ts +50 -16
  4. package/dist/components.js +129 -66
  5. package/dist/components.js.map +1 -1
  6. package/dist/util.d.ts +44 -16
  7. package/package.json +1 -1
  8. package/src/preact/mutations/__mockData__/baselineNucleotideMutations.json +337412 -0
  9. package/src/preact/mutations/__mockData__/overallVariantCount.json +14 -0
  10. package/src/preact/mutations/getMutationsTableData.spec.ts +20 -3
  11. package/src/preact/mutations/getMutationsTableData.ts +37 -2
  12. package/src/preact/mutations/mutations-table.tsx +47 -27
  13. package/src/preact/mutations/mutations.stories.tsx +41 -9
  14. package/src/preact/mutations/mutations.tsx +22 -6
  15. package/src/preact/mutations/queryMutations.ts +28 -8
  16. package/src/preact/mutationsOverTime/__mockData__/aminoAcidMutationsByDay.ts +11077 -3062
  17. package/src/preact/mutationsOverTime/__mockData__/byWeek.ts +3883 -6606
  18. package/src/preact/mutationsOverTime/__mockData__/defaultMockData.ts +17624 -2203
  19. package/src/preact/mutationsOverTime/mutations-over-time.tsx +1 -1
  20. package/src/query/queryMutationsOverTime.spec.ts +144 -4
  21. package/src/query/queryMutationsOverTime.ts +17 -1
  22. package/src/web-components/visualization/gs-mutations.stories.ts +62 -4
  23. package/src/web-components/visualization/gs-mutations.tsx +44 -0
  24. package/standalone-bundle/assets/{mutationOverTimeWorker-x1ipPFL0.js.map → mutationOverTimeWorker-DEybsZ5r.js.map} +1 -1
  25. package/standalone-bundle/dashboard-components.js +2515 -2464
  26. package/standalone-bundle/dashboard-components.js.map +1 -1
@@ -481,6 +481,29 @@ export declare class MutationFilterComponent extends PreactLitAdapter {
481
481
  *
482
482
  * The proportion interval filter can be used to filter the displayed mutations on client side.
483
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
+ *
484
507
  * ### Grid View
485
508
  *
486
509
  * The grid view shows the proportion of each sequence symbol (nucleotide or amino acid) for each position that has a mutation.
@@ -501,6 +524,17 @@ export declare class MutationsComponent extends PreactLitAdapterWithGridJsStyles
501
524
  nucleotideInsertions?: string[];
502
525
  aminoAcidInsertions?: string[];
503
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;
504
538
  /**
505
539
  * The type of the sequence for which the mutations should be shown.
506
540
  */
@@ -1331,7 +1365,7 @@ declare global {
1331
1365
 
1332
1366
  declare global {
1333
1367
  interface HTMLElementTagNameMap {
1334
- 'gs-mutations-over-time': MutationsOverTimeComponent;
1368
+ 'gs-sequences-by-location': SequencesByLocationComponent;
1335
1369
  }
1336
1370
  }
1337
1371
 
@@ -1339,7 +1373,7 @@ declare global {
1339
1373
  declare global {
1340
1374
  namespace JSX {
1341
1375
  interface IntrinsicElements {
1342
- 'gs-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1376
+ 'gs-sequences-by-location': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1343
1377
  }
1344
1378
  }
1345
1379
  }
@@ -1347,7 +1381,7 @@ declare global {
1347
1381
 
1348
1382
  declare global {
1349
1383
  interface HTMLElementTagNameMap {
1350
- 'gs-sequences-by-location': SequencesByLocationComponent;
1384
+ 'gs-statistics': StatisticsComponent;
1351
1385
  }
1352
1386
  }
1353
1387
 
@@ -1355,7 +1389,7 @@ declare global {
1355
1389
  declare global {
1356
1390
  namespace JSX {
1357
1391
  interface IntrinsicElements {
1358
- 'gs-sequences-by-location': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1392
+ 'gs-statistics': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1359
1393
  }
1360
1394
  }
1361
1395
  }
@@ -1363,7 +1397,7 @@ declare global {
1363
1397
 
1364
1398
  declare global {
1365
1399
  interface HTMLElementTagNameMap {
1366
- 'gs-statistics': StatisticsComponent;
1400
+ 'gs-mutations-over-time': MutationsOverTimeComponent;
1367
1401
  }
1368
1402
  }
1369
1403
 
@@ -1371,7 +1405,7 @@ declare global {
1371
1405
  declare global {
1372
1406
  namespace JSX {
1373
1407
  interface IntrinsicElements {
1374
- 'gs-statistics': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1408
+ 'gs-mutations-over-time': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1375
1409
  }
1376
1410
  }
1377
1411
  }
@@ -1379,11 +1413,10 @@ declare global {
1379
1413
 
1380
1414
  declare global {
1381
1415
  interface HTMLElementTagNameMap {
1382
- 'gs-date-range-selector': DateRangeSelectorComponent;
1416
+ 'gs-text-input': TextInputComponent;
1383
1417
  }
1384
1418
  interface HTMLElementEventMap {
1385
- 'gs-date-range-filter-changed': CustomEvent<Record<string, string>>;
1386
- 'gs-date-range-option-changed': DateRangeOptionChangedEvent;
1419
+ 'gs-text-input-changed': CustomEvent<Record<string, string>>;
1387
1420
  }
1388
1421
  }
1389
1422
 
@@ -1391,7 +1424,7 @@ declare global {
1391
1424
  declare global {
1392
1425
  namespace JSX {
1393
1426
  interface IntrinsicElements {
1394
- 'gs-date-range-selector': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1427
+ 'gs-text-input': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1395
1428
  }
1396
1429
  }
1397
1430
  }
@@ -1399,10 +1432,11 @@ declare global {
1399
1432
 
1400
1433
  declare global {
1401
1434
  interface HTMLElementTagNameMap {
1402
- 'gs-location-filter': LocationFilterComponent;
1435
+ 'gs-date-range-selector': DateRangeSelectorComponent;
1403
1436
  }
1404
1437
  interface HTMLElementEventMap {
1405
- 'gs-location-changed': CustomEvent<Record<string, string>>;
1438
+ 'gs-date-range-filter-changed': CustomEvent<Record<string, string>>;
1439
+ 'gs-date-range-option-changed': DateRangeOptionChangedEvent;
1406
1440
  }
1407
1441
  }
1408
1442
 
@@ -1410,7 +1444,7 @@ declare global {
1410
1444
  declare global {
1411
1445
  namespace JSX {
1412
1446
  interface IntrinsicElements {
1413
- 'gs-location-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1447
+ 'gs-date-range-selector': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1414
1448
  }
1415
1449
  }
1416
1450
  }
@@ -1418,10 +1452,10 @@ declare global {
1418
1452
 
1419
1453
  declare global {
1420
1454
  interface HTMLElementTagNameMap {
1421
- 'gs-text-input': TextInputComponent;
1455
+ 'gs-location-filter': LocationFilterComponent;
1422
1456
  }
1423
1457
  interface HTMLElementEventMap {
1424
- 'gs-text-input-changed': CustomEvent<Record<string, string>>;
1458
+ 'gs-location-changed': CustomEvent<Record<string, string>>;
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-location-filter': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
1433
1467
  }
1434
1468
  }
1435
1469
  }