From 2152ad8754b2e276e8104e05f1d9639ac5397271 Mon Sep 17 00:00:00 2001 From: Rori Cremer <6863459+RoriCremer@users.noreply.github.com> Date: Fri, 6 May 2022 09:27:49 -0400 Subject: [PATCH] move elseif --- ...ferenceConfidenceVariantContextMerger.java | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/main/java/org/broadinstitute/hellbender/tools/walkers/ReferenceConfidenceVariantContextMerger.java b/src/main/java/org/broadinstitute/hellbender/tools/walkers/ReferenceConfidenceVariantContextMerger.java index badf09b785d..6e8c27aba84 100644 --- a/src/main/java/org/broadinstitute/hellbender/tools/walkers/ReferenceConfidenceVariantContextMerger.java +++ b/src/main/java/org/broadinstitute/hellbender/tools/walkers/ReferenceConfidenceVariantContextMerger.java @@ -538,24 +538,23 @@ private GenotypesContext mergeRefConfidenceGenotypes(final VariantContext vc, final int ploidy = g.getPloidy(); final GenotypeBuilder genotypeBuilder = new GenotypeBuilder(g); if (!doSomaticMerge) { - if (g.hasPL() | g.hasAD()) { + if (g.hasPL()) { + // lazy initialization of the genotype index map by ploidy. int[] perSampleIndexesOfRelevantAlleles = AlleleSubsettingUtils.getIndexesOfRelevantAllelesForGVCF(remappedAlleles, targetAlleles, vc.getStart(), g, false); - if (g.hasPL()) { - // lazy initialization of the genotype index map by ploidy. - final int[] genotypeIndexMapByPloidy = genotypeIndexMapsByPloidy[ploidy] == null - ? calculators.getInstance(ploidy, maximumAlleleCount).genotypeIndexMap(perSampleIndexesOfRelevantAlleles, calculators) //probably horribly slow - : genotypeIndexMapsByPloidy[ploidy]; - final int[] PLs = generatePL(g, genotypeIndexMapByPloidy); - genotypeBuilder.PL(PLs); - } - if (g.hasAD()) { - final int[] AD = g.hasAD() ? AlleleSubsettingUtils.generateAD(g.getAD(), perSampleIndexesOfRelevantAlleles) : null; - genotypeBuilder.AD(AD); - } + final int[] genotypeIndexMapByPloidy = genotypeIndexMapsByPloidy[ploidy] == null + ? calculators.getInstance(ploidy, maximumAlleleCount).genotypeIndexMap(perSampleIndexesOfRelevantAlleles, calculators) //probably horribly slow + : genotypeIndexMapsByPloidy[ploidy]; + final int[] PLs = generatePL(g, genotypeIndexMapByPloidy); + genotypeBuilder.PL(PLs); // clean up low confidence hom refs for better annotations later } else if (GenotypeGVCFsEngine.excludeFromAnnotations(g)) { genotypeBuilder.alleles(Collections.nCopies(ploidy, Allele.NO_CALL)); } + if (g.hasAD()) { + int[] perSampleIndexesOfRelevantAlleles = AlleleSubsettingUtils.getIndexesOfRelevantAllelesForGVCF(remappedAlleles, targetAlleles, vc.getStart(), g, false); + final int[] AD = g.hasAD() ? AlleleSubsettingUtils.generateAD(g.getAD(), perSampleIndexesOfRelevantAlleles) : null; + genotypeBuilder.AD(AD); + } } else { // doSomaticMerge genotypeBuilder.noAttributes();