1 
2 /******************************************************************************
3  *
4  *  This file is part of canu, a software program that assembles whole-genome
5  *  sequencing reads into contigs.
6  *
7  *  This software is based on:
8  *    'Celera Assembler' r4587 (http://wgs-assembler.sourceforge.net)
9  *    the 'kmer package' r1994 (http://kmer.sourceforge.net)
10  *
11  *  Except as indicated otherwise, this is a 'United States Government Work',
12  *  and is released in the public domain.
13  *
14  *  File 'README.licenses' in the root directory of this distribution
15  *  contains full conditions and disclaimers.
16  */
17 
18 #pragma once
19 
20 //  Definitions for our exportable data.
21 
22 enum Vote_Value_t {
23   IDENT = 0,    //  Just an iid in this record.
24   DELETE,
25   A_SUBST,
26   C_SUBST,
27   G_SUBST,
28   T_SUBST,  //  DON'T rearrange this!  Code depends on the ordering.
29   A_INSERT,
30   C_INSERT,
31   G_INSERT,
32   T_INSERT,
33   NO_VOTE,
34   EXTENSION
35 };
36 
37 static char
VoteChar(Vote_Value_t val)38 VoteChar(Vote_Value_t val) {
39   switch (val) {
40     case A_INSERT:
41     case A_SUBST:
42       return 'a';
43     case C_INSERT:
44     case C_SUBST:
45       return 'c';
46     case G_INSERT:
47     case G_SUBST:
48       return 'g';
49     case T_INSERT:
50     case T_SUBST:
51       return 't';
52     default:
53       assert(false);
54   }
55   return 'a';
56 }
57 
58 static Vote_Value_t
InsVote(char c)59 InsVote(char c) {
60   switch (c) {
61     case 'a':
62       return A_INSERT;
63     case 'c':
64       return C_INSERT;
65     case 'g':
66       return G_INSERT;
67     case 't':
68       return T_INSERT;
69     default:
70       fprintf(stderr, "ERROR: Bad sequence '%c' 0x%02x)\n", c, c);
71       assert(false);
72   }
73   return NO_VOTE;
74 }
75 
76 static Vote_Value_t
SubstVote(char c)77 SubstVote(char c) {
78   switch (c) {
79     case 'a':
80       return A_SUBST;
81     case 'c':
82       return C_SUBST;
83     case 'g':
84       return G_SUBST;
85     case 't':
86       return T_SUBST;
87     default:
88       fprintf(stderr, "ERROR: Bad sequence '%c' 0x%02x)\n", c, c);
89       assert(false);
90   }
91   return NO_VOTE;
92 }
93 
94 
95 struct Correction_Output_t {
96   bool  keep_left   :  1;    //  set true if left overlap degree is low
97   bool  keep_right  :  1;    //  set true if right overlap degree is low
98   Vote_Value_t  type        :  4;    //  Vote_Value_t
99   uint32  pos         :  26;   //
100   uint32  readID;
101 };
102