@genspectrum/dashboard-components 0.1.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/LICENSE +661 -0
- package/README.md +109 -0
- package/custom-elements.json +1587 -0
- package/dist/dashboard-components.js +7322 -0
- package/dist/dashboard-components.js.map +1 -0
- package/dist/genspectrum-components.d.ts +298 -0
- package/dist/style.css +2930 -0
- package/package.json +109 -0
- package/src/constants.ts +6 -0
- package/src/index.ts +1 -0
- package/src/lapisApi/ReferenceGenome.ts +30 -0
- package/src/lapisApi/__mockData__/referenceGenome.json +58 -0
- package/src/lapisApi/lapisApi.ts +99 -0
- package/src/lapisApi/lapisTypes.ts +51 -0
- package/src/operator/Dataset.ts +3 -0
- package/src/operator/DivisionOperator.spec.ts +27 -0
- package/src/operator/DivisionOperator.ts +60 -0
- package/src/operator/FetchAggregatedOperator.ts +44 -0
- package/src/operator/FetchInsertionsOperator.ts +24 -0
- package/src/operator/FetchSubstitutionsOrDeletionsOperator.ts +49 -0
- package/src/operator/FillMissingOperator.spec.ts +26 -0
- package/src/operator/FillMissingOperator.ts +30 -0
- package/src/operator/GroupByAndSumOperator.spec.ts +26 -0
- package/src/operator/GroupByAndSumOperator.ts +26 -0
- package/src/operator/GroupByOperator.spec.ts +43 -0
- package/src/operator/GroupByOperator.ts +32 -0
- package/src/operator/MapOperator.spec.ts +13 -0
- package/src/operator/MapOperator.ts +16 -0
- package/src/operator/MockOperator.spec.ts +11 -0
- package/src/operator/MockOperator.ts +12 -0
- package/src/operator/Operator.ts +5 -0
- package/src/operator/SlidingOperator.spec.ts +52 -0
- package/src/operator/SlidingOperator.ts +23 -0
- package/src/operator/SortOperator.spec.ts +13 -0
- package/src/operator/SortOperator.ts +16 -0
- package/src/preact/LapisUrlContext.ts +3 -0
- package/src/preact/ReferenceGenomeContext.ts +5 -0
- package/src/preact/components/SegmentSelector.tsx +62 -0
- package/src/preact/components/chart.stories.tsx +42 -0
- package/src/preact/components/chart.tsx +32 -0
- package/src/preact/components/checkbox-selector.stories.tsx +56 -0
- package/src/preact/components/checkbox-selector.tsx +46 -0
- package/src/preact/components/confidence-interval-selector.tsx +45 -0
- package/src/preact/components/csv-download-button.stories.tsx +25 -0
- package/src/preact/components/csv-download-button.tsx +51 -0
- package/src/preact/components/error-display.stories.tsx +22 -0
- package/src/preact/components/error-display.tsx +5 -0
- package/src/preact/components/headline.stories.tsx +29 -0
- package/src/preact/components/headline.tsx +16 -0
- package/src/preact/components/info.stories.tsx +22 -0
- package/src/preact/components/info.tsx +16 -0
- package/src/preact/components/loading-display.stories.tsx +20 -0
- package/src/preact/components/loading-display.tsx +5 -0
- package/src/preact/components/min-max-percent-slider.css +40 -0
- package/src/preact/components/min-max-range-slider.tsx +95 -0
- package/src/preact/components/mutation-type-selector.tsx +30 -0
- package/src/preact/components/no-data-display.stories.tsx +20 -0
- package/src/preact/components/no-data-display.tsx +5 -0
- package/src/preact/components/percent-intput.tsx +49 -0
- package/src/preact/components/proportion-selector-dropdown.stories.tsx +66 -0
- package/src/preact/components/proportion-selector-dropdown.tsx +33 -0
- package/src/preact/components/proportion-selector.stories.tsx +81 -0
- package/src/preact/components/proportion-selector.tsx +43 -0
- package/src/preact/components/scaling-selector.stories.tsx +25 -0
- package/src/preact/components/scaling-selector.tsx +36 -0
- package/src/preact/components/select.stories.tsx +42 -0
- package/src/preact/components/select.tsx +21 -0
- package/src/preact/components/table.stories.tsx +24 -0
- package/src/preact/components/table.tsx +51 -0
- package/src/preact/components/tabs.stories.tsx +60 -0
- package/src/preact/components/tabs.tsx +49 -0
- package/src/preact/dateRangeSelector/date-range-selector.stories.tsx +32 -0
- package/src/preact/dateRangeSelector/date-range-selector.tsx +228 -0
- package/src/preact/dateRangeSelector/dateConversion.ts +8 -0
- package/src/preact/locationFilter/__mockData__/aggregated.json +775 -0
- package/src/preact/locationFilter/fetchAutocompletionList.spec.ts +36 -0
- package/src/preact/locationFilter/fetchAutocompletionList.ts +43 -0
- package/src/preact/locationFilter/location-filter.stories.tsx +50 -0
- package/src/preact/locationFilter/location-filter.tsx +112 -0
- package/src/preact/mutationComparison/__mockData__/nucleotideMutationsOtherVariant.json +295 -0
- package/src/preact/mutationComparison/__mockData__/nucleotideMutationsSomeVariant.json +304 -0
- package/src/preact/mutationComparison/fetchMutationData.spec.ts +118 -0
- package/src/preact/mutationComparison/getMutationComparisonTableData.spec.ts +125 -0
- package/src/preact/mutationComparison/getMutationComparisonTableData.ts +40 -0
- package/src/preact/mutationComparison/mutation-comparison-table.tsx +43 -0
- package/src/preact/mutationComparison/mutation-comparison-venn.tsx +122 -0
- package/src/preact/mutationComparison/mutation-comparison.stories.tsx +152 -0
- package/src/preact/mutationComparison/mutation-comparison.tsx +179 -0
- package/src/preact/mutationComparison/queryMutationData.ts +53 -0
- package/src/preact/mutationFilter/mutation-filter.stories.tsx +164 -0
- package/src/preact/mutationFilter/mutation-filter.tsx +268 -0
- package/src/preact/mutationFilter/parseAndValidateMutation.ts +54 -0
- package/src/preact/mutationFilter/parseMutation.spec.ts +150 -0
- package/src/preact/mutationFilter/sequenceTypeFromSegment.spec.ts +66 -0
- package/src/preact/mutationFilter/sequenceTypeFromSegment.ts +20 -0
- package/src/preact/mutations/__mockData__/nucleotideInsertions.json +252 -0
- package/src/preact/mutations/__mockData__/nucleotideMutations.json +880 -0
- package/src/preact/mutations/getInsertionsTableData.spec.ts +36 -0
- package/src/preact/mutations/getInsertionsTableData.ts +10 -0
- package/src/preact/mutations/getMutationsGridData.spec.ts +135 -0
- package/src/preact/mutations/getMutationsGridData.ts +92 -0
- package/src/preact/mutations/getMutationsTableData.spec.ts +94 -0
- package/src/preact/mutations/getMutationsTableData.ts +17 -0
- package/src/preact/mutations/mutations-grid.tsx +84 -0
- package/src/preact/mutations/mutations-insertions-table.tsx +33 -0
- package/src/preact/mutations/mutations-table.tsx +47 -0
- package/src/preact/mutations/mutations.stories.tsx +95 -0
- package/src/preact/mutations/mutations.tsx +192 -0
- package/src/preact/mutations/queryMutations.ts +55 -0
- package/src/preact/prevalenceOverTime/__mockData__/denominator.json +1700 -0
- package/src/preact/prevalenceOverTime/__mockData__/denominatorOneVariant.json +608 -0
- package/src/preact/prevalenceOverTime/__mockData__/numeratorEG.json +1560 -0
- package/src/preact/prevalenceOverTime/__mockData__/numeratorJN1.json +592 -0
- package/src/preact/prevalenceOverTime/__mockData__/numeratorOneVariant.json +604 -0
- package/src/preact/prevalenceOverTime/getPrevalenceOverTimeTableData.spec.ts +67 -0
- package/src/preact/prevalenceOverTime/getPrevalenceOverTimeTableData.ts +18 -0
- package/src/preact/prevalenceOverTime/prevalence-over-time-bar-chart.tsx +105 -0
- package/src/preact/prevalenceOverTime/prevalence-over-time-bubble-chart.tsx +86 -0
- package/src/preact/prevalenceOverTime/prevalence-over-time-line-chart.tsx +141 -0
- package/src/preact/prevalenceOverTime/prevalence-over-time-table.tsx +46 -0
- package/src/preact/prevalenceOverTime/prevalence-over-time.stories.tsx +165 -0
- package/src/preact/prevalenceOverTime/prevalence-over-time.tsx +202 -0
- package/src/preact/relativeGrowthAdvantage/__mockData__/denominator.json +376 -0
- package/src/preact/relativeGrowthAdvantage/__mockData__/numerator.json +332 -0
- package/src/preact/relativeGrowthAdvantage/relative-growth-advantage-chart.tsx +138 -0
- package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.stories.tsx +71 -0
- package/src/preact/relativeGrowthAdvantage/relative-growth-advantage.tsx +136 -0
- package/src/preact/shared/charts/LogitScale.ts +48 -0
- package/src/preact/shared/charts/colors.ts +26 -0
- package/src/preact/shared/charts/confideceInterval.ts +29 -0
- package/src/preact/shared/charts/getYAxisScale.ts +16 -0
- package/src/preact/shared/charts/scales.ts +16 -0
- package/src/preact/shared/icons/DeleteIcon.tsx +17 -0
- package/src/preact/shared/sort/sortInsertions.spec.ts +47 -0
- package/src/preact/shared/sort/sortInsertions.ts +21 -0
- package/src/preact/shared/sort/sortMutationPositions.spec.ts +31 -0
- package/src/preact/shared/sort/sortMutationPositions.ts +14 -0
- package/src/preact/shared/sort/sortSubstitutionsAndDeletions.spec.ts +47 -0
- package/src/preact/shared/sort/sortSubstitutionsAndDeletions.ts +17 -0
- package/src/preact/shared/table/formatProportion.ts +3 -0
- package/src/preact/textInput/__mockData__/aggregated_hosts.json +24 -0
- package/src/preact/textInput/fetchAutocompleteList.ts +9 -0
- package/src/preact/textInput/text-input.stories.tsx +49 -0
- package/src/preact/textInput/text-input.tsx +73 -0
- package/src/preact/useQuery.ts +27 -0
- package/src/query/queryInsertions.ts +14 -0
- package/src/query/queryPrevalenceOverTime.ts +126 -0
- package/src/query/queryRelativeGrowthAdvantage.ts +131 -0
- package/src/query/querySubstitutionsOrDeletions.ts +19 -0
- package/src/styles/tailwind.css +3 -0
- package/src/styles/tailwind.d.ts +3 -0
- package/src/types.ts +23 -0
- package/src/utils/mutations.spec.ts +64 -0
- package/src/utils/mutations.ts +165 -0
- package/src/utils/temporal.spec.ts +97 -0
- package/src/utils/temporal.ts +348 -0
- package/src/utils/test-utils.ts +5 -0
- package/src/utils/type-utils.ts +15 -0
- package/src/utils/utils.spec.ts +16 -0
- package/src/utils/utils.ts +38 -0
- package/src/web-components/PreactLitAdapter.tsx +62 -0
- package/src/web-components/PreactLitAdapterWithGridJsStyles.tsx +12 -0
- package/src/web-components/app.ts +51 -0
- package/src/web-components/display/index.ts +4 -0
- package/src/web-components/display/mutation-comparison-component.stories.ts +138 -0
- package/src/web-components/display/mutation-comparison-component.tsx +31 -0
- package/src/web-components/display/mutations-component.stories.ts +107 -0
- package/src/web-components/display/mutations-component.tsx +27 -0
- package/src/web-components/display/prevalence-over-time-component.stories.ts +205 -0
- package/src/web-components/display/prevalence-over-time-component.tsx +46 -0
- package/src/web-components/display/relative-growth-advantage-component.stories.ts +89 -0
- package/src/web-components/display/relative-growth-advantage-component.tsx +37 -0
- package/src/web-components/index.ts +3 -0
- package/src/web-components/input/date-range-selector-component.stories.ts +53 -0
- package/src/web-components/input/date-range-selector-component.tsx +33 -0
- package/src/web-components/input/index.ts +4 -0
- package/src/web-components/input/location-filter-component.stories.ts +184 -0
- package/src/web-components/input/location-filter-component.tsx +68 -0
- package/src/web-components/input/location-filter.mdx +25 -0
- package/src/web-components/input/mutation-filter-component.stories.ts +97 -0
- package/src/web-components/input/mutation-filter-component.tsx +27 -0
- package/src/web-components/input/text-input-component.stories.ts +92 -0
- package/src/web-components/input/text-input-component.tsx +30 -0
- package/src/web-components/lapis-context.ts +3 -0
- package/src/web-components/reference-genome-context.ts +5 -0
- package/src/web-components/withinShadowRoot.story.ts +34 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { describe, expect, test } from 'vitest';
|
|
2
|
+
|
|
3
|
+
import { fetchAutocompletionList } from './fetchAutocompletionList';
|
|
4
|
+
import { DUMMY_LAPIS_URL, lapisRequestMocks } from '../../../vitest.setup';
|
|
5
|
+
|
|
6
|
+
describe('fetchAutocompletionList', () => {
|
|
7
|
+
test('should fetch autocompletion list', async () => {
|
|
8
|
+
const fields = ['region', 'country', 'division'];
|
|
9
|
+
|
|
10
|
+
lapisRequestMocks.aggregated(
|
|
11
|
+
{ fields },
|
|
12
|
+
{
|
|
13
|
+
data: [
|
|
14
|
+
{ count: 0, region: 'region1', country: 'country1_1', division: 'division1_1_1' },
|
|
15
|
+
{ count: 0, region: 'region1', country: 'country1_1', division: 'division1_1_2' },
|
|
16
|
+
{ count: 0, region: 'region1', country: 'country1_1', division: null },
|
|
17
|
+
{ count: 0, region: 'region1', country: 'country1_2', division: 'division1_2_1' },
|
|
18
|
+
{ count: 0, region: 'region2', country: 'country2_1', division: null },
|
|
19
|
+
],
|
|
20
|
+
},
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
const result = await fetchAutocompletionList(fields, DUMMY_LAPIS_URL);
|
|
24
|
+
|
|
25
|
+
expect(result).to.deep.equal([
|
|
26
|
+
{ region: 'region1', country: null, division: null },
|
|
27
|
+
{ region: 'region1', country: 'country1_1', division: null },
|
|
28
|
+
{ region: 'region1', country: 'country1_1', division: 'division1_1_1' },
|
|
29
|
+
{ region: 'region1', country: 'country1_1', division: 'division1_1_2' },
|
|
30
|
+
{ region: 'region1', country: 'country1_2', division: null },
|
|
31
|
+
{ region: 'region1', country: 'country1_2', division: 'division1_2_1' },
|
|
32
|
+
{ region: 'region2', country: null, division: null },
|
|
33
|
+
{ region: 'region2', country: 'country2_1', division: null },
|
|
34
|
+
]);
|
|
35
|
+
});
|
|
36
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { FetchAggregatedOperator } from '../../operator/FetchAggregatedOperator';
|
|
2
|
+
|
|
3
|
+
export async function fetchAutocompletionList(fields: string[], lapis: string, signal?: AbortSignal) {
|
|
4
|
+
const toAncestorInHierarchyOverwriteValues = Array(fields.length - 1)
|
|
5
|
+
.fill(0)
|
|
6
|
+
.map((_, i) => i + 1)
|
|
7
|
+
.map((i) => fields.slice(i).reduce((acc, field) => ({ ...acc, [field]: null }), {}));
|
|
8
|
+
|
|
9
|
+
const fetchAggregatedOperator = new FetchAggregatedOperator<Record<string, string | null>>({}, fields);
|
|
10
|
+
|
|
11
|
+
const data = (await fetchAggregatedOperator.evaluate(lapis, signal)).content;
|
|
12
|
+
const locationValues = data
|
|
13
|
+
.map((entry) => fields.reduce((acc, field) => ({ ...acc, [field]: entry[field] }), {}))
|
|
14
|
+
.reduce<Set<string>>((setOfAllHierarchies, entry) => {
|
|
15
|
+
setOfAllHierarchies.add(JSON.stringify(entry));
|
|
16
|
+
toAncestorInHierarchyOverwriteValues.forEach((overwriteValues) => {
|
|
17
|
+
setOfAllHierarchies.add(JSON.stringify({ ...entry, ...overwriteValues }));
|
|
18
|
+
});
|
|
19
|
+
return setOfAllHierarchies;
|
|
20
|
+
}, new Set());
|
|
21
|
+
|
|
22
|
+
return [...locationValues].map((json) => JSON.parse(json)).sort(compareLocationEntries(fields));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function compareLocationEntries(fields: string[]) {
|
|
26
|
+
return (a: Record<string, string | null>, b: Record<string, string | null>) => {
|
|
27
|
+
for (const field of fields) {
|
|
28
|
+
const valueA = a[field];
|
|
29
|
+
const valueB = b[field];
|
|
30
|
+
if (valueA === valueB) {
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
if (valueA === null) {
|
|
34
|
+
return -1;
|
|
35
|
+
}
|
|
36
|
+
if (valueB === null) {
|
|
37
|
+
return 1;
|
|
38
|
+
}
|
|
39
|
+
return valueA < valueB ? -1 : 1;
|
|
40
|
+
}
|
|
41
|
+
return 0;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { withActions } from '@storybook/addon-actions/decorator';
|
|
2
|
+
import { type Meta, type StoryObj } from '@storybook/preact';
|
|
3
|
+
|
|
4
|
+
import data from './__mockData__/aggregated.json';
|
|
5
|
+
import { LocationFilter, type LocationFilterProps } from './location-filter';
|
|
6
|
+
import { AGGREGATED_ENDPOINT, LAPIS_URL } from '../../constants';
|
|
7
|
+
import { LapisUrlContext } from '../LapisUrlContext';
|
|
8
|
+
|
|
9
|
+
const meta: Meta<typeof LocationFilter> = {
|
|
10
|
+
title: 'Input/LocationFilter',
|
|
11
|
+
component: LocationFilter,
|
|
12
|
+
parameters: {
|
|
13
|
+
fetchMock: {
|
|
14
|
+
mocks: [
|
|
15
|
+
{
|
|
16
|
+
matcher: {
|
|
17
|
+
name: 'numeratorEG',
|
|
18
|
+
url: AGGREGATED_ENDPOINT,
|
|
19
|
+
body: {
|
|
20
|
+
fields: ['region', 'country', 'division', 'location'],
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
response: {
|
|
24
|
+
status: 200,
|
|
25
|
+
body: data,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
actions: {
|
|
31
|
+
handles: ['gs-location-changed'],
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
args: {
|
|
35
|
+
fields: ['region', 'country', 'division', 'location'],
|
|
36
|
+
},
|
|
37
|
+
decorators: [withActions],
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default meta;
|
|
41
|
+
|
|
42
|
+
export const Primary: StoryObj<LocationFilterProps> = {
|
|
43
|
+
render: (args) => (
|
|
44
|
+
<div class='max-w-screen-lg'>
|
|
45
|
+
<LapisUrlContext.Provider value={LAPIS_URL}>
|
|
46
|
+
<LocationFilter fields={args.fields} />
|
|
47
|
+
</LapisUrlContext.Provider>
|
|
48
|
+
</div>
|
|
49
|
+
),
|
|
50
|
+
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { useContext, useRef, useState } from 'preact/hooks';
|
|
2
|
+
|
|
3
|
+
import { fetchAutocompletionList } from './fetchAutocompletionList';
|
|
4
|
+
import { LapisUrlContext } from '../LapisUrlContext';
|
|
5
|
+
import { useQuery } from '../useQuery';
|
|
6
|
+
|
|
7
|
+
export type LocationFilterProps = {
|
|
8
|
+
value?: string;
|
|
9
|
+
fields: string[];
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const LocationFilter = ({ value: initialValue, fields }: LocationFilterProps) => {
|
|
13
|
+
const lapis = useContext(LapisUrlContext);
|
|
14
|
+
|
|
15
|
+
const [value, setValue] = useState(initialValue ?? '');
|
|
16
|
+
const [unknownLocation, setUnknownLocation] = useState(false);
|
|
17
|
+
|
|
18
|
+
const formRef = useRef<HTMLFormElement>(null);
|
|
19
|
+
|
|
20
|
+
const { data, error, isLoading } = useQuery(() => fetchAutocompletionList(fields, lapis), [fields, lapis]);
|
|
21
|
+
|
|
22
|
+
if (isLoading)
|
|
23
|
+
return (
|
|
24
|
+
<form class='flex'>
|
|
25
|
+
<input type='text' class='input input-bordered grow' value={value} disabled />
|
|
26
|
+
<button class='btn ml-1' disabled type='submit'>
|
|
27
|
+
Loading...
|
|
28
|
+
</button>
|
|
29
|
+
</form>
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
if (error) {
|
|
33
|
+
return (
|
|
34
|
+
<p>
|
|
35
|
+
Error: {error.name} {error.message} {error.stack}
|
|
36
|
+
</p>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
const onInput = (event: InputEvent) => {
|
|
41
|
+
if (event.target instanceof HTMLInputElement) {
|
|
42
|
+
const inputValue = event.target.value;
|
|
43
|
+
setValue(inputValue);
|
|
44
|
+
if (unknownLocation) {
|
|
45
|
+
const eventDetail = parseLocation(inputValue, fields);
|
|
46
|
+
if (hasMatchingEntry(data, eventDetail)) {
|
|
47
|
+
setUnknownLocation(false);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const submit = (event: SubmitEvent) => {
|
|
54
|
+
event.preventDefault();
|
|
55
|
+
const eventDetail = parseLocation(value, fields);
|
|
56
|
+
|
|
57
|
+
if (hasMatchingEntry(data, eventDetail)) {
|
|
58
|
+
setUnknownLocation(false);
|
|
59
|
+
|
|
60
|
+
formRef.current?.dispatchEvent(
|
|
61
|
+
new CustomEvent('gs-location-changed', {
|
|
62
|
+
detail: eventDetail,
|
|
63
|
+
bubbles: true,
|
|
64
|
+
composed: true,
|
|
65
|
+
}),
|
|
66
|
+
);
|
|
67
|
+
} else {
|
|
68
|
+
setUnknownLocation(true);
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
return (
|
|
73
|
+
<form class='flex' onSubmit={submit} ref={formRef}>
|
|
74
|
+
<input
|
|
75
|
+
type='text'
|
|
76
|
+
class={`input input-bordered grow ${unknownLocation ? 'border-2 border-error' : ''}`}
|
|
77
|
+
value={value}
|
|
78
|
+
onInput={onInput}
|
|
79
|
+
list='countries'
|
|
80
|
+
/>
|
|
81
|
+
<datalist id='countries'>
|
|
82
|
+
{data?.map((v) => {
|
|
83
|
+
const value = fields
|
|
84
|
+
.map((field) => v[field])
|
|
85
|
+
.filter((value) => value !== null)
|
|
86
|
+
.join(' / ');
|
|
87
|
+
return <option key={value} value={value} />;
|
|
88
|
+
})}
|
|
89
|
+
</datalist>
|
|
90
|
+
<button class='btn btn-primary ml-1' type='submit'>
|
|
91
|
+
Submit
|
|
92
|
+
</button>
|
|
93
|
+
</form>
|
|
94
|
+
);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
const parseLocation = (location: string, fields: string[]) => {
|
|
98
|
+
const fieldValues = location.split('/').map((part) => part.trim());
|
|
99
|
+
return fieldValues.reduce((acc, fieldValue, i) => ({ ...acc, [fields[i]]: fieldValue }), {});
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const hasMatchingEntry = (data: Record<string, string>[] | null, eventDetail: Record<string, string>) => {
|
|
103
|
+
if (data === null) {
|
|
104
|
+
return false;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
const matchingEntries = Object.entries(eventDetail)
|
|
108
|
+
.filter(([, value]) => value !== undefined)
|
|
109
|
+
.reduce((filteredData, [key, value]) => filteredData.filter((it) => it[key] === value), data);
|
|
110
|
+
|
|
111
|
+
return matchingEntries.length > 0;
|
|
112
|
+
};
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
{
|
|
2
|
+
"info": {
|
|
3
|
+
"dataVersion": 1709685650
|
|
4
|
+
},
|
|
5
|
+
"data": [
|
|
6
|
+
{
|
|
7
|
+
"mutation": "C29400T",
|
|
8
|
+
"proportion": 3.1102264244837026e-4,
|
|
9
|
+
"count": 5,
|
|
10
|
+
"sequenceName": null,
|
|
11
|
+
"mutationFrom": "C",
|
|
12
|
+
"mutationTo": "T",
|
|
13
|
+
"position": 29400
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
"mutation": "G210T",
|
|
17
|
+
"proportion": 0.01464640274543449,
|
|
18
|
+
"count": 239,
|
|
19
|
+
"sequenceName": null,
|
|
20
|
+
"mutationFrom": "G",
|
|
21
|
+
"mutationTo": "T",
|
|
22
|
+
"position": 210
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"mutation": "C241T",
|
|
26
|
+
"proportion": 0.9940534575772437,
|
|
27
|
+
"count": 16215,
|
|
28
|
+
"sequenceName": null,
|
|
29
|
+
"mutationFrom": "C",
|
|
30
|
+
"mutationTo": "T",
|
|
31
|
+
"position": 241
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"mutation": "C3037T",
|
|
35
|
+
"proportion": 0.9993303707311134,
|
|
36
|
+
"count": 16416,
|
|
37
|
+
"sequenceName": null,
|
|
38
|
+
"mutationFrom": "C",
|
|
39
|
+
"mutationTo": "T",
|
|
40
|
+
"position": 3037
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"mutation": "C12876T",
|
|
44
|
+
"proportion": 1.8254837531945966e-4,
|
|
45
|
+
"count": 3,
|
|
46
|
+
"sequenceName": null,
|
|
47
|
+
"mutationFrom": "C",
|
|
48
|
+
"mutationTo": "T",
|
|
49
|
+
"position": 12876
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"mutation": "G4181T",
|
|
53
|
+
"proportion": 4.876264781177618e-4,
|
|
54
|
+
"count": 8,
|
|
55
|
+
"sequenceName": null,
|
|
56
|
+
"mutationFrom": "G",
|
|
57
|
+
"mutationTo": "T",
|
|
58
|
+
"position": 4181
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"mutation": "C15495T",
|
|
62
|
+
"proportion": 6.0642813826561554e-5,
|
|
63
|
+
"count": 1,
|
|
64
|
+
"sequenceName": null,
|
|
65
|
+
"mutationFrom": "C",
|
|
66
|
+
"mutationTo": "T",
|
|
67
|
+
"position": 15495
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"mutation": "C6402T",
|
|
71
|
+
"proportion": 0.005851161089778753,
|
|
72
|
+
"count": 96,
|
|
73
|
+
"sequenceName": null,
|
|
74
|
+
"mutationFrom": "C",
|
|
75
|
+
"mutationTo": "T",
|
|
76
|
+
"position": 6402
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"mutation": "C18664T",
|
|
80
|
+
"proportion": 1.2142553579017667e-4,
|
|
81
|
+
"count": 2,
|
|
82
|
+
"sequenceName": null,
|
|
83
|
+
"mutationFrom": "C",
|
|
84
|
+
"mutationTo": "T",
|
|
85
|
+
"position": 18664
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
"mutation": "C7124T",
|
|
89
|
+
"proportion": 4.334096959940561e-4,
|
|
90
|
+
"count": 7,
|
|
91
|
+
"sequenceName": null,
|
|
92
|
+
"mutationFrom": "C",
|
|
93
|
+
"mutationTo": "T",
|
|
94
|
+
"position": 7124
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"mutation": "T8654C",
|
|
98
|
+
"proportion": 1.231527093596059e-4,
|
|
99
|
+
"count": 2,
|
|
100
|
+
"sequenceName": null,
|
|
101
|
+
"mutationFrom": "T",
|
|
102
|
+
"mutationTo": "C",
|
|
103
|
+
"position": 8654
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
"mutation": "C8986T",
|
|
107
|
+
"proportion": 7.306380905991232e-4,
|
|
108
|
+
"count": 12,
|
|
109
|
+
"sequenceName": null,
|
|
110
|
+
"mutationFrom": "C",
|
|
111
|
+
"mutationTo": "T",
|
|
112
|
+
"position": 8986
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
"mutation": "G9053T",
|
|
116
|
+
"proportion": 4.868252905738453e-4,
|
|
117
|
+
"count": 8,
|
|
118
|
+
"sequenceName": null,
|
|
119
|
+
"mutationFrom": "G",
|
|
120
|
+
"mutationTo": "T",
|
|
121
|
+
"position": 9053
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"mutation": "A28030G",
|
|
125
|
+
"proportion": 3.6861829575474597e-4,
|
|
126
|
+
"count": 6,
|
|
127
|
+
"sequenceName": null,
|
|
128
|
+
"mutationFrom": "A",
|
|
129
|
+
"mutationTo": "G",
|
|
130
|
+
"position": 28030
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
"mutation": "C10029T",
|
|
134
|
+
"proportion": 1.2178784557301182e-4,
|
|
135
|
+
"count": 2,
|
|
136
|
+
"sequenceName": null,
|
|
137
|
+
"mutationFrom": "C",
|
|
138
|
+
"mutationTo": "T",
|
|
139
|
+
"position": 10029
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
"mutation": "A11201G",
|
|
143
|
+
"proportion": 1.8250395425234214e-4,
|
|
144
|
+
"count": 3,
|
|
145
|
+
"sequenceName": null,
|
|
146
|
+
"mutationFrom": "A",
|
|
147
|
+
"mutationTo": "G",
|
|
148
|
+
"position": 11201
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"mutation": "A11332G",
|
|
152
|
+
"proportion": 1.826595226497808e-4,
|
|
153
|
+
"count": 3,
|
|
154
|
+
"sequenceName": null,
|
|
155
|
+
"mutationFrom": "A",
|
|
156
|
+
"mutationTo": "G",
|
|
157
|
+
"position": 11332
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"mutation": "C14408T",
|
|
161
|
+
"proportion": 0.9990265863600414,
|
|
162
|
+
"count": 16421,
|
|
163
|
+
"sequenceName": null,
|
|
164
|
+
"mutationFrom": "C",
|
|
165
|
+
"mutationTo": "T",
|
|
166
|
+
"position": 14408
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"mutation": "G15451A",
|
|
170
|
+
"proportion": 9.109127345600292e-4,
|
|
171
|
+
"count": 15,
|
|
172
|
+
"sequenceName": null,
|
|
173
|
+
"mutationFrom": "G",
|
|
174
|
+
"mutationTo": "A",
|
|
175
|
+
"position": 15451
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"mutation": "C16466T",
|
|
179
|
+
"proportion": 3.641660597232338e-4,
|
|
180
|
+
"count": 6,
|
|
181
|
+
"sequenceName": null,
|
|
182
|
+
"mutationFrom": "C",
|
|
183
|
+
"mutationTo": "T",
|
|
184
|
+
"position": 16466
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
"mutation": "C21618G",
|
|
188
|
+
"proportion": 3.0807147258163895e-4,
|
|
189
|
+
"count": 5,
|
|
190
|
+
"sequenceName": null,
|
|
191
|
+
"mutationFrom": "C",
|
|
192
|
+
"mutationTo": "G",
|
|
193
|
+
"position": 21618
|
|
194
|
+
},
|
|
195
|
+
{
|
|
196
|
+
"mutation": "T22917G",
|
|
197
|
+
"proportion": 6.934375590997919e-4,
|
|
198
|
+
"count": 11,
|
|
199
|
+
"sequenceName": null,
|
|
200
|
+
"mutationFrom": "T",
|
|
201
|
+
"mutationTo": "G",
|
|
202
|
+
"position": 22917
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
"mutation": "C22995A",
|
|
206
|
+
"proportion": 3.7591629597143037e-4,
|
|
207
|
+
"count": 6,
|
|
208
|
+
"sequenceName": null,
|
|
209
|
+
"mutationFrom": "C",
|
|
210
|
+
"mutationTo": "A",
|
|
211
|
+
"position": 22995
|
|
212
|
+
},
|
|
213
|
+
{
|
|
214
|
+
"mutation": "A23403G",
|
|
215
|
+
"proportion": 0.9993927617196988,
|
|
216
|
+
"count": 16458,
|
|
217
|
+
"sequenceName": null,
|
|
218
|
+
"mutationFrom": "A",
|
|
219
|
+
"mutationTo": "G",
|
|
220
|
+
"position": 23403
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
"mutation": "C23604G",
|
|
224
|
+
"proportion": 0.0010364589684184855,
|
|
225
|
+
"count": 17,
|
|
226
|
+
"sequenceName": null,
|
|
227
|
+
"mutationFrom": "C",
|
|
228
|
+
"mutationTo": "G",
|
|
229
|
+
"position": 23604
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
"mutation": "A25983T",
|
|
233
|
+
"proportion": 6.0782883539995136e-5,
|
|
234
|
+
"count": 1,
|
|
235
|
+
"sequenceName": null,
|
|
236
|
+
"mutationFrom": "A",
|
|
237
|
+
"mutationTo": "T",
|
|
238
|
+
"position": 25983
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
"mutation": "A17725C",
|
|
242
|
+
"proportion": 2.4251242876197404e-4,
|
|
243
|
+
"count": 4,
|
|
244
|
+
"sequenceName": null,
|
|
245
|
+
"mutationFrom": "A",
|
|
246
|
+
"mutationTo": "C",
|
|
247
|
+
"position": 17725
|
|
248
|
+
},
|
|
249
|
+
{
|
|
250
|
+
"mutation": "G24410A",
|
|
251
|
+
"proportion": 6.067961165048543e-4,
|
|
252
|
+
"count": 10,
|
|
253
|
+
"sequenceName": null,
|
|
254
|
+
"mutationFrom": "G",
|
|
255
|
+
"mutationTo": "A",
|
|
256
|
+
"position": 24410
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
"mutation": "C25469T",
|
|
260
|
+
"proportion": 0.0010943579766536965,
|
|
261
|
+
"count": 18,
|
|
262
|
+
"sequenceName": null,
|
|
263
|
+
"mutationFrom": "C",
|
|
264
|
+
"mutationTo": "T",
|
|
265
|
+
"position": 25469
|
|
266
|
+
},
|
|
267
|
+
{
|
|
268
|
+
"mutation": "C14214T",
|
|
269
|
+
"proportion": 2.4310198128114745e-4,
|
|
270
|
+
"count": 4,
|
|
271
|
+
"sequenceName": null,
|
|
272
|
+
"mutationFrom": "C",
|
|
273
|
+
"mutationTo": "T",
|
|
274
|
+
"position": 14214
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
"mutation": "T26767C",
|
|
278
|
+
"proportion": 0.0013351945135643625,
|
|
279
|
+
"count": 22,
|
|
280
|
+
"sequenceName": null,
|
|
281
|
+
"mutationFrom": "T",
|
|
282
|
+
"mutationTo": "C",
|
|
283
|
+
"position": 26767
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
"mutation": "G199-",
|
|
287
|
+
"proportion": 0.55,
|
|
288
|
+
"count": 10,
|
|
289
|
+
"sequenceName": null,
|
|
290
|
+
"mutationFrom": "G",
|
|
291
|
+
"mutationTo": "-",
|
|
292
|
+
"position": 199
|
|
293
|
+
}
|
|
294
|
+
]
|
|
295
|
+
}
|