Validate that the reference padding base for indels is correct.
This commit is contained in:
parent
f10588420c
commit
e48492f3c3
|
|
@ -154,10 +154,10 @@ public class ValidateVariants extends RodWalker<Integer, Integer> {
|
||||||
try {
|
try {
|
||||||
switch( type ) {
|
switch( type ) {
|
||||||
case ALL:
|
case ALL:
|
||||||
vc.extraStrictValidation(observedRefAllele, rsIDs);
|
vc.extraStrictValidation(observedRefAllele, ref.getBase(), rsIDs);
|
||||||
break;
|
break;
|
||||||
case REF:
|
case REF:
|
||||||
vc.validateReferenceBases(observedRefAllele);
|
vc.validateReferenceBases(observedRefAllele, ref.getBase());
|
||||||
break;
|
break;
|
||||||
case IDS:
|
case IDS:
|
||||||
vc.validateRSIDs(rsIDs);
|
vc.validateRSIDs(rsIDs);
|
||||||
|
|
|
||||||
|
|
@ -1055,11 +1055,12 @@ public class VariantContext implements Feature { // to enable tribble intergrati
|
||||||
* Run all extra-strict validation tests on a Variant Context object
|
* Run all extra-strict validation tests on a Variant Context object
|
||||||
*
|
*
|
||||||
* @param reference the true reference allele
|
* @param reference the true reference allele
|
||||||
|
* @param paddedRefBase the reference base used for padding indels
|
||||||
* @param rsIDs the true dbSNP IDs
|
* @param rsIDs the true dbSNP IDs
|
||||||
*/
|
*/
|
||||||
public void extraStrictValidation(Allele reference, Set<String> rsIDs) {
|
public void extraStrictValidation(Allele reference, Byte paddedRefBase, Set<String> rsIDs) {
|
||||||
// validate the reference
|
// validate the reference
|
||||||
validateReferenceBases(reference);
|
validateReferenceBases(reference, paddedRefBase);
|
||||||
|
|
||||||
// validate the RS IDs
|
// validate the RS IDs
|
||||||
validateRSIDs(rsIDs);
|
validateRSIDs(rsIDs);
|
||||||
|
|
@ -1074,11 +1075,15 @@ public class VariantContext implements Feature { // to enable tribble intergrati
|
||||||
//checkReferenceTrack();
|
//checkReferenceTrack();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void validateReferenceBases(Allele reference) {
|
public void validateReferenceBases(Allele reference, Byte paddedRefBase) {
|
||||||
// don't validate if we're an insertion
|
// don't validate if we're an insertion
|
||||||
if ( !reference.isNull() && !reference.basesMatch(getReference()) ) {
|
if ( !reference.isNull() && !reference.basesMatch(getReference()) ) {
|
||||||
throw new TribbleException.InternalCodecException(String.format("the REF allele is incorrect for the record at position %s:%d, %s vs. %s", getChr(), getStart(), reference.getBaseString(), getReference().getBaseString()));
|
throw new TribbleException.InternalCodecException(String.format("the REF allele is incorrect for the record at position %s:%d, %s vs. %s", getChr(), getStart(), reference.getBaseString(), getReference().getBaseString()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// we also need to validate the padding base for simple indels
|
||||||
|
if ( hasReferenceBaseForIndel() && !getReferenceBaseForIndel().equals(paddedRefBase) )
|
||||||
|
throw new TribbleException.InternalCodecException(String.format("the padded REF base is incorrect for the record at position %s:%d, %s vs. %s", getChr(), getStart(), (char)getReferenceBaseForIndel().byteValue(), (char)paddedRefBase.byteValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void validateRSIDs(Set<String> rsIDs) {
|
public void validateRSIDs(Set<String> rsIDs) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue