Exemple #1
0
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);
}
int main(int argc, char *argv[])
/* Process command line. */
{
struct bzp *bzp = bzpDefault();

/* Do initialization. */
bzpTime(NULL);
dnaUtilOpen();
optionInit(&argc, argv, options);
if (argc != 4)
    usage(bzp);

/* Fill in parameters from command line options. */
bzpSetOptions(bzp);
loadAndAlignAll(bzp, argv[1], argv[2], argv[3]);

/* If you were a turtle you'd be home right now. */
return 0;
}