@genspectrum/dashboard-components 0.1.3 → 0.1.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.
Files changed (78) hide show
  1. package/custom-elements.json +488 -117
  2. package/dist/dashboard-components.js +904 -466
  3. package/dist/dashboard-components.js.map +1 -1
  4. package/dist/genspectrum-components.d.ts +473 -67
  5. package/dist/style.css +273 -153
  6. package/package.json +11 -7
  7. package/src/preact/aggregatedData/aggregate.stories.tsx +7 -5
  8. package/src/preact/aggregatedData/aggregate.tsx +16 -7
  9. package/src/preact/components/ReferenceGenomesAwaiter.tsx +25 -0
  10. package/src/preact/components/csv-download-button.tsx +8 -2
  11. package/src/preact/components/headline.stories.tsx +19 -1
  12. package/src/preact/components/headline.tsx +25 -5
  13. package/src/preact/components/info.stories.tsx +24 -3
  14. package/src/preact/components/info.tsx +49 -5
  15. package/src/preact/components/min-max-range-slider.tsx +4 -4
  16. package/src/preact/components/percent-intput.tsx +2 -3
  17. package/src/preact/components/resize-container.tsx +23 -0
  18. package/src/preact/components/table.tsx +1 -0
  19. package/src/preact/components/tabs.stories.tsx +2 -2
  20. package/src/preact/components/tabs.tsx +47 -24
  21. package/src/preact/dateRangeSelector/date-range-selector.stories.tsx +36 -4
  22. package/src/preact/dateRangeSelector/date-range-selector.tsx +67 -53
  23. package/src/preact/locationFilter/location-filter.tsx +2 -2
  24. package/src/preact/mutationComparison/getMutationComparisonTableData.spec.ts +5 -5
  25. package/src/preact/mutationComparison/getMutationComparisonTableData.ts +45 -10
  26. package/src/preact/mutationComparison/mutation-comparison-table.tsx +20 -22
  27. package/src/preact/mutationComparison/mutation-comparison-venn.tsx +6 -3
  28. package/src/preact/mutationComparison/mutation-comparison.stories.tsx +11 -1
  29. package/src/preact/mutationComparison/mutation-comparison.tsx +16 -7
  30. package/src/preact/mutationFilter/mutation-filter.stories.tsx +70 -31
  31. package/src/preact/mutationFilter/mutation-filter.tsx +62 -14
  32. package/src/preact/mutations/getInsertionsTableData.spec.ts +6 -4
  33. package/src/preact/mutations/getInsertionsTableData.ts +1 -1
  34. package/src/preact/mutations/getMutationsTableData.spec.ts +9 -19
  35. package/src/preact/mutations/getMutationsTableData.ts +1 -1
  36. package/src/preact/mutations/mutations-insertions-table.tsx +3 -1
  37. package/src/preact/mutations/mutations-table.tsx +3 -1
  38. package/src/preact/mutations/mutations.stories.tsx +11 -1
  39. package/src/preact/mutations/mutations.tsx +24 -7
  40. package/src/preact/prevalenceOverTime/prevalence-over-time-bar-chart.tsx +1 -0
  41. package/src/preact/prevalenceOverTime/prevalence-over-time-bubble-chart.tsx +1 -0
  42. package/src/preact/prevalenceOverTime/prevalence-over-time-line-chart.tsx +1 -0
  43. package/src/preact/prevalenceOverTime/prevalence-over-time.stories.tsx +8 -0
  44. package/src/preact/prevalenceOverTime/prevalence-over-time.tsx +31 -13
  45. package/src/preact/relativeGrowthAdvantage/relative-growth-advantage-chart.tsx +8 -5
  46. package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.stories.tsx +15 -0
  47. package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.tsx +62 -12
  48. package/src/preact/shared/sort/sortInsertions.spec.ts +11 -10
  49. package/src/preact/shared/sort/sortInsertions.ts +10 -17
  50. package/src/preact/shared/sort/sortSubstitutionsAndDeletions.spec.ts +19 -10
  51. package/src/preact/shared/sort/sortSubstitutionsAndDeletions.ts +45 -12
  52. package/src/preact/textInput/text-input.stories.tsx +22 -1
  53. package/src/preact/textInput/text-input.tsx +3 -1
  54. package/src/utils/typeAssertions.spec.ts +31 -0
  55. package/src/utils/typeAssertions.ts +16 -0
  56. package/src/web-components/PreactLitAdapter.tsx +0 -1
  57. package/src/web-components/app.stories.ts +129 -0
  58. package/src/web-components/app.ts +27 -6
  59. package/src/web-components/display/aggregate-component.stories.ts +24 -11
  60. package/src/web-components/display/aggregate-component.tsx +26 -5
  61. package/src/web-components/display/mutation-comparison-component.stories.ts +32 -11
  62. package/src/web-components/display/mutation-comparison-component.tsx +79 -4
  63. package/src/web-components/display/mutations-component.stories.ts +40 -19
  64. package/src/web-components/display/mutations-component.tsx +71 -4
  65. package/src/web-components/display/prevalence-over-time-component.stories.ts +44 -18
  66. package/src/web-components/display/prevalence-over-time-component.tsx +105 -5
  67. package/src/web-components/display/relative-growth-advantage-component.stories.ts +32 -10
  68. package/src/web-components/display/relative-growth-advantage-component.tsx +66 -3
  69. package/src/web-components/input/date-range-selector-component.stories.ts +51 -9
  70. package/src/web-components/input/date-range-selector-component.tsx +69 -4
  71. package/src/web-components/input/location-filter-component.stories.ts +15 -4
  72. package/src/web-components/input/location-filter-component.tsx +2 -6
  73. package/src/web-components/input/mutation-filter-component.stories.ts +33 -12
  74. package/src/web-components/input/mutation-filter-component.tsx +60 -4
  75. package/src/web-components/input/text-input-component.stories.ts +26 -6
  76. package/src/web-components/input/text-input-component.tsx +34 -3
  77. package/src/web-components/display/aggregate-component.mdx +0 -25
  78. package/src/web-components/input/location-filter.mdx +0 -25
@@ -8,10 +8,6 @@ import { ReactiveElement } from '@lit/reactive-element';
8
8
  import { TemplateResult } from 'lit-html';
9
9
 
10
10
  /**
11
- * ## Tag
12
- *
13
- * `gs-aggregate-component`
14
- *
15
11
  * ## Context
16
12
  *
17
13
  * This component displays aggregated data, which can provide an overview of the underlying data.
@@ -30,46 +26,127 @@ export declare class AggregateComponent extends PreactLitAdapterWithGridJsStyles
30
26
  * The proportion represents the ratio of the aggregated value to the total count of the data
31
27
  * (considering the applied filter).
32
28
  */
33
- views: View_5[];
29
+ views: View[];
34
30
  /**
35
31
  * The filter to apply to the data.
36
32
  */
37
33
  filter: LapisFilter;
34
+ /**
35
+ * The size of the component.
36
+ *
37
+ * If not set, the component will take the full width of its container with height 700px.
38
+ *
39
+ * The width and height should be a string with a unit in css style, e.g. '100%', '500px' or '50vh'.
40
+ * If the unit is %, the size will be relative to the container of the component.
41
+ */
42
+ size: {
43
+ width?: string;
44
+ height?: string;
45
+ } | undefined;
46
+ /**
47
+ * The headline of the component. Set to an empty string to hide the headline.
48
+ */
49
+ headline: string | undefined;
38
50
  render(): JSX_2.Element;
39
51
  }
40
52
 
53
+ /**
54
+ * ## Context
55
+ *
56
+ * This component provides the main application context.
57
+ * All other `gs-*` components must be (possibly nested) children of this component.
58
+ * It makes use of the [Lit Context](https://lit.dev/docs/data/context/) to
59
+ * - provide the URL to the LAPIS instance to all its children
60
+ * - fetch the reference genomes from LAPIS and provide it to all its children
61
+ *
62
+ * This will show an error message if the reference genome cannot be fetched
63
+ * (e.g., due to an invalid LAPIS URL).
64
+ *
65
+ * ## Shadow DOM
66
+ *
67
+ * This component does __not__ use a shadow DOM. Children of this component will be rendered directly in the light DOM.
68
+ */
41
69
  export declare class App extends LitElement {
70
+ /**
71
+ * The URL of the LAPIS instance that all children of this component will use.
72
+ */
42
73
  lapis: string;
43
- referenceGenome: ReferenceGenome;
44
- private updateReferenceGenome;
74
+ /* Excluded from this release type: referenceGenome */
75
+ /* Excluded from this release type: updateReferenceGenome */
45
76
  render(): TemplateResult<1> | undefined;
46
77
  createRenderRoot(): this;
47
78
  }
48
79
 
49
- declare type ConfidenceIntervalMethod = 'wilson' | 'none';
50
-
51
- declare type CustomSelectOption = {
52
- label: string;
53
- dateFrom: string;
54
- dateTo: string;
55
- };
56
-
57
80
  /**
58
- * @fires {CustomEvent<{ dateFrom: string; dateTo: string; }>} gs-date-range-changed - When the date range has changed
81
+ * ## Context
82
+ * This component is a group of input fields designed to specify a date range. It consists of 3 fields:
83
+ *
84
+ * - a select field to choose a predefined date range,
85
+ * - an input field with an attached date picker for the start date,
86
+ * - an input field with an attached date picker for the end date.
87
+ *
88
+ * Setting a value in the select field will overwrite the previous values of the start and end date.
89
+ * Setting a value in either of the date pickers will set the select field to "custom",
90
+ * which represents an arbitrary date range.
91
+ *
92
+ * @fires {CustomEvent<{ dateFrom: string; dateTo: string; }>} gs-date-range-changed
93
+ * Fired when:
94
+ * - The select field is changed,
95
+ * - A date is selected in either of the date pickers,
96
+ * - A date was typed into either of the date input fields, and the input field loses focus ("on blur").
97
+ * Contains the dates in the format `YYYY-MM-DD`.
59
98
  */
60
99
  export declare class DateRangeSelectorComponent extends PreactLitAdapter {
61
- customSelectOptions: CustomSelectOption[];
100
+ /**
101
+ * An array of custom options that the select field should provide,
102
+ * in addition to the predefined options.
103
+ * The `label` will be shown to the user, and it will be available as `initialValue`.
104
+ * The dates must be in the format `YYYY-MM-DD`.
105
+ */
106
+ customSelectOptions: {
107
+ label: string;
108
+ dateFrom: string;
109
+ dateTo: string;
110
+ }[];
111
+ /**
112
+ * The `dateFrom` value to use in the `allTimes` preset in the format `YYYY-MM-DD`.
113
+ */
62
114
  earliestDate: string | undefined;
115
+ /**
116
+ * The initial value to use for this date range selector.
117
+ * Must be a valid label from the preset labels or a `label` given in the `customSelectOptions`.
118
+ *
119
+ * If the value is invalid, the component will default to `'last6Months'`.
120
+ */
121
+ initialValue: 'custom' | 'allTimes' | 'last2Weeks' | 'lastMonth' | 'last2Months' | 'last3Months' | 'last6Months' | string | undefined;
63
122
  render(): JSX_2.Element;
64
123
  }
65
124
 
125
+ declare class Deletion implements Mutation {
126
+ readonly segment: string | undefined;
127
+ readonly valueAtReference: string | undefined;
128
+ readonly position: number;
129
+ readonly code: string;
130
+ constructor(segment: string | undefined, valueAtReference: string | undefined, position: number);
131
+ equals(other: Mutation): boolean;
132
+ toString(): string;
133
+ static parse(mutationStr: string): Deletion | null;
134
+ }
135
+
136
+ declare class Insertion implements Mutation {
137
+ readonly segment: string | undefined;
138
+ readonly position: number;
139
+ readonly insertedSymbols: string;
140
+ readonly code: string;
141
+ constructor(segment: string | undefined, position: number, insertedSymbols: string);
142
+ equals(other: Mutation): boolean;
143
+ toString(): string;
144
+ static parse(mutationStr: string): Insertion | null;
145
+ }
146
+
66
147
  declare type LapisFilter = Record<string, string | number | null | boolean>;
67
148
 
68
149
  /**
69
- * ## Tag
70
- *
71
- * `gs-location-filter`
72
- *
73
150
  * ## Context
74
151
  *
75
152
  * This component provides an input field to specify filters for locations.
@@ -101,7 +178,7 @@ export declare class LocationFilterComponent extends PreactLitAdapter {
101
178
  * The initial value to use for this location filter.
102
179
  * Must be of the form `valueForField1 / valueForField2 / ... / valueForFieldN`.
103
180
  */
104
- value: string;
181
+ initialValue: string;
105
182
  /**
106
183
  * The fields to display in the location filter, in hierarchical order.
107
184
  * The top-level field should be the first entry in the array.
@@ -112,37 +189,193 @@ export declare class LocationFilterComponent extends PreactLitAdapter {
112
189
  render(): JSX_2.Element;
113
190
  }
114
191
 
115
- export declare class MutationComparisonComponent extends PreactLitAdapterWithGridJsStyles {
116
- variants: MutationComparisonVariant[];
117
- sequenceType: SequenceType;
118
- views: View[];
119
- render(): JSX_2.Element;
192
+ declare interface Mutation {
193
+ readonly segment: string | undefined;
194
+ readonly position: number;
195
+ readonly code: string;
196
+ equals(other: Mutation): boolean;
197
+ toString(): string;
120
198
  }
121
199
 
122
- declare interface MutationComparisonVariant {
123
- lapisFilter: LapisFilter;
124
- displayName: string;
200
+ /**
201
+ * This component allows to compare mutations between different variants.
202
+ * A variant is defined by its LAPIS filter.
203
+ *
204
+ * It only shows substitutions and deletions, it does not show insertions.
205
+ *
206
+ * ## Views
207
+ *
208
+ * ### Table View
209
+ *
210
+ * The table view shows mutations
211
+ * and the proportions with which the mutation occurs in the respective variant.
212
+ * It only shows mutations that are present in at least one of the variants
213
+ * and where the proportion is within the selected proportion interval for at least one variant.
214
+ *
215
+ * ### Venn View
216
+ *
217
+ * The Venn view shows the overlap of mutations between the variants in a Venn diagram.
218
+ * A variant is considered to have a certain mutation,
219
+ * if the proportion of the mutation in the variant is within the selected proportion interval.
220
+ * Thus, changing the proportion interval may change a mutations from being "common" between variant
221
+ * to being "for one variant only".
222
+ */
223
+ export declare class MutationComparisonComponent extends PreactLitAdapterWithGridJsStyles {
224
+ /**
225
+ * An array of variants to compare.
226
+ *
227
+ * The `lapisFilter` will be sent as is to LAPIS to filter the mutation data.
228
+ * It must be a valid LAPIS filter object.
229
+ *
230
+ * The `displayName` will be used as the label for the variant in the views.
231
+ * It should be human-readable.
232
+ */
233
+ variants: {
234
+ lapisFilter: Record<string, string | number | null | boolean>;
235
+ displayName: string;
236
+ }[];
237
+ /**
238
+ * The type of the sequence for which the mutations should be shown.
239
+ */
240
+ sequenceType: 'nucleotide' | 'amino acid';
241
+ /**
242
+ * A list of tabs with views that this component should provide.
243
+ */
244
+ views: ('table' | 'venn')[];
245
+ /**
246
+ * The size of the component.
247
+ *
248
+ * If not set, the component will take the full width of its container with height 700px.
249
+ *
250
+ * The width and height should be a string with a unit in css style, e.g. '100%', '500px' or '50vh'.
251
+ * If the unit is %, the size will be relative to the container of the component.
252
+ */
253
+ size: {
254
+ width?: string;
255
+ height?: string;
256
+ } | undefined;
257
+ /**
258
+ * The headline of the component. Set to an empty string to hide the headline.
259
+ */
260
+ headline: string | undefined;
261
+ render(): JSX_2.Element;
125
262
  }
126
263
 
127
264
  /**
128
- * @fires {CustomEvent<SelectedMutationFilterStrings>} gs-mutation-filter-changed - When the mutation filter values have changed
129
- * @fires {CustomEvent<SelectedMutationFilterStrings>} gs-mutation-filter-on-blur - When the mutation filter has lost focus
265
+ * ## Context
266
+ * This component provides an input field to specify filters for nucleotide and amino acid mutations and insertions.
267
+ *
268
+ * Input values have to be provided one at a time and submitted by pressing the Enter key or by clicking the '+' button.
269
+ * After submission, the component validates the input and fires an event with the selected mutations.
270
+ * All previously selected mutations are displayed at the input field and added to the event.
271
+ * Users can remove a mutation by clicking the 'x' button next to the mutation.
272
+ *
273
+ * Validation of the input is performed according to the following rules:
274
+ *
275
+ * Mutations have to conform to the following format: `<gene/segment>:<symbol at reference><position><Substituted symbol/Deletion>`
276
+ * - Gene/segment: The gene or segment where the mutation occurs. Must be contained in the reference genome
277
+ * (Optional for elements with only one gene/segment)
278
+ * - Symbol at reference: The symbol at the reference position. (Optional)
279
+ * - Position: The position of the mutation. (Required)
280
+ * - Substituted symbol/Deletion: The substituted symbol or '-' for a deletion. (Required)
281
+ * Example: S:614G, 614G, 614- or 614G
282
+ *
283
+ * Insertions have to conform to the following format: `ins_<gene/segment>:<position>:<Inserted symbols>`
284
+ * - Gene/segment: The gene or segment where the insertion occurs. Must be contained in the reference genome
285
+ * (Optional for elements with only one gene/segment)
286
+ * - Position: The position of the insertion. (Required)
287
+ * - Inserted symbols: The symbols that are inserted. (Required)
288
+ * Example: ins_S:614:G, ins_614:G
289
+ *
290
+ * @fires {CustomEvent<{
291
+ * nucleotideMutations: string[],
292
+ * aminoAcidMutations: string[],
293
+ * nucleotideInsertions: string[],
294
+ * aminoAcidInsertions: string[]
295
+ * }>} gs-mutation-filter-changed
296
+ * Fired when:
297
+ * - The user has submitted a valid mutation or insertion
298
+ * - The user has removed a mutation or insertion
299
+ *
300
+ * @fires {CustomEvent<{
301
+ * nucleotideMutations: string[],
302
+ * aminoAcidMutations: string[],
303
+ * nucleotideInsertions: string[],
304
+ * aminoAcidInsertions: string[]
305
+ * }>} gs-mutation-filter-on-blur
306
+ * Fired when:
307
+ * - the mutation filter has lost focus
308
+ * Contains the selected mutations in the format
130
309
  */
131
310
  export declare class MutationFilterComponent extends PreactLitAdapter {
311
+ /**
312
+ * The initial value to use for this mutation filter.
313
+ * Must be either
314
+ * - an array of strings of valid mutations.
315
+ * - an object with the keys `nucleotideMutations`, `aminoAcidMutations`, `nucleotideInsertions` and `aminoAcidInsertions` and corresponding string arrays.
316
+ */
317
+ initialValue: SelectedMutationFilterStrings | string[] | undefined;
132
318
  render(): JSX_2.Element;
133
319
  }
134
320
 
321
+ /**
322
+ * This component displays mutations (substitutions, deletions and insertions) for a given variant.
323
+ *
324
+ * ## Views
325
+ *
326
+ * ### Table View
327
+ *
328
+ * The table view shows all substitutions and deletions for the given variant.
329
+ * It shows the type (substitution or deletion), the total count of the mutation
330
+ * and the proportion of the mutation in the variant.
331
+ * The proportion is relative to the total number of sequences matching
332
+ * the specified sequence filters with non-ambiguous reads at that position.
333
+ *
334
+ * The proportion interval filter can be used to filter the displayed mutations on client side.
335
+ *
336
+ * ### Grid View
337
+ *
338
+ * The grid view shows the proportion of each sequence symbol (nucleotide or amino acid) for each position that has a mutation.
339
+ * Only positions with at least one mutation in the selected proportion interval are shown.
340
+ *
341
+ * ### Insertions View
342
+ *
343
+ * The insertions view shows the count of all insertions for the given variant.
344
+ *
345
+ */
135
346
  export declare class MutationsComponent extends PreactLitAdapterWithGridJsStyles {
136
- variant: LapisFilter;
137
- sequenceType: SequenceType;
138
- views: View_2[];
347
+ /**
348
+ * The `variant` will be sent as is to LAPIS to filter the mutation data.
349
+ * It must be a valid LAPIS filter object.
350
+ */
351
+ variant: Record<string, string | number | null | boolean>;
352
+ /**
353
+ * The type of the sequence for which the mutations should be shown.
354
+ */
355
+ sequenceType: 'nucleotide' | 'amino acid';
356
+ /**
357
+ * A list of tabs with views that this component should provide.
358
+ */
359
+ views: ('table' | 'grid' | 'insertions')[];
360
+ /**
361
+ * The size of the component.
362
+ *
363
+ * If not set, the component will take the full width of its container with height 700px.
364
+ *
365
+ * The width and height should be a string with a unit in css style, e.g. '100%', '500px' or '50vh'.
366
+ * If the unit is %, the size will be relative to the container of the component.
367
+ */
368
+ size: {
369
+ width?: string;
370
+ height?: string;
371
+ } | undefined;
372
+ /**
373
+ * The headline of the component. Set to an empty string to hide the headline.
374
+ */
375
+ headline: string | undefined;
139
376
  render(): JSX_2.Element;
140
377
  }
141
378
 
142
- declare type NamedLapisFilter = LapisFilter & {
143
- displayName: string;
144
- };
145
-
146
379
  declare abstract class PreactLitAdapter extends ReactiveElement {
147
380
  static styles: CSSResult[];
148
381
  /* Excluded from this release type: lapis */
@@ -155,13 +388,99 @@ declare abstract class PreactLitAdapterWithGridJsStyles extends PreactLitAdapter
155
388
  static styles: CSSResult[];
156
389
  }
157
390
 
391
+ /**
392
+ * This component displays the prevalence over time of one or more variants.
393
+ * The prevalence is calculated as the ratio of the number of cases of each variant given as `numerator`
394
+ * to the number of cases of the variant given as `denominator`.
395
+ *
396
+ * In the chart views,
397
+ * - the user can select whether to display a confidence interval (not available in the bubble chart).
398
+ * The confidence interval is calculated using [Wilson score interval](https://en.wikipedia.org/wiki/Binomial_proportion_confidence_interval),
399
+ * with a confidence level of 95%.
400
+ * - the x-axis shows time steps in the selected `granularity`.
401
+ * - the user can select the y-axis scale (linear, logistic, logit).
402
+ *
403
+ * ## Views
404
+ *
405
+ * ### Bar View
406
+ *
407
+ * Displays the prevalence over time as a bar chart.
408
+ * Shows a bar for each variant in the `numerator` on every time step.
409
+ *
410
+ * ### Line View
411
+ *
412
+ * Displays the prevalence over time as a line chart.
413
+ * Each data point is connected for better visibility.
414
+ * Shows a line for each variant in the `numerator`.
415
+ *
416
+ * ### Bubble View
417
+ *
418
+ * Displays the prevalence over time as a bubble chart.
419
+ * The size of the bubbles represents the number of cases of the `denominator` variant.
420
+ * The height of the bubbles represents the prevalence of the `numerator` variants.
421
+ *
422
+ * ### Table View
423
+ *
424
+ * Displays the prevalence over time as a table with one row per time point.
425
+ */
158
426
  export declare class PrevalenceOverTimeComponent extends PreactLitAdapterWithGridJsStyles {
159
- numerator: NamedLapisFilter | NamedLapisFilter[];
160
- denominator: NamedLapisFilter;
161
- granularity: TemporalGranularity;
427
+ /**
428
+ * Either a single variant or an array of variants to compare.
429
+ * This must be a valid LAPIS filter object with an additional `displayName` property
430
+ * which will be used as the label for the variant in the views,
431
+ * or an array of such objects.
432
+ */
433
+ numerator: (Record<string, string | number | null | boolean> & {
434
+ displayName: string;
435
+ }) | (Record<string, string | number | null | boolean> & {
436
+ displayName: string;
437
+ })[];
438
+ /**
439
+ * The variant that the variants in `numerator` are compared to.
440
+ */
441
+ denominator: Record<string, string | number | null | boolean> & {
442
+ displayName: string;
443
+ };
444
+ /**
445
+ * The granularity of the time axis.
446
+ */
447
+ granularity: 'day' | 'week' | 'month' | 'year';
448
+ /**
449
+ * The number of time steps to use for smoothing the data.
450
+ * `0` means no smoothing.
451
+ * Must be a non-negative integer.
452
+ *
453
+ * For a given time, the shown value is the mean of the neighbouring measured values.
454
+ * The `smoothingWindow` value provides the number of neighbouring values to take into account.
455
+ * The resulting time is computed via `Math.floor(smoothingWindow / 2)`.
456
+ */
162
457
  smoothingWindow: number;
163
- views: View_3[];
164
- confidenceIntervalMethods: ConfidenceIntervalMethod[];
458
+ /**
459
+ * A list of tabs with views that this component should provide.
460
+ */
461
+ views: ('bar' | 'line' | 'bubble' | 'table')[];
462
+ /**
463
+ * A list of methods to calculate the confidence interval.
464
+ * The option `none` is always available and disables confidence intervals.
465
+ * Pass an empty array to disable the confidence interval selector.
466
+ */
467
+ confidenceIntervalMethods: ('wilson' | 'none')[];
468
+ /**
469
+ * The headline of the component. Set to an empty string to hide the headline.
470
+ */
471
+ headline: string | undefined;
472
+ /**
473
+ * The size of the component.
474
+ *
475
+ * If not set, the component will take the full width of its container with height 700px.
476
+ *
477
+ * The width and height should be a string with a unit in css style, e.g. '100%', '500px' or '50vh'.
478
+ * If the unit is %, the size will be relative to the container of the component.
479
+ */
480
+ size: {
481
+ width?: string;
482
+ height?: string;
483
+ } | undefined;
165
484
  render(): JSX_2.Element;
166
485
  }
167
486
 
@@ -208,36 +527,123 @@ declare const referenceGenomeResponse: default_2.ZodObject<{
208
527
  }[];
209
528
  }>;
210
529
 
530
+ /**
531
+ * We assume a discrete time model, where new infections happen exactly every `generationTime` days.
532
+ * This is what we call a "generation".
533
+ *
534
+ * This component estimates the relative growth advantage of a variant by performing a logistic regression.
535
+ * Based on the inferred logistic growth rate, we derive the relative growth advantage (per generation).
536
+ *
537
+ * For details on the scientific method, see:
538
+ * Chen, Chaoran, et al. "Quantification of the spread of SARS-CoV-2 variant B.1.1.7 in Switzerland." Epidemics (2021);
539
+ * doi: [10.1016/j.epidem.2021.100480](https://doi.org/10.1016/j.epidem.2021.100480)
540
+ *
541
+ * This component fetches aggregated data from LAPIS.
542
+ * Then the data is sent to `https://cov-spectrum.org/api/v2/computed/model/chen2021Fitness`
543
+ * which performs the logistic regression and calculates the relative growth advantage.
544
+ *
545
+ * ## Views
546
+ *
547
+ * ### Line View
548
+ *
549
+ * The line view shows the relative growth advantage over time in a line chart.
550
+ * The dots in the plot show the proportions of the focal variant (`numerator`) to the `denominator` variant
551
+ * for every day as observed in the data.
552
+ * The line shows a logistic curve fitted to the data points, including a 95% confidence interval.
553
+ */
211
554
  export declare class RelativeGrowthAdvantageComponent extends PreactLitAdapter {
212
- numerator: LapisFilter;
213
- denominator: LapisFilter;
555
+ /**
556
+ * The LAPIS filter for the focal variant.
557
+ */
558
+ numerator: Record<string, string | number | null | boolean>;
559
+ /**
560
+ * The LAPIS filter for the variant that the focal variant (`numerator`) should be compared to.
561
+ */
562
+ denominator: Record<string, string | number | null | boolean>;
563
+ /**
564
+ * The generation time represents the number of days over which the variant's relative growth advantage is measured.
565
+ * For example, if we set a generation time of 7 days, then we estimate the growth advantage per week.
566
+ */
214
567
  generationTime: number;
215
- views: View_4[];
568
+ /**
569
+ * A list of tabs with views that this component should provide.
570
+ */
571
+ views: 'line'[];
572
+ /**
573
+ * The headline of the component. Set to an empty string to hide the headline.
574
+ */
575
+ headline: string | undefined;
576
+ /**
577
+ * The size of the component.
578
+ *
579
+ * If not set, the component will take the full width of its container with height 700px.
580
+ *
581
+ * The width and height should be a string with a unit in css style, e.g. '100%', '500px' or '50vh'.
582
+ * If the unit is %, the size will be relative to the container of the component.
583
+ */
584
+ size: {
585
+ width?: string;
586
+ height?: string;
587
+ } | undefined;
216
588
  render(): JSX_2.Element;
217
589
  }
218
590
 
219
- declare type SequenceType = 'nucleotide' | 'amino acid';
591
+ declare type SelectedFilters = {
592
+ nucleotideMutations: (Substitution | Deletion)[];
593
+ aminoAcidMutations: (Substitution | Deletion)[];
594
+ nucleotideInsertions: Insertion[];
595
+ aminoAcidInsertions: Insertion[];
596
+ };
597
+
598
+ declare type SelectedMutationFilterStrings = {
599
+ [Key in keyof SelectedFilters]: string[];
600
+ };
220
601
 
221
- declare type TemporalGranularity = 'day' | 'week' | 'month' | 'year';
602
+ declare class Substitution implements Mutation {
603
+ readonly segment: string | undefined;
604
+ readonly valueAtReference: string | undefined;
605
+ readonly substitutionValue: string | undefined;
606
+ readonly position: number;
607
+ readonly code: string;
608
+ constructor(segment: string | undefined, valueAtReference: string | undefined, substitutionValue: string | undefined, position: number);
609
+ equals(other: Mutation): boolean;
610
+ toString(): string;
611
+ static parse(mutationStr: string): Substitution | null;
612
+ }
222
613
 
223
614
  /**
224
- * @fires {CustomEvent<Record<string, string>>} gs-text-input-changed - When the text input has changed
615
+ *
616
+ * ## Context
617
+ *
618
+ * This component provides a text input field to specify filters for arbitrary fields of this Lapis instance.
619
+ *
620
+ * @fires {CustomEvent<Record<string, string>>} gs-text-input-changed
621
+ * Fired when the input field is changed.
622
+ * The `details` of this event contain an object with the `lapisField` as key and the input value as value.
623
+ * Example:
624
+ * ```
625
+ * {
626
+ * "host": "Homo sapiens"
627
+ * }
628
+ * ```
225
629
  */
226
630
  export declare class TextInputComponent extends PreactLitAdapter {
631
+ /**
632
+ * The initial value to use for this text input.
633
+ */
634
+ initialValue: string | undefined;
635
+ /**
636
+ * The Lapis field name to use for this text input.
637
+ */
227
638
  lapisField: string;
228
- placeholderText: string;
639
+ /**
640
+ * The placeholder text to display in the input field.
641
+ */
642
+ placeholderText: string | undefined;
229
643
  render(): JSX_2.Element;
230
644
  }
231
645
 
232
- declare type View = 'table' | 'venn';
233
-
234
- declare type View_2 = 'table' | 'grid' | 'insertions';
235
-
236
- declare type View_3 = 'bar' | 'line' | 'bubble' | 'table';
237
-
238
- declare type View_4 = 'line';
239
-
240
- declare type View_5 = 'table';
646
+ declare type View = 'table';
241
647
 
242
648
  export { }
243
649
 
@@ -299,31 +705,31 @@ declare global {
299
705
 
300
706
  declare global {
301
707
  interface HTMLElementTagNameMap {
302
- 'gs-mutation-filter': TextInputComponent;
708
+ 'gs-location-filter': LocationFilterComponent;
303
709
  }
304
710
  interface HTMLElementEventMap {
305
- 'gs-mutation-filter-changed': CustomEvent<SelectedMutationFilterStrings>;
306
- 'gs-mutation-filter-on-blur': CustomEvent<SelectedMutationFilterStrings>;
711
+ 'gs-location-changed': CustomEvent<Record<string, string>>;
307
712
  }
308
713
  }
309
714
 
310
715
 
311
716
  declare global {
312
717
  interface HTMLElementTagNameMap {
313
- 'gs-location-filter': LocationFilterComponent;
718
+ 'gs-text-input': TextInputComponent;
314
719
  }
315
720
  interface HTMLElementEventMap {
316
- 'gs-location-changed': CustomEvent<Record<string, string>>;
721
+ 'gs-text-input-changed': CustomEvent<Record<string, string>>;
317
722
  }
318
723
  }
319
724
 
320
725
 
321
726
  declare global {
322
727
  interface HTMLElementTagNameMap {
323
- 'gs-text-input': TextInputComponent;
728
+ 'gs-mutation-filter': TextInputComponent;
324
729
  }
325
730
  interface HTMLElementEventMap {
326
- 'gs-text-input-changed': CustomEvent<Record<string, string>>;
731
+ 'gs-mutation-filter-changed': CustomEvent<SelectedMutationFilterStrings>;
732
+ 'gs-mutation-filter-on-blur': CustomEvent<SelectedMutationFilterStrings>;
327
733
  }
328
734
  }
329
735