From 7dc6f733995760369fd6693b20328728ebb4e3f1 Mon Sep 17 00:00:00 2001 From: Guillermo del Angel Date: Tue, 14 Feb 2012 21:11:24 -0500 Subject: [PATCH 1/3] Bug fix for validation site selector: records with AC=0 in them were always being thrown out if input vcf was sites-only, even when -ignorePolymorphicStatus flag was set --- .../UniformSamplingFrequencySelector.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/validation/validationsiteselector/UniformSamplingFrequencySelector.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/validation/validationsiteselector/UniformSamplingFrequencySelector.java index 66720a252..eda75d647 100644 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/validation/validationsiteselector/UniformSamplingFrequencySelector.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/validation/validationsiteselector/UniformSamplingFrequencySelector.java @@ -52,13 +52,16 @@ public class UniformSamplingFrequencySelector extends FrequencyModeSelector { if (! selectedInTargetSamples && !IGNORE_POLYMORPHIC) return; } else { - if ( attributes.containsKey(VCFConstants.ALLELE_COUNT_KEY) ) { - int ac = vc.getAttributeAsInt(VCFConstants.ALLELE_COUNT_KEY, 0); - if (ac == 0) return; // site not polymorphic + if (!IGNORE_POLYMORPHIC) { + if (vc.getAttributes().containsKey(VCFConstants.ALLELE_COUNT_KEY)) + { + int ac = vc.getAttributeAsInt(VCFConstants.ALLELE_COUNT_KEY, 0); + if (ac == 0) return; // site not polymorphic + } + else + // no allele count field in VC + return; } - else - return; - } // create bare-bones event and log in corresponding bin // attributes contains AC,AF,AN pulled from original vc, and we keep them here and log in output file for bookkeeping purposes From cd352f502d8226ed29851dca9c928bfc70355ce8 Mon Sep 17 00:00:00 2001 From: Guillermo del Angel Date: Fri, 17 Feb 2012 10:21:37 -0500 Subject: [PATCH 2/3] Corner case bug fix: if a read starts with an insertion, when computing the consensus allele for calling the insertion was only added to the last element in the consensus key hash map. Now, an insertion that partially overlaps with several candidate alleles will have their respective count increased for all of them --- .../IndelGenotypeLikelihoodsCalculationModel.java | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/IndelGenotypeLikelihoodsCalculationModel.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/IndelGenotypeLikelihoodsCalculationModel.java index fe2086d47..6321ef1f6 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/IndelGenotypeLikelihoodsCalculationModel.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/IndelGenotypeLikelihoodsCalculationModel.java @@ -152,15 +152,13 @@ public class IndelGenotypeLikelihoodsCalculationModel extends GenotypeLikelihood // case 1: current insertion is prefix of indel in hash map consensusIndelStrings.put(s,cnt+1); foundKey = true; - break; - } + } else if (indelString.startsWith(s)) { // case 2: indel stored in hash table is prefix of current insertion // In this case, new bases are new key. consensusIndelStrings.remove(s); consensusIndelStrings.put(indelString,cnt+1); foundKey = true; - break; } } if (!foundKey) @@ -176,8 +174,7 @@ public class IndelGenotypeLikelihoodsCalculationModel extends GenotypeLikelihood // case 1: current insertion is suffix of indel in hash map consensusIndelStrings.put(s,cnt+1); foundKey = true; - break; - } + } else if (indelString.endsWith(s)) { // case 2: indel stored in hash table is suffix of current insertion // In this case, new bases are new key. @@ -185,7 +182,6 @@ public class IndelGenotypeLikelihoodsCalculationModel extends GenotypeLikelihood consensusIndelStrings.remove(s); consensusIndelStrings.put(indelString,cnt+1); foundKey = true; - break; } } if (!foundKey) @@ -233,9 +229,7 @@ public class IndelGenotypeLikelihoodsCalculationModel extends GenotypeLikelihood maxAlleleCnt = curCnt; bestAltAllele = s; } -// if (DEBUG) -// System.out.format("Key:%s, number: %d\n",s,consensusIndelStrings.get(s) ); - } //gdebug- + } if (maxAlleleCnt < minIndelCountForGenotyping) return aList; From f2ef8d1d2342cd4b6d80283587d6db7931d146ec Mon Sep 17 00:00:00 2001 From: Guillermo del Angel Date: Fri, 17 Feb 2012 17:15:53 -0500 Subject: [PATCH 3/3] Reverting last commit until I learn how to effectively replicate and debug pipeline test failures, and until I also learn how to effectively remove a kep from a HashMap that's being iterated on --- .../IndelGenotypeLikelihoodsCalculationModel.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/IndelGenotypeLikelihoodsCalculationModel.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/IndelGenotypeLikelihoodsCalculationModel.java index 6321ef1f6..fe2086d47 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/IndelGenotypeLikelihoodsCalculationModel.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/IndelGenotypeLikelihoodsCalculationModel.java @@ -152,13 +152,15 @@ public class IndelGenotypeLikelihoodsCalculationModel extends GenotypeLikelihood // case 1: current insertion is prefix of indel in hash map consensusIndelStrings.put(s,cnt+1); foundKey = true; - } + break; + } else if (indelString.startsWith(s)) { // case 2: indel stored in hash table is prefix of current insertion // In this case, new bases are new key. consensusIndelStrings.remove(s); consensusIndelStrings.put(indelString,cnt+1); foundKey = true; + break; } } if (!foundKey) @@ -174,7 +176,8 @@ public class IndelGenotypeLikelihoodsCalculationModel extends GenotypeLikelihood // case 1: current insertion is suffix of indel in hash map consensusIndelStrings.put(s,cnt+1); foundKey = true; - } + break; + } else if (indelString.endsWith(s)) { // case 2: indel stored in hash table is suffix of current insertion // In this case, new bases are new key. @@ -182,6 +185,7 @@ public class IndelGenotypeLikelihoodsCalculationModel extends GenotypeLikelihood consensusIndelStrings.remove(s); consensusIndelStrings.put(indelString,cnt+1); foundKey = true; + break; } } if (!foundKey) @@ -229,7 +233,9 @@ public class IndelGenotypeLikelihoodsCalculationModel extends GenotypeLikelihood maxAlleleCnt = curCnt; bestAltAllele = s; } - } +// if (DEBUG) +// System.out.format("Key:%s, number: %d\n",s,consensusIndelStrings.get(s) ); + } //gdebug- if (maxAlleleCnt < minIndelCountForGenotyping) return aList;