0ede364a2dcb452681933d5a3579b4f05d90a245 markd Sun Jul 5 15:16:27 2020 -0700 fixed bug where totalSeqSize was not stored in index, now hgBlat works diff --git src/gfServer/gfServer.c src/gfServer/gfServer.c index 9c5ed66..9c2c43f 100644 --- src/gfServer/gfServer.c +++ src/gfServer/gfServer.c @@ -56,31 +56,30 @@ int minMatch = gfMinMatch; /* Can be overridden from command line. */ int tileSize = gfTileSize; /* Can be overridden from command line. */ int stepSize = 0; /* Can be overridden from command line. */ boolean doTrans = FALSE; /* Do translation? */ boolean allowOneMismatch = FALSE; boolean noSimpRepMask = FALSE; int repMatch = 1024; /* Can be overridden from command line. */ int maxDnaHits = 100; /* Can be overridden from command line. */ int maxTransHits = 200; /* Can be overridden from command line. */ int maxGap = gfMaxGap; boolean seqLog = FALSE; boolean ipLog = FALSE; boolean doMask = FALSE; boolean canStop = FALSE; -boolean writeIndex = FALSE; char *indexFile = NULL; void usage() /* Explain usage and exit. */ { errAbort( "gfServer v %s - Make a server to quickly find where DNA occurs in genome\n" " To set up a server:\n" " gfServer start host port file(s)\n" " where the files are .2bit or .nib format files specified relative to the current directory\n" " To remove a server:\n" " gfServer stop host port\n" " To query a server with DNA sequence:\n" " gfServer query host port probe.fa\n" " To query a server with protein sequence:\n" @@ -1005,31 +1004,32 @@ if (netGetString(sd, buf) != NULL) { fileCount = atoi(buf); for (i=0; i<fileCount; ++i) { printf("%s\n", netRecieveString(sd, buf)); } } close(sd); } static void buildIndex(char *gfxFile, int fileCount, char *seqFiles[]) /* build pre-computed index for seqFiles and write to gfxFile */ { struct genoFindIndex *gfIdx = genoFindIndexBuild(fileCount, seqFiles, minMatch, maxGap, tileSize, - repMatch, doTrans, NULL, allowOneMismatch, doMask, stepSize, noSimpRepMask); + repMatch, doTrans, NULL, allowOneMismatch, doMask, stepSize, + noSimpRepMask); genoFindIndexWrite(gfIdx, gfxFile); } static void dynWarnErrorVa(char* msg, va_list args) /* warnHandler to log and send back an error response */ { char buf[4096]; int msgLen = vsnprintf(buf, sizeof(buf) - 1, msg, args); buf[msgLen] = '\0'; logError("%s", buf); printf("Error: %s\n", buf); } static void dynReadBytes(char *buf, int bufSize) /* read pending bytes */ @@ -1080,30 +1080,31 @@ *genomeNameRet = cloneString(words[1]); } else errAbort("invalid command '%s'", command); } static struct dnaSeq* dynReadQuerySeq(int qSize, boolean isTrans, boolean queryIsProt) /* read the DNA sequence from the query, filtering junk */ { struct dnaSeq *seq; AllocVar(seq); seq->size = qSize; seq->dna = needLargeMem(qSize+1); if (gfReadMulti(STDIN_FILENO, seq->dna, qSize) != qSize) errAbort("read of %d bytes of query sequence failed", qSize); +seq->dna[qSize] = '\0'; if (queryIsProt) { seq->size = aaFilteredSize(seq->dna); aaFilter(seq->dna, seq->dna); } else { seq->size = dnaFilteredSize(seq->dna); dnaFilter(seq->dna, seq->dna); } int maxSize = (isTrans ? maxAaSize : maxNtSize); if (seq->size > maxSize) { seq->size = maxSize; @@ -1211,34 +1212,32 @@ stepSize = optionInt("stepSize", tileSize); if (optionExists("repMatch")) repMatch = optionInt("repMatch", 0); else repMatch = gfDefaultRepMatch(tileSize, stepSize, doTrans); minMatch = optionInt("minMatch", minMatch); maxDnaHits = optionInt("maxDnaHits", maxDnaHits); maxTransHits = optionInt("maxTransHits", maxTransHits); maxNtSize = optionInt("maxNtSize", maxNtSize); maxAaSize = optionInt("maxAaSize", maxAaSize); seqLog = optionExists("seqLog"); ipLog = optionExists("ipLog"); doMask = optionExists("mask"); canStop = optionExists("canStop"); noSimpRepMask = optionExists("noSimpRepMask"); -writeIndex = optionExists("writeIndex"); indexFile = optionVal("indexFile", NULL); -if (writeIndex && (indexFile == NULL)) - errAbort("-writeIndex options requires -indexFile"); + if (argc < 2) usage(); if (optionExists("log")) logOpenFile(argv[0], optionVal("log", NULL)); if (optionExists("syslog")) logOpenSyslog(argv[0], optionVal("logFacility", NULL)); if (optionExists("debugLog")) logSetMinPriority("debug"); if (sameWord(command, "direct")) { if (argc < 4) usage(); genoFindDirect(argv[2], argc-3, argv+3); }