package jalview.io.vcf;
import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertTrue;
+import jalview.bin.Cache;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.DBRefEntry;
import jalview.datamodel.Mapping;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
+import java.util.Map;
+import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
public class VCFLoaderTest
// 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" };
+ @BeforeClass
+ public void setUp()
+ {
+ /*
+ * configure to capture all available VCF and VEP (CSQ) fields
+ */
+ Cache.loadProperties("test/jalview/io/testProps.jvprops");
+ Cache.setProperty("VCF_FIELDS", ".*");
+ Cache.setProperty("VEP_FIELDS", ".*");
+ }
+
@Test(groups = "Functional")
public void testDoLoad() throws IOException
{
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);
+ Map map = (Map) sf.getValue("CSQ");
+ assertEquals(map.size(), 9);
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);
+ map = (Map) sf.getValue("CSQ");
+ assertEquals(map.size(), 9);
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);
+ map = (Map) sf.getValue("CSQ");
+ assertEquals(map.size(), 9);
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);
+ map = (Map) sf.getValue("CSQ");
+ assertEquals(map.size(), 9);
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);
+ map = (Map) sf.getValue("CSQ");
+ assertEquals(map.size(), 9);
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);
+ map = (Map) sf.getValue("CSQ");
+ assertEquals(map.size(), 9);
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);
+ map = (Map) sf.getValue("CSQ");
+ assertEquals(map.size(), 9);
/*
* verify variant feature(s) added to transcript3
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"));
+ map = (Map) sf.getValue("CSQ");
+ assertEquals(map.size(), 9);
+ assertEquals(sf.getValueAsString("CSQ", "Feature"), "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"));
+ assertEquals(map.size(), 9);
+ assertEquals(sf.getValueAsString("CSQ", "Feature"), "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"));
+ assertEquals(map.size(), 9);
+ assertEquals(sf.getValueAsString("CSQ", "Feature"), "transcript3");
/*
* verify variants computed on protein product for transcript3
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"));
+ assertEquals(map.size(), 9);
+ assertEquals(sf.getValueAsString("CSQ", "Feature"), "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"));
+ assertEquals(map.size(), 9);
+ assertEquals(sf.getValueAsString("CSQ", "Feature"), "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"));
+ assertEquals(map.size(), 9);
+ assertEquals(sf.getValueAsString("CSQ", "Feature"), "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"));
+ assertEquals(map.size(), 9);
+ assertEquals(sf.getValueAsString("CSQ", "Feature"), "transcript4");
}
}