Fixed bug that required symbolic alleles to be padded with reference base and added integration test to test parsing and output of symbolic alleles

This commit is contained in:
Menachem Fromer 2011-08-12 12:23:44 -04:00
parent c7ca33cbff
commit 7ed120361d
3 changed files with 44 additions and 2 deletions

View File

@ -170,7 +170,7 @@ public class UserException extends ReviewedStingException {
}
public MalformedVCF(String message, int lineNo) {
super(String.format("The provided VCF file is malformed at line nmber %d: %s", lineNo, message));
super(String.format("The provided VCF file is malformed at line number %d: %s", lineNo, message));
}
}

View File

@ -1209,7 +1209,10 @@ public class VariantContext implements Feature { // to enable tribble intergrati
}
private void validateReferencePadding() {
boolean needsPadding = hasSymbolicAlleles() || (getReference().length() == getEnd() - getStart()); // off by one because padded base was removed
if (hasSymbolicAlleles()) // symbolic alleles don't need padding...
return;
boolean needsPadding = (getReference().length() == getEnd() - getStart()); // off by one because padded base was removed
if ( needsPadding && !hasReferenceBaseForIndel() )
throw new ReviewedStingException("Badly formed variant context at location " + getChr() + ":" + getStart() + "; no padded reference base was provided.");

View File

@ -0,0 +1,39 @@
package org.broadinstitute.sting.gatk.walkers.CNV;
import org.broadinstitute.sting.WalkerTest;
import org.testng.annotations.Test;
import java.util.Arrays;
public class SymbolicAllelesIntegrationTest extends WalkerTest {
public static String baseTestString(String reference, String VCF) {
return "-T CombineVariants" +
" -R " + reference +
" --variant:vcf " + validationDataLocation + VCF +
" -filteredRecordsMergeType KEEP_IF_ANY_UNFILTERED" +
" -genotypeMergeOptions REQUIRE_UNIQUE" +
" -setKey null" +
" -o %s" +
" -NO_HEADER";
}
@Test
public void test1() {
WalkerTestSpec spec = new WalkerTestSpec(
baseTestString(b36KGReference, "symbolic_alleles_1.vcf"),
1,
Arrays.asList("89a1c56f264ac27a2a4be81072473b6f"));
executeTest("Test symbolic alleles", spec);
}
@Test
public void test2() {
WalkerTestSpec spec = new WalkerTestSpec(
baseTestString(b36KGReference, "symbolic_alleles_2.vcf"),
1,
Arrays.asList("6645babc8c7d46be0da223477c7b1291"));
executeTest("Test symbolic alleles mixed in with non-symbolic alleles", spec);
}
}