@molgenis/vip-report-template 6.1.1 → 7.0.0
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/.nvmrc +1 -1
- package/.travis.yml +9 -11
- package/README.md +411 -1
- package/eslint.config.mjs +11 -0
- package/package.json +40 -35
- package/scripts/deploy_npm_registry.sh +5 -0
- package/src/App.tsx +35 -29
- package/src/assets/sass/main.scss +12 -4
- package/src/components/Allele.tsx +95 -0
- package/src/components/Anchor.tsx +1 -1
- package/src/components/Breadcrumb.tsx +8 -5
- package/src/components/DatasetDropdown.tsx +10 -23
- package/src/components/ErrorNotification.tsx +9 -0
- package/src/components/GenomeBrowser.tsx +40 -23
- package/src/components/HpoTerm.tsx +1 -1
- package/src/components/{record/Pager.tsx → Pager.tsx} +21 -14
- package/src/components/RecordsPerPage.tsx +9 -7
- package/src/components/RecordsTable.tsx +130 -0
- package/src/components/SampleTable.tsx +70 -98
- package/src/components/SearchBox.tsx +8 -2
- package/src/components/Sort.tsx +28 -25
- package/src/components/Table.tsx +16 -0
- package/src/components/Tooltip.tsx +20 -0
- package/src/components/VariantBreadcrumb.tsx +54 -0
- package/src/components/VariantConsequenceContainer.tsx +100 -0
- package/src/components/VariantConsequenceTable.tsx +58 -0
- package/src/components/VariantContainer.tsx +71 -0
- package/src/components/VariantFilters.tsx +27 -0
- package/src/components/VariantGenotypeTable.tsx +44 -0
- package/src/components/VariantInfoTable.tsx +24 -33
- package/src/components/VariantResults.tsx +103 -0
- package/src/components/VariantTable.tsx +62 -66
- package/src/components/VariantTypeSelect.tsx +34 -0
- package/src/components/VariantsContainer.tsx +150 -0
- package/src/components/VariantsContainerHeader.tsx +70 -0
- package/src/components/field/Field.tsx +80 -0
- package/src/components/field/FieldAlt.tsx +19 -0
- package/src/components/field/FieldChrom.tsx +6 -0
- package/src/components/{record/Id.tsx → field/FieldFilter.tsx} +2 -1
- package/src/components/field/FieldFormat.tsx +10 -0
- package/src/components/{record/Filter.tsx → field/FieldId.tsx} +1 -1
- package/src/components/field/FieldPos.tsx +6 -0
- package/src/components/field/FieldQual.tsx +6 -0
- package/src/components/field/FieldRef.tsx +8 -0
- package/src/components/field/composed/FieldClinVar.tsx +72 -0
- package/src/components/field/composed/FieldComposed.tsx +68 -0
- package/src/components/field/composed/FieldGene.tsx +39 -0
- package/src/components/field/composed/FieldGenotype.tsx +35 -0
- package/src/components/{record/format/GenotypeField.tsx → field/composed/FieldGenotypeSnvSv.tsx} +20 -16
- package/src/components/field/composed/FieldGenotypeStr.tsx +31 -0
- package/src/components/field/composed/FieldGnomAd.tsx +58 -0
- package/src/components/field/composed/FieldHpo.tsx +50 -0
- package/src/components/field/composed/FieldInheritanceModes.tsx +32 -0
- package/src/components/field/composed/FieldLocus.tsx +18 -0
- package/src/components/field/composed/FieldVipC.tsx +25 -0
- package/src/components/field/composed/FieldVipCS.tsx +15 -0
- package/src/components/field/composed/FieldVkgl.tsx +37 -0
- package/src/components/field/genotype/FieldGenotype.tsx +19 -0
- package/src/components/field/genotype/FieldGenotypeType.tsx +9 -0
- package/src/components/field/info/FieldConsequence.tsx +15 -0
- package/src/components/{record/info/Hgvs.tsx → field/info/FieldHgvs.tsx} +4 -6
- package/src/components/field/info/FieldInfo.tsx +27 -0
- package/src/components/{record/info/PubMed.tsx → field/info/FieldPubMed.tsx} +4 -7
- package/src/components/field/typed/FieldCategorical.tsx +17 -0
- package/src/components/{record/field/FieldValueCharacter.tsx → field/typed/FieldCharacter.tsx} +3 -2
- package/src/components/{record/field/FieldValueFlag.tsx → field/typed/FieldFlag.tsx} +3 -2
- package/src/components/{record/field/FieldValueFloat.tsx → field/typed/FieldFloat.tsx} +3 -2
- package/src/components/{record/field/FieldValueInteger.tsx → field/typed/FieldInteger.tsx} +3 -2
- package/src/components/{record/field/FieldValueString.tsx → field/typed/FieldString.tsx} +3 -2
- package/src/components/field/typed/FieldTyped.tsx +20 -0
- package/src/components/field/typed/FieldTypedItem.tsx +49 -0
- package/src/components/field/typed/FieldTypedMultiple.tsx +21 -0
- package/src/components/filter/Filter.tsx +56 -48
- package/src/components/filter/FilterWrapper.scss +23 -0
- package/src/components/filter/FilterWrapper.tsx +63 -0
- package/src/components/filter/composed/FilterAllelicImbalance.tsx +26 -0
- package/src/components/filter/composed/FilterComposed.tsx +92 -0
- package/src/components/filter/composed/FilterDeNovo.tsx +35 -0
- package/src/components/filter/composed/FilterHpo.tsx +16 -0
- package/src/components/filter/composed/FilterInheritance.tsx +42 -0
- package/src/components/filter/composed/FilterLocus.tsx +75 -0
- package/src/components/filter/composed/FilterVipC.tsx +16 -0
- package/src/components/filter/composed/FilterVipCS.tsx +16 -0
- package/src/components/filter/fixed/FilterAlt.tsx +20 -0
- package/src/components/filter/fixed/FilterChrom.tsx +22 -0
- package/src/components/filter/fixed/FilterFilter.tsx +20 -0
- package/src/components/filter/fixed/FilterFixed.tsx +96 -0
- package/src/components/filter/fixed/FilterId.tsx +20 -0
- package/src/components/filter/fixed/FilterPos.tsx +22 -0
- package/src/components/filter/fixed/FilterQual.tsx +21 -0
- package/src/components/filter/fixed/FilterRef.tsx +22 -0
- package/src/components/filter/typed/FilterCategorical.tsx +119 -0
- package/src/components/filter/typed/FilterFlag.tsx +23 -0
- package/src/components/filter/typed/FilterInterval.tsx +72 -0
- package/src/components/filter/typed/FilterString.tsx +43 -0
- package/src/components/filter/typed/FilterTyped.tsx +56 -0
- package/src/components/form/ButtonApply.tsx +11 -0
- package/src/components/form/ButtonDownload.tsx +11 -0
- package/src/components/form/ButtonReset.tsx +9 -0
- package/src/components/{Checkbox.tsx → form/Checkbox.tsx} +4 -9
- package/src/components/form/Input.tsx +19 -0
- package/src/components/form/Select.scss +7 -0
- package/src/components/form/Select.tsx +34 -0
- package/src/components/tree/DecisionTreeBoolMultiQuery.tsx +1 -1
- package/src/components/tree/DecisionTreeBoolQuery.tsx +1 -1
- package/src/components/tree/DecisionTreeNode.tsx +41 -39
- package/src/components/tree/DecisionTreeNodeBool.tsx +1 -1
- package/src/components/tree/DecisionTreeNodeBoolMulti.tsx +1 -1
- package/src/components/tree/DecisionTreeNodeCategorical.tsx +1 -1
- package/src/components/tree/DecisionTreeNodeExists.tsx +1 -1
- package/src/components/tree/DecisionTreeNodeLeaf.tsx +1 -1
- package/src/components/tree/DecisionTreeOutcomeNode.tsx +1 -1
- package/src/components/tree/DecisionTreePath.tsx +1 -1
- package/src/igv.d.ts +2 -1
- package/src/index.tsx +48 -19
- package/src/mocks/GRCh37/decisionTree.json +23 -22
- package/src/mocks/GRCh37/field_metadata.json +435 -95
- package/src/mocks/GRCh37/sampleTree.json +143 -0
- package/src/mocks/GRCh37/static.ts +63 -133
- package/src/mocks/GRCh37/vcf/family.vcf.blob +37 -31
- package/src/mocks/GRCh38/decisionTree.json +52 -33
- package/src/mocks/GRCh38/decisionTreeStr.json +572 -0
- package/src/mocks/GRCh38/fasta/chr1_149380406-149403321.fasta.gz.blob +0 -0
- package/src/mocks/GRCh38/field_metadata.json +435 -95
- package/src/mocks/GRCh38/sampleTree.json +175 -0
- package/src/mocks/GRCh38/static.ts +101 -42
- package/src/mocks/GRCh38/str.cram.blob +0 -0
- package/src/mocks/GRCh38/str.cram.crai.blob +0 -0
- package/src/mocks/GRCh38/vcf/family.vcf.blob +25 -24
- package/src/mocks/GRCh38/vcf/no_vep.vcf.blob +29 -28
- package/src/mocks/GRCh38/vcf/samples_0.vcf.blob +28 -27
- package/src/mocks/GRCh38/vcf/samples_1.vcf.blob +29 -28
- package/src/mocks/GRCh38/vcf/samples_100.vcf.blob +28 -27
- package/src/mocks/GRCh38/vcf/str.vcf.blob +321 -0
- package/src/mocks/MockApiClient.ts +341 -328
- package/src/mocks/config_cram.json +701 -0
- package/src/mocks/config_vcf.json +699 -0
- package/src/store/app.ts +30 -0
- package/src/store/index.tsx +3 -168
- package/src/store/variants.ts +182 -0
- package/src/types/config.d.ts +190 -0
- package/src/types/configCellComposed.d.ts +86 -0
- package/src/types/configCells.d.ts +129 -0
- package/src/types/configFilter.d.ts +80 -0
- package/src/types/configFilterComposed.d.ts +60 -0
- package/src/types/configSort.d.ts +13 -0
- package/src/types/filter.d.ts +17 -0
- package/src/types/store.d.ts +34 -0
- package/src/utils/api.ts +281 -0
- package/src/utils/config/config.ts +182 -0
- package/src/utils/config/configCells.ts +74 -0
- package/src/utils/config/configCellsComposed.ts +508 -0
- package/src/utils/config/configCellsField.ts +61 -0
- package/src/utils/config/configCellsFixed.ts +126 -0
- package/src/utils/config/configFilters.ts +46 -0
- package/src/utils/config/configFiltersComposed.ts +208 -0
- package/src/utils/config/configFiltersField.ts +49 -0
- package/src/utils/config/configFiltersFixed.ts +106 -0
- package/src/utils/config/configSorts.ts +44 -0
- package/src/utils/config/configValidator.ts +380 -0
- package/src/utils/config/configVip.ts +25 -0
- package/src/utils/csq.ts +115 -0
- package/src/utils/decisionTree.ts +45 -0
- package/src/utils/download.ts +30 -0
- package/src/utils/error.ts +69 -0
- package/src/utils/query/query.ts +55 -0
- package/src/utils/query/queryFilter.ts +132 -0
- package/src/utils/query/queryFilterComposed.ts +247 -0
- package/src/utils/query/queryFilterField.ts +75 -0
- package/src/utils/query/queryFilterFixed.ts +44 -0
- package/src/utils/query/querySample.ts +18 -0
- package/src/utils/query/queryVariantType.ts +76 -0
- package/src/utils/query/selector.ts +41 -0
- package/src/utils/{sortUtils.ts → query/sort.ts} +32 -11
- package/src/utils/sample.ts +19 -35
- package/src/utils/utils.ts +66 -2
- package/src/utils/variantType.ts +43 -0
- package/src/utils/vcf.ts +352 -0
- package/src/views/Help.tsx +109 -114
- package/src/views/Home.tsx +3 -2
- package/src/views/Sample.tsx +12 -7
- package/src/views/SampleVariant.tsx +23 -112
- package/src/views/SampleVariantConsequence.tsx +54 -114
- package/src/views/SampleVariants.tsx +33 -445
- package/src/views/SampleVariantsRedirect.tsx +20 -0
- package/src/views/Samples.tsx +7 -10
- package/src/views/Variant.tsx +31 -61
- package/src/views/VariantConsequence.tsx +42 -72
- package/src/views/Variants.tsx +29 -138
- package/src/views/VariantsRedirect.tsx +25 -0
- package/src/views/data/data.tsx +32 -6
- package/tests/store/variants.test.ts +122 -0
- package/tests/utils/config/config.test.ts +167 -0
- package/tests/utils/config/configCells.test.ts +86 -0
- package/tests/utils/config/configCellsComposed.test.ts +1163 -0
- package/tests/utils/config/configCellsField.test.ts +164 -0
- package/tests/utils/config/configCellsFixed.test.ts +99 -0
- package/tests/utils/config/configFilters.test.ts +80 -0
- package/tests/utils/config/configFiltersComposed.test.ts +504 -0
- package/tests/utils/config/configFiltersField.test.ts +140 -0
- package/tests/utils/config/configFiltersFixed.test.ts +81 -0
- package/tests/utils/config/configSorts.test.ts +55 -0
- package/tests/utils/config/configValidator.test.ts +56 -0
- package/tests/utils/config/configVip.test.ts +53 -0
- package/tests/utils/decisionTree.test.ts +71 -0
- package/tests/utils/download.test.ts +20 -0
- package/tests/utils/query/query.test.ts +84 -0
- package/tests/utils/query/queryFilter.test.ts +243 -0
- package/tests/utils/query/queryFilterComposed.test.ts +301 -0
- package/tests/utils/query/queryFilterField.test.ts +75 -0
- package/tests/utils/query/queryFilterFixed.test.ts +86 -0
- package/tests/utils/query/querySample.test.ts +45 -0
- package/tests/utils/query/queryVariantType.test.ts +56 -0
- package/{src/__tests__/sortUtils.test.ts → tests/utils/query/sort.test.ts} +3 -4
- package/tests/utils/sample.test.ts +259 -0
- package/tests/utils/utils.test.ts +120 -0
- package/tests/utils/variantType.test.ts +48 -0
- package/tests/utils/vcf.test.ts +649 -0
- package/tsconfig.json +6 -2
- package/vite.config.mts +20 -3
- package/.eslintignore +0 -4
- package/.eslintrc.js +0 -23
- package/src/Api.ts +0 -12
- package/src/__tests__/decisionTreeUtils.test.ts +0 -75
- package/src/__tests__/field.test.ts +0 -107
- package/src/__tests__/query.test.ts +0 -188
- package/src/__tests__/sample.test.ts +0 -184
- package/src/__tests__/utils.test.ts +0 -24
- package/src/__tests__/viewUtils.test.ts +0 -125
- package/src/components/ConsequenceTable.tsx +0 -45
- package/src/components/Error.tsx +0 -9
- package/src/components/FieldHeader.tsx +0 -26
- package/src/components/InfoCollapsablePane.tsx +0 -90
- package/src/components/VariantInfoNestedTable.tsx +0 -127
- package/src/components/VariantSampleTable.tsx +0 -58
- package/src/components/VariantsSampleTable.tsx +0 -183
- package/src/components/VariantsTable.tsx +0 -124
- package/src/components/filter/FilterAllelicBalance.tsx +0 -81
- package/src/components/filter/FilterCategorical.tsx +0 -81
- package/src/components/filter/FilterClinVar.tsx +0 -21
- package/src/components/filter/FilterGene.tsx +0 -34
- package/src/components/filter/FilterHpo.tsx +0 -161
- package/src/components/filter/FilterInheritance.tsx +0 -162
- package/src/components/filter/FilterIntegerGq.tsx +0 -47
- package/src/components/filter/FilterVI.tsx +0 -68
- package/src/components/filter/FilterVariantType.tsx +0 -146
- package/src/components/filter/Filters.tsx +0 -29
- package/src/components/filter/InfoFilter.tsx +0 -39
- package/src/components/filter/InfoFilters.tsx +0 -35
- package/src/components/filter/SampleFilters.tsx +0 -93
- package/src/components/filter/SamplesFilters.tsx +0 -33
- package/src/components/record/Allele.tsx +0 -38
- package/src/components/record/AlleleBreakend.tsx +0 -5
- package/src/components/record/AlleleMissing.tsx +0 -5
- package/src/components/record/AlleleNucs.tsx +0 -49
- package/src/components/record/AlleleSymbolic.tsx +0 -5
- package/src/components/record/Alt.tsx +0 -17
- package/src/components/record/Chrom.tsx +0 -5
- package/src/components/record/Format.tsx +0 -40
- package/src/components/record/Info.tsx +0 -55
- package/src/components/record/Pos.tsx +0 -5
- package/src/components/record/Qual.tsx +0 -5
- package/src/components/record/RecordDownload.tsx +0 -66
- package/src/components/record/Ref.tsx +0 -6
- package/src/components/record/field/Field.tsx +0 -36
- package/src/components/record/field/FieldMultipleValue.tsx +0 -22
- package/src/components/record/field/FieldSingleValue.tsx +0 -35
- package/src/components/record/info/ClinVar.tsx +0 -81
- package/src/components/record/info/Consequence.tsx +0 -18
- package/src/components/record/info/Gene.tsx +0 -56
- package/src/components/record/info/GnomAD.tsx +0 -54
- package/src/components/record/info/Hpo.tsx +0 -52
- package/src/components/record/info/InheritanceModes.tsx +0 -22
- package/src/components/record/info/VipC.tsx +0 -23
- package/src/components/record/info/Vkgl.tsx +0 -42
- package/src/mocks/GRCh37/vcf/no_vep.vcf.blob +0 -61
- package/src/mocks/GRCh37/vcf/samples_0.vcf.blob +0 -93
- package/src/mocks/GRCh37/vcf/samples_1.vcf.blob +0 -93
- package/src/mocks/GRCh37/vcf/samples_100.vcf.blob +0 -93
- package/src/utils/ApiUtils.ts +0 -259
- package/src/utils/csqUtils.ts +0 -27
- package/src/utils/decisionTreeUtils.ts +0 -14
- package/src/utils/field.ts +0 -49
- package/src/utils/query.ts +0 -154
- package/src/utils/viewUtils.ts +0 -32
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
import Ajv, { JTDSchemaType } from "ajv/dist/jtd";
|
|
2
|
+
import { Json } from "@molgenis/vip-report-api";
|
|
3
|
+
import { ConfigValidationError } from "../error.ts";
|
|
4
|
+
import {
|
|
5
|
+
ConfigJson,
|
|
6
|
+
ConfigJsonField,
|
|
7
|
+
ConfigJsonFilter,
|
|
8
|
+
ConfigJsonRecordsPerPageOption,
|
|
9
|
+
ConfigJsonSort,
|
|
10
|
+
ConfigJsonSortOrder,
|
|
11
|
+
ConfigJsonVariant,
|
|
12
|
+
ConfigJsonVariantConsequence,
|
|
13
|
+
ConfigJsonVariants,
|
|
14
|
+
ConfigJsonVip,
|
|
15
|
+
ConfigJsonVipParams,
|
|
16
|
+
ConfigJsonVipParamsCram,
|
|
17
|
+
ConfigJsonVipParamsVcf,
|
|
18
|
+
} from "../../types/config";
|
|
19
|
+
|
|
20
|
+
const ajv = new Ajv();
|
|
21
|
+
|
|
22
|
+
// allow additional properties so we can extend config in vip without updating vip-report-template
|
|
23
|
+
const schemaConfigJsonVipParamsVcf: JTDSchemaType<ConfigJsonVipParamsVcf> = {
|
|
24
|
+
properties: {
|
|
25
|
+
filter: {
|
|
26
|
+
properties: { classes: { type: "string" }, consequences: { type: "boolean" } },
|
|
27
|
+
additionalProperties: true,
|
|
28
|
+
},
|
|
29
|
+
filter_samples: {
|
|
30
|
+
properties: { classes: { type: "string" } },
|
|
31
|
+
additionalProperties: true,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
additionalProperties: true,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// allow additional properties so we can extend config in vip without updating vip-report-template
|
|
38
|
+
const schemaConfigJsonVipParamsCram: JTDSchemaType<ConfigJsonVipParamsCram> = {
|
|
39
|
+
properties: {
|
|
40
|
+
call_snv: { type: "boolean" },
|
|
41
|
+
call_str: { type: "boolean" },
|
|
42
|
+
call_sv: { type: "boolean" },
|
|
43
|
+
call_cnv: { type: "boolean" },
|
|
44
|
+
},
|
|
45
|
+
additionalProperties: true,
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// allow additional properties so we can extend config in vip without updating vip-report-template
|
|
49
|
+
const schemaConfigJsonVipParams: JTDSchemaType<ConfigJsonVipParams> = {
|
|
50
|
+
properties: {
|
|
51
|
+
vcf: schemaConfigJsonVipParamsVcf,
|
|
52
|
+
},
|
|
53
|
+
optionalProperties: {
|
|
54
|
+
cram: schemaConfigJsonVipParamsCram,
|
|
55
|
+
},
|
|
56
|
+
additionalProperties: true,
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const schemaConfigJsonVip: JTDSchemaType<ConfigJsonVip> = {
|
|
60
|
+
properties: {
|
|
61
|
+
filter_field: {
|
|
62
|
+
properties: { type: { enum: ["genotype"] }, name: { type: "string" } },
|
|
63
|
+
optionalProperties: { label: { type: "string" }, description: { type: "string" } },
|
|
64
|
+
},
|
|
65
|
+
params: schemaConfigJsonVipParams,
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const schemaConfigJsonField: JTDSchemaType<ConfigJsonField> = {
|
|
70
|
+
discriminator: "type",
|
|
71
|
+
mapping: {
|
|
72
|
+
fixed: {
|
|
73
|
+
properties: {
|
|
74
|
+
name: { enum: ["chrom", "pos", "id", "ref", "alt", "qual", "filter"] },
|
|
75
|
+
},
|
|
76
|
+
optionalProperties: {
|
|
77
|
+
label: { type: "string" },
|
|
78
|
+
description: { type: "string" },
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
info: {
|
|
82
|
+
properties: {
|
|
83
|
+
name: { type: "string" },
|
|
84
|
+
},
|
|
85
|
+
optionalProperties: {
|
|
86
|
+
label: { type: "string" },
|
|
87
|
+
description: { type: "string" },
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
format: {
|
|
91
|
+
properties: {
|
|
92
|
+
name: { type: "string" },
|
|
93
|
+
},
|
|
94
|
+
optionalProperties: {
|
|
95
|
+
label: { type: "string" },
|
|
96
|
+
description: { type: "string" },
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
genotype: {
|
|
100
|
+
properties: {
|
|
101
|
+
name: { type: "string" },
|
|
102
|
+
},
|
|
103
|
+
optionalProperties: {
|
|
104
|
+
label: { type: "string" },
|
|
105
|
+
description: { type: "string" },
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
composed: {
|
|
109
|
+
properties: {
|
|
110
|
+
name: {
|
|
111
|
+
enum: [
|
|
112
|
+
"clinVar",
|
|
113
|
+
"gene",
|
|
114
|
+
"genotype",
|
|
115
|
+
"genotype_maternal",
|
|
116
|
+
"genotype_paternal",
|
|
117
|
+
"gnomAdAf",
|
|
118
|
+
"hpo",
|
|
119
|
+
"inheritancePattern",
|
|
120
|
+
"locus",
|
|
121
|
+
"vipC",
|
|
122
|
+
"vipCS",
|
|
123
|
+
"vkgl",
|
|
124
|
+
],
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
optionalProperties: {
|
|
128
|
+
label: { type: "string" },
|
|
129
|
+
description: { type: "string" },
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
group: {
|
|
133
|
+
// TODO deduplicate code, see mappings listed above
|
|
134
|
+
properties: {
|
|
135
|
+
fields: {
|
|
136
|
+
elements: {
|
|
137
|
+
discriminator: "type",
|
|
138
|
+
mapping: {
|
|
139
|
+
fixed: {
|
|
140
|
+
properties: {
|
|
141
|
+
name: { enum: ["chrom", "pos", "id", "ref", "alt", "qual", "filter"] },
|
|
142
|
+
},
|
|
143
|
+
optionalProperties: {
|
|
144
|
+
label: { type: "string" },
|
|
145
|
+
description: { type: "string" },
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
info: {
|
|
149
|
+
properties: {
|
|
150
|
+
name: { type: "string" },
|
|
151
|
+
},
|
|
152
|
+
optionalProperties: {
|
|
153
|
+
label: { type: "string" },
|
|
154
|
+
description: { type: "string" },
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
format: {
|
|
158
|
+
properties: {
|
|
159
|
+
name: { type: "string" },
|
|
160
|
+
},
|
|
161
|
+
optionalProperties: {
|
|
162
|
+
label: { type: "string" },
|
|
163
|
+
description: { type: "string" },
|
|
164
|
+
},
|
|
165
|
+
},
|
|
166
|
+
genotype: {
|
|
167
|
+
properties: {
|
|
168
|
+
name: { type: "string" },
|
|
169
|
+
},
|
|
170
|
+
optionalProperties: {
|
|
171
|
+
label: { type: "string" },
|
|
172
|
+
description: { type: "string" },
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
composed: {
|
|
176
|
+
properties: {
|
|
177
|
+
name: {
|
|
178
|
+
enum: [
|
|
179
|
+
"clinVar",
|
|
180
|
+
"gene",
|
|
181
|
+
"genotype",
|
|
182
|
+
"gnomAdAf",
|
|
183
|
+
"hpo",
|
|
184
|
+
"inheritancePattern",
|
|
185
|
+
"locus",
|
|
186
|
+
"ref",
|
|
187
|
+
"vipC",
|
|
188
|
+
"vipCS",
|
|
189
|
+
"vkgl",
|
|
190
|
+
],
|
|
191
|
+
},
|
|
192
|
+
},
|
|
193
|
+
optionalProperties: {
|
|
194
|
+
label: { type: "string" },
|
|
195
|
+
description: { type: "string" },
|
|
196
|
+
},
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
const schemaConfigJsonFilter: JTDSchemaType<ConfigJsonFilter> = {
|
|
207
|
+
discriminator: "type",
|
|
208
|
+
mapping: {
|
|
209
|
+
fixed: {
|
|
210
|
+
properties: {
|
|
211
|
+
name: { enum: ["chrom", "pos", "id", "ref", "alt", "qual", "filter"] },
|
|
212
|
+
},
|
|
213
|
+
optionalProperties: {
|
|
214
|
+
label: { type: "string" },
|
|
215
|
+
description: { type: "string" },
|
|
216
|
+
},
|
|
217
|
+
},
|
|
218
|
+
info: {
|
|
219
|
+
properties: {
|
|
220
|
+
name: { type: "string" },
|
|
221
|
+
},
|
|
222
|
+
optionalProperties: {
|
|
223
|
+
label: { type: "string" },
|
|
224
|
+
description: { type: "string" },
|
|
225
|
+
},
|
|
226
|
+
},
|
|
227
|
+
format: {
|
|
228
|
+
properties: {
|
|
229
|
+
name: { type: "string" },
|
|
230
|
+
},
|
|
231
|
+
optionalProperties: {
|
|
232
|
+
label: { type: "string" },
|
|
233
|
+
description: { type: "string" },
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
genotype: {
|
|
237
|
+
properties: {
|
|
238
|
+
name: { type: "string" },
|
|
239
|
+
},
|
|
240
|
+
optionalProperties: {
|
|
241
|
+
label: { type: "string" },
|
|
242
|
+
description: { type: "string" },
|
|
243
|
+
},
|
|
244
|
+
},
|
|
245
|
+
composed: {
|
|
246
|
+
properties: {
|
|
247
|
+
name: {
|
|
248
|
+
enum: ["allelicImbalance", "deNovo", "hpo", "inheritanceMatch", "locus", "vipC", "vipCS"],
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
optionalProperties: {
|
|
252
|
+
label: { type: "string" },
|
|
253
|
+
description: { type: "string" },
|
|
254
|
+
},
|
|
255
|
+
},
|
|
256
|
+
},
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
const schemaConfigJsonSortOrder: JTDSchemaType<ConfigJsonSortOrder> = {
|
|
260
|
+
properties: {
|
|
261
|
+
direction: { enum: ["asc", "desc"] },
|
|
262
|
+
field: schemaConfigJsonField,
|
|
263
|
+
},
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
const schemaConfigJsonSort: JTDSchemaType<ConfigJsonSort> = {
|
|
267
|
+
properties: {
|
|
268
|
+
selected: { type: "boolean" },
|
|
269
|
+
orders: {
|
|
270
|
+
elements: schemaConfigJsonSortOrder,
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
const schemaConfigJsonRecordsPerPageOption: JTDSchemaType<ConfigJsonRecordsPerPageOption> = {
|
|
276
|
+
properties: {
|
|
277
|
+
number: { type: "uint16" },
|
|
278
|
+
},
|
|
279
|
+
optionalProperties: {
|
|
280
|
+
selected: { type: "boolean" },
|
|
281
|
+
},
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
const schemaConfigJsonVariants: JTDSchemaType<ConfigJsonVariants> = {
|
|
285
|
+
properties: {
|
|
286
|
+
cells: {
|
|
287
|
+
optionalProperties: {
|
|
288
|
+
all: { elements: schemaConfigJsonField },
|
|
289
|
+
snv: { elements: schemaConfigJsonField },
|
|
290
|
+
str: { elements: schemaConfigJsonField },
|
|
291
|
+
sv: { elements: schemaConfigJsonField },
|
|
292
|
+
},
|
|
293
|
+
},
|
|
294
|
+
},
|
|
295
|
+
optionalProperties: {
|
|
296
|
+
filters: {
|
|
297
|
+
optionalProperties: {
|
|
298
|
+
all: { elements: schemaConfigJsonFilter },
|
|
299
|
+
snv: { elements: schemaConfigJsonFilter },
|
|
300
|
+
str: { elements: schemaConfigJsonFilter },
|
|
301
|
+
sv: { elements: schemaConfigJsonFilter },
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
sorts: {
|
|
305
|
+
optionalProperties: {
|
|
306
|
+
all: { elements: schemaConfigJsonSort },
|
|
307
|
+
snv: { elements: schemaConfigJsonSort },
|
|
308
|
+
str: { elements: schemaConfigJsonSort },
|
|
309
|
+
sv: { elements: schemaConfigJsonSort },
|
|
310
|
+
},
|
|
311
|
+
},
|
|
312
|
+
recordsPerPage: {
|
|
313
|
+
optionalProperties: {
|
|
314
|
+
all: { elements: schemaConfigJsonRecordsPerPageOption },
|
|
315
|
+
snv: { elements: schemaConfigJsonRecordsPerPageOption },
|
|
316
|
+
str: { elements: schemaConfigJsonRecordsPerPageOption },
|
|
317
|
+
sv: { elements: schemaConfigJsonRecordsPerPageOption },
|
|
318
|
+
},
|
|
319
|
+
},
|
|
320
|
+
},
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
const schemaConfigJsonVariant: JTDSchemaType<ConfigJsonVariant> = {
|
|
324
|
+
properties: {
|
|
325
|
+
cells: {
|
|
326
|
+
optionalProperties: {
|
|
327
|
+
all: { elements: schemaConfigJsonField },
|
|
328
|
+
snv: { elements: schemaConfigJsonField },
|
|
329
|
+
str: { elements: schemaConfigJsonField },
|
|
330
|
+
sv: { elements: schemaConfigJsonField },
|
|
331
|
+
},
|
|
332
|
+
},
|
|
333
|
+
},
|
|
334
|
+
optionalProperties: {
|
|
335
|
+
sample_cells: {
|
|
336
|
+
optionalProperties: {
|
|
337
|
+
all: { elements: schemaConfigJsonField },
|
|
338
|
+
snv: { elements: schemaConfigJsonField },
|
|
339
|
+
str: { elements: schemaConfigJsonField },
|
|
340
|
+
sv: { elements: schemaConfigJsonField },
|
|
341
|
+
},
|
|
342
|
+
},
|
|
343
|
+
},
|
|
344
|
+
};
|
|
345
|
+
|
|
346
|
+
const schemaConfigJsonVariantConsequence: JTDSchemaType<ConfigJsonVariantConsequence> = {
|
|
347
|
+
optionalProperties: {
|
|
348
|
+
sample_cells: {
|
|
349
|
+
optionalProperties: {
|
|
350
|
+
all: { elements: schemaConfigJsonField },
|
|
351
|
+
snv: { elements: schemaConfigJsonField },
|
|
352
|
+
str: { elements: schemaConfigJsonField },
|
|
353
|
+
sv: { elements: schemaConfigJsonField },
|
|
354
|
+
},
|
|
355
|
+
},
|
|
356
|
+
},
|
|
357
|
+
};
|
|
358
|
+
|
|
359
|
+
const schema: JTDSchemaType<ConfigJson> = {
|
|
360
|
+
properties: {
|
|
361
|
+
vip: schemaConfigJsonVip,
|
|
362
|
+
sample_variants: schemaConfigJsonVariants,
|
|
363
|
+
variants: schemaConfigJsonVariants,
|
|
364
|
+
sample_variant: schemaConfigJsonVariant,
|
|
365
|
+
variant: schemaConfigJsonVariant,
|
|
366
|
+
sample_variant_consequence: schemaConfigJsonVariantConsequence,
|
|
367
|
+
variant_consequence: schemaConfigJsonVariantConsequence,
|
|
368
|
+
},
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
const validate = ajv.compile(schema);
|
|
372
|
+
|
|
373
|
+
export function validateConfig(json: Json): ConfigJson {
|
|
374
|
+
const valid = validate(json);
|
|
375
|
+
if (valid) {
|
|
376
|
+
return json; // json is 'ConfigStatic' here
|
|
377
|
+
} else {
|
|
378
|
+
throw new ConfigValidationError(validate);
|
|
379
|
+
}
|
|
380
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ConfigJsonVip, ConfigVip } from "../../types/config";
|
|
2
|
+
import { MetadataContainer } from "../api.ts";
|
|
3
|
+
import { getSampleField } from "../vcf.ts";
|
|
4
|
+
import { ConfigInvalidPropertyValueError } from "../error.ts";
|
|
5
|
+
|
|
6
|
+
export function initConfigVip(config: ConfigJsonVip, metadata: MetadataContainer): ConfigVip {
|
|
7
|
+
const filterField = config.filter_field;
|
|
8
|
+
const fieldMetadata = getSampleField(metadata.records, filterField.name);
|
|
9
|
+
|
|
10
|
+
if (fieldMetadata === undefined) {
|
|
11
|
+
throw new ConfigInvalidPropertyValueError(
|
|
12
|
+
"vip.filter_field.name",
|
|
13
|
+
filterField.name,
|
|
14
|
+
"does not exist in vcf metadata",
|
|
15
|
+
);
|
|
16
|
+
} else if (fieldMetadata.type !== "CATEGORICAL") {
|
|
17
|
+
throw new ConfigInvalidPropertyValueError(
|
|
18
|
+
"vip.filter_field.name",
|
|
19
|
+
filterField.name,
|
|
20
|
+
`is of type ${fieldMetadata.type} instead of CATEGORICAL`,
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return { filter_field: fieldMetadata, params: config.params };
|
|
25
|
+
}
|
package/src/utils/csq.ts
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { FieldMetadata, NestedFieldMetadata, Value } from "@molgenis/vip-report-vcf";
|
|
2
|
+
import { Direction } from "./query/sort.ts";
|
|
3
|
+
|
|
4
|
+
function is(infoMeta: FieldMetadata, id: string) {
|
|
5
|
+
return infoMeta.id === id;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function isCsq(infoMeta: FieldMetadata) {
|
|
9
|
+
return infoMeta.parent?.id === "CSQ";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export function isCsqInfo(infoMeta: FieldMetadata, id: string) {
|
|
13
|
+
return isCsq(infoMeta) && is(infoMeta, id);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function isAnyCsqInfo(infoMeta: FieldMetadata, ids: string[]) {
|
|
17
|
+
return isCsq(infoMeta) && ids.some((id) => is(infoMeta, id));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const consequenceOrder = [
|
|
21
|
+
"transcript_ablation",
|
|
22
|
+
"splice_acceptor_variant",
|
|
23
|
+
"splice_donor_variant",
|
|
24
|
+
"splice_donor_5th_base_variant",
|
|
25
|
+
"splice_donor_region_variant",
|
|
26
|
+
"splice_polypyrimidine_tract_variant",
|
|
27
|
+
"stop_gained",
|
|
28
|
+
"frameshift_variant",
|
|
29
|
+
"stop_lost",
|
|
30
|
+
"start_lost",
|
|
31
|
+
"transcript_amplification",
|
|
32
|
+
"inframe_insertion",
|
|
33
|
+
"inframe_deletion",
|
|
34
|
+
"missense_variant",
|
|
35
|
+
"protein_altering_variant",
|
|
36
|
+
"splice_region_variant",
|
|
37
|
+
"incomplete_terminal_codon_variant",
|
|
38
|
+
"start_retained_variant",
|
|
39
|
+
"stop_retained_variant",
|
|
40
|
+
"synonymous_variant",
|
|
41
|
+
"coding_sequence_variant",
|
|
42
|
+
"mature_miRNA_variant",
|
|
43
|
+
"5_prime_UTR_variant",
|
|
44
|
+
"3_prime_UTR_variant",
|
|
45
|
+
"non_coding_transcript_exon_variant",
|
|
46
|
+
"intron_variant",
|
|
47
|
+
"NMD_transcript_variant",
|
|
48
|
+
"non_coding_transcript_variant",
|
|
49
|
+
"upstream_gene_variant",
|
|
50
|
+
"downstream_gene_variant",
|
|
51
|
+
"TFBS_ablation",
|
|
52
|
+
"TFBS_amplification",
|
|
53
|
+
"TF_binding_site_variant",
|
|
54
|
+
"regulatory_region_ablation",
|
|
55
|
+
"regulatory_region_amplification",
|
|
56
|
+
"feature_elongation",
|
|
57
|
+
"regulatory_region_variant",
|
|
58
|
+
"feature_truncation",
|
|
59
|
+
"intergenic_variant",
|
|
60
|
+
].reduce((acc: { [key: string]: number }, curr, currIndex) => {
|
|
61
|
+
acc[curr] = currIndex;
|
|
62
|
+
return acc;
|
|
63
|
+
}, {});
|
|
64
|
+
|
|
65
|
+
function getMostSevereConsequenceIndex(value: string[]) {
|
|
66
|
+
const filteredMappedIndices = value
|
|
67
|
+
.map((consequence) => consequenceOrder[consequence])
|
|
68
|
+
.filter((value) => value !== undefined);
|
|
69
|
+
return filteredMappedIndices.length != 0 ? filteredMappedIndices.reduce((max, value) => Math.max(max, value)) : 0;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function compareCsqValue(aValue: number | null, bValue: number | null, direction: string): number {
|
|
73
|
+
if (aValue === null) return bValue === null ? 0 : 1;
|
|
74
|
+
if (bValue === null) return -1;
|
|
75
|
+
return direction === "desc" ? bValue - aValue : aValue - bValue;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
export function compareCsq(
|
|
79
|
+
aValueArray: Value[],
|
|
80
|
+
bValueArray: Value[],
|
|
81
|
+
field: FieldMetadata,
|
|
82
|
+
direction: Direction,
|
|
83
|
+
): number {
|
|
84
|
+
const parentField = field.parent as FieldMetadata;
|
|
85
|
+
const parentItems = (parentField.nested as NestedFieldMetadata).items;
|
|
86
|
+
|
|
87
|
+
const index = parentItems.findIndex((item) => item.id === field.id);
|
|
88
|
+
if (index === -1) {
|
|
89
|
+
throw new Error(`unknown field '${field.id}'`);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const aValue = aValueArray[index] as number | null;
|
|
93
|
+
const bValue = bValueArray[index] as number | null;
|
|
94
|
+
return compareCsqValue(aValue, bValue, direction);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export function compareCsqDefault(
|
|
98
|
+
aValue: Value[],
|
|
99
|
+
bValue: Value[],
|
|
100
|
+
pickIndex: number,
|
|
101
|
+
consequenceIndex: number,
|
|
102
|
+
): number {
|
|
103
|
+
if (pickIndex !== -1) {
|
|
104
|
+
if (aValue[pickIndex] === "1") return bValue[pickIndex] === null ? -1 : 0;
|
|
105
|
+
if (bValue[pickIndex] === "1") return 1;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (consequenceIndex !== -1) {
|
|
109
|
+
const aIndex = getMostSevereConsequenceIndex(aValue[consequenceIndex] as string[]);
|
|
110
|
+
const bIndex = getMostSevereConsequenceIndex(bValue[consequenceIndex] as string[]);
|
|
111
|
+
return aIndex - bIndex;
|
|
112
|
+
} else {
|
|
113
|
+
return 0;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { VcfRecord } from "@molgenis/vip-report-vcf";
|
|
2
|
+
import { Item } from "@molgenis/vip-report-api";
|
|
3
|
+
import { DecisionTreePath } from "../components/tree/DecisionTreePath";
|
|
4
|
+
|
|
5
|
+
import { getInfoNestedField, getInfoValue, getSampleField, getSampleValue } from "./vcf.ts";
|
|
6
|
+
import { SampleContainer, VcfMetadataContainer } from "./api.ts";
|
|
7
|
+
import { RuntimeError } from "./error.ts";
|
|
8
|
+
|
|
9
|
+
export function getDecisionTreePath(
|
|
10
|
+
metadata: VcfMetadataContainer,
|
|
11
|
+
variant: Item<VcfRecord>,
|
|
12
|
+
csqId: number,
|
|
13
|
+
): DecisionTreePath {
|
|
14
|
+
let decisionTreePath: DecisionTreePath;
|
|
15
|
+
const fieldMetadata = getInfoNestedField(metadata, "CSQ", "VIPP");
|
|
16
|
+
if (fieldMetadata) {
|
|
17
|
+
const value = getInfoValue(variant, csqId, fieldMetadata);
|
|
18
|
+
if (value === undefined) throw new RuntimeError("required value must not be undefined");
|
|
19
|
+
decisionTreePath = value as DecisionTreePath;
|
|
20
|
+
} else {
|
|
21
|
+
decisionTreePath = [];
|
|
22
|
+
}
|
|
23
|
+
return decisionTreePath;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function getSampleTreePath(
|
|
27
|
+
metadata: VcfMetadataContainer,
|
|
28
|
+
sample: SampleContainer,
|
|
29
|
+
variant: Item<VcfRecord>,
|
|
30
|
+
csqId: number,
|
|
31
|
+
): DecisionTreePath {
|
|
32
|
+
let decisionTreePath: DecisionTreePath;
|
|
33
|
+
const fieldMetadata = getSampleField(metadata, "VIPP_S");
|
|
34
|
+
if (fieldMetadata) {
|
|
35
|
+
const value = getSampleValue(sample, variant, -1, fieldMetadata); // TODO replace with getSampleNestedValue once VIPP_S metadata is nested
|
|
36
|
+
if (value === undefined) throw new RuntimeError("required value must not be undefined");
|
|
37
|
+
if (!Array.isArray(value)) throw new RuntimeError();
|
|
38
|
+
const valueArray = value as string[];
|
|
39
|
+
if (valueArray.length <= csqId) throw new RuntimeError();
|
|
40
|
+
decisionTreePath = valueArray[csqId]!.split("&") as DecisionTreePath;
|
|
41
|
+
} else {
|
|
42
|
+
decisionTreePath = [];
|
|
43
|
+
}
|
|
44
|
+
return decisionTreePath;
|
|
45
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { HtsFileMetadata } from "@molgenis/vip-report-api";
|
|
2
|
+
|
|
3
|
+
export function createVcfDownloadFilename(htsFileMetadata: HtsFileMetadata) {
|
|
4
|
+
return (
|
|
5
|
+
(htsFileMetadata.uri.split("\\").pop()?.split("/").pop()?.split(".").shift() || "unknown") +
|
|
6
|
+
"_report_" +
|
|
7
|
+
getDateTimeString() +
|
|
8
|
+
".vcf"
|
|
9
|
+
);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// derived from https://stackoverflow.com/a/19176102
|
|
13
|
+
function getDateTimeString() {
|
|
14
|
+
const now = new Date();
|
|
15
|
+
|
|
16
|
+
const year = now.getFullYear().toString();
|
|
17
|
+
let month = (now.getMonth() + 1).toString();
|
|
18
|
+
let day = now.getDate().toString();
|
|
19
|
+
let hour = now.getHours().toString();
|
|
20
|
+
let minute = now.getMinutes().toString();
|
|
21
|
+
let second = now.getSeconds().toString();
|
|
22
|
+
|
|
23
|
+
if (month.length == 1) month = "0" + month;
|
|
24
|
+
if (day.length == 1) day = "0" + day;
|
|
25
|
+
if (hour.length == 1) hour = "0" + hour;
|
|
26
|
+
if (minute.length == 1) minute = "0" + minute;
|
|
27
|
+
if (second.length == 1) second = "0" + second;
|
|
28
|
+
|
|
29
|
+
return year + month + day + "_" + hour + minute + second;
|
|
30
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { ValidateFunction } from "ajv";
|
|
2
|
+
import { SortPath } from "@molgenis/vip-report-api";
|
|
3
|
+
|
|
4
|
+
export class ArrayIndexOutOfBoundsException extends Error {
|
|
5
|
+
constructor() {
|
|
6
|
+
super();
|
|
7
|
+
this.name = "ArrayIndexOutOfBoundsException";
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export class UnexpectedEnumValueException extends Error {
|
|
12
|
+
constructor(enumValue: string) {
|
|
13
|
+
super(enumValue);
|
|
14
|
+
this.name = "UnexpectedEnumValueException";
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export class InvalidIdException extends Error {
|
|
19
|
+
constructor(id: string | undefined) {
|
|
20
|
+
super(id);
|
|
21
|
+
this.name = "InvalidIdException";
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export class InvalidVcfError extends Error {
|
|
26
|
+
constructor() {
|
|
27
|
+
super();
|
|
28
|
+
this.name = "InvalidVcfException";
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* programming error
|
|
34
|
+
*/
|
|
35
|
+
export class RuntimeError extends Error {
|
|
36
|
+
constructor(message?: string) {
|
|
37
|
+
super(message);
|
|
38
|
+
this.name = "RuntimeError";
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export class ConfigValidationError extends Error {
|
|
43
|
+
constructor(validate: ValidateFunction) {
|
|
44
|
+
super("config invalid");
|
|
45
|
+
this.name = "ConfigValidationError";
|
|
46
|
+
console.error("validation errors", validate.errors);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export class ConfigInvalidError extends Error {
|
|
51
|
+
constructor(message?: string) {
|
|
52
|
+
super("config invalid" + (message ? `: ${message}` : ""));
|
|
53
|
+
this.name = "ConfigInvalidError";
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export class ConfigInvalidPropertyValueError extends ConfigInvalidError {
|
|
58
|
+
constructor(property: string, value: string, message: string) {
|
|
59
|
+
super(`property '${property}' value '${value}' ${message}`);
|
|
60
|
+
this.name = "ConfigInvalidError";
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export class InvalidSortPathError extends Error {
|
|
65
|
+
constructor(path: SortPath) {
|
|
66
|
+
super(`invalid record sort path '[${path.join(",")}]'`);
|
|
67
|
+
this.name = "InvalidSortPathError";
|
|
68
|
+
}
|
|
69
|
+
}
|