9e3d893e8b06be4d573059247c43af5928a17944
angie
Wed Nov 20 10:14:39 2013 -0800
Suppress a vcfFileErr about something that occurs in 1000 Genomes Phase 1VCF and is not really a big deal: if there's a keyword for which we're
not expecting any particular number of values ("Number=." in header,
def->fieldCount=-1), and the '=' is omitted when there are no values
to report, just carry on and pretend we saw an '=' with no values
after it.
diff --git src/lib/vcf.c src/lib/vcf.c
index 51c14a5..dd1c443 100644
--- src/lib/vcf.c
+++ src/lib/vcf.c
@@ -622,30 +622,33 @@
"VCF_MAX_INFO may need to be increased in vcf.c!", VCF_MAX_INFO);
record->infoElements = vcfFileAlloc(vcff, record->infoCount * sizeof(struct vcfInfoElement));
char *emptyString = vcfFilePooledStr(vcff, "");
int i;
for (i = 0; i < record->infoCount; i++)
{
char *elStr = elWords[i];
char *eq = strchr(elStr, '=');
struct vcfInfoElement *el = &(record->infoElements[i]);
if (eq == NULL)
{
el->key = vcfFilePooledStr(vcff, elStr);
enum vcfInfoType type = typeForInfoKey(vcff, el->key);
if (type != vcfInfoFlag)
{
+ struct vcfInfoDef *def = vcfInfoDefForKey(vcff, el->key);
+ // Complain only if we are expecting a particular number of values for this keyword:
+ if (def != NULL && def->fieldCount >= 0)
vcfFileErr(vcff, "Missing = after key in INFO element: \"%s\" (type=%d)",
elStr, type);
if (type == vcfInfoString)
{
el->values = vcfFileAlloc(vcff, sizeof(union vcfDatum));
el->values[0].datString = emptyString;
}
}
continue;
}
*eq = '\0';
el->key = vcfFilePooledStr(vcff, elStr);
enum vcfInfoType type = typeForInfoKey(vcff, el->key);
char *valStr = eq+1;
el->count = parseInfoValue(record, el->key, type, valStr, &(el->values), &(el->missingData));