6819e624cfe2476aa5e10be99ebaf8c96e319278 angie Tue Aug 9 15:40:00 2011 -0700 Feature #3710 (vcfTabix UI options): added checkbox to enable/disable haplotype sorting display. diff --git src/hg/lib/pgSnp.c src/hg/lib/pgSnp.c index bdb716e..4b10959 100644 --- src/hg/lib/pgSnp.c +++ src/hg/lib/pgSnp.c @@ -729,30 +729,48 @@ alCounts[1+j] = -1; 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 && !gotAltCounts) dyStringPrintf(dy, "%d", alCounts[0]); +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) + uglyf("i=%d gt=NULL wtf?\n", i); + alCounts[gt->hapIxA]++; + if (! gt->isHaploid) + alCounts[gt->hapIxB]++; + } + dyStringPrintf(dy, "%d", alCounts[0]); + for (i = 1; i < alDescCount; i++) + dyStringPrintf(dy, ",%d", alCounts[i]); + } return cloneStringZ(dy->string, dy->stringSize+1); } struct pgSnp *pgSnpFromVcfRecord(struct vcfRecord *rec) /* Convert VCF rec to pgSnp; don't free rec->file (vcfFile) until * you're done with pgSnp because pgSnp points to rec->chrom. */ { static struct dyString *dy = NULL; if (dy == NULL) dy = dyStringNew(0); else dyStringClear(dy); struct pgSnp *pgs; AllocVar(pgs); pgs->chrom = rec->chrom;