Skip to content

Commit

Permalink
Verify that VCF 4.3 files with a "v4.4" header can be parsed. Fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
jrobinso committed Dec 4, 2023
1 parent c84524b commit 55c85ab
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/test/java/org/broad/igv/variant/vcf/VCFVariantTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
15 changes: 15 additions & 0 deletions test/data/vcf/fake_v4.vcf
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
##fileformat=VCFv4.4
##contig=<ID=20,length=63025520,assembly=b37>
##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

0 comments on commit 55c85ab

Please sign in to comment.