@molgenis/vip-report-template 7.0.1 → 7.0.2
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/package.json +1 -1
- package/src/components/VariantsContainerHeader.tsx +1 -1
- package/src/components/field/composed/FieldGenotypeStr.tsx +2 -1
- package/src/types/config.d.ts +1 -1
- package/src/utils/config/configVip.ts +2 -8
- package/src/utils/query/query.ts +3 -1
- package/src/utils/query/querySample.ts +6 -3
- package/tests/utils/config/configVip.test.ts +4 -4
- package/tests/utils/query/querySample.test.ts +7 -0
package/package.json
CHANGED
|
@@ -34,7 +34,7 @@ export const VariantsContainerHeader: Component<{
|
|
|
34
34
|
const sampleMother = props.sample.maternalSample;
|
|
35
35
|
const sampleOtherFamilyMembers = props.sample.otherPedigreeSamples;
|
|
36
36
|
|
|
37
|
-
if (!(sampleFather ===
|
|
37
|
+
if (!(sampleFather === null && sampleMother === null && sampleOtherFamilyMembers.length === 0)) {
|
|
38
38
|
const tokens: string[] = [];
|
|
39
39
|
if (sampleMother !== null) {
|
|
40
40
|
tokens.push(`mother (${getTitleAffectedStatusLabel(sampleMother)})`);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Component, Show } from "solid-js";
|
|
2
2
|
import { Allele } from "../../Allele";
|
|
3
3
|
import { CellValueGenotype } from "../../../types/configCellComposed";
|
|
4
|
+
import { FieldGenotypeSnvSv } from "./FieldGenotypeSnvSv.tsx";
|
|
4
5
|
|
|
5
6
|
export const FieldGenotypeStr: Component<{
|
|
6
7
|
value: CellValueGenotype;
|
|
@@ -12,7 +13,7 @@ export const FieldGenotypeStr: Component<{
|
|
|
12
13
|
props.value.repeatUnitMatch !== undefined;
|
|
13
14
|
|
|
14
15
|
return (
|
|
15
|
-
<Show when={showGenotype()}>
|
|
16
|
+
<Show when={showGenotype()} fallback={<FieldGenotypeSnvSv value={props.value} />}>
|
|
16
17
|
<abbr title={`display repeat unit familiar to clinician: ${props.value.displayRepeatUnit!}`}>
|
|
17
18
|
<Allele value={props.value.repeatUnitValue!} isAbbreviate={false} />
|
|
18
19
|
<sub>n</sub>
|
package/src/types/config.d.ts
CHANGED
|
@@ -7,13 +7,7 @@ export function initConfigVip(config: ConfigJsonVip, metadata: MetadataContainer
|
|
|
7
7
|
const filterField = config.filter_field;
|
|
8
8
|
const fieldMetadata = getSampleField(metadata.records, filterField.name);
|
|
9
9
|
|
|
10
|
-
if (fieldMetadata
|
|
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") {
|
|
10
|
+
if (fieldMetadata && fieldMetadata.type !== "CATEGORICAL") {
|
|
17
11
|
throw new ConfigInvalidPropertyValueError(
|
|
18
12
|
"vip.filter_field.name",
|
|
19
13
|
filterField.name,
|
|
@@ -21,5 +15,5 @@ export function initConfigVip(config: ConfigJsonVip, metadata: MetadataContainer
|
|
|
21
15
|
);
|
|
22
16
|
}
|
|
23
17
|
|
|
24
|
-
return { filter_field: fieldMetadata, params: config.params };
|
|
18
|
+
return { filter_field: fieldMetadata || null, params: config.params };
|
|
25
19
|
}
|
package/src/utils/query/query.ts
CHANGED
|
@@ -23,7 +23,9 @@ export function createQuery(
|
|
|
23
23
|
|
|
24
24
|
if (sample !== null) {
|
|
25
25
|
const querySample = createQuerySample(config.vip, sample);
|
|
26
|
-
|
|
26
|
+
if (querySample !== null) {
|
|
27
|
+
queryParts.push(querySample);
|
|
28
|
+
}
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
const queryFilters = createQueryFilters(config.variants.filters, filterValues);
|
|
@@ -5,10 +5,13 @@ import { ConfigVip } from "../../types/config";
|
|
|
5
5
|
import { FilterValueCategorical } from "../../types/configFilter";
|
|
6
6
|
import { createQueryFilterFieldCategorical } from "./queryFilterField.ts";
|
|
7
7
|
|
|
8
|
-
export function createQuerySample(config: ConfigVip, sample: SampleContainer): Query {
|
|
8
|
+
export function createQuerySample(config: ConfigVip, sample: SampleContainer): Query | null {
|
|
9
|
+
const filterField = config.filter_field;
|
|
10
|
+
if (filterField === null) return null;
|
|
11
|
+
|
|
9
12
|
const filterValues = getFilterValues(config);
|
|
10
|
-
const selector = createSelectorSample(sample,
|
|
11
|
-
return createQueryFilterFieldCategorical(selector,
|
|
13
|
+
const selector = createSelectorSample(sample, filterField);
|
|
14
|
+
return createQueryFilterFieldCategorical(selector, filterField, filterValues);
|
|
12
15
|
}
|
|
13
16
|
|
|
14
17
|
function getFilterValues(config: ConfigVip): FilterValueCategorical {
|
|
@@ -44,10 +44,10 @@ describe("config vip", () => {
|
|
|
44
44
|
test("init metadata unavailable", () => {
|
|
45
45
|
vi.mocked(getSampleField).mockReturnValue(undefined);
|
|
46
46
|
|
|
47
|
-
expect(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
expect(initConfigVip(config, metadata as MetadataContainer)).toStrictEqual({
|
|
48
|
+
filter_field: null,
|
|
49
|
+
params,
|
|
50
|
+
});
|
|
51
51
|
});
|
|
52
52
|
});
|
|
53
53
|
});
|
|
@@ -41,5 +41,12 @@ describe("query sample", () => {
|
|
|
41
41
|
"__null",
|
|
42
42
|
]);
|
|
43
43
|
});
|
|
44
|
+
|
|
45
|
+
test("create without filter field", () => {
|
|
46
|
+
const classes = "VUS,LP,P";
|
|
47
|
+
const config = { filter_field: null, params: { vcf: { filter_samples: { classes } } } } as ConfigVip;
|
|
48
|
+
const sample = { item: { data: { index: 1 } } } as SampleContainer;
|
|
49
|
+
expect(createQuerySample(config, sample)).toStrictEqual(null);
|
|
50
|
+
});
|
|
44
51
|
});
|
|
45
52
|
});
|