19 #ifndef OST_SEQ_SUBST_WEIGHT_MATRIX_HH
20 #define OST_SEQ_SUBST_WEIGHT_MATRIX_HH
24 #include <boost/shared_ptr.hpp>
31 namespace ost {
namespace seq {
namespace alg {
42 const static int ALPHABET_SIZE=
'Z'-
'A'+1;
55 ::memset(weights_, 0,
sizeof(
WeightType)*ALPHABET_SIZE*ALPHABET_SIZE);
58 void AssignPreset(Preset p);
66 if (!(IsAlpha(aa_one) && IsAlpha(aa_two))) {
69 int i=Index(aa_one, aa_two);
70 return (i>=0 && i<ALPHABET_SIZE*ALPHABET_SIZE) ? weights_[i] : 0;
85 if ((IsAlpha(aa_one) && IsAlpha(aa_two))) {
86 int i=Index(aa_one, aa_two);
87 if (i>=0 && i<ALPHABET_SIZE*ALPHABET_SIZE) {
89 min_weight_ = std::min(min_weight_,weight);
90 max_weight_ = std::max(max_weight_,weight);
96 int Index(
char aa_one,
char aa_two)
const {
97 return (toupper(aa_one)-
'A')*ALPHABET_SIZE+(toupper(aa_two)-
'A');
101 bool IsAlpha(
char aa)
const {
102 return (toupper(aa)>=
'A' && toupper(aa)<=
'Z');
104 WeightType weights_[ALPHABET_SIZE*ALPHABET_SIZE];
105 WeightType max_weight_;
106 WeightType min_weight_;
void SetWeight(char aa_one, char aa_two, WeightType weight)
Set the substitution weight between two amino acids.
#define DLLEXPORT_OST_SEQ_ALG
SubstWeightMatrix()
Initialize substitution matrix with zero.
WeightType GetMinWeight() const
Get the minimal substitution weight of the matrix.
WeightType GetMaxWeight() const
Get the maximal substitution weight of the matrix.
position-independet substitution weight matrix
boost::shared_ptr< SubstWeightMatrix > SubstWeightMatrixPtr
WeightType GetWeight(char aa_one, char aa_two) const
Get the substitution weight between two amino acids.