From 04d241e16971ce94007290ac9cc1dedadf4bb600 Mon Sep 17 00:00:00 2001 From: "bart.charbon" Date: Fri, 9 Jun 2023 13:35:01 +0200 Subject: [PATCH 1/3] Filter VIAB from export since it is a calculated field. --- src/VcfWriter.ts | 6 ++++-- src/__tests__/VcfWriter.test.ts | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/VcfWriter.ts b/src/VcfWriter.ts index be7d6db..af2b696 100644 --- a/src/VcfWriter.ts +++ b/src/VcfWriter.ts @@ -202,14 +202,16 @@ function writeString(value: string) { } function writeFormat(samples: RecordSample[]): string { - const keys = Object.keys(samples[0]); + const keys = Object.keys(samples[0]).filter((key) => key !== "VIAB"); return keys.length > 0 ? keys.map(writeString).join(":") : MISSING; } function writeSample(formatFields: FormatMetadataContainer, sample: RecordSample): string { const vcf = []; for (const [key, value] of Object.entries(sample)) { - vcf.push(writeSampleValue(formatFields[key], value)); + if (key !== "VIAB") { + vcf.push(writeSampleValue(formatFields[key], value)); + } } return vcf.join(":"); } diff --git a/src/__tests__/VcfWriter.test.ts b/src/__tests__/VcfWriter.test.ts index 7f6b10c..e4ee404 100644 --- a/src/__tests__/VcfWriter.test.ts +++ b/src/__tests__/VcfWriter.test.ts @@ -35,9 +35,10 @@ test("parse and write vcf: Samples filtered", () => { ##FORMAT= ##FORMAT= ##FORMAT= +##FORMAT= ##contig= #CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\tSAMPLE1\tSAMPLE2 -1\t1\t.\tA\tG\t.\t.\t.\tGT:GQ:HQ\t0/1:.:4,5\t1/1 +1\t1\t.\tA\tG\t.\t.\t.\tGT:AD:GQ:HQ\t0/1:20,80:.:4,5\t1/1 `; expect(writeVcf(parseVcf(vcfSamples), { samples: ["SAMPLE1", "SAMPLE2"] })).toBe(expectedVcfSamples); }); @@ -47,6 +48,7 @@ test("parse and write vcf: Samples none", () => { ##FORMAT= ##FORMAT= ##FORMAT= +##FORMAT= ##contig= #CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO 1\t1\t.\tA\tG\t.\t.\t. @@ -124,7 +126,8 @@ const vcfSamples = `##fileformat=VCFv4.2 ##FORMAT= ##FORMAT= ##FORMAT= +##FORMAT= ##contig= #CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO\tFORMAT\tSAMPLE0\tSAMPLE1\tSAMPLE2 -1\t1\t.\tA\tG\t.\t.\t.\tGT:GQ:HQ\t0|1:1:2,3\t0/1:.:4,5\t1/1 +1\t1\t.\tA\tG\t.\t.\t.\tGT:AD:GQ:HQ\t0|1:1,50:1:2,3\t0/1:20,80:.:4,5\t1/1 `; From e3c69bcc45ef914223acbace364acf805a80f578 Mon Sep 17 00:00:00 2001 From: "bart.charbon" Date: Tue, 13 Jun 2023 14:21:42 +0200 Subject: [PATCH 2/3] Bump version to 1.3.6 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0137a65..1c7fb5d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@molgenis/vip-report-vcf", - "version": "1.3.5", + "version": "1.3.6", "description": "TypeScript VCF library with support for both reading and writing", "scripts": { "preinstall": "curl --no-progress-meter --location https://github.com/molgenis/vip-utils/releases/download/v1.1.3/field_metadata.json --create-dirs --output src/metadata/field_metadata.json", From 0134a3d25a31c4c347063c6e523d654750c5c1ca Mon Sep 17 00:00:00 2001 From: "bart.charbon" Date: Tue, 4 Jul 2023 15:00:10 +0200 Subject: [PATCH 3/3] Bump version to 1.4.0 and vip-utils to 1.3.0 to support GADO --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1c7fb5d..7c8fbe5 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { "name": "@molgenis/vip-report-vcf", - "version": "1.3.6", + "version": "1.4.0", "description": "TypeScript VCF library with support for both reading and writing", "scripts": { - "preinstall": "curl --no-progress-meter --location https://github.com/molgenis/vip-utils/releases/download/v1.1.3/field_metadata.json --create-dirs --output src/metadata/field_metadata.json", + "preinstall": "curl --no-progress-meter --location https://github.com/molgenis/vip-utils/releases/download/v1.3.0/field_metadata.json --create-dirs --output src/metadata/field_metadata.json", "build": "tsc --build", "format": "prettier --write src/**/*.ts", "lint": "eslint src/**/*.ts",