254a0a6357dce9f6659ab9f9dd41553a881a0987 angie Tue Oct 11 09:22:56 2016 -0700 As Belinda Giardine pointed out, VCF genotype indexes should be initialized in case they somehow slip through parsing. refs #18219 diff --git src/lib/vcf.c src/lib/vcf.c index 2b8cf7f..5c67e21 100644 --- src/lib/vcf.c +++ src/lib/vcf.c @@ -1258,30 +1258,31 @@ for (i = 0; i < vcff->genotypeCount; i++) { char *string = record->genotypeUnparsedStrings[i]; struct vcfGenotype *gt = &(record->genotypes[i]); // Each genotype can have multiple :-separated info elements: char *gtWords[VCF_MAX_FORMAT]; int gtWordCount = chopByChar(string, ':', gtWords, ArraySize(gtWords)); if (gtWordCount != formatWordCount) vcfFileErr(vcff, "The FORMAT column has %d words but the genotype column for %s " "has %d words", formatWordCount, vcff->genotypeIds[i], gtWordCount); if (gtWordCount > formatWordCount) gtWordCount = formatWordCount; gt->id = vcff->genotypeIds[i]; gt->infoCount = gtWordCount; gt->infoElements = vcfFileAlloc(vcff, gtWordCount * sizeof(struct vcfInfoElement)); + gt->hapIxA = gt->hapIxB = -1; boolean foundGT = FALSE; int j; for (j = 0; j < gtWordCount; j++) { // Special parsing of genotype: if (sameString(formatWords[j], vcfGtGenotype)) { parseGt(gtWords[j], gt); foundGT = TRUE; } else if (!foundGT && sameString(formatWords[j], vcfGtPhred)) { parsePlAsGt(gtWords[j], gt); foundGT = TRUE; }