Skip to content

Commit

Permalink
fix: retrieve vcfMeta from report instead of report.binary
Browse files Browse the repository at this point in the history
  • Loading branch information
dennishendriksen committed Jan 26, 2024
1 parent bc94dec commit aca7dbd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
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": "5.0.1",
"version": "5.0.2",
"description": "TypeScript Report API for Variant Call Format (VCF) Report Templates",
"scripts": {
"build": "tsc --build",
Expand Down
3 changes: 1 addition & 2 deletions src/ApiClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export interface ReportData {
data: Data;
binary: BinaryReportData;
decisionTree?: DecisionTree;
vcfMeta?: ExternalMetadata;
}

interface Data {
Expand All @@ -38,11 +39,9 @@ interface Data {

export interface BinaryReportData {
vcf?: Uint8Array;
vcfMeta?: ExternalMetadata;
fastaGz?: { [key: string]: Uint8Array };
genesGz?: Uint8Array;
cram?: { [key: string]: Cram };
decisionTree?: DecisionTree;
}

export class ApiClient implements Api {
Expand Down
5 changes: 2 additions & 3 deletions src/WindowApiClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export type EncodedReportData = {
fastaGz?: { [key: string]: string };
genesGz?: string;
cram?: { [key: string]: { cram: string; crai: string } };
decisionTreeGz?: string;
};

declare global {
Expand All @@ -28,12 +27,12 @@ export class WindowApiClient extends ApiClient {
if (reportData === undefined) {
alert("This is a report template. Use the vip-report tool to create reports using this template and data.");
}
const vcfMeta = reportData.binary.vcfMeta ? reportData.binary.vcfMeta : undefined;
const vcfMeta = reportData.vcfMeta ? reportData.vcfMeta : undefined;
const vcf = parseVcf(new TextDecoder().decode(reportData.binary.vcf), vcfMeta);
reportData.metadata.records = vcf.metadata;
reportData.data.records = vcf.data;
delete reportData.binary.vcf;
delete reportData.binary.vcfMeta;
delete reportData.vcfMeta;
super(reportData);
}
}

0 comments on commit aca7dbd

Please sign in to comment.