The GT field once again reigns supreme (it must be the first genotype field). Thanks for the catch Eric.

git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3645 348d0f76-0448-11de-a6fe-93d51630548a
This commit is contained in:
aaron 2010-06-25 21:03:05 +00:00
parent 894ad354fa
commit 5f8a3f95ef
2 changed files with 14 additions and 5 deletions

View File

@ -425,8 +425,8 @@ public class VCF4Codec implements FeatureCodec {
if (i >= GTValueSplitSize)
gtAttributes.put(genotypeKeyArray[i],".");
else if (genotypeKeyArray[i].equals("GT"))
if (genotypeAlleleLocation >= 0)
throw new StingException("Saw two GT fields in record at position " + locAndAlleles.first);
if (i != 0)
throw new StingException("Saw GT at position " + i + ", it must be at the first position for genotypes. At location = " + locAndAlleles.first);
else
genotypeAlleleLocation = i;
else if (genotypeKeyArray[i].equals("GQ"))

View File

@ -174,21 +174,30 @@ public class VCF4UnitTest extends BaseTest {
// test too many info fields - NOT a valid test with validation turned off in the VCF4 reader
String twoManyInfoLine = "20\t14370\trs6054257\tG\tA\t29\tPASS\tNS=3;DP=14;AF=0.5;DB;H2;HH\tGT:GQ:DP:HQ\t0|0:48:1:51,51\t1|0:48:8:51,51\t1/1:43:5:.,.";
String twoManyInfoLine = "20\t14370\trs6054257\tG\tA\t29\tPASS\tNS=3;DP=14;AF=0.5;DB;H2;HH\tGT:GQ:DP:HQ\t0|0:48:1:51,51\t1|0:48:8:51,51\t1/1:43:5:0,0";
//@Test(expected=StingException.class)
public void testCheckTooManyInfoFields() {
TestSetup testSetup = new TestSetup().invoke(vcfGenotypeFile);
testSetup.codec.decode(twoManyInfoLine);
}
// test a regular line
String regularLine = "20\t14370\trs6054257\tG\tA\t29\tPASS\tNS=3;DP=14;AF=0.5;DB;H2\tGT:GQ:DP:HQ\t0|0:48:1:51,51\t1|0:48:8:51,51\t1/1:43:5:.,.";
String regularLine = "20\t14370\trs6054257\tG\tA\t29\tPASS\tNS=3;DP=14;AF=0.5;DB;H2\tGT:GQ:DP:HQ\t0|0:48:1:51,51\t1|0:48:8:51,51\t1/1:43:5:0,0";
@Test
public void testCheckInfoValidation() {
TestSetup testSetup = new TestSetup().invoke(vcfGenotypeFile);
testSetup.codec.decode(regularLine);
}
// test too few info lines, we don't provide the DP in this line
String twoFewInfoLine = "20\t14370\trs6054257\tG\tA\t29\tPASS\tNS=3;AF=0.5;DB;H2\tGT:GQ:DP:HQ\t0|0:48:1:51,51\t1|0:48:8:51,51\t1/1:43:5:.,.";
// test GT field in the incorrect position (!= 0)
String GTFieldInTheWrongPosition = "20\t14370\trs6054257\tG\tA\t29\tPASS\tNS=3;AF=0.5;DB;H2\tGQ:DP:HQ:GT\t48:1:51,51:0|0\t48:8:51,51:0|0\t43:5:0,0:0|0";
@Test(expected=StingException.class)
public void testCheckGTFieldOrdering() {
TestSetup testSetup = new TestSetup().invoke(vcfGenotypeFile);
testSetup.codec.decode(GTFieldInTheWrongPosition);
}
// test too few info lines, we don't provide the DP in this line
String twoFewInfoLine = "20\t14370\trs6054257\tG\tA\t29\tPASS\tNS=3;AF=0.5;DB;H2\tGT:GQ:DP:HQ\t0|0:48:1:51,51\t0|0:48:1:51,51\t0|0:48:1:51,51";
@Test
public void testCheckTwoFewInfoValidation() {
TestSetup testSetup = new TestSetup().invoke(vcfGenotypeFile);