import static org.testng.Assert.assertNull;
import static org.testng.Assert.assertTrue;
+import java.io.File;
+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.BeforeTest;
+import org.testng.annotations.Test;
+
import jalview.bin.Cache;
import jalview.datamodel.AlignmentI;
import jalview.datamodel.DBRefEntry;
import jalview.io.gff.Gff3Helper;
import jalview.util.MapList;
-import java.io.File;
-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.BeforeTest;
-import org.testng.annotations.Test;
-
public class VCFLoaderTest
{
private static final float DELTA = 0.00001f;
.getSequenceFeatures();
SequenceFeatures.sortFeatures(geneFeatures, true);
assertEquals(geneFeatures.size(), 5);
+
SequenceFeature sf = geneFeatures.get(0);
assertEquals(sf.getFeatureGroup(), "VCF");
assertEquals(sf.getBegin(), 2);
assertEquals(sf.getEnd(), 2);
+ assertEquals(sf.getType(), SEQUENCE_VARIANT);
+ assertEquals(sf.getScore(), 0f);
+ assertEquals(Float.parseFloat((String) sf.getValue("AF")), 5.0e-03,
+ DELTA);
+ assertEquals(sf.getValue("AC_Female"), "12");
+ // malformed float for AF_AFR is ignored (JAL-3375)
+ assertNull(sf.getValue("AC_AFR"));
+ assertEquals(sf.getValue(Gff3Helper.ALLELES), "A,T");
+
+ sf = geneFeatures.get(1);
+ assertEquals(sf.getFeatureGroup(), "VCF");
+ assertEquals(sf.getBegin(), 2);
+ assertEquals(sf.getEnd(), 2);
assertEquals(sf.getScore(), 0f);
assertEquals(sf.getValue("AF"), "4.0e-03");
assertEquals(sf.getValue("AF_AFR"), "2.3e-4");
// malformed integer for AC_Female is ignored (JAL-3375)
assertNull(sf.getValue("AC_Female"));
- sf = geneFeatures.get(1);
- assertEquals(sf.getFeatureGroup(), "VCF");
- assertEquals(sf.getBegin(), 2);
- assertEquals(sf.getEnd(), 2);
- assertEquals(sf.getType(), SEQUENCE_VARIANT);
- assertEquals(sf.getScore(), 0f);
- assertEquals(Float.parseFloat((String) sf.getValue("AF")), 5.0e-03,
- DELTA);
- assertEquals(sf.getValue("AC_Female"), "12");
- // malformed float for AF_AFR is ignored (JAL-3375)
- assertNull(sf.getValue("AC_AFR"));
- assertEquals(sf.getValue(Gff3Helper.ALLELES), "A,T");
-
sf = geneFeatures.get(2);
assertEquals(sf.getFeatureGroup(), "VCF");
assertEquals(sf.getBegin(), 4);
assertEquals(sf.getEnd(), 4);
assertEquals(sf.getType(), SEQUENCE_VARIANT);
assertEquals(sf.getScore(), 0f);
- assertEquals(Float.parseFloat((String) sf.getValue("AF")), 2.0e-03,
+ assertEquals(Float.parseFloat((String) sf.getValue("AF")), 3.0e-03,
DELTA);
- assertEquals(sf.getValue(Gff3Helper.ALLELES), "G,C");
+ assertEquals(sf.getValue(Gff3Helper.ALLELES), "G,GA");
+ assertNull(sf.getValue("ID")); // '.' is ignored
+ assertNull(sf.getValue("FILTER")); // '.' is ignored
sf = geneFeatures.get(3);
assertEquals(sf.getFeatureGroup(), "VCF");
assertEquals(sf.getEnd(), 4);
assertEquals(sf.getType(), SEQUENCE_VARIANT);
assertEquals(sf.getScore(), 0f);
- assertEquals(Float.parseFloat((String) sf.getValue("AF")), 3.0e-03,
+ assertEquals(Float.parseFloat((String) sf.getValue("AF")), 2.0e-03,
DELTA);
- assertEquals(sf.getValue(Gff3Helper.ALLELES), "G,GA");
- assertNull(sf.getValue("ID")); // '.' is ignored
- assertNull(sf.getValue("FILTER")); // '.' is ignored
+ assertEquals(sf.getValue(Gff3Helper.ALLELES), "G,C");
sf = geneFeatures.get(4);
assertEquals(sf.getFeatureGroup(), "VCF");
List<SequenceFeature> transcriptFeatures = al.getSequenceAt(1)
.getSequenceFeatures();
assertEquals(transcriptFeatures.size(), 3);
+
sf = transcriptFeatures.get(0);
assertEquals(sf.getFeatureGroup(), "VCF");
assertEquals(sf.getBegin(), 2);
assertEquals(sf.getEnd(), 2);
assertEquals(sf.getType(), SEQUENCE_VARIANT);
assertEquals(sf.getScore(), 0f);
- assertEquals(Float.parseFloat((String) sf.getValue("AF")), 2.0e-03,
+ assertEquals(Float.parseFloat((String) sf.getValue("AF")), 3.0e-03,
DELTA);
- assertEquals(sf.getValue(Gff3Helper.ALLELES), "G,C");
+ assertEquals(sf.getValue(Gff3Helper.ALLELES), "G,GA");
+
sf = transcriptFeatures.get(1);
assertEquals(sf.getFeatureGroup(), "VCF");
assertEquals(sf.getBegin(), 2);
assertEquals(sf.getEnd(), 2);
assertEquals(sf.getType(), SEQUENCE_VARIANT);
assertEquals(sf.getScore(), 0f);
- assertEquals(Float.parseFloat((String) sf.getValue("AF")), 3.0e-03,
+ assertEquals(Float.parseFloat((String) sf.getValue("AF")), 2.0e-03,
DELTA);
- assertEquals(sf.getValue(Gff3Helper.ALLELES), "G,GA");
+ assertEquals(sf.getValue(Gff3Helper.ALLELES), "G,C");
/*
* verify SNP variant feature(s) computed and added to protein
DELTA);
/*
- * variant A/C at 45051611 maps to T/G at gene position 24
+ * variant A/T at 45051611 maps to T/A at gene position 24
*/
sf = geneFeatures.get(3);
assertEquals(sf.getFeatureGroup(), "VCF");
assertEquals(sf.getEnd(), 24);
assertEquals(sf.getType(), SEQUENCE_VARIANT);
assertEquals(sf.getScore(), 0f);
- assertEquals(sf.getValue(Gff3Helper.ALLELES), "T,G");
- assertEquals(Float.parseFloat((String) sf.getValue("AF")), 4.0e-03,
+ assertEquals(sf.getValue(Gff3Helper.ALLELES), "T,A");
+ assertEquals(Float.parseFloat((String) sf.getValue("AF")), 5.0e-03,
DELTA);
/*
- * variant A/T at 45051611 maps to T/A at gene position 24
+ * variant A/C at 45051611 maps to T/G at gene position 24
*/
sf = geneFeatures.get(4);
assertEquals(sf.getFeatureGroup(), "VCF");
assertEquals(sf.getEnd(), 24);
assertEquals(sf.getType(), SEQUENCE_VARIANT);
assertEquals(sf.getScore(), 0f);
- assertEquals(sf.getValue(Gff3Helper.ALLELES), "T,A");
- assertEquals(Float.parseFloat((String) sf.getValue("AF")), 5.0e-03,
+ assertEquals(sf.getValue(Gff3Helper.ALLELES), "T,G");
+ assertEquals(Float.parseFloat((String) sf.getValue("AF")), 4.0e-03,
DELTA);
/*
assertEquals(sf.getBegin(), 13);
assertEquals(sf.getEnd(), 13);
assertEquals(sf.getScore(), 0f);
- assertEquals(Float.parseFloat((String) sf.getValue("AF")), 0.5f, DELTA);
- assertEquals(sf.getValue("alleles"), "C,T");
+ assertEquals(Float.parseFloat((String) sf.getValue("AF")), 0.4f, DELTA);
+ assertEquals(sf.getValue("alleles"), "C,G");
map = (Map) sf.getValue("CSQ");
assertEquals(map.size(), 9);
assertEquals(sf.getBegin(), 13);
assertEquals(sf.getEnd(), 13);
assertEquals(sf.getScore(), 0f);
- assertEquals(Float.parseFloat((String) sf.getValue("AF")), 0.4f, DELTA);
- assertEquals(sf.getValue("alleles"), "C,G");
+ assertEquals(Float.parseFloat((String) sf.getValue("AF")), 0.5f, DELTA);
+ assertEquals(sf.getValue("alleles"), "C,T");
map = (Map) sf.getValue("CSQ");
assertEquals(map.size(), 9);
assertEquals(sf.getBegin(), 17);
assertEquals(sf.getEnd(), 17);
assertEquals(sf.getScore(), 0f);
- assertEquals(Float.parseFloat((String) sf.getValue("AF")), 0.7f, DELTA);
- assertEquals(sf.getValue("alleles"), "A,G");
+ assertEquals(Float.parseFloat((String) sf.getValue("AF")), 0.6f, DELTA);
+ assertEquals(sf.getValue("alleles"), "A,AC");
map = (Map) sf.getValue("CSQ");
assertEquals(map.size(), 9);
assertEquals(sf.getBegin(), 17);
assertEquals(sf.getEnd(), 17); // insertion
assertEquals(sf.getScore(), 0f);
- assertEquals(Float.parseFloat((String) sf.getValue("AF")), 0.6f, DELTA);
- assertEquals(sf.getValue("alleles"), "A,AC");
+ assertEquals(Float.parseFloat((String) sf.getValue("AF")), 0.7f, DELTA);
+ assertEquals(sf.getValue("alleles"), "A,G");
map = (Map) sf.getValue("CSQ");
assertEquals(map.size(), 9);
assertEquals(sf.getBegin(), 11);
assertEquals(sf.getEnd(), 11);
assertEquals(sf.getScore(), 0f);
- assertEquals(Float.parseFloat((String) sf.getValue("AF")), 0.7f, DELTA);
- assertEquals(sf.getValue("alleles"), "A,G");
+ assertEquals(Float.parseFloat((String) sf.getValue("AF")), 0.6f, DELTA);
+ assertEquals(sf.getValue("alleles"), "A,AC");
+ map = (Map) sf.getValue("CSQ");
assertEquals(map.size(), 9);
assertEquals(sf.getValueAsString("CSQ", "Feature"), "transcript3");
assertEquals(sf.getBegin(), 11);
assertEquals(sf.getEnd(), 11);
assertEquals(sf.getScore(), 0f);
- assertEquals(Float.parseFloat((String) sf.getValue("AF")), 0.6f, DELTA);
- assertEquals(sf.getValue("alleles"), "A,AC");
+ assertEquals(Float.parseFloat((String) sf.getValue("AF")), 0.7f, DELTA);
+ assertEquals(sf.getValue("alleles"), "A,G");
+ map = (Map) sf.getValue("CSQ");
assertEquals(map.size(), 9);
assertEquals(sf.getValueAsString("CSQ", "Feature"), "transcript3");
assertEquals(sf.getBegin(), 7);
assertEquals(sf.getEnd(), 7);
assertEquals(sf.getScore(), 0f);
- assertEquals(Float.parseFloat((String) sf.getValue("AF")), 0.5f, DELTA);
- assertEquals(sf.getValue("alleles"), "C,T");
+ assertEquals(Float.parseFloat((String) sf.getValue("AF")), 0.4f, DELTA);
+ assertEquals(sf.getValue("alleles"), "C,G");
+ map = (Map) sf.getValue("CSQ");
assertEquals(map.size(), 9);
assertEquals(sf.getValueAsString("CSQ", "Feature"), "transcript4");
assertEquals(sf.getBegin(), 7);
assertEquals(sf.getEnd(), 7);
assertEquals(sf.getScore(), 0f);
- assertEquals(Float.parseFloat((String) sf.getValue("AF")), 0.4f, DELTA);
- assertEquals(sf.getValue("alleles"), "C,G");
+ assertEquals(Float.parseFloat((String) sf.getValue("AF")), 0.5f, DELTA);
+ assertEquals(sf.getValue("alleles"), "C,T");
+ map = (Map) sf.getValue("CSQ");
assertEquals(map.size(), 9);
assertEquals(sf.getValueAsString("CSQ", "Feature"), "transcript4");
assertEquals(sf.getBegin(), 11);
assertEquals(sf.getEnd(), 11);
assertEquals(sf.getScore(), 0f);
- assertEquals(Float.parseFloat((String) sf.getValue("AF")), 0.7f, DELTA);
- assertEquals(sf.getValue("alleles"), "A,G");
+ assertEquals(Float.parseFloat((String) sf.getValue("AF")), 0.6f, DELTA);
+ assertEquals(sf.getValue("alleles"), "A,AC");
+ map = (Map) sf.getValue("CSQ");
assertEquals(map.size(), 9);
assertEquals(sf.getValueAsString("CSQ", "Feature"), "transcript4");
assertEquals(sf.getBegin(), 11);
assertEquals(sf.getEnd(), 11);
assertEquals(sf.getScore(), 0f);
- assertEquals(Float.parseFloat((String) sf.getValue("AF")), 0.6f, DELTA);
- assertEquals(sf.getValue("alleles"), "A,AC");
+ assertEquals(Float.parseFloat((String) sf.getValue("AF")), 0.7f, DELTA);
+ assertEquals(sf.getValue("alleles"), "A,G");
+ map = (Map) sf.getValue("CSQ");
assertEquals(map.size(), 9);
assertEquals(sf.getValueAsString("CSQ", "Feature"), "transcript4");
}