From ace14591f26071eb7391975e334b2d5cf5d4e0ef Mon Sep 17 00:00:00 2001 From: Colin Date: Mon, 25 Sep 2023 12:47:11 -0400 Subject: [PATCH] Updates --- .../variants/src/VariantTrack/saveTrackFormats/vcf.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/plugins/variants/src/VariantTrack/saveTrackFormats/vcf.ts b/plugins/variants/src/VariantTrack/saveTrackFormats/vcf.ts index 3bcf751ab8..59a927efbb 100644 --- a/plugins/variants/src/VariantTrack/saveTrackFormats/vcf.ts +++ b/plugins/variants/src/VariantTrack/saveTrackFormats/vcf.ts @@ -1,9 +1,17 @@ import { Feature } from '@jbrowse/core/util' +function generateINFO(feature: Feature) { + return Object.entries(feature.get('INFO')) + .map(([key, value]) => `${key}=${value}`) + .join(';') +} export function stringifyVCF({ features }: { features: Feature[] }) { + const fields = ['refName', 'start', 'name', 'REF', 'ALT', 'QUAL', 'FILTER'] return features .map(feature => { - return `hello ${feature.get('name')}` + return `${fields + .map(field => feature.get(field) || '.') + .join('\t')}\t${generateINFO(feature)}` }) .join('\n') }