4dd0e74f2da650f4f41ccfc29fc18df024e303d9
braney
  Tue Nov 29 18:03:37 2016 -0800
get BLAT custom tracks to work on assembly hubs

diff --git src/lib/twoBit.c src/lib/twoBit.c
index 513b2b9..77399b4 100644
--- src/lib/twoBit.c
+++ src/lib/twoBit.c
@@ -1243,15 +1243,30 @@
 struct twoBitIndex *index;
 long long totalSize = 0;
 for (index = tbf->indexList; index != NULL; index = index->next)
     {
     int size = twoBitSeqSizeNoNs(tbf, index->name);
     totalSize += size;
     }
 return totalSize;
 }
 
 boolean twoBitIsSequence(struct twoBitFile *tbf, char *chromName)
 /* Return TRUE if chromName is in 2bit file. */
 {
 return (hashFindVal(tbf->hash, chromName) != NULL);
 }
+
+struct hash *twoBitChromHash(char *fileName)
+/* Build a hash of chrom names with their sizes. */
+{
+struct twoBitFile *tbf = twoBitOpen(fileName);
+struct twoBitIndex *index;
+struct hash *hash = hashNew(digitsBaseTwo(tbf->seqCount));
+for (index = tbf->indexList; index != NULL; index = index->next)
+    {
+    hashAddInt(hash, index->name, twoBitSeqSize(tbf, index->name));
+    }
+
+twoBitClose(&tbf);
+return hash;
+}