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("<TR><TD><B><A HREF=\"#Submitters\">Submitter Handles</A>&nbsp;&nbsp;</TD><TD></B>");
 int i;
 for (i=0;  i < snp->submitterCount;  i++)
     printf("%s<A HREF=\"http://www.ncbi.nlm.nih.gov/SNP/snp_viewTable.cgi?h=%s\" TARGET=_BLANK>"
 	   "%s</A>", (i > 0 ? ", " : ""), snp->submitters[i], snp->submitters[i]);
 printf("</TD></TR>\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("<TR><TD><B><A HREF=\"#AlleleFreq\">Allele Frequencies</A>&nbsp;&nbsp;</B></TD><TD>");
     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("</TR></TABLE>\n");
     if (gotNonIntN)
 	printf(" <em>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.</em><BR>\n", total2N);
     }
 else
     puts("</TABLE>");
 if (isNotEmpty(snp->bitfields) && differentString(snp->bitfields, "unknown"))
     {
     printf("<BR><B><A HREF=\"#Bitfields\">Miscellaneous properties annotated by dbSNP</A>:"
 	   "</B>\n\n");