Merge branch 'master' into rodRefactor

Conflicts:
	public/java/src/org/broadinstitute/sting/gatk/walkers/variantutils/VariantsToVCF.java
	public/java/test/org/broadinstitute/sting/gatk/walkers/indels/RealignerTargetCreatorIntegrationTest.java
	public/java/test/org/broadinstitute/sting/gatk/walkers/recalibration/RecalibrationWalkersIntegrationTest.java
This commit is contained in:
Mark DePristo 2011-08-04 18:44:14 -04:00
commit 75632abf88
4 changed files with 25 additions and 6 deletions

View File

@ -240,6 +240,14 @@ public class VariantDataManager {
if( jitter && annotationKey.equalsIgnoreCase("HRUN") ) { // Integer valued annotations must be jittered a bit to work in this GMM
value += -0.25 + 0.5 * GenomeAnalysisEngine.getRandomGenerator().nextDouble();
}
if (vc.isIndel() && annotationKey.equalsIgnoreCase("QD")) {
// normalize QD by event length for indel case
int eventLength = Math.abs(vc.getAlternateAllele(0).getBaseString().length() - vc.getReference().getBaseString().length()); // ignore multi-allelic complication here for now
if (eventLength > 0) // sanity check
value /= (double)eventLength;
}
if( jitter && annotationKey.equalsIgnoreCase("HaplotypeScore") && MathUtils.compareDoubles(value, 0.0, 0.0001) == 0 ) { value = -0.2 + 0.4*GenomeAnalysisEngine.getRandomGenerator().nextDouble(); }
if( jitter && annotationKey.equalsIgnoreCase("FS") && MathUtils.compareDoubles(value, 0.0, 0.001) == 0 ) { value = -0.2 + 0.4*GenomeAnalysisEngine.getRandomGenerator().nextDouble(); }
} catch( Exception e ) {

View File

@ -154,10 +154,10 @@ public class ValidateVariants extends RodWalker<Integer, Integer> {
try {
switch( type ) {
case ALL:
vc.extraStrictValidation(observedRefAllele, rsIDs);
vc.extraStrictValidation(observedRefAllele, ref.getBase(), rsIDs);
break;
case REF:
vc.validateReferenceBases(observedRefAllele);
vc.validateReferenceBases(observedRefAllele, ref.getBase());
break;
case IDS:
vc.validateRSIDs(rsIDs);

View File

@ -71,6 +71,9 @@ public class VariantsToVCF extends RodWalker<Integer, Integer> {
@Argument(fullName="sample", shortName="sample", doc="The sample name represented by the variant rod (for data like GELI with genotypes)", required=false)
protected String sampleName = null;
@Argument(fullName="fixRef", shortName="fixRef", doc="Fix common reference base in case there's an indel without padding", required=false)
protected boolean fixReferenceBase = false;
private Set<String> allowedGenotypeFormatStrings = new HashSet<String>();
private boolean wroteHeader = false;
@ -109,8 +112,11 @@ public class VariantsToVCF extends RodWalker<Integer, Integer> {
vc = VariantContext.modifyGenotypes(vc, genotypes);
}
writeRecord(vc, tracker, ref.getBase());
// todo - fix me. This may not be the cleanest way to handle features what need correct indel padding
if (fixReferenceBase) {
vc = new VariantContext("Variant",vc.getChr(),vc.getStart(), vc.getEnd(), vc.getAlleles(), vc.getGenotypes(), vc.getNegLog10PError(), vc.getFilters(),vc.getAttributes(), ref.getBase());
}
writeRecord(vc, tracker, ref.getBase());
}
return 1;

View File

@ -1055,11 +1055,12 @@ public class VariantContext implements Feature { // to enable tribble intergrati
* Run all extra-strict validation tests on a Variant Context object
*
* @param reference the true reference allele
* @param paddedRefBase the reference base used for padding indels
* @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
validateReferenceBases(reference);
validateReferenceBases(reference, paddedRefBase);
// validate the RS IDs
validateRSIDs(rsIDs);
@ -1074,11 +1075,15 @@ public class VariantContext implements Feature { // to enable tribble intergrati
//checkReferenceTrack();
}
public void validateReferenceBases(Allele reference) {
public void validateReferenceBases(Allele reference, Byte paddedRefBase) {
// don't validate if we're an insertion
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()));
}
// 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) {