From f9a70d72dee269611204c6ba9dd78034bba45620 Mon Sep 17 00:00:00 2001 From: jrobinso <933148+jrobinso@users.noreply.github.com> Date: Mon, 27 Nov 2023 19:56:06 -0800 Subject: [PATCH] Verify that VCF 4.3 files with a "v4.4" header can be parsed. Fixes #1289 --- .../broad/igv/variant/vcf/VCFVariantTest.java | 20 +++++++++++++++++++ test/data/vcf/fake_v4.vcf | 15 ++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 test/data/vcf/fake_v4.vcf diff --git a/src/test/java/org/broad/igv/variant/vcf/VCFVariantTest.java b/src/test/java/org/broad/igv/variant/vcf/VCFVariantTest.java index 4fd7f359bd..44da2f550b 100644 --- a/src/test/java/org/broad/igv/variant/vcf/VCFVariantTest.java +++ b/src/test/java/org/broad/igv/variant/vcf/VCFVariantTest.java @@ -95,4 +95,24 @@ private VCFVariant tstStart(String chr, int fileFeatStart, VariantContext.Type v assertEquals(expFeatStart, variant.getStart()); return variant; } + + /** + * Just verifies IGV will read a file marked vcf4.4 in the header, actual format is 4.1. + * + * @return + * @throws Exception + */ + @Test + public void tstFakeV4() throws Exception{ + + System.setProperty("samjdk.optimistic_vcf_4_4", "true"); + + String filePath = TestUtils.DATA_DIR + "vcf/fake_v4.vcf"; + TestUtils.createIndex(filePath); + TribbleFeatureSource src = TribbleFeatureSource.getFeatureSource(new ResourceLocator(filePath), genome); + + VCFVariant variant = (VCFVariant) (src.getFeatures("chr20", 10499352 - 5, 10499352 + 5)).next(); + assertEquals(VariantContext.Type.INDEL.toString(), variant.getType()); + assertEquals(10499351, variant.getStart()); + } } diff --git a/test/data/vcf/fake_v4.vcf b/test/data/vcf/fake_v4.vcf new file mode 100644 index 0000000000..d6db4304d5 --- /dev/null +++ b/test/data/vcf/fake_v4.vcf @@ -0,0 +1,15 @@ +##fileformat=VCFv4.4 +##contig= +##reference=human_g1k_v37.fasta +#CHROM POS ID REF ALT QUAL FILTER INFO FORMAT NA12878 +20 10499005 . T C 6913.77 . AC=2;AF=1.00;AN=2;DP=43;FS=0.000;MLEAC=2;MLEAF=1.00;MQ=175.86;MQ0=0;QD=28.20 GT:AD:GQ:PL 1/1:0,38:99:6942,147,0 +20 10499052 . T TTTCTTTCC 481.73 . AC=1;AF=0.500;AN=2;BaseQRankSum=2.060;ClippingRankSum=-0.555;DP=28;FS=4.269;MLEAC=1;MLEAF=0.500;MQ=151.80;MQ0=0;MQRankSum=1.109;QD=2.15;ReadPosRankSum=0.079 GT:AD:GQ:PL 0/1:13,7:99:519,0,723 +20 10499073 . CG TA . . AC=2;AF=1.00;AN=2;DP=43;FS=0.000;MLEAC=2;MLEAF=1.00;MQ=175.86;MQ0=0;QD=28.20 GT:AD:GQ:PL 1/1:0,38:99:6942,147,0 +20 10499099 . CTTCCTTCCTTCCTTTCCTTTCTTTTCCT C 481.73 . AC=1;AF=0.500;AN=2;BaseQRankSum=0.896;ClippingRankSum=-1.001;DP=22;FS=0.000;MLEAC=1;MLEAF=0.500;MQ=126.32;MQ0=0;MQRankSum=1.001;QD=0.78;ReadPosRankSum=-0.065 GT:AD:GQ:PL 0/1:12,5:99:519,0,691 +20 10499111 . CTTTCCTTTCTTTTCCT C 589.73 . AC=1;AF=0.500;AN=2;BaseQRankSum=-0.910;ClippingRankSum=1.395;DP=21;FS=0.000;MLEAC=1;MLEAF=0.500;MQ=123.59;MQ0=0;MQRankSum=-0.667;QD=1.76;ReadPosRankSum=-0.934 GT:AD:GQ:PL 0/1:4,12:99:627,0,519 +20 10499180 . TCC T 481.73 . AC=1;AF=0.500;AN=2;BaseQRankSum=-0.358;ClippingRankSum=0.358;DP=13;FS=0.000;MLEAC=1;MLEAF=0.500;MQ=131.07;MQ0=0;MQRankSum=1.231;QD=18.53;ReadPosRankSum=0.358 GT:AD:GQ:PL 0/1:3,2:99:519,0,722 +20 10499183 . TTCCTTCCTTCCTTC T 481.73 . AC=1;AF=0.500;AN=2;BaseQRankSum=-0.358;ClippingRankSum=0.358;DP=17;FS=0.000;MLEAC=1;MLEAF=0.500;MQ=154.10;MQ0=0;MQRankSum=1.231;QD=2.02;ReadPosRankSum=0.000 GT:AD:GQ:PL 0/1:3,2:99:519,0,654 +20 10499188 . TCC T 683.73 . AC=1;AF=0.500;AN=2;BaseQRankSum=0.000;ClippingRankSum=0.000;DP=13;FS=0.000;MLEAC=1;MLEAF=0.500;MQ=148.61;MQ0=0;MQRankSum=-1.026;QD=26.30;ReadPosRankSum=0.000 GT:AD:GQ:PL 0/1:2,2:99:721,0,519 +20 10499191 . TTCCTTC T 584.73 . AC=1;AF=0.500;AN=2;BaseQRankSum=0.000;ClippingRankSum=0.000;DP=16;FS=0.000;MLEAC=1;MLEAF=0.500;MQ=158.63;MQ0=0;MQRankSum=-1.026;QD=6.09;ReadPosRankSum=0.000 GT:AD:GQ:PL 0/1:2,2:99:622,0,519 +20 10499291 . TTCCTTC A 584.73 . AC=1;AF=0.500;AN=2;BaseQRankSum=0.000;ClippingRankSum=0.000;DP=16;FS=0.000;MLEAC=1;MLEAF=0.500;MQ=158.63;MQ0=0;MQRankSum=-1.026;QD=6.09;ReadPosRankSum=0.000 GT:AD:GQ:PL 0/1:2,2:99:622,0,519 +20 10499352 . T ATTCTTTCC 481.73 . AC=1;AF=0.500;AN=2;BaseQRankSum=2.060;ClippingRankSum=-0.555;DP=28;FS=4.269;MLEAC=1;MLEAF=0.500;MQ=151.80;MQ0=0;MQRankSum=1.109;QD=2.15;ReadPosRankSum=0.079 GT:AD:GQ:PL 0/1:13,7:99:519,0,723 \ No newline at end of file