90aa101ee4f9e47a77b2eac496eca213a787d513
jcasper
  Mon Jul 22 01:53:32 2019 -0700
Adding table browser support for hic tracks, refs #22316

diff --git src/hg/hgTables/hgTables.c src/hg/hgTables/hgTables.c
index c9db65a..9bc02b8 100644
--- src/hg/hgTables/hgTables.c
+++ src/hg/hgTables/hgTables.c
@@ -541,30 +541,32 @@
 struct hTableInfo *hubTrackTableInfo(struct trackDb *tdb)
 /* Given trackDb entry for a hub track, wrap table info around it. */
 {
 struct hTableInfo *hti = NULL;
 if (tdb->subtracks == NULL)
     {
     if (startsWithWord("bigBed", tdb->type) || startsWithWord("bigGenePred", tdb->type) ||
         startsWithWord("bigNarrowPeak", tdb->type))
 	hti = bigBedToHti(tdb->table, NULL);
     else if (startsWithWord("longTabix", tdb->type))
 	hti = longTabixToHti(tdb->table);
     else if (startsWithWord("bam", tdb->type))
 	hti = bamToHti(tdb->table);
     else if (startsWithWord("vcfTabix", tdb->type))
 	hti = vcfToHti(tdb->table, TRUE);
+    else if (sameWord("hic", tdb->type))
+	hti = hicToHti(tdb->table);
     }
 if (hti == NULL)
     {
     AllocVar(hti);
     hti->rootName = cloneString(tdb->track);
     hti->isPos = TRUE;
     hti->type = cloneString(tdb->type);
     }
 return hti;
 }
 
 struct hTableInfo *maybeGetHti(char *db, char *table, struct sqlConnection *conn)
 /* Return primary table info, but don't abort if table not there. Conn should be open to db. */
 {
 struct hTableInfo *hti = NULL;
@@ -576,30 +578,32 @@
     hti = hubTrackTableInfo(tdb);
     }
 else if (isBigBed(database, table, curTrack, ctLookupName))
     hti = bigBedToHti(table, conn);
 else if (isBigWigTable(table))
     hti = bigWigToHti(table);
 else if (isLongTabixTable(table))
     hti = longTabixToHti(table);
 else if (isBamTable(table))
     hti = bamToHti(table);
 else if (isVcfTable(table, &isTabix))
     {
     boolean isTabix = trackIsType(database, table, curTrack, "vcfTabix", ctLookupName);
     hti = vcfToHti(table, isTabix);
     }
+else if (isHicTable(table))
+    hti = hicToHti(table);
 else if (isCustomTrack(table))
     {
     struct customTrack *ct = ctLookupName(table);
     hti = ctToHti(ct);
     }
 else if (sameWord(table, WIKI_TRACK_TABLE))
     {
     hti = wikiHti();
     }
 else
     {
     char *track;
     if (startsWith("chrN_", table))
 	track = table + strlen("chrN_");
     else
@@ -1091,59 +1095,63 @@
 }
 
 
 void doTabOutTable( char *db, char *table, FILE *f, struct sqlConnection *conn, char *fields)
 /* Do tab-separated output on fields of a single table. */
 {
 boolean isTabix = FALSE;
 if (isBigBed(database, table, curTrack, ctLookupName))
     bigBedTabOut(db, table, conn, fields, f);
 else if (isLongTabixTable(table))
     longTabixTabOut(db, table, conn, fields, f);
 else if (isBamTable(table))
     bamTabOut(db, table, conn, fields, f);
 else if (isVcfTable(table, &isTabix))
     vcfTabOut(db, table, conn, fields, f, isTabix);
+else if (isHicTable(table))
+    hicTabOut(db, table, conn, fields, f);
 else if (isCustomTrack(table))
     {
     doTabOutCustomTracks(db, table, conn, fields, f);
     }
 else
     doTabOutDb(db, db, table, table, f, conn, fields);
 }
 
 struct slName *fullTableFields(char *db, char *table)
 /* Return list of fields in db.table.field format. */
 {
 char dtBuf[256];
 struct sqlConnection *conn=NULL;
 struct slName *fieldList = NULL, *dtfList = NULL, *field, *dtf;
 if (isBigBed(database, table, curTrack, ctLookupName))
     {
     if (!trackHubDatabase(database))
 	conn = hAllocConn(db);
     fieldList = bigBedGetFields(table, conn);
     hFreeConn(&conn);
     }
 else if (isLongTabixTable(table))
     fieldList = getLongTabixFields(6);
 else if (isHalTable(table))
     fieldList = getBedFields(6);
 else if (isBamTable(table))
     fieldList = bamGetFields(table);
 else if (isVcfTable(table, NULL))
     fieldList = vcfGetFields(table);
+else if (isHicTable(table))
+    fieldList = hicGetFields(table);
 else if (isCustomTrack(table))
     {
     struct customTrack *ct = ctLookupName(table);
     char *type = ct->dbTrackType;
     if (type != NULL)
         {
 	conn = hAllocConn(CUSTOM_TRASH);
 	if (startsWithWord("maf", type) || 
             startsWithWord("makeItems", type) || 
             sameWord("bedDetail", type) || 
             sameWord("barChart", type) || 
             sameWord("interact", type) || 
             sameWord("pgSnp", type))
 	        fieldList = sqlListFields(conn, ct->dbTableName);
 	hFreeConn(&conn);