41a9770252865a7968aaa170ed14a713b1e43e1c
jcasper
  Mon Aug 12 07:51:02 2019 -0700
Fixing two bugs in displaying 4DN hic files, refs #22316

diff --git src/hg/lib/hic.c src/hg/lib/hic.c
index 9966f6d..1758389 100644
--- src/hg/lib/hic.c
+++ src/hg/lib/hic.c
@@ -1,58 +1,59 @@
 /* hic.c contains a few helpful wrapper functions for managing Hi-C data. */
 
 #include "common.h"
 #include "linefile.h"
 #include "dystring.h"
 #include "jksql.h"
 #include "hic.h"
 #include "hdb.h"
 #include "trackHub.h"
 #include "Cstraw.h"
 #include "hash.h"
 #include "chromAlias.h"
 #include "interact.h"
 
-char *hicLoadHeader(char *filename, struct hicMeta **header)
+char *hicLoadHeader(char *filename, struct hicMeta **header, char *ucscAssembly)
 /* Create a hicMeta structure for the supplied Hi-C file.  If
  * the return value is non-NULL, it points to a string containing
  * an error message that explains why the retrieval failed. */
 {
 char *genome;
 char **chromosomes, **bpResolutions;
 int nChroms, nBpRes;
 
 char *errMsg = CstrawHeader(filename, &genome, &chromosomes, &nChroms, &bpResolutions, &nBpRes, NULL, NULL);
 if (errMsg != NULL)
     return errMsg;
 
 struct hicMeta *newMeta = NULL;
 AllocVar(newMeta);
-newMeta->assembly = genome;
+newMeta->fileAssembly = genome;
 newMeta->nRes = nBpRes;
 newMeta->resolutions = bpResolutions;
 newMeta->nChroms = nChroms;
 newMeta->chromNames = chromosomes;
 newMeta->ucscToAlias = NULL;
+newMeta->ucscAssembly = cloneString(ucscAssembly);
 newMeta->filename = cloneString(filename);
 
 *header = newMeta;
 if (trackHubDatabase(genome))
     return NULL;
 
 // add alias hash in case file uses 1 vs chr1, etc.
-struct hash *aliasToUcsc = chromAliasMakeLookupTable(newMeta->assembly);
+struct hash *aliasToUcsc = chromAliasMakeLookupTable(newMeta->ucscAssembly);
 if (aliasToUcsc != NULL)
     {
     struct hash *ucscToAlias = newHash(0);
     int i;
     for (i=0; i<nChroms; i++)
         {
         struct chromAlias *cA = hashFindVal(aliasToUcsc, chromosomes[i]);
         if (cA != NULL)
             {
             hashAdd(ucscToAlias, cA->chrom, cloneString(chromosomes[i]));
             }
         }
     newMeta->ucscToAlias = ucscToAlias;
     hashFree(&aliasToUcsc);
     }