static char rcsid[] = "$Id: method.c 226364 2023-03-07 02:58:57Z twu $";
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "method.h"

#include <stdlib.h>

char *
Method_string (Method_T method) {
  /* May want to turn on NO_COMPARE in substring.c also */
  switch (method) {
  case TR__TR_EXACT: return "tr.exact";
  case TR__TR_EXT: return "tr.ext";
  case TR__KMER_EXACT1: case RNA__KMER_EXACT1: case DNA__KMER_EXACT1: return "exact1";
  case TR__EXT: case RNA__EXT: case DNA__EXT: return "ext";
  case DNA__KMER_COMPLETE: return "complete";
  case TR__TR_COMPLETE: return "tr.complete";
  case TR__TR_APPROX: return "tr.approx";
  case TR__SEGMENT1: case RNA__SEGMENT1: case DNA__SEGMENT1: return "seg1";
  case TR__KMER_EXACT2: case RNA__KMER_EXACT2: case DNA__KMER_EXACT2: return "exact2";
  case TR__KMER_APPROX: case RNA__KMER_APPROX: case DNA__KMER_APPROX: return "approx";
  case SEGMENT2: return "seg2";
  case FUSION: return "fusion";
  default: abort();
  }
}


void
Method_samprint (Filestring_T fp, Method_T method) {
  switch (method) {
  case TR__TR_EXACT: FPRINTF(fp,"\tXG:Z:tr.exact"); break;
  case TR__TR_EXT: FPRINTF(fp,"\tXG:Z:tr.ext"); break;
  case TR__KMER_EXACT1: case RNA__KMER_EXACT1: case DNA__KMER_EXACT1: FPRINTF(fp,"\tXG:Z:exact1"); break;
  case TR__EXT: case RNA__EXT: case DNA__EXT: FPRINTF(fp,"\tXG:Z:ext"); break;
  case DNA__KMER_COMPLETE: FPRINTF(fp,"\tXG:Z:complete"); break;
  case TR__TR_COMPLETE: FPRINTF(fp,"\tXG:Z:tr.complete"); break;
  case TR__TR_APPROX: FPRINTF(fp,"\tXG:Z:tr.approx"); break;
  case TR__SEGMENT1: case RNA__SEGMENT1: case DNA__SEGMENT1: FPRINTF(fp,"\tXG:Z:seg1"); break;
  case TR__KMER_EXACT2: case RNA__KMER_EXACT2: case DNA__KMER_EXACT2: FPRINTF(fp,"\tXG:Z:exact2"); break;
  case TR__KMER_APPROX: case RNA__KMER_APPROX: case DNA__KMER_APPROX: FPRINTF(fp,"\tXG:Z:approx"); break;
  case SEGMENT2: FPRINTF(fp,"\tXG:Z:seg2"); break;
  case FUSION: FPRINTF(fp,"\tXG:Z:fusion"); break;
  default: abort();
  }

  return;
}

void
Method_print (Filestring_T fp, Method_T method) {
  switch (method) {
  case TR__TR_EXACT: FPRINTF(fp,"\tmethod:tr.exact"); break;
  case TR__TR_EXT: FPRINTF(fp,"\tmethod:tr.ext"); break;
  case TR__KMER_EXACT1: case RNA__KMER_EXACT1: case DNA__KMER_EXACT1: FPRINTF(fp,"\tmethod:exact1"); break;
  case TR__EXT: case RNA__EXT: case DNA__EXT: FPRINTF(fp,"\tmethod:ext"); break;
  case DNA__KMER_COMPLETE: FPRINTF(fp,"\tmethod:complete"); break;
  case TR__TR_COMPLETE: FPRINTF(fp,"\tmethod:tr.complete"); break;
  case TR__TR_APPROX: FPRINTF(fp,"\tmethod:tr.approx"); break;
  case TR__SEGMENT1: case RNA__SEGMENT1: case DNA__SEGMENT1: FPRINTF(fp,"\tmethod:seg1"); break;
  case TR__KMER_EXACT2: case RNA__KMER_EXACT2: case DNA__KMER_EXACT2: FPRINTF(fp,"\tmethod:exact2"); break;
  case TR__KMER_APPROX: case RNA__KMER_APPROX: case DNA__KMER_APPROX: FPRINTF(fp,"\tmethod:approx"); break;
  case SEGMENT2: FPRINTF(fp,"\tmethod:seg2"); break;
  case FUSION: FPRINTF(fp,"\tmethod:fusion"); break;
  default: abort();
  }

  return;
}

