Patch from Bob to deal with symbolic alleles: these weren't getting padded but they should be.

This commit is contained in:
Eric Banks 2011-07-06 12:51:44 -04:00
parent 0b86958a56
commit 14fee4ccbd
1 changed files with 12 additions and 1 deletions

View File

@ -1343,6 +1343,15 @@ public class VariantContext implements Feature { // to enable tribble intergrati
return (int)stop;
}
private boolean hasSymbolicAlleles() {
for (Allele a: getAlleles()) {
if (a.isSymbolic()) {
return true;
}
}
return false;
}
public static VariantContext createVariantContextWithPaddedAlleles(VariantContext inputVC, byte inputRefBase, boolean refBaseShouldBeAppliedToEndOfAlleles) {
Allele refAllele = inputVC.getReference();
@ -1352,7 +1361,9 @@ public class VariantContext implements Feature { // to enable tribble intergrati
// We need to pad a VC with a common base if the length of the reference allele is less than the length of the VariantContext.
// This happens because the position of e.g. an indel is always one before the actual event (as per VCF convention).
long locLength = (inputVC.getEnd() - inputVC.getStart()) + 1;
if (refAllele.length() == locLength)
if (inputVC.hasSymbolicAlleles())
padVC = true;
else if (refAllele.length() == locLength)
padVC = false;
else if (refAllele.length() == locLength-1)
padVC = true;