JAL-2738 remove commented code, unit test coverage
authorgmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 9 Oct 2017 08:47:42 +0000 (09:47 +0100)
committergmungoc <g.m.carstairs@dundee.ac.uk>
Mon, 9 Oct 2017 08:47:42 +0000 (09:47 +0100)
src/jalview/io/vcf/VCFLoader.java
test/jalview/io/vcf/VCFLoaderTest.java
test/jalview/io/vcf/testVcf.dat [new file with mode: 0644]

index c1c84fb..711b82a 100644 (file)
@@ -432,15 +432,6 @@ public class VCFLoader
        */
       VariantContext variant = variants.next();
 
-      /*
-       * we can only process SNP variants (which can be reported
-       * as part of a MIXED variant record
-       */
-      if (!variant.isSNP() && !variant.isMixed())
-      {
-        // continue;
-      }
-
       int start = variant.getStart() - offset;
       int end = variant.getEnd() - offset;
 
@@ -564,13 +555,6 @@ public class VCFLoader
     String reference = variant.getReference().getBaseString();
     Allele alt = variant.getAlternateAllele(altAlleleIndex);
     String allele = alt.getBaseString();
-    if (allele.length() != 1)
-    {
-      /*
-       * not a SNP variant
-       */
-      // return 0;
-    }
 
     /*
      * build the ref,alt allele description e.g. "G,A", using the base
index b01266e..13c6f95 100644 (file)
@@ -1,7 +1,7 @@
 package jalview.io.vcf;
 
 import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.fail;
+import static org.testng.Assert.assertTrue;
 
 import jalview.datamodel.AlignmentI;
 import jalview.datamodel.DBRefEntry;
@@ -9,6 +9,7 @@ import jalview.datamodel.Mapping;
 import jalview.datamodel.Sequence;
 import jalview.datamodel.SequenceFeature;
 import jalview.datamodel.SequenceI;
+import jalview.datamodel.features.SequenceFeatures;
 import jalview.gui.AlignFrame;
 import jalview.io.DataSourceType;
 import jalview.io.FileLoader;
@@ -25,30 +26,43 @@ import org.testng.annotations.Test;
 
 public class VCFLoaderTest
 {
-  // columns 9717- of gene P30419 from Ensembl (modified)
-  private static final String FASTA =
-  // forward strand 'gene'
-  ">gene1/1-25 chromosome:GRCh38:17:45051610:45051634:1\n"
+  private static final float DELTA = 0.00001f;
+
+  // columns 9717- of gene P30419 from Ensembl (much modified)
+  private static final String FASTA = ""
+          +
+          /*
+           * forward strand 'gene' and 'transcript' with two exons
+           */
+          ">gene1/1-25 chromosome:GRCh38:17:45051610:45051634:1\n"
           + "CAAGCTGGCGGACGAGAGTGTGACA\n"
-          // and a 'made up' mini-transcript with two exons
           + ">transcript1/1-18\n--AGCTGGCG----AGAGTGTGAC-\n"
-          +
-          // 'reverse strand' gene (reverse complement)
-          ">gene2/1-25 chromosome:GRCh38:17:45051610:45051634:-1\n"
+
+          /*
+           * reverse strand gene and transcript (reverse complement alleles!)
+           */
+          + ">gene2/1-25 chromosome:GRCh38:17:45051610:45051634:-1\n"
           + "TGTCACACTCTCGTCCGCCAGCTTG\n"
-          // and its 'transcript'
-          + ">transcript2/1-18\n"
-          + "-GTCACACTCT----CGCCAGCT--\n";
+          + ">transcript2/1-18\n" + "-GTCACACTCT----CGCCAGCT--\n"
+
+          /*
+           * 'gene' on chromosome 5 with two transcripts
+           */
+          + ">gene3/1-25 chromosome:GRCh38:5:45051610:45051634:1\n"
+          + "CAAGCTGGCGGACGAGAGTGTGACA\n"
+          + ">transcript3/1-18\n--AGCTGGCG----AGAGTGTGAC-\n"
+          + ">transcript4/1-18\n-----TGG-GGACGAGAGTGTGA-A\n";
 
   private static final String[] VCF = { "##fileformat=VCFv4.2",
       "##INFO=<ID=AF,Number=A,Type=Float,Description=\"Allele Frequency, for each ALT allele, in the same order as listed\">",
       "##reference=GRCh38",
       "#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO",
-      // SNP A/T in position 2 of gene sequence (precedes transcript)
-      "17\t45051611\t.\tA\tT\t1666.64\tRF\tAC=15;AF=5.08130e-03",
+      // A/T,C variants in position 2 of gene sequence (precedes transcript)
+      // should create 2 variant features with respective scores
+      "17\t45051611\t.\tA\tT,C\t1666.64\tRF\tAC=15;AF=5.0e-03,4.0e-03",
       // SNP G/C in position 4 of gene sequence, position 2 of transcript
-      // this is a mixed variant, the insertion G/GA is not transferred
-      "17\t45051613\t.\tG\tGA,C\t1666.64\tRF\tAC=15;AF=3.08130e-03" };
+      // insertion G/GA is transferred to nucleotide but not to peptide
+      "17\t45051613\t.\tG\tGA,C\t1666.64\tRF\tAC=15;AF=3.0e-03,2.0e-03" };
 
   @Test(groups = "Functional")
   public void testDoLoad() throws IOException
@@ -62,42 +76,69 @@ public class VCFLoaderTest
 
     /*
      * verify variant feature(s) added to gene
+     * NB alleles at a locus may not be processed, and features added,
+     * in the order in which they appear in the VCF record as method
+     * VariantContext.getAlternateAlleles() does not guarantee order
+     * - order of assertions here matches what we find (is not important) 
      */
     List<SequenceFeature> geneFeatures = al.getSequenceAt(0)
             .getSequenceFeatures();
-    assertEquals(geneFeatures.size(), 2);
+    SequenceFeatures.sortFeatures(geneFeatures, true);
+    assertEquals(geneFeatures.size(), 4);
     SequenceFeature sf = geneFeatures.get(0);
     assertEquals(sf.getFeatureGroup(), "VCF");
     assertEquals(sf.getBegin(), 2);
     assertEquals(sf.getEnd(), 2);
+    assertEquals(sf.getScore(), 4.0e-03, DELTA);
+    assertEquals(sf.getValue(Gff3Helper.ALLELES), "A,C");
     assertEquals(sf.getType(), SequenceOntologyI.SEQUENCE_VARIANT);
-    assertEquals(sf.getScore(), 5.08130e-03, 0.000001f);
+    sf = geneFeatures.get(1);
+    assertEquals(sf.getFeatureGroup(), "VCF");
+    assertEquals(sf.getBegin(), 2);
+    assertEquals(sf.getEnd(), 2);
+    assertEquals(sf.getType(), SequenceOntologyI.SEQUENCE_VARIANT);
+    assertEquals(sf.getScore(), 5.0e-03, DELTA);
     assertEquals(sf.getValue(Gff3Helper.ALLELES), "A,T");
 
-    sf = geneFeatures.get(1);
+    sf = geneFeatures.get(2);
     assertEquals(sf.getFeatureGroup(), "VCF");
     assertEquals(sf.getBegin(), 4);
     assertEquals(sf.getEnd(), 4);
     assertEquals(sf.getType(), SequenceOntologyI.SEQUENCE_VARIANT);
-    assertEquals(sf.getScore(), 3.08130e-03, 0.000001f);
+    assertEquals(sf.getScore(), 2.0e-03, DELTA);
     assertEquals(sf.getValue(Gff3Helper.ALLELES), "G,C");
 
+    sf = geneFeatures.get(3);
+    assertEquals(sf.getFeatureGroup(), "VCF");
+    assertEquals(sf.getBegin(), 4);
+    assertEquals(sf.getEnd(), 4);
+    assertEquals(sf.getType(), SequenceOntologyI.SEQUENCE_VARIANT);
+    assertEquals(sf.getScore(), 3.0e-03, DELTA);
+    assertEquals(sf.getValue(Gff3Helper.ALLELES), "G,GA");
+
     /*
      * verify variant feature(s) added to transcript
      */
     List<SequenceFeature> transcriptFeatures = al.getSequenceAt(1)
             .getSequenceFeatures();
-    assertEquals(transcriptFeatures.size(), 1);
+    assertEquals(transcriptFeatures.size(), 2);
     sf = transcriptFeatures.get(0);
     assertEquals(sf.getFeatureGroup(), "VCF");
     assertEquals(sf.getBegin(), 2);
     assertEquals(sf.getEnd(), 2);
     assertEquals(sf.getType(), SequenceOntologyI.SEQUENCE_VARIANT);
-    assertEquals(sf.getScore(), 3.08130e-03, 0.000001f);
+    assertEquals(sf.getScore(), 2.0e-03, DELTA);
     assertEquals(sf.getValue(Gff3Helper.ALLELES), "G,C");
+    sf = transcriptFeatures.get(1);
+    assertEquals(sf.getFeatureGroup(), "VCF");
+    assertEquals(sf.getBegin(), 2);
+    assertEquals(sf.getEnd(), 2);
+    assertEquals(sf.getType(), SequenceOntologyI.SEQUENCE_VARIANT);
+    assertEquals(sf.getScore(), 3.0e-03, DELTA);
+    assertEquals(sf.getValue(Gff3Helper.ALLELES), "G,GA");
 
     /*
-     * verify variant feature(s) computed and added to protein
+     * verify SNP variant feature(s) computed and added to protein
      * first codon AGC varies to ACC giving S/T
      */
     DBRefEntry[] dbRefs = al.getSequenceAt(1).getDBRefs();
@@ -147,7 +188,7 @@ public class VCFLoaderTest
      * from Ensembl and transcripts computed)
      */
     AlignmentI alignment = af.getViewport().getAlignment();
-    SequenceI gene1 = alignment.getSequenceAt(0);
+    SequenceI gene1 = alignment.findName("gene1");
     int[] to = new int[] { 45051610, 45051634 };
     int[] from = new int[] { gene1.getStart(), gene1.getEnd() };
     gene1.setGeneLoci("human", "GRCh38", "17", new MapList(from, to, 1, 1));
@@ -158,7 +199,7 @@ public class VCFLoaderTest
      * which is chromosome 45051612-45051619,45051624-45051633
      */
     to = new int[] { 45051612, 45051619, 45051624, 45051633 };
-    SequenceI transcript1 = alignment.getSequenceAt(1);
+    SequenceI transcript1 = alignment.findName("transcript1");
     from = new int[] { transcript1.getStart(), transcript1.getEnd() };
     transcript1.setGeneLoci("human", "GRCh38", "17", new MapList(from, to,
             1, 1));
@@ -166,7 +207,7 @@ public class VCFLoaderTest
     /*
      * map gene2 to chromosome reverse strand
      */
-    SequenceI gene2 = alignment.getSequenceAt(2);
+    SequenceI gene2 = alignment.findName("gene2");
     to = new int[] { 45051634, 45051610 };
     from = new int[] { gene2.getStart(), gene2.getEnd() };
     gene2.setGeneLoci("human", "GRCh38", "17", new MapList(from, to, 1, 1));
@@ -177,7 +218,7 @@ public class VCFLoaderTest
      * which is chromosome 45051633-45051624,45051619-45051612
      */
     to = new int[] { 45051633, 45051624, 45051619, 45051612 };
-    SequenceI transcript2 = alignment.getSequenceAt(3);
+    SequenceI transcript2 = alignment.findName("transcript2");
     from = new int[] { transcript2.getStart(), transcript2.getEnd() };
     transcript2.setGeneLoci("human", "GRCh38", "17", new MapList(from, to,
             1, 1));
@@ -201,6 +242,42 @@ public class VCFLoaderTest
     product = new DBRefEntry("", "", "ENSP002", map);
     transcript2.addDBRef(product);
 
+    /*
+     * map gene3 to chromosome 
+     */
+    SequenceI gene3 = alignment.findName("gene3");
+    to = new int[] { 45051610, 45051634 };
+    from = new int[] { gene3.getStart(), gene3.getEnd() };
+    gene3.setGeneLoci("human", "GRCh38", "5", new MapList(from, to, 1, 1));
+
+    /*
+     * map 'transcript3' to chromosome
+     */
+    SequenceI transcript3 = alignment.findName("transcript3");
+    to = new int[] { 45051612, 45051619, 45051624, 45051633 };
+    from = new int[] { transcript3.getStart(), transcript3.getEnd() };
+    transcript3.setGeneLoci("human", "GRCh38", "5", new MapList(from, to,
+            1, 1));
+
+    /*
+     * map 'transcript4' to chromosome
+     */
+    SequenceI transcript4 = alignment.findName("transcript4");
+    to = new int[] { 45051615, 45051617, 45051619, 45051632, 45051634,
+        45051634 };
+    from = new int[] { transcript4.getStart(), transcript4.getEnd() };
+    transcript4.setGeneLoci("human", "GRCh38", "5", new MapList(from, to,
+            1, 1));
+
+    /*
+     * add a protein product as a DBRef on transcript3
+     */
+    SequenceI peptide3 = new Sequence("ENSP003", "SWRECD");
+    mapList = new MapList(new int[] { 1, 18 }, new int[] { 1, 6 }, 3, 1);
+    map = new Mapping(peptide3, mapList);
+    product = new DBRefEntry("", "", "ENSP003", map);
+    transcript3.addDBRef(product);
+
     return alignment;
   }
 
@@ -225,44 +302,69 @@ public class VCFLoaderTest
     /*
      * verify variant feature(s) added to gene2
      * gene/1-25 maps to chromosome 45051634- reverse strand
-     * variants A/T at 45051611 and G/C at 45051613 map to
-     * T/A and C/G at gene positions 24 and 22 respectively
+     * variants A/T, A/C at 45051611 and G/GA,G/C at 45051613 map to
+     * T/A, T/G and C/TC,C/G at gene positions 24 and 22 respectively
      */
     List<SequenceFeature> geneFeatures = al.getSequenceAt(2)
             .getSequenceFeatures();
-    assertEquals(geneFeatures.size(), 2);
+    SequenceFeatures.sortFeatures(geneFeatures, true);
+    assertEquals(geneFeatures.size(), 4);
     SequenceFeature sf = geneFeatures.get(0);
     assertEquals(sf.getFeatureGroup(), "VCF");
     assertEquals(sf.getBegin(), 22);
     assertEquals(sf.getEnd(), 22);
     assertEquals(sf.getType(), SequenceOntologyI.SEQUENCE_VARIANT);
-    assertEquals(sf.getScore(), 3.08130e-03, 0.000001f);
+    assertEquals(sf.getScore(), 2.0e-03, DELTA);
     assertEquals("C,G", sf.getValue(Gff3Helper.ALLELES));
 
     sf = geneFeatures.get(1);
     assertEquals(sf.getFeatureGroup(), "VCF");
+    assertEquals(sf.getBegin(), 22);
+    assertEquals(sf.getEnd(), 22);
+    assertEquals(sf.getType(), SequenceOntologyI.SEQUENCE_VARIANT);
+    assertEquals(sf.getScore(), 3.0e-03, DELTA);
+    assertEquals("C,TC", sf.getValue(Gff3Helper.ALLELES));
+
+    sf = geneFeatures.get(2);
+    assertEquals(sf.getFeatureGroup(), "VCF");
     assertEquals(sf.getBegin(), 24);
     assertEquals(sf.getEnd(), 24);
     assertEquals(sf.getType(), SequenceOntologyI.SEQUENCE_VARIANT);
-    assertEquals(sf.getScore(), 5.08130e-03, 0.000001f);
+    assertEquals(sf.getScore(), 4.0e-03, DELTA);
+    assertEquals("T,G", sf.getValue(Gff3Helper.ALLELES));
+
+    sf = geneFeatures.get(3);
+    assertEquals(sf.getFeatureGroup(), "VCF");
+    assertEquals(sf.getBegin(), 24);
+    assertEquals(sf.getEnd(), 24);
+    assertEquals(sf.getType(), SequenceOntologyI.SEQUENCE_VARIANT);
+    assertEquals(sf.getScore(), 5.0e-03, DELTA);
     assertEquals("T,A", sf.getValue(Gff3Helper.ALLELES));
 
     /*
      * verify variant feature(s) added to transcript2
-     * variant C/G at position 22 of gene overlaps and maps to
-     * position 17 of transcript
+     * variants G/GA,G/C at position 22 of gene overlap and map to
+     * C/TC,C/G at position 17 of transcript
      */
     List<SequenceFeature> transcriptFeatures = al.getSequenceAt(3)
             .getSequenceFeatures();
-    assertEquals(transcriptFeatures.size(), 1);
+    assertEquals(transcriptFeatures.size(), 2);
     sf = transcriptFeatures.get(0);
     assertEquals(sf.getFeatureGroup(), "VCF");
     assertEquals(sf.getBegin(), 17);
     assertEquals(sf.getEnd(), 17);
     assertEquals(sf.getType(), SequenceOntologyI.SEQUENCE_VARIANT);
-    assertEquals(sf.getScore(), 3.08130e-03, 0.000001f);
+    assertEquals(sf.getScore(), 2.0e-03, DELTA);
     assertEquals("C,G", sf.getValue(Gff3Helper.ALLELES));
 
+    sf = transcriptFeatures.get(1);
+    assertEquals(sf.getFeatureGroup(), "VCF");
+    assertEquals(sf.getBegin(), 17);
+    assertEquals(sf.getEnd(), 17);
+    assertEquals(sf.getType(), SequenceOntologyI.SEQUENCE_VARIANT);
+    assertEquals(sf.getScore(), 3.0e-03, DELTA);
+    assertEquals("C,TC", sf.getValue(Gff3Helper.ALLELES));
+
     /*
      * verify variant feature(s) computed and added to protein
      * last codon GCT varies to GGT giving A/G in the last peptide position
@@ -287,18 +389,6 @@ public class VCFLoaderTest
   }
 
   /**
-   * Tests that where variant records have more than one SNP allele, a variant
-   * feature is created for each, and the corresponding data values set on it
-   * 
-   * @throws IOException
-   */
-  @Test(groups = "Functional")
-  public void testDoLoad_multipleAlleles() throws IOException
-  {
-    fail("todo");
-  }
-
-  /**
    * Tests that if VEP consequence (CSQ) data is present in the VCF data, then
    * it is added to the variant feature, but restricted where possible to the
    * consequences for a specific transcript
@@ -308,6 +398,149 @@ public class VCFLoaderTest
   @Test(groups = "Functional")
   public void testDoLoad_vepCsq() throws IOException
   {
-    fail("todo");
+    AlignmentI al = buildAlignment();
+
+    VCFLoader loader = new VCFLoader(al);
+
+    /*
+     * VCF data file with variants at gene3 positions
+     * 1 C/A
+     * 5 C/T
+     * 9 CGT/C (deletion)
+     * 13 C/G, C/T
+     * 17 A/AC (insertion), A/G
+     */
+    loader.doLoad("test/jalview/io/vcf/testVcf.dat", null);
+
+    /*
+     * verify variant feature(s) added to gene3
+     */
+    List<SequenceFeature> geneFeatures = al.findName("gene3")
+            .getSequenceFeatures();
+    SequenceFeatures.sortFeatures(geneFeatures, true);
+    assertEquals(geneFeatures.size(), 7);
+    SequenceFeature sf = geneFeatures.get(0);
+    assertEquals(sf.getBegin(), 1);
+    assertEquals(sf.getEnd(), 1);
+    assertEquals(sf.getScore(), 0.1f, DELTA);
+    assertEquals(sf.getValue("alleles"), "C,A");
+    // gene features include Consequence for all transcripts
+    assertEquals(((String) sf.getValue("CSQ")).split(",").length, 2);
+
+    sf = geneFeatures.get(1);
+    assertEquals(sf.getBegin(), 5);
+    assertEquals(sf.getEnd(), 5);
+    assertEquals(sf.getScore(), 0.2f, DELTA);
+    assertEquals(sf.getValue("alleles"), "C,T");
+    assertEquals(((String) sf.getValue("CSQ")).split(",").length, 2);
+
+    sf = geneFeatures.get(2);
+    assertEquals(sf.getBegin(), 9);
+    assertEquals(sf.getEnd(), 11); // deletion over 3 positions
+    assertEquals(sf.getScore(), 0.3f, DELTA);
+    assertEquals(sf.getValue("alleles"), "CGG,C");
+    assertEquals(((String) sf.getValue("CSQ")).split(",").length, 2);
+
+    sf = geneFeatures.get(3);
+    assertEquals(sf.getBegin(), 13);
+    assertEquals(sf.getEnd(), 13);
+    assertEquals(sf.getScore(), 0.5f, DELTA);
+    assertEquals(sf.getValue("alleles"), "C,T");
+    assertEquals(((String) sf.getValue("CSQ")).split(",").length, 2);
+
+    sf = geneFeatures.get(4);
+    assertEquals(sf.getBegin(), 13);
+    assertEquals(sf.getEnd(), 13);
+    assertEquals(sf.getScore(), 0.4f, DELTA);
+    assertEquals(sf.getValue("alleles"), "C,G");
+    assertEquals(((String) sf.getValue("CSQ")).split(",").length, 2);
+
+    sf = geneFeatures.get(5);
+    assertEquals(sf.getBegin(), 17);
+    assertEquals(sf.getEnd(), 17);
+    assertEquals(sf.getScore(), 0.7f, DELTA);
+    assertEquals(sf.getValue("alleles"), "A,G");
+    assertEquals(((String) sf.getValue("CSQ")).split(",").length, 2);
+
+    sf = geneFeatures.get(6);
+    assertEquals(sf.getBegin(), 17);
+    assertEquals(sf.getEnd(), 17); // insertion
+    assertEquals(sf.getScore(), 0.6f, DELTA);
+    assertEquals(sf.getValue("alleles"), "A,AC");
+    assertEquals(((String) sf.getValue("CSQ")).split(",").length, 2);
+
+    /*
+     * verify variant feature(s) added to transcript3
+     * at columns 5 (1), 17 (2), positions 3, 11
+     * note the deletion at columns 9-11 is not transferred since col 11
+     * has no mapping to transcript 3 
+     */
+    List<SequenceFeature> transcriptFeatures = al.findName("transcript3")
+            .getSequenceFeatures();
+    SequenceFeatures.sortFeatures(transcriptFeatures, true);
+    assertEquals(transcriptFeatures.size(), 3);
+    sf = transcriptFeatures.get(0);
+    assertEquals(sf.getBegin(), 3);
+    assertEquals(sf.getEnd(), 3);
+    assertEquals(sf.getScore(), 0.2f, DELTA);
+    assertEquals(sf.getValue("alleles"), "C,T");
+    // transcript features only have Consequence for that transcripts
+    assertEquals(((String) sf.getValue("CSQ")).split(",").length, 1);
+    assertTrue(sf.getValue("CSQ").toString().contains("transcript3"));
+
+    sf = transcriptFeatures.get(1);
+    assertEquals(sf.getBegin(), 11);
+    assertEquals(sf.getEnd(), 11);
+    assertEquals(sf.getScore(), 0.7f, DELTA);
+    assertEquals(sf.getValue("alleles"), "A,G");
+    assertEquals(((String) sf.getValue("CSQ")).split(",").length, 1);
+    assertTrue(sf.getValue("CSQ").toString().contains("transcript3"));
+
+    sf = transcriptFeatures.get(2);
+    assertEquals(sf.getBegin(), 11);
+    assertEquals(sf.getEnd(), 11);
+    assertEquals(sf.getScore(), 0.6f, DELTA);
+    assertEquals(sf.getValue("alleles"), "A,AC");
+    assertEquals(((String) sf.getValue("CSQ")).split(",").length, 1);
+    assertTrue(sf.getValue("CSQ").toString().contains("transcript3"));
+
+    /*
+     * verify variant feature(s) added to transcript4
+     * at columns 13 (2) and 17 (2), positions 7 and 11
+     */
+    transcriptFeatures = al.findName("transcript4").getSequenceFeatures();
+    SequenceFeatures.sortFeatures(transcriptFeatures, true);
+    assertEquals(transcriptFeatures.size(), 4);
+    sf = transcriptFeatures.get(0);
+    assertEquals(sf.getBegin(), 7);
+    assertEquals(sf.getEnd(), 7);
+    assertEquals(sf.getScore(), 0.5f, DELTA);
+    assertEquals(sf.getValue("alleles"), "C,T");
+    assertEquals(((String) sf.getValue("CSQ")).split(",").length, 1);
+    assertTrue(sf.getValue("CSQ").toString().contains("transcript4"));
+
+    sf = transcriptFeatures.get(1);
+    assertEquals(sf.getBegin(), 7);
+    assertEquals(sf.getEnd(), 7);
+    assertEquals(sf.getScore(), 0.4f, DELTA);
+    assertEquals(sf.getValue("alleles"), "C,G");
+    assertEquals(((String) sf.getValue("CSQ")).split(",").length, 1);
+    assertTrue(sf.getValue("CSQ").toString().contains("transcript4"));
+
+    sf = transcriptFeatures.get(2);
+    assertEquals(sf.getBegin(), 11);
+    assertEquals(sf.getEnd(), 11);
+    assertEquals(sf.getScore(), 0.7f, DELTA);
+    assertEquals(sf.getValue("alleles"), "A,G");
+    assertEquals(((String) sf.getValue("CSQ")).split(",").length, 1);
+    assertTrue(sf.getValue("CSQ").toString().contains("transcript4"));
+
+    sf = transcriptFeatures.get(3);
+    assertEquals(sf.getBegin(), 11);
+    assertEquals(sf.getEnd(), 11);
+    assertEquals(sf.getScore(), 0.6f, DELTA);
+    assertEquals(sf.getValue("alleles"), "A,AC");
+    assertEquals(((String) sf.getValue("CSQ")).split(",").length, 1);
+    assertTrue(sf.getValue("CSQ").toString().contains("transcript4"));
   }
 }
diff --git a/test/jalview/io/vcf/testVcf.dat b/test/jalview/io/vcf/testVcf.dat
new file mode 100644 (file)
index 0000000..e9e6c22
--- /dev/null
@@ -0,0 +1,13 @@
+##fileformat=VCFv4.2
+##INFO=<ID=AC,Number=A,Type=Integer,Description="Allele count in genotypes, for each ALT allele, in the same order as listed">
+##INFO=<ID=AF,Number=A,Type=Float,Description="Allele Frequency, for each ALT allele, in the same order as listed">
+##INFO=<ID=AF_Female,Number=R,Type=Float,Description="Allele Frequency among Female genotypes, for each ALT allele, in the same order as listed">
+##INFO=<ID=AN,Number=1,Type=Integer,Description="Total number of alleles in called genotypes">
+##INFO=<ID=CSQ,Number=.,Type=String,Description="Consequence annotations from Ensembl VEP. Format: Allele|Consequence|IMPACT|SYMBOL|Gene|Feature_type|Feature|BIOTYPE|PolyPhen">
+##reference=GRCh38
+#CHROM POS     ID      REF     ALT     QUAL    FILTER  INFO
+5      45051610        .       C       A       81.96   RF;AC0  AC=1;AF=0.1;AN=0;AF_Female=2;AB_MEDIAN=6.00000e-01;CSQ=A|missense_variant|MODIFIER|WASH7P|gene3|Transcript|transcript3|rna|Benign,A|downstream_gene_variant|MODIFIER|WASH7P|gene3|Transcript|transcript4|mrna|Bad
+5      45051614        .       C       T       1666.64 RF      AC=1;AF=0.2;AN=0;AF_Female=2;AB_MEDIAN=6.00000e-01;CSQ=T|missense_variant|MODIFIER|WASH7P|gene3|Transcript|transcript3|rna|Benign,T|downstream_gene_variant|MODIFIER|WASH7P|gene3|Transcript|transcript4|mrna|Bad
+5      45051618        .       CGG     C       41.94   AC0     AC=1;AF=0.3;AN=0;AF_Female=2;AB_MEDIAN=6.00000e-01;CSQ=C|missense_variant|MODIFIER|WASH7P|gene3|Transcript|transcript3|rna|Benign,C|downstream_gene_variant|MODIFIER|WASH7P|gene3|Transcript|transcript4|mrna|Bad,CSQ=CGT|missense_variant|MODIFIER|WASH7P|gene3|Transcript|transcript3|rna|Benign,CGT|downstream_gene_variant|MODIFIER|WASH7P|gene3|Transcript|transcript4|mrna|Bad
+5      45051622        .       C       G,T     224.23  RF;AC0  AC=1,2;AF=0.4,0.5;AN=0;AF_Female=2;AB_MEDIAN=6.00000e-01;CSQ=G|missense_variant|MODIFIER|WASH7P|gene3|Transcript|transcript3|rna|Benign,G|downstream_gene_variant|MODIFIER|WASH7P|gene3|Transcript|transcript4|mrna|Bad,T|missense_variant|MODIFIER|WASH7P|gene3|Transcript|transcript3|rna|Benign,T|downstream_gene_variant|MODIFIER|WASH7P|gene3|Transcript|transcript4|mrna|Bad
+5      45051626        .       A       AC,G    433.35  RF;AC0  AC=3,4;AF=0.6,0.7;AN=0;AF_Female=2;AB_MEDIAN=6.00000e-01;CSQ=G|missense_variant|MODIFIER|WASH7P|gene3|Transcript|transcript3|rna|Benign,G|downstream_gene_variant|MODIFIER|WASH7P|gene3|Transcript|transcript4|mrna|Bad,AC|missense_variant|MODIFIER|WASH7P|gene3|Transcript|transcript3|rna|Benign,AC|downstream_gene_variant|MODIFIER|WASH7P|gene3|Transcript|transcript4|mrna|Bad