66c727bc69fc4e13d60e6ad21f387ad845122f54
angie
Thu Nov 6 11:49:17 2014 -0800
Better display of allele count total for SNPs tracks -- before I wasextrapolating total2N from frequency but that isn't precise enough for
very low frequencies.
diff --git src/hg/hgc/hgc.c src/hg/hgc/hgc.c
index cd7b4d5..dd3c9fc 100644
--- src/hg/hgc/hgc.c
+++ src/hg/hgc/hgc.c
@@ -17260,50 +17260,52 @@
}
void printSnp132ExtraColumns(struct trackDb *tdb, struct snp132Ext *snp)
/* Print columns new in snp132 */
{
// Skip exceptions column; handled below in writeSnpExceptionWithVersion
printf("
Submitter Handles | ");
int i;
for (i=0; i < snp->submitterCount; i++)
printf("%s"
"%s", (i > 0 ? ", " : ""), snp->submitters[i], snp->submitters[i]);
printf(" |
\n");
if (snp->alleleFreqCount > 0)
{
boolean gotNonIntN = FALSE;
- int total2N = 0;
+ double total2NDbl = 0.0;
+ for (i = 0; i < snp->alleleFreqCount; i++)
+ total2NDbl += snp->alleleNs[i];
+ int total2N = round(total2NDbl);
printf("Allele Frequencies | ");
for (i = 0; i < snp->alleleFreqCount; i++)
{
printf("%s%s: %.3f%% ", (i > 0 ? "; " : ""), snp->alleles[i], (snp->alleleFreqs[i]*100.0));
// alleleNs should be integers (counts of chromosomes in which allele was observed)
// but dbSNP extrapolates them from reported frequency and reported sample count,
// so sometimes they are not integers. Present them as integers when we can, warn
// when we can't.
double f = snp->alleleFreqs[i], n = snp->alleleNs[i];
if (f > 0)
{
- total2N = round(n / f);
int roundedN = round(n);
if (fabs(n - roundedN) < 0.01)
printf("(%d / %d)", roundedN, total2N);
else
{
gotNonIntN = TRUE;
- printf("(%.3f / %d)", n, total2N);
+ printf("(%.3f / %.3f)", n, total2NDbl);
}
}
}
printf(" |
\n");
if (gotNonIntN)
printf(" Note: dbSNP extrapolates allele counts from reported frequencies and "
"reported 2N sample sizes (total %d); non-integer allele count may imply "
"an inaccuracy in one of the reported numbers.
\n", total2N);
}
else
puts("");
if (isNotEmpty(snp->bitfields) && differentString(snp->bitfields, "unknown"))
{
printf("
Miscellaneous properties annotated by dbSNP:"
"\n\n");