From 0e10359a5ef56eb2ae1fa8640510e486941f73ff Mon Sep 17 00:00:00 2001 From: ebanks Date: Fri, 30 Apr 2010 16:58:30 +0000 Subject: [PATCH] Okay, finished up the ability to cap a base's qual by its read's mapping quality. This is experimental - I have not tested its performance on SNP calling, or even played around with it. If you want to test it out, go nuts. But don't come running to me if your results are not good. git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3282 348d0f76-0448-11de-a6fe-93d51630548a --- .../genotyper/DiploidGenotypeCalculationModel.java | 2 +- .../gatk/walkers/genotyper/GenotypeLikelihoods.java | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/DiploidGenotypeCalculationModel.java b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/DiploidGenotypeCalculationModel.java index fe9089486..55813a2fa 100755 --- a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/DiploidGenotypeCalculationModel.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/DiploidGenotypeCalculationModel.java @@ -76,7 +76,7 @@ public class DiploidGenotypeCalculationModel extends JointEstimateGenotypeCalcul // create the GenotypeLikelihoods object GenotypeLikelihoods GL = new GenotypeLikelihoods(UAC.baseModel, priors, UAC.defaultPlatform); - GL.add(pileup, true); + GL.add(pileup, true, UAC.CAP_BASE_QUALITY); GLs.put(sample, GL); double[] posteriors = GL.getPosteriors(); diff --git a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypeLikelihoods.java b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypeLikelihoods.java index 7572f1538..4b6470994 100644 --- a/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypeLikelihoods.java +++ b/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/GenotypeLikelihoods.java @@ -263,7 +263,7 @@ public class GenotypeLikelihoods implements Cloneable { } public int add(ReadBackedPileup pileup) { - return add(pileup, false); + return add(pileup, false, false); } /** @@ -271,11 +271,12 @@ public class GenotypeLikelihoods implements Cloneable { * read-based pileup up by calling add(observedBase, qualityScore) for each base / qual in the * pileup * - * @param pileup read pileup - * @param ignoreBadBases should we ignore bad bases + * @param pileup read pileup + * @param ignoreBadBases should we ignore bad bases? + * @param capBaseQualsAtMappingQual should we cap a base's quality by its read's mapping quality? * @return the number of good bases found in the pileup */ - public int add(ReadBackedPileup pileup, boolean ignoreBadBases) { + public int add(ReadBackedPileup pileup, boolean ignoreBadBases, boolean capBaseQualsAtMappingQual) { int n = 0; for ( PileupElement p : pileup ) { @@ -285,7 +286,8 @@ public class GenotypeLikelihoods implements Cloneable { char base = (char)p.getBase(); if ( ! ignoreBadBases || ! badBase(base) ) { - n += add(base, p.getQual(), p.getRead(), p.getOffset()); + byte qual = capBaseQualsAtMappingQual ? (byte)Math.min((int)p.getQual(), p.getMappingQual()) : p.getQual(); + n += add(base, qual, p.getRead(), p.getOffset()); } }