14 #define awt_assert(bed) arb_assert(bed)
16 #define IUPAC_EMPTY "" // changed from " " to "" (2009-03-19 -- ralf)
17 #define ILL_CODE char(26)
19 using namespace iupac;
22 #define _____________ {NULp,0}
25 { {
"A", 1 }, {
"A", 1 } },
26 { {
"CGT", 3 }, {
"CGU", 3 } },
27 { {
"C", 1 }, {
"C", 1 } },
28 { {
"AGT", 3 }, {
"AGU", 3 } },
31 { {
"G", 1 }, {
"G", 1 } },
32 { {
"ACT", 3 }, {
"ACU", 3 } },
35 { {
"GT", 2 }, {
"GU", 2 } },
37 { {
"AC", 2 }, {
"AC", 2 } },
38 { {
"ACGT", 1 }, {
"ACGU", 1 } },
42 { {
"AG", 2 }, {
"AG", 2 } },
43 { {
"CG", 2 }, {
"CG", 2 } },
44 { {
"T", 1 }, {
"U", 1 } },
45 { {
"T", 1 }, {
"U", 1 } },
46 { {
"ACG", 3 }, {
"ACG", 3 } },
47 { {
"AT", 2 }, {
"AU", 2 } },
49 { {
"CT", 2 }, {
"CU", 2 } },
71 void setup_amino_group() {
74 const char *members = aminoGroupMembers[g];
75 for (
int p = 0; members[p]; ++p) {
78 amino_group[c-
'A'] = g;
83 Setup() { setup_amino_group(); }
108 for (c1=0; c1<26; c1++) {
112 for (c2=0; c2<=c1; c2++) {
118 IUPAC_add[c1][c1] =
char(c1);
120 for (c2=0; c2<c1; c2++) {
121 if (strchr(decoded1,
'A'+c2)) {
122 IUPAC_add[c1][c2] =
char(c1);
134 const char *d1 = decoded1;
135 const char *d2 = decoded2;
141 if (!z1 && !z2)
break;
148 else if (!z2 || (z1 && z1<z2)) {
162 #if !defined(NDEBUG) && 0
163 printf(
"Mix '%s' + '%s' = '%s'\n", decoded1, decoded2, mixed);
168 for (c3=0; c3<26; c3++) {
170 IUPAC_add[c1][c2] =
char(c3);
176 IUPAC_add[c1][c2] = 0;
181 if (IUPAC_add[c1][c2]==(
'U'-
'A')) {
182 IUPAC_add[c1][c2] =
'T'-
'A';
185 IUPAC_add[c2][c1] = IUPAC_add[c1][c2];
193 if (!IUPAC_add_initialized) {
195 IUPAC_add_initialized = 1;
208 if (isalpha(c1))
break;
211 c1 = toupper(c1)-
'A';
212 unsigned char c = IUPAC_add[c1][c1];
215 if (isalpha(bases[i])) {
216 int c2 = toupper(bases[i])-
'A';
217 c = IUPAC_add[c][c2];
240 if (!isalpha(iupac)) {
245 if (decode_amino_iupac_groups) {
269 void TEST_amino_groups() {
274 for (
char c =
'A'; c <=
'Z'; ++c) {
282 const char *
const found = strchr(members, c);
288 const char *
const found = strchr(decoded, c);
297 for (
int pos = 0; member[pos]; ++pos) {
304 void TEST_nuc_groups() {
305 for (
int base = 0; base<26; base++) {
307 for (
int alitype = 0; alitype<2; alitype++) {
310 if ((base+
'A') ==
'N') {
320 for (
size_t pos = 1; pos<group.
count; ++pos) {
static Amino_Group amino_group[26]
const char *const members
char get_amino_consensus_char(Amino_Group ag)
static char IUPAC_add[26][26]
char buffer[MESSAGE_BUFFERSIZE]
char combine(char c1, char c2, GB_alignment_type ali)
const char * decode(char iupac, GB_alignment_type aliType, bool decode_amino_iupac_groups)
static void initialize_IUPAC_add()
#define TEST_EXPECT_EQUAL__BROKEN(expr, want, got)
static int IUPAC_add_initialized
#define TEST_REJECT(cond)
const Nuc_Group nuc_group[26][2]
#define TEST_EXPECT_LESS(val, ref)
Amino_Group get_amino_group_for(char aa)
#define TEST_EXPECT_IN_RANGE(val, lower, higher)
char encode(const char bases[], GB_alignment_type aliType)
static const char * aminoGroupMembers[AA_GROUP_COUNT]
#define TEST_EXPECT_DIFFERENT(expr, want)
#define TEST_EXPECT_EQUAL(expr, want)