c84272bbcc9ec90557ebc14ebfd556df43094510
angie
  Fri Mar 6 14:10:45 2015 -0800
Added a link to chrom.sizes file (on hgdownload) at the end of the sequence size table on the chromInfo page.
refs #14870

diff --git src/hg/hgTracks/hgTracks.c src/hg/hgTracks/hgTracks.c
index 42ada88..56e32e2 100644
--- src/hg/hgTracks/hgTracks.c
+++ src/hg/hgTracks/hgTracks.c
@@ -5675,30 +5675,47 @@
 	cgiTableRowEnd();
 	cgiSimpleTableRowStart();
 	cgiSimpleTableFieldStart();
 	printLongWithCommas(stdout, scafCount);
 	cgiTableFieldEnd();
 	cgiSimpleTableFieldStart();
 	printLongWithCommas(stdout, totalSize);
 	cgiTableFieldEnd();
 	}
     cgiTableRowEnd();
     }
 sqlFreeResult(&sr);
 hFreeConn(&conn);
 }
 
+static void chromSizesDownloadRow()
+/* Show link to chrom.sizes file at end of chromInfo table (unless this is a hub) */
+{
+if (! trackHubDatabase(database))
+    {
+    cgiSimpleTableRowStart();
+    cgiSimpleTableFieldStart();
+    puts("download as file");
+    cgiTableFieldEnd();
+    cgiSimpleTableFieldStart();
+    printf("<A HREF=\"http://%s/goldenPath/%s/bigZips/%s.chrom.sizes\">%s.chrom.sizes</A>",
+           hDownloadsServer(), database, database, database);
+    cgiTableFieldEnd();
+    cgiTableRowEnd();
+    }
+}
+
 void chromInfoPage()
 /* Show list of chromosomes (or scaffolds, etc) on which this db is based. */
 {
 char *position = cartUsualString(cart, "position", hDefaultPos(database));
 char *defaultChrom = hDefaultChrom(database);
 char *freeze = hFreezeFromDb(database);
 struct dyString *title = dyStringNew(512);
 if (freeze == NULL)
     dyStringPrintf(title, "%s Browser Sequences",
 		   hOrganism(database));
 else if (stringIn(database, freeze))
     dyStringPrintf(title, "%s %s Browser Sequences",
 		   hOrganism(database), freeze);
 else
     dyStringPrintf(title, "%s %s (%s) Browser Sequences",
@@ -5719,30 +5736,31 @@
 cgiSimpleTableFieldStart();
 puts("Sequence name &nbsp;");
 cgiTableFieldEnd();
 cgiSimpleTableFieldStart();
 puts("Length (bp) including gaps &nbsp;");
 cgiTableFieldEnd();
 cgiTableRowEnd();
 
 if (sameString(database,"hg38"))
     chromInfoRowsChromExt("withAltRandom");
 else if ((startsWith("chr", defaultChrom) || startsWith("Group", defaultChrom)) &&
     hChromCount(database) < 100)
     chromInfoRowsChrom();
 else
     chromInfoRowsNonChrom(1000);
+chromSizesDownloadRow();
 
 hTableEnd();
 cgiDown(0.9);
 
 hgPositionsHelpHtml(organism, database);
 puts("</FORM>");
 dyStringFree(&title);
 webEndSectionTables();
 }
 
 
 void resetVars()
 /* Reset vars except for position and database. */
 {
 static char *except[] = {"db", "position", NULL};