void ProcessNonDaemonCommands(int argc, const char **argv) { if (strcmp(argv[1], "index") == 0) { if (CommandPipe == NULL) { GenomeIndex::runIndexer(argc - 2, argv + 2); } else { // // The error cases in index build don't really free memory properly, so we just don't allows it in daemon mode. // WriteErrorMessage("The index command is not available in daemon mode. Please run 'snap index' directly.\n"); } } else if (strcmp(argv[1], "single") == 0 || strcmp(argv[1], "paired") == 0) { for (int i = 1; i < argc; /* i is increased below */) { unsigned nArgsConsumed; if (strcmp(argv[i], "single") == 0) { SingleAlignerContext single; single.runAlignment(argc - i, argv + i, SNAP_VERSION, &nArgsConsumed); } else if (strcmp(argv[i], "paired") == 0) { PairedAlignerContext paired; paired.runAlignment(argc - i, argv + i, SNAP_VERSION, &nArgsConsumed); } else { fprintf(stderr, "Invalid command: %s\n\n", argv[i]); usage(); return; } _ASSERT(nArgsConsumed > 0); i += nArgsConsumed; } } else { WriteErrorMessage("Invalid command: %s\n\n", argv[1]); usage(); } }
int main(int argc, const char **argv) { printf("Welcome to SNAP version %s.\n\n", SNAP_VERSION); if (argc < 2) { usage(); } else if (strcmp(argv[1], "index") == 0) { GenomeIndex::runIndexer(argc - 2, argv + 2); } else if (strcmp(argv[1], "single") == 0) { SingleAlignerContext single; single.runAlignment(argc - 2, argv + 2, SNAP_VERSION); } else if (strcmp(argv[1], "paired") == 0) { PairedAlignerContext paired; paired.runAlignment(argc - 2, argv + 2, SNAP_VERSION); } else { fprintf(stderr, "Invalid command: %s\n\n", argv[1]); usage(); } }