[Bio] / Kmers2 / kguts_main.cc Repository:
ViewVC logotype

View of /Kmers2/kguts_main.cc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (download) (as text) (annotate)
Tue Sep 8 17:20:18 2015 UTC (4 years, 2 months ago) by olson
Branch: MAIN
CVS Tags: HEAD
C++ class version of kmer_guts.

#include "kguts.h"

int main(int argc,char *argv[]) {
  int c;
  char *past;
  char file[300];
  int is_server = 0;
  in_port_t port;
  char port_file[1024];
  pid_t parent = -1;

  port_file[0] = 0;
  file[0] = 0;

  KmerGuts guts;

  while ((c = getopt (argc, argv, "ad:s:wD:m:g:OM:l:L:P:H")) != -1) {
    switch (c) {
    case 'a':
	guts.aa = 1;
      break;
    case 'H':
	guts.hits_only = 1;
      break;
    case 'd':
	guts.debug = strtol(optarg,&past,0);
      break;
    case 'l':
	port = atoi(optarg);
	is_server = 1;
	break;

    case 'L':
	strncpy(port_file, optarg, sizeof(port_file) -1 );
	port_file[sizeof(port_file) - 1] = 0;
	break;

    case 'P':
	parent = atoi(optarg);
	break;
	
    case 'm':
	guts.min_hits = strtol(optarg,&past,0);
      break;
    case 'M':
	guts.min_weighted_hits = strtol(optarg,&past,0);
      break;
    case 'O':
	guts.order_constraint = 1;
      break;
    case 'g':
	guts.max_gap = strtol(optarg,&past,0);
      break;
    case 'D':
      strcpy(file,optarg);
      break;
    case 's':
	guts.size_hash = strtol(optarg,&past,0);
      break;
    case 'w':
	guts.write_mem_map = 1;
      break;
    default:
      fprintf(stderr,"arguments: [-a] [-d level] [-s hash-size] [-w] [-m min_hits] -D DataDir \n");
      abort ();
    }
  }

  KmerGuts::kmer_handle_t *kmersH = guts.init_kmers(file);

  if (is_server)
  {
      guts.run_accept_loop(kmersH, port, port_file, parent);
  }
  else
  {
      guts.run_from_filehandle(kmersH, stdin, stdout);
  }
  return 0;
}


MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3