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;
52 ::memset(weights_, 0,
sizeof(
WeightType)*ALPHABET_SIZE*ALPHABET_SIZE);
55 void AssignPreset(Preset p);
63 if (!(IsAlpha(aa_one) && IsAlpha(aa_two))) {
66 int i=Index(aa_one, aa_two);
67 return (i>=0 && i<ALPHABET_SIZE*ALPHABET_SIZE) ? weights_[i] : 0;
82 if ((IsAlpha(aa_one) && IsAlpha(aa_two))) {
83 int i=Index(aa_one, aa_two);
84 if (i>=0 && i<ALPHABET_SIZE*ALPHABET_SIZE) {
86 min_weight_ = std::min(min_weight_,weight);
87 max_weight_ = std::max(max_weight_,weight);
93 int Index(
char aa_one,
char aa_two)
const {
94 return (toupper(aa_one)-
'A')*ALPHABET_SIZE+(toupper(aa_two)-
'A');
98 bool IsAlpha(
char aa)
const {
99 return (toupper(aa)>=
'A' && toupper(aa)<=
'Z');
101 WeightType weights_[ALPHABET_SIZE*ALPHABET_SIZE];
102 WeightType max_weight_;
103 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.