@genspectrum/dashboard-components 1.7.0 → 1.8.1
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/README.md +22 -2
- package/custom-elements.json +81 -0
- package/dist/assets/{mutationOverTimeWorker-DPS3tmOd.js.map → mutationOverTimeWorker-BRPqAM5Z.js.map} +1 -1
- package/dist/components.d.ts +49 -22
- package/dist/components.js +130 -37
- package/dist/components.js.map +1 -1
- package/dist/util.d.ts +22 -22
- package/package.json +1 -1
- package/src/preact/MutationLinkTemplateContext.tsx +56 -0
- package/src/preact/components/annotated-mutation.stories.tsx +69 -17
- package/src/preact/components/annotated-mutation.tsx +45 -19
- package/src/preact/mutationComparison/mutation-comparison-table.tsx +3 -0
- package/src/preact/mutations/mutations-table.tsx +3 -0
- package/src/preact/shared/stories/expectMutationAnnotation.ts +3 -1
- package/src/preact/wastewater/mutationsOverTime/__mockData__/detailsAminAcidNonSegmented.json +88 -0
- package/src/preact/wastewater/mutationsOverTime/wastewater-mutations-over-time.stories.tsx +34 -0
- package/src/query/queryWastewaterMutationsOverTime.ts +1 -1
- package/src/utils/mutations.ts +18 -10
- package/src/web-components/gs-app.spec-d.ts +7 -0
- package/src/web-components/gs-app.stories.ts +32 -2
- package/src/web-components/gs-app.ts +17 -0
- package/src/web-components/mutation-link-template-context.ts +13 -0
- package/src/web-components/mutationLinks.mdx +27 -0
- package/src/web-components/visualization/gs-mutation-comparison.tsx +18 -8
- package/src/web-components/visualization/gs-mutations-over-time.stories.ts +12 -1
- package/src/web-components/visualization/gs-mutations-over-time.tsx +24 -14
- package/src/web-components/visualization/gs-mutations.tsx +19 -9
- package/src/web-components/wastewaterVisualization/gs-wastewater-mutations-over-time.tsx +17 -7
- package/standalone-bundle/assets/{mutationOverTimeWorker-Dp-A14AP.js.map → mutationOverTimeWorker-DtFX4Ihx.js.map} +1 -1
- package/standalone-bundle/dashboard-components.js +6360 -6298
- package/standalone-bundle/dashboard-components.js.map +1 -1
package/src/utils/mutations.ts
CHANGED
|
@@ -17,15 +17,19 @@ export interface MutationClass extends Mutation {
|
|
|
17
17
|
const nucleotideChars = 'ACGTRYKMSWBDHVN';
|
|
18
18
|
const aminoAcidChars = 'ACDEFGHIKLMNPQRSTVWY';
|
|
19
19
|
|
|
20
|
-
function segmentPart(
|
|
21
|
-
|
|
20
|
+
function segmentPart(isOptional: boolean) {
|
|
21
|
+
const segmentPart = `(?<segment>[A-Z0-9_-]+):`;
|
|
22
|
+
if (isOptional) {
|
|
23
|
+
return `(${segmentPart})?`;
|
|
24
|
+
}
|
|
25
|
+
return segmentPart;
|
|
22
26
|
}
|
|
23
27
|
|
|
24
|
-
function buildSubstitutionRegex(type: 'nucleotide' | 'aminoAcid') {
|
|
28
|
+
function buildSubstitutionRegex(type: 'nucleotide' | 'aminoAcid', segmentPartIsOptional: boolean) {
|
|
25
29
|
const chars = type === 'nucleotide' ? nucleotideChars : aminoAcidChars;
|
|
26
30
|
|
|
27
31
|
return new RegExp(
|
|
28
|
-
`^${segmentPart(
|
|
32
|
+
`^${segmentPart(segmentPartIsOptional)}` +
|
|
29
33
|
`(?<valueAtReference>[${chars}*])?` +
|
|
30
34
|
`(?<position>\\d+)` +
|
|
31
35
|
`(?<substitutionValue>[${chars}.*])?$`,
|
|
@@ -33,8 +37,9 @@ function buildSubstitutionRegex(type: 'nucleotide' | 'aminoAcid') {
|
|
|
33
37
|
);
|
|
34
38
|
}
|
|
35
39
|
|
|
36
|
-
const nucleotideSubstitutionRegex = buildSubstitutionRegex('nucleotide');
|
|
37
|
-
const aminoAcidSubstitutionRegex = buildSubstitutionRegex('aminoAcid');
|
|
40
|
+
const nucleotideSubstitutionRegex = buildSubstitutionRegex('nucleotide', true);
|
|
41
|
+
const aminoAcidSubstitutionRegex = buildSubstitutionRegex('aminoAcid', false);
|
|
42
|
+
const aminoAcidSubstitutionWithoutSegmentRegex = buildSubstitutionRegex('aminoAcid', true);
|
|
38
43
|
|
|
39
44
|
export interface Substitution extends Mutation {
|
|
40
45
|
type: 'substitution';
|
|
@@ -74,10 +79,13 @@ export class SubstitutionClass implements MutationClass, Substitution {
|
|
|
74
79
|
return this.code;
|
|
75
80
|
}
|
|
76
81
|
|
|
77
|
-
static parse(mutationStr: string): SubstitutionClass | null {
|
|
82
|
+
static parse(mutationStr: string, segmentIsOptional: boolean = false): SubstitutionClass | null {
|
|
78
83
|
const matchNucleotide = nucleotideSubstitutionRegex.exec(mutationStr);
|
|
79
84
|
const matchAminoAcid = aminoAcidSubstitutionRegex.exec(mutationStr);
|
|
80
|
-
const
|
|
85
|
+
const matchAminAcidWithoutSegment = segmentIsOptional
|
|
86
|
+
? aminoAcidSubstitutionWithoutSegmentRegex.exec(mutationStr)
|
|
87
|
+
: undefined;
|
|
88
|
+
const match = matchNucleotide ?? matchAminoAcid ?? matchAminAcidWithoutSegment;
|
|
81
89
|
if (match?.groups === undefined) {
|
|
82
90
|
return null;
|
|
83
91
|
}
|
|
@@ -94,7 +102,7 @@ function buildDeletionRegex(type: 'nucleotide' | 'aminoAcid') {
|
|
|
94
102
|
const chars = type === 'nucleotide' ? nucleotideChars : aminoAcidChars;
|
|
95
103
|
|
|
96
104
|
return new RegExp(
|
|
97
|
-
`^${segmentPart(type)}` + `(?<valueAtReference>[${chars}*])?` + `(?<position>\\d+)` + `(-)$`,
|
|
105
|
+
`^${segmentPart(type === 'nucleotide')}` + `(?<valueAtReference>[${chars}*])?` + `(?<position>\\d+)` + `(-)$`,
|
|
98
106
|
'i',
|
|
99
107
|
);
|
|
100
108
|
}
|
|
@@ -158,7 +166,7 @@ function buildInsertionRegex(type: 'nucleotide' | 'aminoAcid') {
|
|
|
158
166
|
const wildcardToken = `(?:\\.\\*)`;
|
|
159
167
|
|
|
160
168
|
return new RegExp(
|
|
161
|
-
`^ins_${segmentPart(type)}(?<position>\\d+):(?<insertedSymbols>(?:[${chars}?*]|${wildcardToken})+)$`,
|
|
169
|
+
`^ins_${segmentPart(type === 'nucleotide')}(?<position>\\d+):(?<insertedSymbols>(?:[${chars}?*]|${wildcardToken})+)$`,
|
|
162
170
|
'i',
|
|
163
171
|
);
|
|
164
172
|
}
|
|
@@ -2,9 +2,16 @@ import { describe, expectTypeOf, test } from 'vitest';
|
|
|
2
2
|
|
|
3
3
|
import { AppComponent } from './gs-app';
|
|
4
4
|
import { type MutationAnnotations } from './mutation-annotations-context';
|
|
5
|
+
import { type MutationLinkTemplate } from './mutation-link-template-context';
|
|
5
6
|
|
|
6
7
|
describe('gs-app types', () => {
|
|
7
8
|
test('mutationAnnotations type should match', () => {
|
|
8
9
|
expectTypeOf(AppComponent.prototype).toHaveProperty('mutationAnnotations').toEqualTypeOf<MutationAnnotations>();
|
|
9
10
|
});
|
|
11
|
+
|
|
12
|
+
test('mutationLinkTemplate type should match', () => {
|
|
13
|
+
expectTypeOf(AppComponent.prototype)
|
|
14
|
+
.toHaveProperty('mutationLinkTemplate')
|
|
15
|
+
.toEqualTypeOf<MutationLinkTemplate>();
|
|
16
|
+
});
|
|
10
17
|
});
|
|
@@ -11,6 +11,7 @@ import { referenceGenomeContext } from './reference-genome-context';
|
|
|
11
11
|
import { withComponentDocs } from '../../.storybook/ComponentDocsBlock';
|
|
12
12
|
import { LAPIS_URL, REFERENCE_GENOME_ENDPOINT } from '../constants';
|
|
13
13
|
import { type MutationAnnotations, mutationAnnotationsContext } from './mutation-annotations-context';
|
|
14
|
+
import { type MutationLinkTemplate, mutationLinkTemplateContext } from './mutation-link-template-context';
|
|
14
15
|
import type { ReferenceGenome } from '../lapisApi/ReferenceGenome';
|
|
15
16
|
import referenceGenome from '../lapisApi/__mockData__/referenceGenome.json';
|
|
16
17
|
|
|
@@ -35,11 +36,19 @@ const meta: Meta = {
|
|
|
35
36
|
|
|
36
37
|
export default meta;
|
|
37
38
|
|
|
38
|
-
type StoryProps = {
|
|
39
|
+
type StoryProps = {
|
|
40
|
+
lapis: string;
|
|
41
|
+
mutationAnnotations: MutationAnnotations;
|
|
42
|
+
mutationLinkTemplate: MutationLinkTemplate;
|
|
43
|
+
};
|
|
39
44
|
|
|
40
45
|
const Template: StoryObj<StoryProps> = {
|
|
41
46
|
render: (args) => {
|
|
42
|
-
return html` <gs-app
|
|
47
|
+
return html` <gs-app
|
|
48
|
+
lapis="${args.lapis}"
|
|
49
|
+
.mutationAnnotations="${args.mutationAnnotations}"
|
|
50
|
+
.mutationLinkTemplate="${args.mutationLinkTemplate}"
|
|
51
|
+
>
|
|
43
52
|
<gs-app-display></gs-app-display>
|
|
44
53
|
</gs-app>`;
|
|
45
54
|
},
|
|
@@ -56,6 +65,10 @@ const Template: StoryObj<StoryProps> = {
|
|
|
56
65
|
aminoAcidPositions: ['S:123'],
|
|
57
66
|
},
|
|
58
67
|
],
|
|
68
|
+
mutationLinkTemplate: {
|
|
69
|
+
nucleotideMutation: 'http://foo.com/query?nucMut={{mutation}}',
|
|
70
|
+
aminoAcidMutation: 'http://foo.com/query?aaMut={{mutation}}',
|
|
71
|
+
},
|
|
59
72
|
},
|
|
60
73
|
};
|
|
61
74
|
|
|
@@ -128,6 +141,18 @@ export const FailsToFetchReferenceGenome: StoryObj<StoryProps> = {
|
|
|
128
141
|
},
|
|
129
142
|
};
|
|
130
143
|
|
|
144
|
+
export const ProvidesMutationLinkTemplateToChildren: StoryObj<StoryProps> = {
|
|
145
|
+
...Template,
|
|
146
|
+
play: async ({ canvasElement }) => {
|
|
147
|
+
const canvas = within(canvasElement);
|
|
148
|
+
|
|
149
|
+
await waitFor(async () => {
|
|
150
|
+
await expect(canvas.getByText('http://foo.com/query?nucMut={{mutation}}', { exact: false })).toBeVisible();
|
|
151
|
+
await expect(canvas.getByText('http://foo.com/query?aaMut={{mutation}}', { exact: false })).toBeVisible();
|
|
152
|
+
});
|
|
153
|
+
},
|
|
154
|
+
};
|
|
155
|
+
|
|
131
156
|
@customElement('gs-app-display')
|
|
132
157
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars -- it is used in the story above
|
|
133
158
|
class AppDisplay extends LitElement {
|
|
@@ -143,6 +168,9 @@ class AppDisplay extends LitElement {
|
|
|
143
168
|
@consume({ context: mutationAnnotationsContext, subscribe: true })
|
|
144
169
|
mutationAnnotations: MutationAnnotations = [];
|
|
145
170
|
|
|
171
|
+
@consume({ context: mutationLinkTemplateContext, subscribe: true })
|
|
172
|
+
mutationLinkTemplate: MutationLinkTemplate = {};
|
|
173
|
+
|
|
146
174
|
override render() {
|
|
147
175
|
return html`
|
|
148
176
|
<h1 class="text-xl font-bold">Dummy component</h1>
|
|
@@ -156,6 +184,8 @@ class AppDisplay extends LitElement {
|
|
|
156
184
|
<pre><code>${JSON.stringify(this.referenceGenome, null, 2)}</code></pre>
|
|
157
185
|
<h2 class="text-lg font-bold">Mutation annotations</h2>
|
|
158
186
|
<pre><code>${JSON.stringify(this.mutationAnnotations, null, 2)}</code></pre>
|
|
187
|
+
<h2 class="text-lg font-bold">Mutation link template</h2>
|
|
188
|
+
<pre><code>${JSON.stringify(this.mutationLinkTemplate, null, 2)}</code></pre>
|
|
159
189
|
`;
|
|
160
190
|
}
|
|
161
191
|
|
|
@@ -7,6 +7,7 @@ import z from 'zod';
|
|
|
7
7
|
|
|
8
8
|
import { lapisContext } from './lapis-context';
|
|
9
9
|
import { mutationAnnotationsContext } from './mutation-annotations-context';
|
|
10
|
+
import { mutationLinkTemplateContext } from './mutation-link-template-context';
|
|
10
11
|
import { referenceGenomeContext } from './reference-genome-context';
|
|
11
12
|
import { type ReferenceGenome } from '../lapisApi/ReferenceGenome';
|
|
12
13
|
import { fetchReferenceGenome } from '../lapisApi/lapisApi';
|
|
@@ -59,6 +60,22 @@ export class AppComponent extends LitElement {
|
|
|
59
60
|
aminoAcidPositions?: string[];
|
|
60
61
|
}[] = [];
|
|
61
62
|
|
|
63
|
+
/**
|
|
64
|
+
* Supply a link template for nucleotide and amino acid mutations.
|
|
65
|
+
* The template should include '{{mutation}}' where the mutation code will be inserted, for example:
|
|
66
|
+
*
|
|
67
|
+
* https://my-site.org/query?nucleotideMutation={{mutation}}
|
|
68
|
+
*/
|
|
69
|
+
@provide({ context: mutationLinkTemplateContext })
|
|
70
|
+
@property({ type: Object })
|
|
71
|
+
mutationLinkTemplate: {
|
|
72
|
+
nucleotideMutation?: string;
|
|
73
|
+
aminoAcidMutation?: string;
|
|
74
|
+
} = {
|
|
75
|
+
nucleotideMutation: undefined,
|
|
76
|
+
aminoAcidMutation: undefined,
|
|
77
|
+
};
|
|
78
|
+
|
|
62
79
|
/**
|
|
63
80
|
* @internal
|
|
64
81
|
*/
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { createContext } from '@lit/context';
|
|
2
|
+
import z from 'zod';
|
|
3
|
+
|
|
4
|
+
export const mutationLinkTemplateSchema = z.object({
|
|
5
|
+
nucleotideMutation: z.string().optional(),
|
|
6
|
+
aminoAcidMutation: z.string().optional(),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export type MutationLinkTemplate = z.infer<typeof mutationLinkTemplateSchema>;
|
|
10
|
+
|
|
11
|
+
export const mutationLinkTemplateContext = createContext<MutationLinkTemplate>(
|
|
12
|
+
Symbol('mutation-link-template-context'),
|
|
13
|
+
);
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Meta } from '@storybook/blocks';
|
|
2
|
+
|
|
3
|
+
<Meta title='Concepts/External Mutation Links' />
|
|
4
|
+
|
|
5
|
+
# External Mutation Links
|
|
6
|
+
|
|
7
|
+
When inspecting mutations, you might want to be able to quickly look up a mutation somewhere else.
|
|
8
|
+
For this, it's possible to supply a _link template_ which will then lead to mutation labels being clickable using
|
|
9
|
+
that link template.
|
|
10
|
+
|
|
11
|
+
The mutation link template can be (optionally) supplied to `gs-app` as a JSON object:
|
|
12
|
+
|
|
13
|
+
```html
|
|
14
|
+
<gs-app
|
|
15
|
+
lapis="https://your.lapis.url"
|
|
16
|
+
mutationLinkTemplate='{
|
|
17
|
+
"nucleotideMutation": "https://cov-spectrum.org/explore/Switzerland/AllSamples/Past6M/variants?nucMutations={{mutation}}",
|
|
18
|
+
"aminoAcidMutation": "https://cov-spectrum.org/explore/Switzerland/AllSamples/Past6M/variants?aaMutations={{mutation}}",
|
|
19
|
+
}'
|
|
20
|
+
>
|
|
21
|
+
{/* children... */}
|
|
22
|
+
</gs-app>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
For example (like in the code above) you can directly link to cov-spectrum.
|
|
26
|
+
|
|
27
|
+
Your link needs to have the placeholder `{{mutation}}` in it, which will then be replaced with the mutation code.
|
|
@@ -3,10 +3,12 @@ import { customElement, property } from 'lit/decorators.js';
|
|
|
3
3
|
import type { DetailedHTMLProps, HTMLAttributes } from 'react';
|
|
4
4
|
|
|
5
5
|
import { MutationAnnotationsContextProvider } from '../../preact/MutationAnnotationsContext';
|
|
6
|
+
import { MutationLinkTemplateContextProvider } from '../../preact/MutationLinkTemplateContext';
|
|
6
7
|
import { MutationComparison, type MutationComparisonProps } from '../../preact/mutationComparison/mutation-comparison';
|
|
7
8
|
import { type Equals, type Expect } from '../../utils/typeAssertions';
|
|
8
9
|
import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsStyles';
|
|
9
10
|
import { type MutationAnnotations, mutationAnnotationsContext } from '../mutation-annotations-context';
|
|
11
|
+
import { type MutationLinkTemplate, mutationLinkTemplateContext } from '../mutation-link-template-context';
|
|
10
12
|
|
|
11
13
|
/**
|
|
12
14
|
* ## Context
|
|
@@ -103,17 +105,25 @@ export class MutationComparisonComponent extends PreactLitAdapterWithGridJsStyle
|
|
|
103
105
|
@consume({ context: mutationAnnotationsContext, subscribe: true })
|
|
104
106
|
mutationAnnotations: MutationAnnotations = [];
|
|
105
107
|
|
|
108
|
+
/**
|
|
109
|
+
* @internal
|
|
110
|
+
*/
|
|
111
|
+
@consume({ context: mutationLinkTemplateContext, subscribe: true })
|
|
112
|
+
mutationLinkTemplate: MutationLinkTemplate = {};
|
|
113
|
+
|
|
106
114
|
override render() {
|
|
107
115
|
return (
|
|
108
116
|
<MutationAnnotationsContextProvider value={this.mutationAnnotations}>
|
|
109
|
-
<
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
+
<MutationLinkTemplateContextProvider value={this.mutationLinkTemplate}>
|
|
118
|
+
<MutationComparison
|
|
119
|
+
lapisFilters={this.lapisFilters}
|
|
120
|
+
sequenceType={this.sequenceType}
|
|
121
|
+
views={this.views}
|
|
122
|
+
width={this.width}
|
|
123
|
+
height={this.height}
|
|
124
|
+
pageSize={this.pageSize}
|
|
125
|
+
/>
|
|
126
|
+
</MutationLinkTemplateContextProvider>
|
|
117
127
|
</MutationAnnotationsContextProvider>
|
|
118
128
|
);
|
|
119
129
|
}
|
|
@@ -89,9 +89,20 @@ const mutationAnnotations = [
|
|
|
89
89
|
},
|
|
90
90
|
];
|
|
91
91
|
|
|
92
|
+
const mutationLinkTemplate = {
|
|
93
|
+
nucleotideMutation:
|
|
94
|
+
'https://cov-spectrum.org/explore/Switzerland/AllSamples/Past6M/variants?nucMutations={{mutation}}',
|
|
95
|
+
aminoAcidMutation:
|
|
96
|
+
'https://cov-spectrum.org/explore/Switzerland/AllSamples/Past6M/variants?aaMutations={{mutation}}',
|
|
97
|
+
};
|
|
98
|
+
|
|
92
99
|
const Template: StoryObj<Required<MutationsOverTimeProps>> = {
|
|
93
100
|
render: (args) => html`
|
|
94
|
-
<gs-app
|
|
101
|
+
<gs-app
|
|
102
|
+
lapis="${LAPIS_URL}"
|
|
103
|
+
.mutationAnnotations=${mutationAnnotations}
|
|
104
|
+
.mutationLinkTemplate=${mutationLinkTemplate}
|
|
105
|
+
>
|
|
95
106
|
<gs-mutations-over-time
|
|
96
107
|
.lapisFilter=${args.lapisFilter}
|
|
97
108
|
.sequenceType=${args.sequenceType}
|
|
@@ -3,9 +3,11 @@ import { customElement, property } from 'lit/decorators.js';
|
|
|
3
3
|
import type { DetailedHTMLProps, HTMLAttributes } from 'react';
|
|
4
4
|
|
|
5
5
|
import { MutationAnnotationsContextProvider } from '../../preact/MutationAnnotationsContext';
|
|
6
|
+
import { MutationLinkTemplateContextProvider } from '../../preact/MutationLinkTemplateContext';
|
|
6
7
|
import { MutationsOverTime } from '../../preact/mutationsOverTime/mutations-over-time';
|
|
7
8
|
import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsStyles';
|
|
8
9
|
import { type MutationAnnotations, mutationAnnotationsContext } from '../mutation-annotations-context';
|
|
10
|
+
import { type MutationLinkTemplate, mutationLinkTemplateContext } from '../mutation-link-template-context';
|
|
9
11
|
|
|
10
12
|
/**
|
|
11
13
|
* ## Context
|
|
@@ -140,23 +142,31 @@ export class MutationsOverTimeComponent extends PreactLitAdapterWithGridJsStyles
|
|
|
140
142
|
@consume({ context: mutationAnnotationsContext, subscribe: true })
|
|
141
143
|
mutationAnnotations: MutationAnnotations = [];
|
|
142
144
|
|
|
145
|
+
/**
|
|
146
|
+
* @internal
|
|
147
|
+
*/
|
|
148
|
+
@consume({ context: mutationLinkTemplateContext, subscribe: true })
|
|
149
|
+
mutationLinkTemplate: MutationLinkTemplate = {};
|
|
150
|
+
|
|
143
151
|
override render() {
|
|
144
152
|
return (
|
|
145
153
|
<MutationAnnotationsContextProvider value={this.mutationAnnotations}>
|
|
146
|
-
<
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
154
|
+
<MutationLinkTemplateContextProvider value={this.mutationLinkTemplate}>
|
|
155
|
+
<MutationsOverTime
|
|
156
|
+
lapisFilter={this.lapisFilter}
|
|
157
|
+
sequenceType={this.sequenceType}
|
|
158
|
+
views={this.views}
|
|
159
|
+
width={this.width}
|
|
160
|
+
height={this.height}
|
|
161
|
+
granularity={this.granularity}
|
|
162
|
+
lapisDateField={this.lapisDateField}
|
|
163
|
+
displayMutations={this.displayMutations}
|
|
164
|
+
initialMeanProportionInterval={this.initialMeanProportionInterval}
|
|
165
|
+
hideGaps={this.hideGaps}
|
|
166
|
+
useNewEndpoint={this.useNewEndpoint}
|
|
167
|
+
pageSizes={this.pageSizes}
|
|
168
|
+
/>
|
|
169
|
+
</MutationLinkTemplateContextProvider>
|
|
160
170
|
</MutationAnnotationsContextProvider>
|
|
161
171
|
);
|
|
162
172
|
}
|
|
@@ -3,10 +3,12 @@ import { customElement, property } from 'lit/decorators.js';
|
|
|
3
3
|
import type { DetailedHTMLProps, HTMLAttributes } from 'react';
|
|
4
4
|
|
|
5
5
|
import { MutationAnnotationsContextProvider } from '../../preact/MutationAnnotationsContext';
|
|
6
|
+
import { MutationLinkTemplateContextProvider } from '../../preact/MutationLinkTemplateContext';
|
|
6
7
|
import { Mutations, type MutationsProps } from '../../preact/mutations/mutations';
|
|
7
8
|
import type { Equals, Expect } from '../../utils/typeAssertions';
|
|
8
9
|
import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsStyles';
|
|
9
10
|
import { type MutationAnnotations, mutationAnnotationsContext } from '../mutation-annotations-context';
|
|
11
|
+
import { type MutationLinkTemplate, mutationLinkTemplateContext } from '../mutation-link-template-context';
|
|
10
12
|
|
|
11
13
|
/**
|
|
12
14
|
* ## Context
|
|
@@ -134,18 +136,26 @@ export class MutationsComponent extends PreactLitAdapterWithGridJsStyles {
|
|
|
134
136
|
@consume({ context: mutationAnnotationsContext, subscribe: true })
|
|
135
137
|
mutationAnnotations: MutationAnnotations = [];
|
|
136
138
|
|
|
139
|
+
/**
|
|
140
|
+
* @internal
|
|
141
|
+
*/
|
|
142
|
+
@consume({ context: mutationLinkTemplateContext, subscribe: true })
|
|
143
|
+
mutationLinkTemplate: MutationLinkTemplate = {};
|
|
144
|
+
|
|
137
145
|
override render() {
|
|
138
146
|
return (
|
|
139
147
|
<MutationAnnotationsContextProvider value={this.mutationAnnotations}>
|
|
140
|
-
<
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
148
|
+
<MutationLinkTemplateContextProvider value={this.mutationLinkTemplate}>
|
|
149
|
+
<Mutations
|
|
150
|
+
lapisFilter={this.lapisFilter}
|
|
151
|
+
sequenceType={this.sequenceType}
|
|
152
|
+
views={this.views}
|
|
153
|
+
width={this.width}
|
|
154
|
+
height={this.height}
|
|
155
|
+
pageSize={this.pageSize}
|
|
156
|
+
baselineLapisFilter={this.baselineLapisFilter}
|
|
157
|
+
/>
|
|
158
|
+
</MutationLinkTemplateContextProvider>
|
|
149
159
|
</MutationAnnotationsContextProvider>
|
|
150
160
|
);
|
|
151
161
|
}
|
|
@@ -3,9 +3,11 @@ import { customElement, property } from 'lit/decorators.js';
|
|
|
3
3
|
import { type DetailedHTMLProps, type HTMLAttributes } from 'react';
|
|
4
4
|
|
|
5
5
|
import { MutationAnnotationsContextProvider } from '../../preact/MutationAnnotationsContext';
|
|
6
|
+
import { MutationLinkTemplateContextProvider } from '../../preact/MutationLinkTemplateContext';
|
|
6
7
|
import { WastewaterMutationsOverTime } from '../../preact/wastewater/mutationsOverTime/wastewater-mutations-over-time';
|
|
7
8
|
import { PreactLitAdapterWithGridJsStyles } from '../PreactLitAdapterWithGridJsStyles';
|
|
8
9
|
import { type MutationAnnotations, mutationAnnotationsContext } from '../mutation-annotations-context';
|
|
10
|
+
import { type MutationLinkTemplate, mutationLinkTemplateContext } from '../mutation-link-template-context';
|
|
9
11
|
|
|
10
12
|
/**
|
|
11
13
|
* ## Context
|
|
@@ -79,16 +81,24 @@ export class WastewaterMutationsOverTimeComponent extends PreactLitAdapterWithGr
|
|
|
79
81
|
@consume({ context: mutationAnnotationsContext, subscribe: true })
|
|
80
82
|
mutationAnnotations: MutationAnnotations = [];
|
|
81
83
|
|
|
84
|
+
/**
|
|
85
|
+
* @internal
|
|
86
|
+
*/
|
|
87
|
+
@consume({ context: mutationLinkTemplateContext, subscribe: true })
|
|
88
|
+
mutationLinkTemplate: MutationLinkTemplate = {};
|
|
89
|
+
|
|
82
90
|
override render() {
|
|
83
91
|
return (
|
|
84
92
|
<MutationAnnotationsContextProvider value={this.mutationAnnotations}>
|
|
85
|
-
<
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
93
|
+
<MutationLinkTemplateContextProvider value={this.mutationLinkTemplate}>
|
|
94
|
+
<WastewaterMutationsOverTime
|
|
95
|
+
lapisFilter={this.lapisFilter}
|
|
96
|
+
sequenceType={this.sequenceType}
|
|
97
|
+
width={this.width}
|
|
98
|
+
height={this.height}
|
|
99
|
+
pageSizes={this.pageSizes}
|
|
100
|
+
/>
|
|
101
|
+
</MutationLinkTemplateContextProvider>
|
|
92
102
|
</MutationAnnotationsContextProvider>
|
|
93
103
|
);
|
|
94
104
|
}
|