Skip to content

Commit

Permalink
fix: store external metadata as json instead of bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
dennishendriksen committed Jan 26, 2024
1 parent 02171db commit bc94dec
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.0",
"version": "5.0.1",
"description": "TypeScript Report API for Variant Call Format (VCF) Report Templates",
"scripts": {
"build": "tsc --build",
Expand Down
3 changes: 2 additions & 1 deletion src/ApiClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
SortOrder,
} from "./Api";
import { Metadata as RecordMetadata, Record } from "@molgenis/vip-report-vcf/src/Vcf";
import { Metadata as ExternalMetadata } from "@molgenis/vip-report-vcf/src/FieldMetadata";
import { compareAsc, compareDesc } from "./compare";

export interface ReportData {
Expand All @@ -37,7 +38,7 @@ interface Data {

export interface BinaryReportData {
vcf?: Uint8Array;
vcfMeta?: Uint8Array;
vcfMeta?: ExternalMetadata;
fastaGz?: { [key: string]: Uint8Array };
genesGz?: Uint8Array;
cram?: { [key: string]: Cram };
Expand Down
5 changes: 1 addition & 4 deletions src/WindowApiClient.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { parseVcf } from "@molgenis/vip-report-vcf/src/VcfParser";
import { ApiClient, ReportData } from "./ApiClient";
import { Metadata } from "@molgenis/vip-report-vcf/src/FieldMetadata";

export type EncodedReport = ReportData & {
base85?: EncodedReportData;
Expand Down Expand Up @@ -29,9 +28,7 @@ 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
? (JSON.parse(new TextDecoder().decode(reportData.binary.vcfMeta)) as Metadata)
: undefined;
const vcfMeta = reportData.binary.vcfMeta ? reportData.binary.vcfMeta : undefined;
const vcf = parseVcf(new TextDecoder().decode(reportData.binary.vcf), vcfMeta);
reportData.metadata.records = vcf.metadata;
reportData.data.records = vcf.data;
Expand Down

0 comments on commit bc94dec

Please sign in to comment.