@molgenis/vip-report-template 8.2.2 → 8.3.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.
@@ -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
- repeatUnitMatch: ValueFlag | undefined;
35
+ repeatUnitMatch: ValueInteger | 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,6 +20,7 @@ import {
11
20
  CellValueHpo,
12
21
  CellValueInheritanceModes,
13
22
  CellValueLocus,
23
+ CellValueSpanningReads,
14
24
  CellValueVipC,
15
25
  CellValueVipCS,
16
26
  CellValueVkgl,
@@ -80,6 +90,12 @@ export function initConfigCellComposed(
80
90
  case "vkgl":
81
91
  fieldConfig = createConfigFieldCustomVkgl(configStatic, metadata.records);
82
92
  break;
93
+ case "confidenceInterval":
94
+ fieldConfig = createConfigFieldCustomConfidenceInterval(configStatic, metadata.records, sample);
95
+ break;
96
+ case "spanningReads":
97
+ fieldConfig = createConfigFieldCustomSpanningReads(configStatic, metadata.records, sample);
98
+ break;
83
99
  default:
84
100
  throw new ConfigInvalidError(`unknown composed cell name '${id}'`);
85
101
  }
@@ -201,16 +217,17 @@ function createConfigFieldCustomGenotypeForSample(
201
217
  ): ConfigCellCustom<CellValueGenotype> | null {
202
218
  if (sample === null) return null;
203
219
 
204
- const [fieldGt, fieldRepCn, fieldViab] = getSampleFields(metadata, "GT", "REPCN", "VIAB");
205
- if (fieldGt === undefined) return null; // unlikely, but possible
206
-
207
- const [fieldSvType, fieldRu, fieldRuMatch, fieldDisplayRu] = getInfoFields(
220
+ const [fieldGt, fieldViab, fieldRu, fieldRuMatch, fieldRepCn] = getSampleFields(
208
221
  metadata,
209
- "SVTYPE",
210
- "RU",
211
- "RUMATCH",
212
- "DisplayRU",
222
+ "GT",
223
+ "VIAB",
224
+ "RU_CALL",
225
+ "RU_MATCH",
226
+ "RU_NR",
213
227
  );
228
+ if (fieldGt === undefined) return null; // unlikely, but possible
229
+
230
+ const [fieldSvType, fieldDisplayRu] = getInfoFields(metadata, "SVTYPE", "DisplayRU");
214
231
 
215
232
  return {
216
233
  type: "composed",
@@ -219,23 +236,28 @@ function createConfigFieldCustomGenotypeForSample(
219
236
  description: () => getDescription(config),
220
237
  valueCount: () => 1,
221
238
  value: (record: Item<VcfRecord>, valueIndex: number): CellValueGenotype => {
222
- const [genotype, repeatCount, viab] = getSampleValues(
239
+ const [genotype, viab, repeatUnitValue, repeatUnitMatch, repeatCount] = getSampleValues(
223
240
  sample,
224
241
  record,
225
242
  valueIndex,
226
243
  fieldGt,
227
- fieldRepCn,
228
244
  fieldViab,
229
- ) as [Genotype, ValueString | undefined, number | null | undefined];
230
-
231
- const [svType, repeatUnitValue, repeatUnitMatch, displayRepeatUnit] = getInfoValues(
232
- record,
233
- valueIndex,
234
- fieldSvType,
235
245
  fieldRu,
236
246
  fieldRuMatch,
237
- fieldDisplayRu,
238
- ) as [ValueString | undefined, ValueString | undefined, ValueFlag | undefined, ValueString | undefined];
247
+ fieldRepCn,
248
+ ) as [
249
+ Genotype,
250
+ number | null | undefined,
251
+ ValueString | undefined,
252
+ ValueInteger | undefined,
253
+ ValueString[] | undefined,
254
+ ];
255
+
256
+ const [svType, displayRepeatUnit] = getInfoValues(record, valueIndex, fieldSvType, fieldDisplayRu) as [
257
+ ValueString | undefined,
258
+ ValueString | undefined,
259
+ ];
260
+
239
261
  return {
240
262
  refAllele: record.data.r,
241
263
  altAlleles: record.data.a,
@@ -251,6 +273,59 @@ function createConfigFieldCustomGenotypeForSample(
251
273
  };
252
274
  }
253
275
 
276
+ function createConfigFieldCustomConfidenceInterval(
277
+ config: ConfigJsonFieldComposed,
278
+ metadata: VcfMetadataContainer,
279
+ sample: SampleContainer | null,
280
+ ): ConfigCellCustom<CellValueConfidenceInterval> | null {
281
+ if (sample === null) return null;
282
+ const fieldGt = getSampleField(metadata, "GT");
283
+ const fieldCi = getSampleField(metadata, "RU_CI");
284
+ return {
285
+ type: "composed",
286
+ id: "confidenceInterval",
287
+ label: () => getLabel(config, "Confidence interval"),
288
+ description: () => getDescription(config, "Confidence interval for repeat unit count"),
289
+ valueCount: () => 1,
290
+ value: (record: Item<VcfRecord>, valueIndex: number): CellValueConfidenceInterval => {
291
+ const genotype = getSampleValue(sample, record, valueIndex, fieldGt) as Genotype;
292
+ const ci = getSampleValue(sample, record, valueIndex, fieldCi) as ValueString[];
293
+
294
+ return {
295
+ genotype: genotype,
296
+ confidenceInterval: ci !== undefined ? ci : [],
297
+ };
298
+ },
299
+ };
300
+ }
301
+
302
+ function createConfigFieldCustomSpanningReads(
303
+ config: ConfigJsonFieldComposed,
304
+ metadata: VcfMetadataContainer,
305
+ sample: SampleContainer | null,
306
+ ): ConfigCellCustom<CellValueSpanningReads> | null {
307
+ if (sample === null) return null;
308
+ const fieldGt = getSampleField(metadata, "GT");
309
+ const fieldSpan = getSampleField(metadata, "RU_SPAN");
310
+ return {
311
+ type: "composed",
312
+ id: "spanningReads",
313
+ label: () => getLabel(config, "Spanning Reads"),
314
+ description: () => getDescription(config, "Number of spanning reads for the genotype."),
315
+ valueCount: () => 1,
316
+ value: (record: Item<VcfRecord>, valueIndex: number): CellValueSpanningReads => {
317
+ console.log("here!");
318
+ const genotype = getSampleValue(sample, record, valueIndex, fieldGt) as Genotype;
319
+ const spanning = getSampleValue(sample, record, valueIndex, fieldSpan) as ValueInteger[];
320
+
321
+ return {
322
+ genotype: genotype,
323
+ spanningReads: spanning !== undefined ? spanning : [],
324
+ };
325
+ },
326
+ };
327
+ }
328
+
254
329
  function createConfigFieldCustomGnomAd(
255
330
  config: ConfigJsonFieldComposed,
256
331
  metadata: VcfMetadataContainer,