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)
This commit is contained in:
Eric Banks 2014-01-13 22:13:53 -05:00
parent 22bcd10372
commit 91bdf069d3
2 changed files with 10 additions and 4 deletions

View File

@ -153,9 +153,12 @@ public class CombineReferenceCalculationVariants extends RodWalker<VariantContex
public void initialize() {
// take care of the VCF headers
final Map<String, VCFHeader> vcfRods = GATKVCFUtils.getVCFHeadersFromRods(getToolkit());
final Set<String> samples = SampleUtils.getSampleList(vcfRods, GATKVariantContextUtils.GenotypeMergeType.REQUIRE_UNIQUE);
final Set<VCFHeaderLine> 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<String> 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<VariantContex
result = genotypingEngine.calculateGenotypes(result);
// if it turned monomorphic and we don't want such sites, quit
if ( !INCLUDE_NON_VARIANTS && result.isMonomorphicInSamples() )
if ( result == null || (!INCLUDE_NON_VARIANTS && result.isMonomorphicInSamples()) )
return null;
// re-annotate it

View File

@ -1045,8 +1045,9 @@ public class GATKVariantContextUtils {
* @return new VariantContext representing the merge of all VCs or null if it not relevant
*/
public static VariantContext referenceConfidenceMerge(final List<VariantContext> 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<Allele> remappedAlleles,
final List<Allele> 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();