6f9be896e698affdeb0f5bc22369c0be69029048
braney
  Wed May 29 13:33:38 2024 -0700
don't try to read data off the beginning of the chrom.

diff --git src/hg/lib/quickLift.c src/hg/lib/quickLift.c
index cfd22fc..fcf90e5 100644
--- src/hg/lib/quickLift.c
+++ src/hg/lib/quickLift.c
@@ -35,31 +35,34 @@
 *insert = 0;
 
 // add .link.bb
 strcpy(insert, ".link.bb");
 
 return cloneString(linkBuffer);
 }
 
 struct bigBedInterval *quickLiftIntervals(char *quickLiftFile, struct bbiFile *bbi,   char *chrom, int start, int end, struct hash **pChainHash)
 /* Return intervals from "other" species that will map to the current window.
  * These intervals are NOT YET MAPPED to the current assembly.
  */
 {
 char *linkFileName = getLinkFile(quickLiftFile);
 // need to add some padding to these coordinates
-struct chain *chain, *chainList = chainLoadIdRangeHub(NULL, quickLiftFile, linkFileName, chrom, start-100000, end+100000, -1);
+int padStart = start - 100000;
+if (padStart < 0)
+    padStart = 0;
+struct chain *chain, *chainList = chainLoadIdRangeHub(NULL, quickLiftFile, linkFileName, chrom, padStart, end+100000, -1);
 struct lm *lm = lmInit(0);
 struct bigBedInterval *bbList = NULL;
 
 for(chain = chainList; chain; chain = chain->next)
     {
     struct cBlock *cb;
     cb = chain->blockList; 
 
     if (cb == NULL)
         continue;
 
     int qStart = cb->qStart;
     int qEnd = cb->qEnd;
 
     // get the range for the links on the "other" species