示例#1
0
文件: server.c 项目: davidhoover/kent
void serverStart(char *files[], int fileCount)
/* Load DNA. Build up indexes, set up listing port, and fall into
 * accept loop. */
{
struct blatzIndex *indexList = NULL;
int i;
int acceptor;
struct bzp *bzp = bzpDefault();

/* Daemonize self. */
bzpSetOptions(bzp);

/* Load up all sequences. */
for (i=0; i<fileCount; ++i)
    {
    struct dnaLoad *dl = dnaLoadOpen(files[i]);
    struct blatzIndex *oneList = blatzIndexDl(dl, bzp->weight, bzp->unmask);
    indexList = slCat(indexList, oneList);
    dnaLoadClose(&dl);
    }
bzpTime("Loaded and indexed %d sequences", slCount(indexList));
verbose(1, "Ready for queries\n");

/* Turn self into proper daemon. */
logDaemonize("blatzServer");

acceptor = netAcceptingSocket(port, 100);
serviceLoop(acceptor, bzp, indexList);
}
static void loadAndAlignAll(struct bzp *bzp, 
        char *target, char *query, char *output)
/* blatz - Align genomic dna across species. */
{
struct dnaLoad *queryDl = dnaLoadOpen(query);
struct dnaLoad *targetDl = dnaLoadOpen(target);
struct blatzIndex *indexList = blatzIndexDl(targetDl, bzp->weight, bzp->unmask);
bzpTime("loaded and indexed target DNA");

// LX BEG
if (bzp->dynaWordCoverage > 0)
   {
   dynaNumWords = (pow(4,bzp->weight)); // ?? check with Jim if this is correct
   AllocArray(dynaWordCount,dynaNumWords);
   printf("Allocated word count table of size %d\n",dynaNumWords);
   dynaWordLimit = bzp->dynaWordCoverage; // cheating, should be more like:
   //dynaWordLimit = bzp->dynaWordCoverage*dynaSequenceSize/dynaNumWords;
   printf("Set word limit to  %d\n",dynaWordLimit);
   }
// LX END

verbose(2, "Loaded %d in %s, opened %s\n", slCount(indexList), target,
        query);
alignAll(bzp, indexList, queryDl, output);
}