From 7a43673599b67d40c6fc47a6e0d9b2d21dfa44f2 Mon Sep 17 00:00:00 2001 From: delangel Date: Thu, 26 May 2011 15:00:36 +0000 Subject: [PATCH] Bug fix: also enclose fetching FS or HRun in a try/catch block or else code will blow up if an annotation is absent (e.g. when there no evidence for a variant in a vc) git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@5877 348d0f76-0448-11de-a6fe-93d51630548a --- .../VariantDataManager.java | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/variantrecalibration/VariantDataManager.java b/java/src/org/broadinstitute/sting/gatk/walkers/variantrecalibration/VariantDataManager.java index a66413bb4..4540734c0 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/variantrecalibration/VariantDataManager.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/variantrecalibration/VariantDataManager.java @@ -10,6 +10,7 @@ import org.broadinstitute.sting.gatk.refdata.RefMetaDataTracker; import org.broadinstitute.sting.utils.MathUtils; import org.broadinstitute.sting.utils.collections.ExpandingArrayList; import org.broadinstitute.sting.utils.exceptions.UserException; +import sun.awt.SunHints; import java.io.PrintStream; import java.util.*; @@ -124,8 +125,8 @@ public class VariantDataManager { } logger.info( "Training with " + trainingData.size() + " variants after standard deviation thresholding." ); if( trainingData.size() < VRAC.MIN_NUM_BAD_VARIANTS ) { - logger.warn("WARNING: Training with very few variant sites! Please check the model reporting PDF to ensure the quality of the model is reliable."); - } + logger.warn("WARNING: Training with very few variant sites! Please check the model reporting PDF to ensure the quality of the model is reliable."); + } return trainingData; } @@ -169,7 +170,7 @@ public class VariantDataManager { if( datum.usedForTraining == -1 && !datum.failingSTDThreshold ) { returnData.add(datum); } else { iii--; } } - + return returnData; } @@ -207,23 +208,23 @@ public class VariantDataManager { private static double decodeAnnotation( final String annotationKey, final VariantContext vc, final boolean jitter ) { double value; - if( jitter && ( annotationKey.equalsIgnoreCase("HRUN") || annotationKey.equalsIgnoreCase("FS") ) ) { // Integer valued annotations must be jittered a bit to work in this GMM - value = Double.parseDouble( (String)vc.getAttribute( annotationKey ) ); - value += -0.25 + 0.5 * GenomeAnalysisEngine.getRandomGenerator().nextDouble(); - } else if( annotationKey.equals("QUAL") ) { + + if( annotationKey.equals("QUAL") ) { value = vc.getPhredScaledQual(); } else { try { value = Double.parseDouble( (String)vc.getAttribute( annotationKey ) ); - if(Double.isInfinite(value)) { value = Double.NaN; } - if(annotationKey.equals("HaplotypeScore") && MathUtils.compareDoubles(value, 0.0, 0.0001) == 0 ) { value = -0.2 + 0.4*GenomeAnalysisEngine.getRandomGenerator().nextDouble(); } + if (Double.isInfinite(value)) + value = Double.NaN; } catch( final Exception e ) { value = Double.NaN; // The VQSR works with missing data now by marginalizing over the missing dimension when evaluating clusters. if( !warnedUserMissingValue ) { logger.warn("WARNING: Missing value detected for " + annotationKey + ". The VQSR will work with missing data by marginalizing over this dimension for this variant. This warning message is only shown once so there may be other annotations missing as well."); warnedUserMissingValue = true; } + } + } return value; }