7581ce82ab2a1bd381ee562ec32ea75c990ef0d2 angie Mon Aug 1 09:42:38 2011 -0700 Feature #2821 (VCF parser): correctly handle an INFO column that is just a"." placeholder. diff --git src/lib/vcf.c src/lib/vcf.c index 75300f1..b93295f 100644 --- src/lib/vcf.c +++ src/lib/vcf.c @@ -510,52 +510,60 @@ break; default: errAbort("invalid vcfInfoType (uninitialized?) %d", type); break; } // If END is given, use it as chromEnd: if (sameString(infoKey, vcfInfoEnd)) record->chromEnd = data[0].datInt; *pData = data; return count; } static void parseInfoColumn(struct vcfFile *vcff, struct vcfRecord *record, char *string) /* Translate string into array of vcfInfoElement. */ { +if (sameString(string, ".")) + { + record->infoCount = 0; + return; + } char *elWords[VCF_MAX_INFO]; record->infoCount = chopByChar(string, ';', elWords, ArraySize(elWords)); if (record->infoCount >= VCF_MAX_INFO) vcfFileErr(vcff, "INFO column contains at least %d elements; " "VCF_MAX_INFO may need to be increased in vcf.c!", VCF_MAX_INFO); record->infoElements = vcfFileAlloc(vcff, record->infoCount * sizeof(struct vcfInfoElement)); 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) { vcfFileErr(vcff, "Missing = after key in INFO element: \"%s\" (type=%d)", elStr, type); if (type == vcfInfoString) - el->values[i].datString = vcfFilePooledStr(vcff, ""); + { + el->values = vcfFileAlloc(vcff, sizeof(union vcfDatum)); + el->values[0].datString = vcfFilePooledStr(vcff, ""); + } } 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)); if (el->count >= VCF_MAX_INFO) vcfFileErr(vcff, "A single element of the INFO column has at least %d values; " "VCF_MAX_INFO may need to be increased in vcf.c!", VCF_MAX_INFO); } } static void vcfParseData(struct vcfFile *vcff)