f683064dc6a998206665b484790ef9d561e6c8a7 markd Sat Dec 5 22:42:53 2020 -0800 initial conversion to gfServer connection to object diff --git src/hg/lib/coordConv.c src/hg/lib/coordConv.c index 08f7474..f7e1675 100644 --- src/hg/lib/coordConv.c +++ src/hg/lib/coordConv.c @@ -235,54 +235,55 @@ nibStart = midPos - (ccr->seqSize/2); if(nibStart < 0) nibStart =0; if(nibStart > (chromSize - ccr->seqSize)) nibStart = chromSize- ccr->seqSize; ccr->midSeq = nibLdPart(nibFileName, nib, chromSize,nibStart, ccr->seqSize); ccr->midStart = nibStart; } carefulClose(&nib); sqlDisconnect(&conn); } struct psl* doDnaAlignment(struct dnaSeq *seq, char *db, char *blatHost, char *port, char *nibDir, struct hash *tFileCache) /* get the alignment from the blat host for this sequence */ { struct psl *pslList = NULL; -int conn =0; struct tempName pslTn; FILE *f = NULL; struct gfOutput *gvo; if(seq == NULL || db == NULL) errAbort("coordConv::doDnaAlignment() - dnaSeq and/or db can't be NULL."); if(strlen(seq->dna) != seq->size) errAbort("coordConv::doDnaAlignment() - there seems to be something fishy about %s: the size doesn't equal the length", seq->name); /* if there are too many n's it can cause the blat server to hang */ if(strstr(seq->dna, "nnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnn") ) return NULL; makeTempName(&pslTn,"ccR", ".psl"); f = mustOpen(pslTn.forCgi, "w"); gvo = gfOutputPsl(920, FALSE, FALSE, f, FALSE, FALSE); gfOutputHead(gvo, f); /* align to genome, both strands */ -conn = gfConnect(blatHost, port); -gfAlignStrand(&conn, nibDir, seq, FALSE, 20, tFileCache, gvo, NULL, NULL); +struct gfConnection *conn = gfConnect(blatHost, port); +gfAlignStrand(conn, nibDir, seq, FALSE, 20, tFileCache, gvo, NULL, NULL); reverseComplement(seq->dna, seq->size); +gfDisconnect(&conn); conn = gfConnect(blatHost, port); -gfAlignStrand(&conn, nibDir, seq, TRUE, 20 , tFileCache, gvo, NULL, NULL); +gfAlignStrand(conn, nibDir, seq, TRUE, 20 , tFileCache, gvo, NULL, NULL); +gfDisconnect(&conn); gfOutputQuery(gvo, f); carefulClose(&f); pslList = pslLoadAll(pslTn.forCgi); remove(pslTn.forCgi); gfOutputFree(&gvo); return pslList; } void getAlignmentsForSeqs(struct coordConvRep *ccr, char *blatHost, char *port, char *nibDir) /* Do alignments for the the dnaSeqs in a coordConvRep */ { struct hash *tFileCache = gfFileCacheNew(); if(!(ccr->midSeq && ccr->upSeq && ccr-> downSeq)) errAbort("coordConv::getAlignmentsForSeqs() - can't have any NULL dnaSeqs."); ccr->midPsl = doDnaAlignment(ccr->midSeq, ccr->to->version, blatHost, port, nibDir, tFileCache);