diff --git a/protected/gatk-protected/src/test/java/org/broadinstitute/sting/gatk/walkers/variantutils/GenotypeGVCFsIntegrationTest.java b/protected/gatk-protected/src/test/java/org/broadinstitute/sting/gatk/walkers/variantutils/GenotypeGVCFsIntegrationTest.java index 4af465c69..1c169decc 100644 --- a/protected/gatk-protected/src/test/java/org/broadinstitute/sting/gatk/walkers/variantutils/GenotypeGVCFsIntegrationTest.java +++ b/protected/gatk-protected/src/test/java/org/broadinstitute/sting/gatk/walkers/variantutils/GenotypeGVCFsIntegrationTest.java @@ -65,7 +65,7 @@ public class GenotypeGVCFsIntegrationTest extends WalkerTest { " -V:sample3 " + privateTestDir + "combine.single.sample.pipeline.3.vcf" + " -L 20:10,000,000-20,000,000", b37KGReference), 1, - Arrays.asList("0d056d8f09dfaf9e34eec28747bb6f33")); + Arrays.asList("09575e44c9dbcd171a30eff43961c57f")); executeTest("combineSingleSamplePipelineGVCF", spec); } @@ -90,7 +90,7 @@ public class GenotypeGVCFsIntegrationTest extends WalkerTest { " -V:sample3 " + privateTestDir + "combine.single.sample.pipeline.3.vcf" + " -L 20:10,000,000-20,000,000", b37KGReference), 1, - Arrays.asList("3552f61d15375afb753879cb0bcd2880")); + Arrays.asList("3f34e05318479cf8743f4227491c7cd1")); executeTest("combineSingleSamplePipelineGVCFHierarchical", spec); } diff --git a/public/gatk-framework/src/main/java/org/broadinstitute/sting/utils/variant/GATKVariantContextUtils.java b/public/gatk-framework/src/main/java/org/broadinstitute/sting/utils/variant/GATKVariantContextUtils.java index 57f7b4175..892cabf61 100644 --- a/public/gatk-framework/src/main/java/org/broadinstitute/sting/utils/variant/GATKVariantContextUtils.java +++ b/public/gatk-framework/src/main/java/org/broadinstitute/sting/utils/variant/GATKVariantContextUtils.java @@ -582,7 +582,7 @@ public class GATKVariantContextUtils { } /** - * Create the new GenotypesContext with the subsetted PLs + * Create the new GenotypesContext with the subsetted PLs and ADs * * @param originalGs the original GenotypesContext * @param vc the original VariantContext @@ -643,7 +643,7 @@ public class GATKVariantContextUtils { newGTs.add(gb.make()); } - return newGTs; + return fixADFromSubsettedAlleles(newGTs, vc, allelesToUse); } private static boolean likelihoodsAreUninformative(final double[] likelihoods) { @@ -1087,10 +1087,10 @@ public class GATKVariantContextUtils { if ( refAllele == null ) return null; - // FinalAlleleSet contains the alleles of the new resulting VC. - // Using linked set in order to guaranteed an stable order: + // FinalAlleleSet contains the alleles of the new resulting VC + // Using linked set in order to guarantee a stable order final LinkedHashSet finalAlleleSet = new LinkedHashSet<>(10); - // Reference goes first: + // Reference goes first finalAlleleSet.add(refAllele); final Map attributes = new LinkedHashMap<>(); @@ -1321,20 +1321,18 @@ public class GATKVariantContextUtils { if ( numNewAlleles == numOriginalAlleles ) return oldGs; - final GenotypesContext newGs = fixPLsFromSubsettedAlleles(oldGs, originalVC, selectedVC.getAlleles()); - - return fixADFromSubsettedAlleles(newGs, originalVC, selectedVC.getAlleles()); + return fixGenotypesFromSubsettedAlleles(oldGs, originalVC, selectedVC.getAlleles()); } /** - * Fix the PLs for the GenotypesContext of a VariantContext that has been subset + * Fix the PLs and ADs for the GenotypesContext of a VariantContext that has been subset * * @param originalGs the original GenotypesContext * @param originalVC the original VariantContext * @param allelesToUse the new (sub)set of alleles to use * @return a new non-null GenotypesContext */ - static private GenotypesContext fixPLsFromSubsettedAlleles(final GenotypesContext originalGs, final VariantContext originalVC, final List allelesToUse) { + static private GenotypesContext fixGenotypesFromSubsettedAlleles(final GenotypesContext originalGs, final VariantContext originalVC, final List allelesToUse) { // we need to determine which of the alternate alleles (and hence the likelihoods) to use and carry forward final List likelihoodIndexesToUse = determineLikelihoodIndexesToUse(originalVC, allelesToUse);