ARB
iupac.h
Go to the documentation of this file.
1 // ================================================================= //
2 // //
3 // File : iupac.h //
4 // Purpose : //
5 // //
6 // Institute of Microbiology (Technical University Munich) //
7 // http://www.arb-home.de/ //
8 // //
9 // ================================================================= //
10 
11 #ifndef IUPAC_H
12 #define IUPAC_H
13 
14 #ifndef ARBDB_BASE_H
15 #include <arbdb_base.h>
16 #endif
17 #ifndef ARB_ASSERT_H
18 #include <arb_assert.h>
19 #endif
20 
21 
22 namespace iupac {
23  // --------------
24  // amino
25 
26  enum Amino_Group {
28 
35 
37 
38  AA_GROUP_COUNT = AA_GROUP_ILLEGAL, // count of real groups plus none-"group"
39  };
42 
43  // -------------
44  // Nucs
45 
46  struct Nuc_Group {
47  const char * const members; // contains members of nuc IUPAC group (NULp if no members)
48  size_t const count; // no of members (1 for 'N'!)
49  };
50 
51  extern const Nuc_Group nuc_group[26][2]; // second index: [0] uses T, [1] uses U
52 
53  inline int to_index(char c) { // calculate index for nuc_group
54  arb_assert(c>='A' && c<='Z');
55  return c-'A';
56  }
57  // @@@ create accessor and hide nuc_group
58 
59  char combine(char c1, char c2, GB_alignment_type ali); // nucleotides only
60  char encode(const char bases[], GB_alignment_type aliType);
61 
62  // -------------
63  // Both
64 
65  const char* decode(char iupac, GB_alignment_type aliType, bool decode_amino_iupac_groups);
66 };
67 
68 #else
69 #error iupac.h included twice
70 #endif // IUPAC_H
#define arb_assert(cond)
Definition: arb_assert.h:245
const char *const members
Definition: iupac.h:47
Definition: iupac.cxx:21
char get_amino_consensus_char(Amino_Group ag)
Definition: iupac.cxx:95
char combine(char c1, char c2, GB_alignment_type ali)
Definition: iupac.cxx:231
const char * decode(char iupac, GB_alignment_type aliType, bool decode_amino_iupac_groups)
Definition: iupac.cxx:239
Amino_Group
Definition: iupac.h:26
const Nuc_Group nuc_group[26][2]
Definition: iupac.cxx:24
int to_index(char c)
Definition: iupac.h:53
GB_alignment_type
Definition: arbdb_base.h:61
Amino_Group get_amino_group_for(char aa)
Definition: iupac.cxx:89
size_t const count
Definition: iupac.h:48
char encode(const char bases[], GB_alignment_type aliType)
Definition: iupac.cxx:192