0cb4f52b6d471905580649074c20761cbe8398da tdreszer Wed Dec 4 11:07:23 2013 -0800 Support for UWash Exome Variants to decifer 'TAC' allele counts. Redmine #9329. diff --git src/hg/lib/pgSnp.c src/hg/lib/pgSnp.c index 7e610d4..d8ecaae 100644 --- src/hg/lib/pgSnp.c +++ src/hg/lib/pgSnp.c @@ -736,30 +736,67 @@ alCounts[0] -= ac; } } if (gotTotalCount) dyStringPrintf(dy, "%d", alCounts[0]); else dyStringAppend(dy, "-1"); for (j = 1; j < alDescCount; j++) if (alCounts[j] >= 0) dyStringPrintf(dy, ",%d", alCounts[j]); else dyStringAppend(dy, ",-1"); } break; } +if (!gotTotalCount) + { + for (i = 0; i < rec->infoCount; i++) + { + // Added specifically for UWash ExomVariants, redmine #9329 + if (sameString(rec->infoElements[i].key, "TAC")) + { + struct vcfInfoElement *tacEl = &rec->infoElements[i]; + int refIx = tacEl->count - 1; // Ref allele count is last in TAC + int alleleCount = -1; + if (!tacEl->missingData[refIx]) // Not in datInt, but don't assume int in datString + alleleCount = atoi(tacEl->values[refIx].datString); // sqlSigned will errAbort! + if (alleleCount > 0) + { + dyStringPrintf(dy, "%d", alleleCount); + gotTotalCount = TRUE; + } + else + dyStringAppend(dy, "-1"); + int tacIx = 0; // Now continue with alt alleles. + for ( ; tacIx < refIx; tacIx++) + { + alleleCount = -1; + if (!tacEl->missingData[tacIx]) + alleleCount = atoi(tacEl->values[tacIx].datString); + if (alleleCount > 0) + { + dyStringPrintf(dy, ",%d", alleleCount); + gotAltCounts = TRUE; + } + else + dyStringAppend(dy, "-1"); + } + break; + } + } + } if (gotTotalCount && !gotAltCounts) { dyStringPrintf(dy, "%d", alCounts[0]); for (i = 1; i < alDescCount; i++) dyStringAppend(dy, ",-1"); } else if (!gotTotalCount && !gotAltCounts && rec->file->genotypeCount > 0) { vcfParseGenotypes(rec); for (i = 0; i < alDescCount; i++) alCounts[i] = 0; for (i = 0; i < rec->file->genotypeCount; i++) { struct vcfGenotype *gt = &(rec->genotypes[i]); if (gt == NULL)