@molgenis/vip-report-template 7.0.0 → 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/.travis.yml CHANGED
@@ -22,7 +22,7 @@ script:
22
22
  - pnpm run coverage
23
23
  - pnpm run build
24
24
  before_deploy:
25
- - mv dist/index.html dist/vip-report-template.html
25
+ - cp dist/index.html dist/vip-report-template.html
26
26
  deploy:
27
27
  - provider: script
28
28
  script: bash scripts/deploy_npm_registry.sh
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molgenis/vip-report-template",
3
- "version": "7.0.0",
3
+ "version": "7.0.2",
4
4
  "description": "Report Template for Variant Call Format (VCF) Report Generator",
5
5
  "license": "LGPL-3.0",
6
6
  "devDependencies": {
@@ -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 === undefined && sampleMother === undefined && sampleOtherFamilyMembers.length === 0)) {
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>
@@ -185,6 +185,6 @@ export type ConfigVariantConsequence = {
185
185
  export type ConfigVipParams = ConfigJsonVipParams;
186
186
 
187
187
  export type ConfigVip = {
188
- filter_field: FieldMetadataWrapper;
188
+ filter_field: FieldMetadataWrapper | null;
189
189
  params: ConfigVipParams;
190
190
  };
@@ -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 === 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") {
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
  }
@@ -23,7 +23,9 @@ export function createQuery(
23
23
 
24
24
  if (sample !== null) {
25
25
  const querySample = createQuerySample(config.vip, sample);
26
- queryParts.push(querySample);
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, config.filter_field);
11
- return createQueryFilterFieldCategorical(selector, config.filter_field, filterValues);
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(() => initConfigVip(config, metadata as MetadataContainer)).toThrowError(
48
- /^config invalid: property 'vip.filter_field.name' value 'f' does not exist in vcf metadata$/,
49
- );
50
- expect(getSampleField).toHaveBeenCalledWith(vcfMetadata, "f");
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
  });