88485cfa7f13affa28ec5765fe9b2db90cce42b6
markd
  Tue Dec 8 21:02:15 2020 -0800
hgPcr working

diff --git src/jkOwnLib/gfPcrLib.c src/jkOwnLib/gfPcrLib.c
index 9097f98..6cdf0cd 100644
--- src/jkOwnLib/gfPcrLib.c
+++ src/jkOwnLib/gfPcrLib.c
@@ -441,124 +441,127 @@
 /* Do detailed PCR scan on DNA already loaded into memory and put results
  * (in reverse order) on *pOutList. */
 {
 /* For PCR primers reversing search strand just means switching
  * order of primers. */
 if (strand == '-')
     pcrLocalStrand(pcrName, seq, seqOffset, seqName, seqSize, maxSize, 
 	rPrimer, rPrimerSize, fPrimer, fPrimerSize, 
 	minPerfect, minGood, strand, pOutList);
 else
     pcrLocalStrand(pcrName, seq, seqOffset, seqName, seqSize, maxSize, 
 	fPrimer, fPrimerSize, rPrimer, rPrimerSize, 
 	minPerfect, minGood, strand, pOutList);
 }
 
-struct gfRange *gfPcrGetRanges(char *host, char *port, char *fPrimer, char *rPrimer,
+struct gfRange *gfPcrGetRanges(struct gfConnection *conn, char *fPrimer, char *rPrimer,
 	int maxSize)
 /* Query gfServer with primers and convert response to a list of gfRanges. */
 {
 char buf[4096];
-struct gfConnection *conn = gfConnect(host, port, FALSE);
 struct gfRange *rangeList = NULL, *range;
 
 /* Query server and put results into rangeList. */
+gfBeginRequest(conn);
+if (conn->isDynamic)
+    safef(buf, sizeof(buf), "%spcr %s %s %s %s %d", gfSignature(), conn->genome, conn->genomeDataDir,
+          fPrimer, rPrimer, maxSize);
+else
     safef(buf, sizeof(buf), "%spcr %s %s %d", gfSignature(), fPrimer, rPrimer, maxSize);
 mustWriteFd(conn->fd, buf, strlen(buf));
 for (;;)
     {
     if (netGetString(conn->fd, buf) == NULL)
 	break;
     if (sameString(buf, "end"))
 	break;
     else if (startsWith("Error:", buf))
 	errAbort("%s", buf);
     else
 	{
 	char *s = buf;
 	char *name, *start, *end, *strand;
 	name = nextWord(&s);
 	start = nextWord(&s);
 	end = nextWord(&s);
 	strand = nextWord(&s);
 	if (strand == NULL)
 	    errAbort("Truncated gfServer response");
 	AllocVar(range);
 	range->tName = cloneString(name);
 	range->tStart = atoi(start);
 	range->tEnd = atoi(end);
 	range->tStrand = strand[0];
 	slAddHead(&rangeList, range);
 	}
     }
-close(conn->fd);
-conn->fd = -1;
+gfEndRequest(conn);
 slReverse(&rangeList);
 return rangeList;
 }
 
 static void gfPcrOneViaNet(
-	char *host, char *port, char *seqDir,
+	struct gfConnection *conn, char *seqDir,
 	char *pcrName, char *fPrimer, char *rPrimer, int maxSize,
 	int minPerfect, int minGood,
 	struct hash *tFileCache, struct gfPcrOutput **pOutList)
 /* Query gfServer for likely primer hits, load DNA to do detailed
  * examination, and output hits to head of *pOutList.. */
 {
 struct gfRange *rangeList = NULL, *range;
 int fPrimerSize = strlen(fPrimer);
 int rPrimerSize = strlen(rPrimer);
 int maxPrimerSize = max(fPrimerSize, rPrimerSize);
 int minPrimerSize = min(fPrimerSize, rPrimerSize);
 
 tolowers(fPrimer);
 tolowers(rPrimer);
 
 /* Check for obvious user mistake. */
 if (minPrimerSize < minGood || minPrimerSize < minPerfect)
     errAbort("Need longer primer in pair %s (%dbp) %s (%dbp).  Minimum size is %d\n",
 	fPrimer, fPrimerSize, rPrimer, rPrimerSize, minGood);
 
 /* Load ranges and do more detailed snooping. */
-rangeList = gfPcrGetRanges(host, port, fPrimer, rPrimer, maxSize);
+rangeList = gfPcrGetRanges(conn, fPrimer, rPrimer, maxSize);
 for (range = rangeList; range != NULL; range = range->next)
     {
     int tSeqSize;
     char seqName[PATH_LEN];
     struct dnaSeq *seq = gfiExpandAndLoadCached(range,
 	tFileCache, seqDir,  0, &tSeqSize, FALSE, FALSE, maxPrimerSize);
     gfiGetSeqName(range->tName, seqName, NULL);
     gfPcrLocal(pcrName, seq, range->tStart, seqName, tSeqSize, maxSize, 
 	    fPrimer, fPrimerSize, rPrimer, rPrimerSize, 
 	    minPerfect, minGood, range->tStrand, pOutList);
     dnaSeqFree(&seq);
     }
 gfRangeFreeList(&rangeList);
 }
 
 
-struct gfPcrOutput *gfPcrViaNet(char *host, char *port, char *seqDir, 
+struct gfPcrOutput *gfPcrViaNet(struct gfConnection *conn, char *seqDir, 
 	struct gfPcrInput *inList, int maxSize, int minPerfect, int minGood)
 /* Do PCRs using gfServer index, returning list of results. */
 {
 struct hash *tFileCache = gfFileCacheNew();
 struct gfPcrInput *in;
 struct gfPcrOutput *outList = NULL;
 
 for (in = inList; in != NULL; in = in->next)
     {
-    gfPcrOneViaNet(host, port, seqDir,
+    gfPcrOneViaNet(conn, seqDir,
     	in->name, in->fPrimer, in->rPrimer, maxSize,
 	minPerfect, minGood,
     	tFileCache, &outList);
     }
 gfFileCacheFree(&tFileCache);
 slReverse(&outList);
 return outList;
 }
 
 char *gfPcrMakePrimer(char *s)
 /* Make primer (lowercased DNA) out of text.  Complain if
  * it is too short or too long. */
 {
 int size = dnaFilteredSize(s);
 int realSize;