From 91bdf069d3d6d67f03bedd757e4b9b80a75b296d Mon Sep 17 00:00:00 2001 From: Eric Banks Date: Mon, 13 Jan 2014 22:13:53 -0500 Subject: [PATCH] Some updates to CRCV. 1. Throw a user error when the input data for a given genotype does not contain PLs. 2. Add VCF header line for --dbsnp input 3. Need to check that the UG result is not null 4. Don't error out at positions with no gVCFs (which is possible when using a dbSNP rod) --- .../variantutils/CombineReferenceCalculationVariants.java | 7 +++++-- .../sting/utils/variant/GATKVariantContextUtils.java | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/variantutils/CombineReferenceCalculationVariants.java b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/variantutils/CombineReferenceCalculationVariants.java index 2a004aaca..66bf562d7 100644 --- a/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/variantutils/CombineReferenceCalculationVariants.java +++ b/protected/gatk-protected/src/main/java/org/broadinstitute/sting/gatk/walkers/variantutils/CombineReferenceCalculationVariants.java @@ -153,9 +153,12 @@ public class CombineReferenceCalculationVariants extends RodWalker vcfRods = GATKVCFUtils.getVCFHeadersFromRods(getToolkit()); - final Set samples = SampleUtils.getSampleList(vcfRods, GATKVariantContextUtils.GenotypeMergeType.REQUIRE_UNIQUE); final Set headerLines = VCFUtils.smartMergeHeaders(vcfRods.values(), true); headerLines.addAll(Arrays.asList(ChromosomeCountConstants.descriptions)); + if ( dbsnp != null && dbsnp.dbsnp.isBound() ) + VCFStandardHeaderLines.addStandardInfoLines(headerLines, true, VCFConstants.DBSNP_KEY); + + final Set samples = SampleUtils.getSampleList(vcfRods, GATKVariantContextUtils.GenotypeMergeType.REQUIRE_UNIQUE); final VCFHeader vcfHeader = new VCFHeader(headerLines, samples); vcfWriter.writeHeader(vcfHeader); @@ -204,7 +207,7 @@ public class CombineReferenceCalculationVariants extends RodWalker VCs, final GenomeLoc loc, final Byte refBase) { - - if ( VCs == null || VCs.size() == 0 ) throw new IllegalArgumentException("VCs cannot be null or empty"); + // this can happen if e.g. you are using a dbSNP file that spans a region with no gVCFs + if ( VCs == null || VCs.size() == 0 ) + return null; // establish the baseline info (sometimes from the first VC) final VariantContext first = VCs.get(0); @@ -1536,6 +1537,8 @@ public class GATKVariantContextUtils { final List remappedAlleles, final List targetAlleles) { for ( final Genotype g : VC.getGenotypes() ) { + if ( !g.hasPL() ) + throw new UserException("cannot merge genotypes from samples without PLs; sample " + g.getSampleName() + " does not have likelihoods at position " + VC.getChr() + ":" + VC.getStart()); // only add if the name is new final String name = g.getSampleName();