54406b80d5d435970989acff7b22dd6146c6b411
braney
  Sat Jan 22 15:24:59 2022 -0800
adding chrom alias support to big files

diff --git src/hg/hgc/encodeClick.c src/hg/hgc/encodeClick.c
index 9a8e117..9c9802d 100644
--- src/hg/hgc/encodeClick.c
+++ src/hg/hgc/encodeClick.c
@@ -1,29 +1,30 @@
 /* Handle details page for ENCODE tracks. */
 
 /* Copyright (C) 2013 The Regents of the University of California 
  * See kent/LICENSE or http://genome.ucsc.edu/license/ for licensing information. */
 
 #include "common.h"
 #include "cart.h"
 #include "hgc.h"
 #include "hCommon.h"
 #include "hgColors.h"
 #include "customTrack.h"
 #include "web.h"
 #include "encode/encodePeak.h"
 #include "peptideMapping.h"
+#include "chromAlias.h"
 
 #ifdef UNUSED
 static boolean pairInList(struct slPair *pair, struct slPair *list)
 /* Return TRUE if pair is in list. */
 {
 struct slPair *el;
 for (el = list; el != NULL; el = el->next)
     if (sameString(pair->name, el->name) && sameString(pair->val, el->val))
         return TRUE;
 return FALSE;
 }
 
 static boolean selGroupListMatch(struct trackDb *tdb, struct slPair *selGroupList)
 /* Return TRUE if tdb has match to every item in selGroupList */
 {
@@ -104,31 +105,31 @@
 }
 
 void doBigEncodePeak(struct trackDb *tdb, struct customTrack *ct, char *item)
 /*  details for encodePeak type tracks. */
 {
 enum encodePeakType peakType = narrowPeak;
 char *chrom = cartString(cart,"c");
 int start = cgiInt("o");
 int end = cgiInt("t");
 boolean firstTime = TRUE;
 //peakType = encodePeakInferTypeFromTable(db, table, tdb->type);
 if (peakType == 0)
     errAbort("unrecognized peak type from table %s", tdb->table);
 genericHeader(tdb, NULL);  // genericClickHandlerPlus gets there first anyway (maybe except for encodePeak custom tracks).
 char *fileName = bbiNameFromSettingOrTable(tdb, NULL, tdb->table);
-struct bbiFile *bbi = bigBedFileOpen(fileName);
+struct bbiFile *bbi =  bigBedFileOpenAlias(fileName, chromAliasGetHash(database));
 struct lm *lm = lmInit(0);
 struct bigBedInterval *bb, *bbList =  bigBedIntervalQuery(bbi, chrom, start, end, 0, lm);
 int fieldCount = 10;
 char *bedRow[fieldCount];
 char startBuf[16], endBuf[16];
 
 for (bb = bbList; bb != NULL; bb = bb->next)
     {
     bigBedIntervalToRow(bb, chrom, startBuf, endBuf, bedRow, ArraySize(bedRow));
     if (firstTime)
         firstTime = FALSE;
     else // print separator
         printf("<BR>\n");
     printPeak(bedRow, 0, item, chrom, start, end, peakType);
     }