Ejemplo n.º 1
0
int 
main(int argc, char *argv[])
{
  int ret = 0;
  tmap_command_t *c = NULL;

  if(argc < 2) {
      return tmap_usage(argc, argv);
  }
  else {
      tmap_file_stderr = tmap_file_fdopen(fileno(stderr), "w", TMAP_FILE_NO_COMPRESSION); // set stderr
      tmap_progress_set_command(argv[1]); // set output progress
      tmap_progress_set_start_time(); // set start time
      bam_verbose = 0; // No verbosity in SAMtools

      c = commands;
      while(0 <= c->type) {
          if (0 == strcmp(c->name, argv[1])) {
              ret = c->func(argc-1, argv+1);
              break;
          }
          c++;
      }
      if(c->type < 0) {
          tmap_help_unknown_cmd(argv[1]);
          tmap_error1(PACKAGE, "Unknown command", Exit, CommandLineArgument);
      }

      // NB: do not close the underlying stderr stream!
      tmap_file_fclose1(tmap_file_stderr, 0);
  }

  return ret;
}
Ejemplo n.º 2
0
int main(int argc, char *argv[])
{
  int ret = 0;

  if(argc < 2) {
      return usage();
  }
  else {
      tmap_file_stderr = tmap_file_fdopen(fileno(stderr), "w", TMAP_FILE_NO_COMPRESSION); // set stderr
      tmap_progress_set_command(argv[1]); // set output progress
      tmap_progress_set_start_time(); // set start time

      if (0 == strcmp("index", argv[1])) ret = tmap_index(argc-1, argv+1);
      else if (0 == strcmp("server", argv[1])) ret = tmap_server_main(argc-1, argv+1);
      else if (0 == strcmp("map1", argv[1])) ret = tmap_map1_main(argc-1, argv+1);
      else if (0 == strcmp("map2", argv[1])) ret = tmap_map2_main(argc-1, argv+1);
      else if (0 == strcmp("map3", argv[1])) ret = tmap_map3_main(argc-1, argv+1);
      else if (0 == strcmp("mapvsw", argv[1])) ret = tmap_map_vsw_main(argc-1, argv+1);
      else if (0 == strcmp("mapall", argv[1])) ret = tmap_map_all_main(argc-1, argv+1);
      else if (0 == strcmp("fasta2pac", argv[1])) ret = tmap_refseq_fasta2pac_main(argc-1, argv+1);
      else if (0 == strcmp("pac2bwt", argv[1])) ret = tmap_bwt_pac2bwt_main(argc-1, argv+1);
      else if (0 == strcmp("bwt2sa", argv[1])) ret = tmap_sa_bwt2sa_main(argc-1, argv+1);
      else if (0 == strcmp("sff2fq", argv[1])) ret = tmap_seq_io_sff2fq_main(argc-1, argv+1);
      else if (0 == strcmp("refinfo", argv[1])) ret = tmap_refseq_refinfo_main(argc-1, argv+1);
      else if (0 == strcmp("pac2fasta", argv[1])) ret = tmap_refseq_pac2fasta_main(argc-1, argv+1);
#ifdef HAVE_SAMTOOLS
      else if (0 == strcmp("sam2fs", argv[1])) ret = tmap_sam2fs_main(argc-1, argv+1);
#endif
#ifdef ENABLE_TMAP_DEBUG_FUNCTIONS
      else if (0 == strcmp("exact", argv[1])) ret = tmap_debug_exact(argc-1, argv+1);
      else if (0 == strcmp("fsw", argv[1])) ret = tmap_fsw_main(argc-1, argv+1);
      else if (0 == strcmp("indexspeed", argv[1])) ret = tmap_index_speed(argc-1, argv+1);
      else if (0 == strcmp("vswbm", argv[1])) ret = tmap_vswbm_main(argc-1, argv+1);
#endif
      else if (0 == strcmp("--version", argv[1]) || 0 == strcmp("-v", argv[1])) ret = version();
      else if (0 == strcmp("--help", argv[1]) || 0 == strcmp("-h", argv[1])) ret = usage();
      else {
          tmap_error1(PACKAGE, "Unknown command", Exit, CommandLineArgument);
      }

      // NB: do not close the underlying stderr stream!
      tmap_file_fclose1(tmap_file_stderr, 0);
  }

  return ret;
}