2d30d99f5f6d3d6532166a0c70c89d38e6053fb1
braney
  Fri Apr 5 16:57:02 2024 -0700
ongoing work on quickLift

diff --git src/hg/lib/quickLift.c src/hg/lib/quickLift.c
index 218229a..99f165f 100644
--- src/hg/lib/quickLift.c
+++ src/hg/lib/quickLift.c
@@ -3,30 +3,31 @@
  * See kent/LICENSE or http://genome.ucsc.edu/license/ for licensing information. */
 
 #include "common.h"
 #include "obscure.h"
 #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 "quickLift.h"
 
 static 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;
@@ -101,15 +102,32 @@
 
 bbiCachedChromLookup(bbi, bb->chromId, lastChromId, chromName, sizeof(chromName));
 //lastChromId=bb->chromId;
 
 bigBedIntervalToRow(bb, chromName, startBuf, endBuf, bedRow, ArraySize(bedRow));
 
 struct bed *bed = bedLoadN(bedRow, bbi->definedFieldCount);
 char *error;
 if ((error = remapBlockedBed(chainHash, bed, 0.0, 0.1, TRUE, TRUE, NULL, NULL)) == NULL)
     return bed;
 //else
     //printf("bed %s error:%s<BR>", bed->name, error);
 
 return NULL;
 }
+
+unsigned quickLiftGetChain(char *fromDb, char *toDb)
+/* Return the id from the quickLiftChain table for given assemblies. */
+{
+unsigned ret = 0;
+struct sqlConnection *conn = hConnectCentral();
+char query[2048];
+sqlSafef(query, sizeof(query), "select q.id from quickLiftChain q  where q.fromDb='%s' and q.toDb='%s'", fromDb, toDb);
+char *geneId = sqlQuickString(conn, query);
+
+hDisconnectCentral(&conn);
+
+if (geneId)
+    ret = atoi(geneId);
+
+return ret;
+}