@molgenis/vip-report-template 8.2.2 → 8.3.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.
@@ -415,16 +415,16 @@
415
415
  "label": "Father"
416
416
  },
417
417
  {
418
- "type": "genotype",
419
- "name": "REPCI"
418
+ "type": "composed",
419
+ "name": "confidenceInterval"
420
420
  },
421
421
  {
422
422
  "type": "genotype",
423
423
  "name": "LC"
424
424
  },
425
425
  {
426
- "type": "genotype",
427
- "name": "ADSP"
426
+ "type": "composed",
427
+ "name": "spanningReads"
428
428
  },
429
429
  {
430
430
  "type": "info",
@@ -533,6 +533,11 @@
533
533
  "type": "composed",
534
534
  "name": "locus"
535
535
  },
536
+ {
537
+ "type": "info",
538
+ "name": "CSQ/PICK",
539
+ "defaultValue": "true"
540
+ },
536
541
  {
537
542
  "type": "info",
538
543
  "name": "CSQ/HPO",
@@ -413,13 +413,17 @@
413
413
  "label": "Father"
414
414
  },
415
415
  {
416
- "type": "genotype",
417
- "name": "REPCI"
416
+ "type": "composed",
417
+ "name": "confidenceInterval"
418
418
  },
419
419
  {
420
420
  "type": "genotype",
421
421
  "name": "LC"
422
422
  },
423
+ {
424
+ "type": "composed",
425
+ "name": "spanningReads"
426
+ },
423
427
  {
424
428
  "type": "genotype",
425
429
  "name": "ADSP"
@@ -413,16 +413,16 @@
413
413
  "label": "Father"
414
414
  },
415
415
  {
416
- "type": "genotype",
417
- "name": "REPCI"
416
+ "type": "composed",
417
+ "name": "confidenceInterval"
418
418
  },
419
419
  {
420
420
  "type": "genotype",
421
421
  "name": "LC"
422
422
  },
423
423
  {
424
- "type": "genotype",
425
- "name": "ADSP"
424
+ "type": "composed",
425
+ "name": "spanningReads"
426
426
  },
427
427
  {
428
428
  "type": "info",
@@ -34,6 +34,7 @@ export interface ConfigJsonFieldComposed extends Describable {
34
34
  type: "composed";
35
35
  name:
36
36
  | "clinVar"
37
+ | "confidenceInterval"
37
38
  | "gene"
38
39
  | "genotype"
39
40
  | "genotype_maternal"
@@ -43,6 +44,7 @@ export interface ConfigJsonFieldComposed extends Describable {
43
44
  | "inheritancePattern"
44
45
  | "locus"
45
46
  | "ref"
47
+ | "spanningReads"
46
48
  | "vipC"
47
49
  | "vipCS"
48
50
  | "vkgl";
@@ -1,4 +1,4 @@
1
- import { Genotype, InfoMetadata, ValueFlag, ValueFloat, ValueString } from "@molgenis/vip-report-vcf";
1
+ import { Genotype, InfoMetadata, ValueFlag, ValueFloat, ValueInteger, ValueString } from "@molgenis/vip-report-vcf";
2
2
  import { ValueCategorical } from "../utils/vcf.ts";
3
3
 
4
4
  export type CellValueClinVar = {
@@ -30,13 +30,23 @@ export type CellValueGenotype = {
30
30
  altAlleles: (string | null)[];
31
31
  genotype: Genotype;
32
32
  svType: ValueString | undefined;
33
- repeatCount: ValueString | undefined;
33
+ repeatCount: ValueString[] | undefined;
34
34
  repeatUnitValue: ValueString | undefined;
35
35
  repeatUnitMatch: ValueFlag | undefined;
36
36
  displayRepeatUnit: ValueString | undefined;
37
37
  viab: number | null | undefined;
38
38
  };
39
39
 
40
+ export type CellValueConfidenceInterval = {
41
+ genotype: Genotype;
42
+ confidenceInterval: ValueString[];
43
+ };
44
+
45
+ export type CellValueSpanningReads = {
46
+ genotype: Genotype;
47
+ spanningReads: ValueInteger[];
48
+ };
49
+
40
50
  export type CellValueHpo = {
41
51
  hpos: ValueCategorical[];
42
52
  gadoPd: ValueCategorical | undefined;
@@ -78,6 +88,8 @@ export type CellValueCustom =
78
88
  | CellValueGene
79
89
  | CellValueGnomAd
80
90
  | CellValueGenotype
91
+ | CellValueConfidenceInterval
92
+ | CellValueSpanningReads
81
93
  | CellValueHpo
82
94
  | CellValueInheritanceModes
83
95
  | CellValueLocus
@@ -1,9 +1,18 @@
1
1
  import { ConfigCellCustom } from "../../types/configCells";
2
- import { Genotype, InfoMetadata, ValueFlag, ValueFloat, ValueString, VcfRecord } from "@molgenis/vip-report-vcf";
2
+ import {
3
+ Genotype,
4
+ InfoMetadata,
5
+ ValueFlag,
6
+ ValueFloat,
7
+ ValueInteger,
8
+ ValueString,
9
+ VcfRecord,
10
+ } from "@molgenis/vip-report-vcf";
3
11
  import { Item } from "@molgenis/vip-report-api";
4
12
  import { getSampleLabel } from "../sample.ts";
5
13
  import {
6
14
  CellValueClinVar,
15
+ CellValueConfidenceInterval,
7
16
  CellValueCustom,
8
17
  CellValueGene,
9
18
  CellValueGenotype,
@@ -11,11 +20,13 @@ import {
11
20
  CellValueHpo,
12
21
  CellValueInheritanceModes,
13
22
  CellValueLocus,
23
+ CellValueSpanningReads,
14
24
  CellValueVipC,
15
25
  CellValueVipCS,
16
26
  CellValueVkgl,
17
27
  } from "../../types/configCellComposed";
18
28
  import {
29
+ getInfoField,
19
30
  getInfoFields,
20
31
  getInfoNestedField,
21
32
  getInfoNestedFields,
@@ -80,6 +91,12 @@ export function initConfigCellComposed(
80
91
  case "vkgl":
81
92
  fieldConfig = createConfigFieldCustomVkgl(configStatic, metadata.records);
82
93
  break;
94
+ case "confidenceInterval":
95
+ fieldConfig = createConfigFieldCustomConfidenceInterval(configStatic, metadata.records, sample);
96
+ break;
97
+ case "spanningReads":
98
+ fieldConfig = createConfigFieldCustomSpanningReads(configStatic, metadata.records, sample);
99
+ break;
83
100
  default:
84
101
  throw new ConfigInvalidError(`unknown composed cell name '${id}'`);
85
102
  }
@@ -201,15 +218,16 @@ function createConfigFieldCustomGenotypeForSample(
201
218
  ): ConfigCellCustom<CellValueGenotype> | null {
202
219
  if (sample === null) return null;
203
220
 
204
- const [fieldGt, fieldRepCn, fieldViab] = getSampleFields(metadata, "GT", "REPCN", "VIAB");
221
+ const [fieldGt, fieldViab] = getSampleFields(metadata, "GT", "VIAB");
205
222
  if (fieldGt === undefined) return null; // unlikely, but possible
206
223
 
207
- const [fieldSvType, fieldRu, fieldRuMatch, fieldDisplayRu] = getInfoFields(
224
+ const [fieldSvType, fieldRu, fieldRuMatch, fieldDisplayRu, fieldRepCn] = getInfoFields(
208
225
  metadata,
209
226
  "SVTYPE",
210
- "RU",
211
- "RUMATCH",
227
+ "RU_CALL",
228
+ "RU_MATCH",
212
229
  "DisplayRU",
230
+ "RU_NR",
213
231
  );
214
232
 
215
233
  return {
@@ -219,23 +237,26 @@ function createConfigFieldCustomGenotypeForSample(
219
237
  description: () => getDescription(config),
220
238
  valueCount: () => 1,
221
239
  value: (record: Item<VcfRecord>, valueIndex: number): CellValueGenotype => {
222
- const [genotype, repeatCount, viab] = getSampleValues(
223
- sample,
224
- record,
225
- valueIndex,
226
- fieldGt,
227
- fieldRepCn,
228
- fieldViab,
229
- ) as [Genotype, ValueString | undefined, number | null | undefined];
240
+ const [genotype, viab] = getSampleValues(sample, record, valueIndex, fieldGt, fieldViab) as [
241
+ Genotype,
242
+ number | null | undefined,
243
+ ];
230
244
 
231
- const [svType, repeatUnitValue, repeatUnitMatch, displayRepeatUnit] = getInfoValues(
245
+ const [svType, repeatUnitValue, repeatUnitMatch, displayRepeatUnit, repeatCount] = getInfoValues(
232
246
  record,
233
247
  valueIndex,
234
248
  fieldSvType,
235
249
  fieldRu,
236
250
  fieldRuMatch,
237
251
  fieldDisplayRu,
238
- ) as [ValueString | undefined, ValueString | undefined, ValueFlag | undefined, ValueString | undefined];
252
+ fieldRepCn,
253
+ ) as [
254
+ ValueString | undefined,
255
+ ValueString | undefined,
256
+ ValueFlag | undefined,
257
+ ValueString | undefined,
258
+ ValueString[] | undefined,
259
+ ];
239
260
  return {
240
261
  refAllele: record.data.r,
241
262
  altAlleles: record.data.a,
@@ -251,6 +272,59 @@ function createConfigFieldCustomGenotypeForSample(
251
272
  };
252
273
  }
253
274
 
275
+ function createConfigFieldCustomConfidenceInterval(
276
+ config: ConfigJsonFieldComposed,
277
+ metadata: VcfMetadataContainer,
278
+ sample: SampleContainer | null,
279
+ ): ConfigCellCustom<CellValueConfidenceInterval> | null {
280
+ if (sample === null) return null;
281
+ const fieldGt = getSampleField(metadata, "GT");
282
+ const fieldCi = getInfoField(metadata, "RU_CI");
283
+ return {
284
+ type: "composed",
285
+ id: "confidenceInterval",
286
+ label: () => getLabel(config, "Confidence interval"),
287
+ description: () => getDescription(config, "Confidence interval for repeat unit count"),
288
+ valueCount: () => 1,
289
+ value: (record: Item<VcfRecord>, valueIndex: number): CellValueConfidenceInterval => {
290
+ const genotype = getSampleValue(sample, record, valueIndex, fieldGt) as Genotype;
291
+ const ci = getInfoValue(record, valueIndex, fieldCi) as ValueString[];
292
+
293
+ return {
294
+ genotype: genotype,
295
+ confidenceInterval: ci !== undefined ? ci : [],
296
+ };
297
+ },
298
+ };
299
+ }
300
+
301
+ function createConfigFieldCustomSpanningReads(
302
+ config: ConfigJsonFieldComposed,
303
+ metadata: VcfMetadataContainer,
304
+ sample: SampleContainer | null,
305
+ ): ConfigCellCustom<CellValueSpanningReads> | null {
306
+ if (sample === null) return null;
307
+ const fieldGt = getSampleField(metadata, "GT");
308
+ const fieldSpan = getSampleField(metadata, "RU_SPAN");
309
+ return {
310
+ type: "composed",
311
+ id: "spanningReads",
312
+ label: () => getLabel(config, "Spanning Reads"),
313
+ description: () => getDescription(config, "Number of spanning reads for the genotype."),
314
+ valueCount: () => 1,
315
+ value: (record: Item<VcfRecord>, valueIndex: number): CellValueSpanningReads => {
316
+ console.log("here!");
317
+ const genotype = getSampleValue(sample, record, valueIndex, fieldGt) as Genotype;
318
+ const spanning = getSampleValue(sample, record, valueIndex, fieldSpan) as ValueInteger[];
319
+
320
+ return {
321
+ genotype: genotype,
322
+ spanningReads: spanning !== undefined ? spanning : [],
323
+ };
324
+ },
325
+ };
326
+ }
327
+
254
328
  function createConfigFieldCustomGnomAd(
255
329
  config: ConfigJsonFieldComposed,
256
330
  metadata: VcfMetadataContainer,