f683064dc6a998206665b484790ef9d561e6c8a7 markd Sat Dec 5 22:42:53 2020 -0800 initial conversion to gfServer connection to object diff --git src/inc/genoFind.h src/inc/genoFind.h index 851cef5..79dd214 100644 --- src/inc/genoFind.h +++ src/inc/genoFind.h @@ -21,30 +21,36 @@ #include "aliType.h" #endif #ifndef LOCALMEM_H #include "localmem.h" #endif #ifndef BITS_H #include "bits.h" #endif #ifndef AXT_H #include "axt.h" #endif +struct gfConnection +/* connection to a gfServer. This allows reuse of the connection when supported. */ +{ + int fd; // socket descriptor +}; + enum gfConstants { gfMinMatch = 2, gfMaxGap = 2, gfTileSize = 11, gfMaxTileUse = 1024, gfPepMaxTileUse = 30000, }; struct gfSeqSource /* Where a block of sequence comes from. */ { struct gfSeqSource *next; char *fileName; /* Name of file. */ bioSeq *seq; /* Sequences. Usually either this or fileName is NULL. */ bits32 start,end; /* Position within merged sequence. */ @@ -345,61 +351,64 @@ void gfCatchPipes(); /* Set up to catch broken pipe signals. */ int gfReadMulti(int sd, void *vBuf, size_t size); /* Read in until all is read or there is an error. */ /* --- Some routines for dealing with gfServer at a high level ---- */ struct hash *gfFileCacheNew(); /* Create hash for storing info on .nib and .2bit files. */ void gfFileCacheFree(struct hash **pCache); /* Free up resources in cache. */ -void gfAlignStrand(int *pConn, char *nibDir, struct dnaSeq *seq, +void gfAlignStrand(struct gfConnection *conn, char *nibDir, struct dnaSeq *seq, boolean isRc, int minMatch, struct hash *tFileCache, struct gfOutput *out, char *genome, char *genomeDataDir); /* Search genome on server with one strand of other sequence to find homology. * Then load homologous bits of genome locally and do detailed alignment. * Call 'outFunction' with each alignment that is found. gfSavePsl is a handy * outFunction to use. */ -void gfAlignTrans(int *pConn, char *nibDir, aaSeq *seq, +void gfAlignTrans(struct gfConnection *conn, char *nibDir, aaSeq *seq, int minMatch, struct hash *tFileHash, struct gfOutput *out, char *genome, char *genomeDataDir); /* Search indexed translated genome on server with an amino acid sequence. * Then load homologous bits of genome locally and do detailed alignment. * Call 'outFunction' with each alignment that is found. */ -void gfAlignTransTrans(int *pConn, char *nibDir, struct dnaSeq *seq, +void gfAlignTransTrans(struct gfConnection *conn, char *nibDir, struct dnaSeq *seq, boolean qIsRc, int minMatch, struct hash *tFileCache, struct gfOutput *out, boolean isRna, char *genome, char *genomeDataDir); /* Search indexed translated genome on server with an dna sequence. Translate * this sequence in three frames. Load homologous bits of genome locally * and do detailed alignment. Call 'outFunction' with each alignment * that is found. */ -int gfMayConnect(char *hostName, char *portName); -/* Set up our network connection to server, or return -1. */ +struct gfConnection *gfMayConnect(char *hostName, char *portName); +/* Set up our network connection to server, or return NULL. */ -int gfConnect(char *hostName, char *portName); +struct gfConnection * gfConnect(char *hostName, char *portName); /* Set up our network connection to server. Aborts on error. */ +void gfDisconnect(struct gfConnection **pConn); +/* Disconnect from server */ + int gfDefaultRepMatch(int tileSize, int stepSize, boolean protTiles); /* Figure out appropriate step repMatch value. */ void gfMakeOoc(char *outName, char *files[], int fileCount, int tileSize, bits32 maxPat, enum gfType tType, boolean noSimpRepMask); /* Count occurences of tiles in seqList and make a .ooc file. */ void gfLongDnaInMem(struct dnaSeq *query, struct genoFind *gf, boolean isRc, int minScore, Bits *qMaskBits, struct gfOutput *out, boolean fastMap, boolean band); /* Chop up query into pieces, align each, and stitch back * together again. */ void gfLongTransTransInMem(struct dnaSeq *query, struct genoFind *gfs[3], struct hash *t3Hash, boolean qIsRc, boolean tIsRc, boolean qIsRna,