b74993f9080884bcc8c767693abed3f4a387ec41
braney
  Sat Mar 1 12:42:39 2025 -0800
quickLift for bigWigs

diff --git src/hg/lib/quickLift.c src/hg/lib/quickLift.c
index 8e0da05aa8c..beb2035dff1 100644
--- src/hg/lib/quickLift.c
+++ src/hg/lib/quickLift.c
@@ -7,59 +7,38 @@
 #include "limits.h"
 #include "float.h"
 #include "asParse.h"
 #include "chain.h"
 #include "binRange.h"
 #include "basicBed.h"
 #include "liftOver.h"
 #include "hash.h"
 #include "bigBed.h"
 #include "bbiFile.h"
 #include "chainNetDbLoad.h"
 #include "hdb.h"
 #include "jksql.h"
 #include "hgConfig.h"
 #include "quickLift.h"
-
-char *getLinkFile(char *quickLiftFile)
-/* Construct the file name of the chain link file from the name of a chain file. 
- * That is, change file.bb to file.link.bb */
-{
-char linkBuffer[4096];
-
-if (!endsWith(quickLiftFile, ".bb"))
-    errAbort("quickLift file (%s) must end in .bb", quickLiftFile);
-
-safef(linkBuffer, sizeof linkBuffer, "%s", quickLiftFile);
-
-// truncate string at ending ".bb"
-int insertOffset = strlen(linkBuffer) - sizeof ".bb" + 1;
-char *insert = &linkBuffer[insertOffset];
-*insert = 0;
-
-// add .link.bb
-strcpy(insert, ".link.bb");
-
-return cloneString(linkBuffer);
-}
+#include "bigChain.h"
 
 struct bigBedInterval *quickLiftGetIntervals(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);
+char *linkFileName = bigChainGetLinkFile(quickLiftFile);
 // need to add some padding to these coordinates
 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;
@@ -147,31 +126,31 @@
 if (geneId)
     ret = atoi(geneId);
 
 return ret;
 }
 
 struct slList *quickLiftSql(struct sqlConnection *conn, char *quickLiftFile, char *table, char *chrom, int start, int end,  char *query, char *extraWhere, ItemLoader2 loader, int numFields,struct hash *chainHash)
 // retrieve items for which we have a loader from a SQL database for which we have a set quickLift chains.  
 // Save the chains we used to map the item back to the current reference.
 {
 // need to add some padding to these coordinates
 int padStart = start - 100000;
 if (padStart < 0)
     padStart = 0;
 
-char *linkFileName = getLinkFile(quickLiftFile);
+char *linkFileName = bigChainGetLinkFile(quickLiftFile);
 struct chain *chain, *chainList = chainLoadIdRangeHub(NULL, quickLiftFile, linkFileName, chrom, padStart, end+100000, -1);
 
 struct slList *item, *itemList = NULL;
 int rowOffset = 0;
 struct sqlResult *sr = NULL;
 char **row = NULL;
 
 for(chain = chainList; chain; chain = chain->next)
     {
     struct cBlock *cb;
     cb = chain->blockList; 
 
     if (cb == NULL)
         continue;