00001 #ifndef CODON_H 00002 #define CODON_H 00003 00004 #include <map> 00005 #include <string> 00006 #include <iostream> 00007 #include <vector> 00008 #include <set> 00009 00010 using namespace std; 00011 00017 int hashbase(char n); 00022 int hashcodon(char c[3]); 00023 int hashcodon(const string &cc); 00024 00028 class codon { 00029 public: 00031 codon(); 00040 codon(const std::string &def); 00044 void use(const int tabid); 00048 char operator[](const string &cd); 00054 char operator[](char cc[3]); 00055 map<char,double> getAAUniformFrequency() const; 00061 static const string univcodon; 00066 static char unknownaa; 00067 //static void readCodonTable(const string &file); 00068 static void readCodonTable(); 00069 static void setCodonFile(const char file[]); 00074 static char codonfile[200]; // $HOME/etc/codontable.txt 00076 void show(ostream &ous) const; 00077 static void showAllCodonTables(ostream &ous); 00078 00079 private: 00080 char majorStart[4]; //"ATG"; 00082 set<string> altstart; 00086 map<string, char> tab; 00087 char nuc2aa[67]; // [64] 1, [65] 2 [66] last character is ? 00094 void convert(); 00095 00102 static vector<map<string,char> > codontables; 00103 static vector<set<string> > starts; 00104 }; 00105 00106 // the universal codon table is defined like this 00107 // char nuc2aa[64]={ /* AAA */ 'K', /* AAC */ 'N', /* AAG */ 'K', 00108 // /* AAU */ 'N', /* ACA */ 'T', /* ACC */ 'T', /* ACG */ 'T', 00109 // /* ACU */ 'T', /* AGA */ 'R', /* AGC */ 'S', /* AGG */ 'R', 00110 // /* AGU */ 'S', /* AUA */ 'I', /* AUC */ 'I', /* AUG */ 'M', 00111 // /* AUU */ 'I', /* CAA */ 'Q', /* CAC */ 'H', /* CAG */ 'Q', 00112 // /* CAU */ 'H', /* CCA */ 'P', /* CCC */ 'P', /* CCG */ 'P', 00113 // /* CCU */ 'P', /* CGA */ 'R', /* CGC */ 'R', /* CGG */ 'R', 00114 // /* CGU */ 'R', /* CUA */ 'L', /* CUC */ 'L', /* CUG */ 'L', 00115 // /* CUU */ 'L', /* GAA */ 'E', /* GAC */ 'D', /* GAG */ 'E', 00116 // /* GAU */ 'D', /* GCA */ 'A', /* GCC */ 'A', /* GCG */ 'A', 00117 // /* GCU */ 'A', /* GGA */ 'G', /* GGC */ 'G', /* GGG */ 'G', 00118 // /* GGU */ 'G', /* GUA */ 'V', /* GUC */ 'V', /* GUG */ 'V', 00119 // /* GUU */ 'V', /* UAA */ '*', /* UAC */ 'Y', /* UAG */ '*', 00120 // /* UAU */ 'Y', /* UCA */ 'S', /* UCC */ 'S', /* UCG */ 'S', 00121 // /* UCU */ 'S', /* UGA */ '*', /* UGC */ 'C', /* UGG */ 'W', 00122 // /* UGU */ 'C', /* UUA */ 'L', /* UUC */ 'F', /* UUG */ 'L', 00123 // /* UUU */ 'F'}; 00124 // Any exception must be handled outside this table. 00125 00126 #endif
1.5.6