From 5a9a37ba01f8aa47b8922d41cc718443eccb65f1 Mon Sep 17 00:00:00 2001 From: Guillermo del Angel Date: Fri, 29 Jun 2012 11:06:12 -0400 Subject: [PATCH] Pool caller improvements: a) Log ref sample depth at every called site (will add more ref-related annotations later), b) Make -glm POOLBOTH work in case we want to genotype snp's and indels together, c) indel bug fix (pool and non-pool): prevent a bad GenomeLoc to be formed if we're running GGA and incoming alleles are larger than ref window size (typically 400 bb) --- ...elGenotypeLikelihoodsCalculationModel.java | 5 ++++- .../genotyper/UnifiedGenotyperEngine.java | 19 ++++++++++++------- 2 files changed, 16 insertions(+), 8 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 96cf5e8c5..230d6c324 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 @@ -186,7 +186,10 @@ public class IndelGenotypeLikelihoodsCalculationModel extends GenotypeLikelihood final int hsize = ref.getWindow().size() - Math.abs(eventLength) - 1; final int numPrefBases = ref.getLocus().getStart() - ref.getWindow().getStart() + 1; - haplotypeMap.putAll(Haplotype.makeHaplotypeListFromAlleles(alleleList, loc.getStart(), + if (hsize <= 0) // protect against event lengths larger than ref window sizes + haplotypeMap.clear(); + else + haplotypeMap.putAll(Haplotype.makeHaplotypeListFromAlleles(alleleList, loc.getStart(), ref, hsize, numPrefBases)); } } diff --git a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperEngine.java b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperEngine.java index 60fa75f41..5cc74e729 100755 --- a/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperEngine.java +++ b/public/java/src/org/broadinstitute/sting/gatk/walkers/genotyper/UnifiedGenotyperEngine.java @@ -367,6 +367,8 @@ public class UnifiedGenotyperEngine { // *** note that calculating strand bias involves overwriting data structures, so we do that last final HashMap attributes = new HashMap(); + // inherit attributed from input vc + attributes.putAll(vc.getAttributes()); // if the site was downsampled, record that fact if ( !limitedContext && rawContext.hasPileupBeenDownsampled() ) attributes.put(VCFConstants.DOWNSAMPLED_KEY, true); @@ -581,6 +583,9 @@ public class UnifiedGenotyperEngine { final AlignmentContext rawContext) { final List models = new ArrayList(2); + String modelPrefix = ""; + if ( UAC.GLmodel.name().toUpperCase().contains("BOTH") ) + modelPrefix = UAC.GLmodel.name().toUpperCase().replaceAll("BOTH",""); // if we're genotyping given alleles and we have a requested SNP at this position, do SNP if ( UAC.GenotypingMode == GenotypeLikelihoodsCalculationModel.GENOTYPING_MODE.GENOTYPE_GIVEN_ALLELES ) { @@ -590,24 +595,24 @@ public class UnifiedGenotyperEngine { if ( vcInput.isSNP() ) { // ignore SNPs if the user chose INDEL mode only - if ( UAC.GLmodel == GenotypeLikelihoodsCalculationModel.Model.BOTH ) - models.add(GenotypeLikelihoodsCalculationModel.Model.SNP); + if ( UAC.GLmodel.name().toUpperCase().contains("BOTH") ) + models.add(GenotypeLikelihoodsCalculationModel.Model.valueOf(modelPrefix+"SNP")); else if ( UAC.GLmodel.name().toUpperCase().contains("SNP") ) models.add(UAC.GLmodel); } else if ( vcInput.isIndel() || vcInput.isMixed() ) { // ignore INDELs if the user chose SNP mode only - if ( UAC.GLmodel == GenotypeLikelihoodsCalculationModel.Model.BOTH ) - models.add(GenotypeLikelihoodsCalculationModel.Model.INDEL); + if ( UAC.GLmodel.name().toUpperCase().contains("BOTH") ) + models.add(GenotypeLikelihoodsCalculationModel.Model.valueOf(modelPrefix+"INDEL")); else if (UAC.GLmodel.name().toUpperCase().contains("INDEL")) models.add(UAC.GLmodel); } // No support for other types yet } else { - if ( UAC.GLmodel == GenotypeLikelihoodsCalculationModel.Model.BOTH ) { - models.add(GenotypeLikelihoodsCalculationModel.Model.SNP); - models.add(GenotypeLikelihoodsCalculationModel.Model.INDEL); + if ( UAC.GLmodel.name().toUpperCase().contains("BOTH") ) { + models.add(GenotypeLikelihoodsCalculationModel.Model.valueOf(modelPrefix+"SNP")); + models.add(GenotypeLikelihoodsCalculationModel.Model.valueOf(modelPrefix+"INDEL")); } else { models.add(UAC.GLmodel);