|
Last change
on this file was
16763,
checked in by westram, 8 years ago
|
|
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Author Date Id Revision
|
|
File size:
2.0 KB
|
| Line | |
|---|
| 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 { |
|---|
| 27 | AA_GROUP_NONE = 0, |
|---|
| 28 | |
|---|
| 29 | AA_GROUP_ALPHA, |
|---|
| 30 | AA_GROUP_BETA, |
|---|
| 31 | AA_GROUP_GAMMA, |
|---|
| 32 | AA_GROUP_DELTA, |
|---|
| 33 | AA_GROUP_EPSILON, |
|---|
| 34 | AA_GROUP_ZETA, |
|---|
| 35 | |
|---|
| 36 | AA_GROUP_ILLEGAL, |
|---|
| 37 | |
|---|
| 38 | AA_GROUP_COUNT = AA_GROUP_ILLEGAL, // count of real groups plus none-"group" |
|---|
| 39 | }; |
|---|
| 40 | Amino_Group get_amino_group_for(char aa); |
|---|
| 41 | char get_amino_consensus_char(Amino_Group ag); |
|---|
| 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 |
|---|
Note: See
TracBrowser
for help on using the repository browser.