From 659eee13a62c31eed4e73ddaa893fd868b52eed5 Mon Sep 17 00:00:00 2001 From: Eric Banks Date: Wed, 18 Jul 2012 15:16:27 -0400 Subject: [PATCH] Handle NPE generated in UG when non-standard reference bases are present in the fasta --- .../genotyper/SNPGenotypeLikelihoodsCalculationModel.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/SNPGenotypeLikelihoodsCalculationModel.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/SNPGenotypeLikelihoodsCalculationModel.java index ac7c370bf..c767cf783 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/SNPGenotypeLikelihoodsCalculationModel.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/SNPGenotypeLikelihoodsCalculationModel.java @@ -35,7 +35,6 @@ import org.broadinstitute.sting.utils.GenomeLoc; import org.broadinstitute.sting.utils.GenomeLocParser; import org.broadinstitute.sting.utils.MathUtils; import org.broadinstitute.sting.utils.baq.BAQ; -import org.broadinstitute.sting.utils.codecs.vcf.VCFConstants; import org.broadinstitute.sting.utils.exceptions.UserException; import org.broadinstitute.sting.utils.pileup.PileupElement; import org.broadinstitute.sting.utils.pileup.ReadBackedPileup; @@ -43,7 +42,6 @@ import org.broadinstitute.sting.utils.pileup.ReadBackedPileupImpl; import org.broadinstitute.sting.utils.variantcontext.*; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; import java.util.Map; @@ -68,9 +66,11 @@ public class SNPGenotypeLikelihoodsCalculationModel extends GenotypeLikelihoodsC final byte refBase = ref.getBase(); final int indexOfRefBase = BaseUtils.simpleBaseToBaseIndex(refBase); + // handle non-standard reference bases + if ( indexOfRefBase == -1 ) + return null; final Allele refAllele = Allele.create(refBase, true); - // calculate the GLs ArrayList GLs = new ArrayList(contexts.size()); for ( Map.Entry sample : contexts.entrySet() ) {