@genspectrum/dashboard-components 0.19.2 → 0.19.3
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/custom-elements.json +160 -10
- package/dist/{LineageFilterChangedEvent-ixHQkq8y.js → LineageFilterChangedEvent-b0iuroUL.js} +15 -5
- package/dist/LineageFilterChangedEvent-b0iuroUL.js.map +1 -0
- package/dist/assets/mutationOverTimeWorker-ChQTFL68.js.map +1 -1
- package/dist/components.d.ts +71 -25
- package/dist/components.js +9047 -8699
- package/dist/components.js.map +1 -1
- package/dist/util.d.ts +51 -25
- package/dist/util.js +2 -1
- package/package.json +1 -1
- package/src/componentsEntrypoint.ts +3 -1
- package/src/preact/components/error-display.stories.tsx +2 -1
- package/src/preact/components/error-display.tsx +2 -3
- package/src/preact/components/resize-container.tsx +7 -10
- package/src/preact/components/tooltip.tsx +7 -4
- package/src/preact/dateRangeFilter/date-range-filter.stories.tsx +5 -4
- package/src/preact/dateRangeFilter/date-range-filter.tsx +2 -1
- package/src/preact/dateRangeFilter/dateRangeOption.ts +2 -1
- package/src/preact/genomeViewer/CDSPlot.tsx +219 -0
- package/src/preact/genomeViewer/genome-data-viewer.stories.tsx +113 -0
- package/src/preact/genomeViewer/genome-data-viewer.tsx +69 -0
- package/src/preact/genomeViewer/loadGff3.spec.ts +61 -0
- package/src/preact/genomeViewer/loadGff3.ts +174 -0
- package/src/preact/lineageFilter/LineageFilterChangedEvent.ts +3 -1
- package/src/preact/lineageFilter/lineage-filter.stories.tsx +3 -2
- package/src/preact/locationFilter/LocationChangedEvent.ts +2 -1
- package/src/preact/locationFilter/location-filter.stories.tsx +3 -2
- package/src/preact/mutationFilter/mutation-filter.stories.tsx +3 -2
- package/src/preact/mutationFilter/mutation-filter.tsx +2 -1
- package/src/preact/shared/charts/colors.ts +1 -1
- package/src/preact/textFilter/TextFilterChangedEvent.ts +3 -1
- package/src/preact/textFilter/text-filter.stories.tsx +4 -3
- package/src/utilEntrypoint.ts +2 -0
- package/src/utils/gsEventNames.ts +9 -0
- package/src/web-components/input/gs-date-range-filter.stories.ts +4 -3
- package/src/web-components/input/gs-date-range-filter.tsx +3 -2
- package/src/web-components/input/gs-lineage-filter.stories.ts +3 -2
- package/src/web-components/input/gs-lineage-filter.tsx +2 -1
- package/src/web-components/input/gs-location-filter.stories.ts +3 -2
- package/src/web-components/input/gs-location-filter.tsx +2 -1
- package/src/web-components/input/gs-mutation-filter.stories.ts +3 -2
- package/src/web-components/input/gs-mutation-filter.tsx +2 -1
- package/src/web-components/input/gs-text-filter.stories.ts +3 -2
- package/src/web-components/input/gs-text-filter.tsx +2 -1
- package/src/web-components/visualization/gs-genome-data-viewer.spec-d.ts +18 -0
- package/src/web-components/visualization/gs-genome-data-viewer.stories.ts +108 -0
- package/src/web-components/visualization/gs-genome-data-viewer.tsx +59 -0
- package/src/web-components/visualization/index.ts +1 -0
- package/standalone-bundle/assets/mutationOverTimeWorker-jChgWnwp.js.map +1 -1
- package/standalone-bundle/dashboard-components.js +8275 -8002
- package/standalone-bundle/dashboard-components.js.map +1 -1
- package/dist/LineageFilterChangedEvent-ixHQkq8y.js.map +0 -1
|
@@ -9,6 +9,7 @@ import '../gs-app';
|
|
|
9
9
|
import './gs-lineage-filter';
|
|
10
10
|
import aggregatedData from '../../preact/lineageFilter/__mockData__/aggregated.json';
|
|
11
11
|
import { type LineageFilterProps } from '../../preact/lineageFilter/lineage-filter';
|
|
12
|
+
import { gsEventNames } from '../../utils/gsEventNames';
|
|
12
13
|
import { withinShadowRoot } from '../withinShadowRoot.story';
|
|
13
14
|
|
|
14
15
|
const codeExample = String.raw`
|
|
@@ -25,7 +26,7 @@ const meta: Meta<Required<LineageFilterProps>> = {
|
|
|
25
26
|
component: 'gs-lineage-filter',
|
|
26
27
|
parameters: withComponentDocs({
|
|
27
28
|
actions: {
|
|
28
|
-
handles: [
|
|
29
|
+
handles: [gsEventNames.lineageFilterChanged, ...previewHandles],
|
|
29
30
|
},
|
|
30
31
|
fetchMock: {
|
|
31
32
|
mocks: [
|
|
@@ -182,7 +183,7 @@ export const FiresEvent: StoryObj<Required<LineageFilterProps>> = {
|
|
|
182
183
|
const inputField = () => canvas.getByPlaceholderText('Enter a lineage');
|
|
183
184
|
const listenerMock = fn();
|
|
184
185
|
await step('Setup event listener mock', () => {
|
|
185
|
-
canvasElement.addEventListener(
|
|
186
|
+
canvasElement.addEventListener(gsEventNames.lineageFilterChanged, listenerMock);
|
|
186
187
|
});
|
|
187
188
|
|
|
188
189
|
await step('wait until data is loaded', async () => {
|
|
@@ -3,6 +3,7 @@ import type { DetailedHTMLProps, HTMLAttributes } from 'react';
|
|
|
3
3
|
|
|
4
4
|
import { type LineageFilterChangedEvent } from '../../preact/lineageFilter/LineageFilterChangedEvent';
|
|
5
5
|
import { LineageFilter, type LineageFilterProps } from '../../preact/lineageFilter/lineage-filter';
|
|
6
|
+
import { type gsEventNames } from '../../utils/gsEventNames';
|
|
6
7
|
import type { Equals, Expect } from '../../utils/typeAssertions';
|
|
7
8
|
import { PreactLitAdapter } from '../PreactLitAdapter';
|
|
8
9
|
|
|
@@ -91,7 +92,7 @@ declare global {
|
|
|
91
92
|
}
|
|
92
93
|
|
|
93
94
|
interface HTMLElementEventMap {
|
|
94
|
-
|
|
95
|
+
[gsEventNames.lineageFilterChanged]: LineageFilterChangedEvent;
|
|
95
96
|
}
|
|
96
97
|
}
|
|
97
98
|
|
|
@@ -10,6 +10,7 @@ import '../gs-app';
|
|
|
10
10
|
import './gs-location-filter';
|
|
11
11
|
import data from '../../preact/locationFilter/__mockData__/aggregated.json';
|
|
12
12
|
import { type LocationFilterProps } from '../../preact/locationFilter/location-filter';
|
|
13
|
+
import { gsEventNames } from '../../utils/gsEventNames';
|
|
13
14
|
import { withinShadowRoot } from '../withinShadowRoot.story';
|
|
14
15
|
|
|
15
16
|
const codeExample = String.raw`
|
|
@@ -26,7 +27,7 @@ const meta: Meta = {
|
|
|
26
27
|
component: 'gs-location-filter',
|
|
27
28
|
parameters: withComponentDocs({
|
|
28
29
|
actions: {
|
|
29
|
-
handles: [
|
|
30
|
+
handles: [gsEventNames.locationChanged, ...previewHandles],
|
|
30
31
|
},
|
|
31
32
|
componentDocs: {
|
|
32
33
|
opensShadowDom: true,
|
|
@@ -189,7 +190,7 @@ export const FiresEvent: StoryObj<LocationFilterProps> = {
|
|
|
189
190
|
|
|
190
191
|
const listenerMock = fn();
|
|
191
192
|
await step('Setup event listener mock', () => {
|
|
192
|
-
canvasElement.addEventListener(
|
|
193
|
+
canvasElement.addEventListener(gsEventNames.locationChanged, listenerMock);
|
|
193
194
|
});
|
|
194
195
|
|
|
195
196
|
await step('wait until data is loaded', async () => {
|
|
@@ -3,6 +3,7 @@ import type { DetailedHTMLProps, HTMLAttributes } from 'react';
|
|
|
3
3
|
|
|
4
4
|
import { type LocationChangedEvent } from '../../preact/locationFilter/LocationChangedEvent';
|
|
5
5
|
import { LocationFilter, type LocationFilterProps } from '../../preact/locationFilter/location-filter';
|
|
6
|
+
import { type gsEventNames } from '../../utils/gsEventNames';
|
|
6
7
|
import type { Equals, Expect } from '../../utils/typeAssertions';
|
|
7
8
|
import { PreactLitAdapter } from '../PreactLitAdapter';
|
|
8
9
|
|
|
@@ -95,7 +96,7 @@ declare global {
|
|
|
95
96
|
}
|
|
96
97
|
|
|
97
98
|
interface HTMLElementEventMap {
|
|
98
|
-
|
|
99
|
+
[gsEventNames.locationChanged]: LocationChangedEvent;
|
|
99
100
|
}
|
|
100
101
|
}
|
|
101
102
|
|
|
@@ -7,6 +7,7 @@ import { previewHandles } from '../../../.storybook/preview';
|
|
|
7
7
|
import { LAPIS_URL, REFERENCE_GENOME_ENDPOINT } from '../../constants';
|
|
8
8
|
import '../gs-app';
|
|
9
9
|
import { type MutationFilterProps } from '../../preact/mutationFilter/mutation-filter';
|
|
10
|
+
import { gsEventNames } from '../../utils/gsEventNames';
|
|
10
11
|
import { withinShadowRoot } from '../withinShadowRoot.story';
|
|
11
12
|
import './gs-mutation-filter';
|
|
12
13
|
|
|
@@ -21,7 +22,7 @@ const meta: Meta<MutationFilterProps> = {
|
|
|
21
22
|
component: 'gs-mutation-filter',
|
|
22
23
|
parameters: withComponentDocs({
|
|
23
24
|
actions: {
|
|
24
|
-
handles: [
|
|
25
|
+
handles: [gsEventNames.mutationFilterChanged, ...previewHandles],
|
|
25
26
|
},
|
|
26
27
|
fetchMock: {},
|
|
27
28
|
componentDocs: {
|
|
@@ -73,7 +74,7 @@ export const FiresFilterChangedEvent: StoryObj<MutationFilterProps> = {
|
|
|
73
74
|
const inputField = () => canvas.getByPlaceholderText('Enter a mutation', { exact: false });
|
|
74
75
|
const listenerMock = fn();
|
|
75
76
|
await step('Setup event listener mock', () => {
|
|
76
|
-
canvasElement.addEventListener(
|
|
77
|
+
canvasElement.addEventListener(gsEventNames.mutationFilterChanged, listenerMock);
|
|
77
78
|
});
|
|
78
79
|
|
|
79
80
|
await step('wait until data is loaded', async () => {
|
|
@@ -4,6 +4,7 @@ import type { DetailedHTMLProps, HTMLAttributes } from 'react';
|
|
|
4
4
|
import { ReferenceGenomesAwaiter } from '../../preact/components/ReferenceGenomesAwaiter';
|
|
5
5
|
import { MutationFilter, type MutationFilterProps } from '../../preact/mutationFilter/mutation-filter';
|
|
6
6
|
import type { MutationsFilter } from '../../types';
|
|
7
|
+
import { type gsEventNames } from '../../utils/gsEventNames';
|
|
7
8
|
import type { Equals, Expect } from '../../utils/typeAssertions';
|
|
8
9
|
import { PreactLitAdapter } from '../PreactLitAdapter';
|
|
9
10
|
|
|
@@ -95,7 +96,7 @@ declare global {
|
|
|
95
96
|
}
|
|
96
97
|
|
|
97
98
|
interface HTMLElementEventMap {
|
|
98
|
-
|
|
99
|
+
[gsEventNames.mutationFilterChanged]: CustomEvent<MutationsFilter>;
|
|
99
100
|
}
|
|
100
101
|
}
|
|
101
102
|
|
|
@@ -9,6 +9,7 @@ import '../gs-app';
|
|
|
9
9
|
import './gs-text-filter';
|
|
10
10
|
import data from '../../preact/textFilter/__mockData__/aggregated_hosts.json';
|
|
11
11
|
import type { TextFilterProps } from '../../preact/textFilter/text-filter';
|
|
12
|
+
import { gsEventNames } from '../../utils/gsEventNames';
|
|
12
13
|
import { withinShadowRoot } from '../withinShadowRoot.story';
|
|
13
14
|
|
|
14
15
|
const codeExample = String.raw`
|
|
@@ -25,7 +26,7 @@ const meta: Meta<Required<TextFilterProps>> = {
|
|
|
25
26
|
component: 'gs-text-filter',
|
|
26
27
|
parameters: withComponentDocs({
|
|
27
28
|
actions: {
|
|
28
|
-
handles: [
|
|
29
|
+
handles: [gsEventNames.textFilterChanged, ...previewHandles],
|
|
29
30
|
},
|
|
30
31
|
fetchMock: {
|
|
31
32
|
mocks: [
|
|
@@ -114,7 +115,7 @@ export const FiresEvents: StoryObj<Required<TextFilterProps>> = {
|
|
|
114
115
|
const inputField = () => canvas.getByPlaceholderText('Enter host name');
|
|
115
116
|
const listenerMock = fn();
|
|
116
117
|
await step('Setup event listener mock', () => {
|
|
117
|
-
canvasElement.addEventListener(
|
|
118
|
+
canvasElement.addEventListener(gsEventNames.textFilterChanged, listenerMock);
|
|
118
119
|
});
|
|
119
120
|
|
|
120
121
|
await step('wait until data is loaded', async () => {
|
|
@@ -3,6 +3,7 @@ import type { DetailedHTMLProps, HTMLAttributes } from 'react';
|
|
|
3
3
|
|
|
4
4
|
import { type TextFilterChangedEvent } from '../../preact/textFilter/TextFilterChangedEvent';
|
|
5
5
|
import { TextFilter, type TextFilterProps } from '../../preact/textFilter/text-filter';
|
|
6
|
+
import { type gsEventNames } from '../../utils/gsEventNames';
|
|
6
7
|
import type { Equals, Expect } from '../../utils/typeAssertions';
|
|
7
8
|
import { PreactLitAdapter } from '../PreactLitAdapter';
|
|
8
9
|
|
|
@@ -85,7 +86,7 @@ declare global {
|
|
|
85
86
|
}
|
|
86
87
|
|
|
87
88
|
interface HTMLElementEventMap {
|
|
88
|
-
|
|
89
|
+
[gsEventNames.textFilterChanged]: TextFilterChangedEvent;
|
|
89
90
|
}
|
|
90
91
|
}
|
|
91
92
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { describe, expectTypeOf, test } from 'vitest';
|
|
2
|
+
|
|
3
|
+
import { GenomeDataViewerComponent } from './gs-genome-data-viewer';
|
|
4
|
+
import type { GenomeDataViewerProps } from '../../preact/genomeViewer/genome-data-viewer';
|
|
5
|
+
|
|
6
|
+
describe('gs-app types', () => {
|
|
7
|
+
test('mutationAnnotations type should match', ({}) => {
|
|
8
|
+
expectTypeOf(GenomeDataViewerComponent.prototype)
|
|
9
|
+
.toHaveProperty('gff3Source')
|
|
10
|
+
.toEqualTypeOf<GenomeDataViewerProps['gff3Source']>();
|
|
11
|
+
expectTypeOf(GenomeDataViewerComponent.prototype)
|
|
12
|
+
.toHaveProperty('genomeLength')
|
|
13
|
+
.toEqualTypeOf<GenomeDataViewerProps['genomeLength']>();
|
|
14
|
+
expectTypeOf(GenomeDataViewerComponent.prototype)
|
|
15
|
+
.toHaveProperty('width')
|
|
16
|
+
.toEqualTypeOf<GenomeDataViewerProps['width']>();
|
|
17
|
+
});
|
|
18
|
+
});
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { expect, waitFor } from '@storybook/test';
|
|
2
|
+
import type { Meta, StoryObj } from '@storybook/web-components';
|
|
3
|
+
import { html } from 'lit';
|
|
4
|
+
|
|
5
|
+
import './gs-genome-data-viewer';
|
|
6
|
+
import '../gs-app';
|
|
7
|
+
import { withComponentDocs } from '../../../.storybook/ComponentDocsBlock';
|
|
8
|
+
import { LAPIS_URL } from '../../constants';
|
|
9
|
+
import type { GenomeDataViewerProps } from '../../preact/genomeViewer/genome-data-viewer';
|
|
10
|
+
import { withinShadowRoot } from '../withinShadowRoot.story';
|
|
11
|
+
|
|
12
|
+
const codeExample = String.raw`
|
|
13
|
+
<gs-genome-data-viewer
|
|
14
|
+
gff3Source='https://raw.githubusercontent.com/nextstrain/nextclade_data/8f2e791d3a59013ee88e1d1d7e83b486d39c4ecb/data/nextstrain/wnv/all-lineages/genome_annotation.gff3'
|
|
15
|
+
genomeLength='11029'
|
|
16
|
+
width='100%'
|
|
17
|
+
></gs-genome-data-viewer>`;
|
|
18
|
+
|
|
19
|
+
const meta: Meta<Required<GenomeDataViewerProps>> = {
|
|
20
|
+
title: 'Visualization/Genome Data Viewer',
|
|
21
|
+
component: 'gs-genome-data-viewer',
|
|
22
|
+
argTypes: {
|
|
23
|
+
gff3Source: { control: 'text' },
|
|
24
|
+
genomeLength: { control: 'number' },
|
|
25
|
+
width: { control: 'text' },
|
|
26
|
+
},
|
|
27
|
+
parameters: withComponentDocs({
|
|
28
|
+
componentDocs: {
|
|
29
|
+
opensShadowDom: true,
|
|
30
|
+
expectsChildren: false,
|
|
31
|
+
codeExample,
|
|
32
|
+
},
|
|
33
|
+
}),
|
|
34
|
+
tags: ['autodocs'],
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default meta;
|
|
38
|
+
|
|
39
|
+
const Template: StoryObj<Required<GenomeDataViewerProps>> = {
|
|
40
|
+
render: (args) => html`
|
|
41
|
+
<gs-app lapis="${LAPIS_URL}">
|
|
42
|
+
<gs-genome-data-viewer
|
|
43
|
+
.genomeLength=${args.genomeLength}
|
|
44
|
+
.gff3Source=${args.gff3Source}
|
|
45
|
+
.width=${args.width}
|
|
46
|
+
></gs-genome-data-viewer>
|
|
47
|
+
</gs-app>
|
|
48
|
+
`,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const SimpleData = `
|
|
52
|
+
##gff-version 3
|
|
53
|
+
#!gff-spec-version 1.21
|
|
54
|
+
#!processor NCBI annotwriter
|
|
55
|
+
##sequence-region NC_009942.1 1 11029
|
|
56
|
+
##species https://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?id=11082
|
|
57
|
+
NC_009942.1 RefSeq region 1 11029 . + . ID=NC_009942.1:1..11029;Dbxref=taxon:11082;country=USA;gb-acronym=WNV;gbkey=Src;genome=genomic;isolate=385-99;mol_type=genomic RNA;note=lineage 1%3B Vero cell passage 2 after isolation;strain=NY99
|
|
58
|
+
NC_009942.1 RefSeq gene 97 10395 . + . gene=POLY;ID=gene-WNVNY99_gp1;gbkey=Prot;product=anchored capsid protein ancC;protein_id=YP_005097850.1
|
|
59
|
+
NC_009942.1 RefSeq CDS 97 465 . + . gene=capsid;Parent=gene-WNVNY99_gp1;gbkey=Prot;product=anchored capsid protein ancC;protein_id=YP_005097850.1
|
|
60
|
+
NC_009942.1 RefSeq CDS 466 966 . + . gene=prM;Parent=gene-WNVNY99_gp1;gbkey=Prot;product=protein pr;protein_id=YP_009164953.1
|
|
61
|
+
NC_009942.1 RefSeq CDS 967 2469 . + . gene=env;Parent=gene-WNVNY99_gp1;gbkey=Prot;product=envelope protein E;protein_id=YP_001527880.1
|
|
62
|
+
NC_009942.1 RefSeq CDS 2470 3525 . + . gene=NS1;Parent=gene-WNVNY99_gp1;gbkey=Prot;product=nonstructural protein NS1;protein_id=YP_001527881.1
|
|
63
|
+
NC_009942.1 RefSeq CDS 3526 4218 . + . gene=NS2A;Parent=gene-WNVNY99_gp1;gbkey=Prot;product=nonstructural protein NS2A;protein_id=YP_001527882.1
|
|
64
|
+
NC_009942.1 RefSeq CDS 4219 4611 . + . gene=NS2B;Parent=gene-WNVNY99_gp1;gbkey=Prot;product=nonstructural protein NS2B;protein_id=YP_001527883.1
|
|
65
|
+
NC_009942.1 RefSeq CDS 4612 6468 . + . gene=NS3;Parent=gene-WNVNY99_gp1;gbkey=Prot;product=nonstructural protein NS3;protein_id=YP_001527884.1
|
|
66
|
+
NC_009942.1 RefSeq CDS 6469 6846 . + . gene=NS4A;Parent=gene-WNVNY99_gp1;gbkey=Prot;product=nonstructural protein NS4A;protein_id=YP_001527885.1
|
|
67
|
+
NC_009942.1 RefSeq CDS 6847 6915 . + . gene=2K;Parent=gene-WNVNY99_gp1;gbkey=Prot;product=protein 2K;protein_id=YP_001527885.1
|
|
68
|
+
NC_009942.1 RefSeq CDS 6916 7680 . + . gene=NS4B;Parent=gene-WNVNY99_gp1;gbkey=Prot;product=nonstructural protein NS4B;protein_id=YP_001527886.1
|
|
69
|
+
NC_009942.1 RefSeq CDS 7681 10395 . + . gene=NS5;Parent=gene-WNVNY99_gp1;gbkey=Prot;product=RNA-dependent RNA polymerase NS5;protein_id=YP_001527887.1
|
|
70
|
+
`;
|
|
71
|
+
export const Default: StoryObj<Required<GenomeDataViewerProps>> = {
|
|
72
|
+
...Template,
|
|
73
|
+
args: {
|
|
74
|
+
genomeLength: 11029,
|
|
75
|
+
gff3Source: 'https://gff3Url',
|
|
76
|
+
width: '100%',
|
|
77
|
+
},
|
|
78
|
+
parameters: {
|
|
79
|
+
fetchMock: {
|
|
80
|
+
mocks: [
|
|
81
|
+
{
|
|
82
|
+
matcher: {
|
|
83
|
+
name: 'gff3Data',
|
|
84
|
+
url: 'https://gff3Url',
|
|
85
|
+
},
|
|
86
|
+
response: {
|
|
87
|
+
status: 200,
|
|
88
|
+
body: SimpleData,
|
|
89
|
+
headers: {
|
|
90
|
+
'Content-Type': 'text/plain',
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
play: async ({ canvasElement, step }) => {
|
|
98
|
+
const canvas = await withinShadowRoot(canvasElement, 'gs-genome-data-viewer');
|
|
99
|
+
|
|
100
|
+
await step('CDS visible', async () => {
|
|
101
|
+
const ns1NameMatches = await canvas.findAllByText('NS1');
|
|
102
|
+
await waitFor(async () => expect(ns1NameMatches[0]).toBeVisible());
|
|
103
|
+
const xAxisTick = await canvas.findAllByText('1000');
|
|
104
|
+
await waitFor(async () => expect(xAxisTick[0]).toBeVisible());
|
|
105
|
+
await waitFor(async () => expect(xAxisTick.length).toBe(2));
|
|
106
|
+
});
|
|
107
|
+
},
|
|
108
|
+
};
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
2
|
+
import type { DetailedHTMLProps, HTMLAttributes } from 'react';
|
|
3
|
+
|
|
4
|
+
import { GenomeDataViewer } from '../../preact/genomeViewer/genome-data-viewer';
|
|
5
|
+
import { PreactLitAdapter } from '../PreactLitAdapter';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* ## Context
|
|
9
|
+
*
|
|
10
|
+
* This component shows the Coding Sequence (CDS) of a genome using a gff3 file as input.
|
|
11
|
+
* The CDS shows which parts of the genome are translated into proteins.
|
|
12
|
+
*
|
|
13
|
+
*/
|
|
14
|
+
@customElement('gs-genome-data-viewer')
|
|
15
|
+
export class GenomeDataViewerComponent extends PreactLitAdapter {
|
|
16
|
+
/**
|
|
17
|
+
* Required
|
|
18
|
+
*
|
|
19
|
+
* The source of the gff3 file. Any spec-compliant gff3 should be accepted, however we use the same format as Nextclade.
|
|
20
|
+
* See https://docs.nextstrain.org/projects/nextclade/en/stable/user/input-files/03-genome-annotation.html for more information.
|
|
21
|
+
* We only use the CDS and gene features from the gff3 file, if you have other features in the gff3 file they will be ignored.
|
|
22
|
+
* Also note that if a CDS has a gene feature as a parent, the gene feature will be ignored.
|
|
23
|
+
*/
|
|
24
|
+
@property({ type: String })
|
|
25
|
+
gff3Source: string = '';
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* The length of the genome, if this is not given it will be computed from the `sequence-region` line of the start of the gff3 file.
|
|
29
|
+
*/
|
|
30
|
+
@property({ type: Number })
|
|
31
|
+
genomeLength: number | undefined = 0;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The width of the component.
|
|
35
|
+
*
|
|
36
|
+
* Visit https://genspectrum.github.io/dashboard-components/?path=/docs/concepts-size-of-components--docs for more information.
|
|
37
|
+
*/
|
|
38
|
+
@property({ type: String })
|
|
39
|
+
width: string = '100%';
|
|
40
|
+
|
|
41
|
+
override render() {
|
|
42
|
+
return <GenomeDataViewer gff3Source={this.gff3Source} genomeLength={this.genomeLength} width={this.width} />;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
declare global {
|
|
47
|
+
interface HTMLElementTagNameMap {
|
|
48
|
+
'gs-genome-data-viewer': GenomeDataViewerComponent;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
declare global {
|
|
53
|
+
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
54
|
+
namespace JSX {
|
|
55
|
+
interface IntrinsicElements {
|
|
56
|
+
'gs-genome-data-viewer': DetailedHTMLProps<HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|