Skip to content

Commit

Permalink
Fix #67 Dropped trailing FORMAT values
Browse files Browse the repository at this point in the history
  • Loading branch information
dennishendriksen committed Nov 8, 2021
1 parent f731be6 commit 1dd830d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@molgenis/vip-report-api",
"version": "2.4.1",
"version": "2.4.2",
"description": "Report API for Variant Call Format (VCF) Report Templates",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/vcf/SampleDataParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export function parseRecordSample(
const parts = token.split(':');

const recordSample: RecordSample = {};
for (let i = 0; i < formatFields.length; ++i) {
for (let i = 0; i < parts.length; ++i) {
const field = formatFields[i];
recordSample[field] = parseFormatValue(parts[i], formatMetadataContainer[field]);
}
Expand Down
9 changes: 9 additions & 0 deletions src/vcf/__tests__/SampleDataParser.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,12 @@ test('parse record sample', () => {
})
).toStrictEqual({ GT: { a: [0, 1], p: true, t: 'het' }, DP: 5 });
});

test('parse record sample - drop trailing fields', () => {
expect(
parseRecordSample('0|1', ['GT', 'DP'], {
GT: gtFormatMetadata,
DP: dpFormatMetadata
})
).toStrictEqual({ GT: { a: [0, 1], p: true, t: 'het' } });
});

0 comments on commit 1dd830d

Please sign in to comment.