19 #ifndef OST_SEQ_SUBST_WEIGHT_MATRIX_HH
20 #define OST_SEQ_SUBST_WEIGHT_MATRIX_HH
24 #include <boost/shared_ptr.hpp>
34 namespace ost {
namespace seq {
namespace alg {
45 const static int ALPHABET_SIZE=
'Z'-
'A'+1;
51 ::memset(weights_, 0,
sizeof(
WeightType)*ALPHABET_SIZE*ALPHABET_SIZE);
60 if (!(IsAlpha(aa_one) && IsAlpha(aa_two))) {
63 int i=Index(aa_one, aa_two);
64 return (i>=0 && i<ALPHABET_SIZE*ALPHABET_SIZE) ? weights_[i] : 0;
71 void SetWeight(
char aa_one,
char aa_two,
WeightType weight)
73 if ((IsAlpha(aa_one) && IsAlpha(aa_two))) {
74 int i=Index(aa_one, aa_two);
75 if (i>=0 && i<ALPHABET_SIZE*ALPHABET_SIZE) {
82 int Index(
char aa_one,
char aa_two)
const {
83 return (toupper(aa_one)-
'A')*ALPHABET_SIZE+(toupper(aa_two)-
'A');
87 bool IsAlpha(
char aa)
const {
88 return (toupper(aa)>=
'A' && toupper(aa)<=
'Z');
90 WeightType weights_[ALPHABET_SIZE*ALPHABET_SIZE];
95 SubstWeightMatrixFromInfo(
const info::InfoGroup& group);
99 info::InfoGroup& group);