From 2e445262f22998738eb9d016602c4ebca96ff91f Mon Sep 17 00:00:00 2001 From: depristo Date: Mon, 12 Jul 2010 22:53:53 +0000 Subject: [PATCH] Promotion to . for variable numbers of arguments git-svn-id: file:///humgen/gsa-scr1/gsa-engineering/svn_contents/trunk@3773 348d0f76-0448-11de-a6fe-93d51630548a --- .../broad/tribble/vcf/VCFCompoundHeaderLine.java | 3 +++ .../sting/utils/genotype/vcf/VCFUtils.java | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/java/src/org/broad/tribble/vcf/VCFCompoundHeaderLine.java b/java/src/org/broad/tribble/vcf/VCFCompoundHeaderLine.java index c9a4030b5..3b8ca07a1 100644 --- a/java/src/org/broad/tribble/vcf/VCFCompoundHeaderLine.java +++ b/java/src/org/broad/tribble/vcf/VCFCompoundHeaderLine.java @@ -54,6 +54,9 @@ public abstract class VCFCompoundHeaderLine extends VCFHeaderLine implements VCF public String getDescription() { return description; } public VCFHeaderLineType getType() { return type; } + // + public void setNumberToUnbounded() { this.count = UNBOUNDED; } + // our type of line, i.e. format, info, etc private final SupportedHeaderLineType lineType; diff --git a/java/src/org/broadinstitute/sting/utils/genotype/vcf/VCFUtils.java b/java/src/org/broadinstitute/sting/utils/genotype/vcf/VCFUtils.java index e74664018..80e0ec10c 100755 --- a/java/src/org/broadinstitute/sting/utils/genotype/vcf/VCFUtils.java +++ b/java/src/org/broadinstitute/sting/utils/genotype/vcf/VCFUtils.java @@ -165,8 +165,19 @@ public class VCFUtils { VCFCompoundHeaderLine compOther = (VCFCompoundHeaderLine)other; // if the names are the same, but the values are different, we need to quit - if (! (compLine).equalsExcludingDescription(compOther) ) - throw new IllegalStateException("Incompatible header types, collision between these two types: " + line + " " + other ); + if (! (compLine).equalsExcludingDescription(compOther) ) { + if ( compLine.getType().equals(compOther.getType()) ) { + // The Number entry is an Integer that describes the number of values that can be + // included with the INFO field. For example, if the INFO field contains a single + // number, then this value should be 1. However, if the INFO field describes a pair + // of numbers, then this value should be 2 and so on. If the number of possible + // values varies, is unknown, or is unbounded, then this value should be '.'. + logger.warn("Promoting header field Number to . due to number differences in header lines: " + line + " " + other); + compOther.setNumberToUnbounded(); + } else { + throw new IllegalStateException("Incompatible header types, collision between these two types: " + line + " " + other ); + } + } if ( ! compLine.getDescription().equals(compOther) ) if ( logger != null ) logger.warn(String.format("Allowing unequal description fields through: keeping " + compOther + " excluding " + compLine)); } else {