19 #ifndef OST_SEQ_SUBST_WEIGHT_MATRIX_HH
20 #define OST_SEQ_SUBST_WEIGHT_MATRIX_HH
24 #include <boost/shared_ptr.hpp>
32 namespace ost {
namespace seq {
namespace alg {
34 class SubstWeightMatrix;
43 const static int ALPHABET_SIZE=
'Z'-
'A'+1;
54 ::memset(weights_, 0,
sizeof(
WeightType)*ALPHABET_SIZE*ALPHABET_SIZE);
65 if (!(IsAlpha(aa_one) && IsAlpha(aa_two))) {
68 int i=Index(aa_one, aa_two);
69 return (i>=0 && i<ALPHABET_SIZE*ALPHABET_SIZE) ? weights_[i] : 0;
84 if ((IsAlpha(aa_one) && IsAlpha(aa_two))) {
85 int i=Index(aa_one, aa_two);
86 if (i>=0 && i<ALPHABET_SIZE*ALPHABET_SIZE) {
88 min_weight_ = std::min(min_weight_,weight);
89 max_weight_ = std::max(max_weight_,weight);
99 int Index(
char aa_one,
char aa_two)
const {
100 return (toupper(aa_one)-
'A')*ALPHABET_SIZE+(toupper(aa_two)-
'A');
104 bool IsAlpha(
char aa)
const {
105 return (toupper(aa)>=
'A' && toupper(aa)<=
'Z');
107 WeightType weights_[ALPHABET_SIZE*ALPHABET_SIZE];
108 WeightType max_weight_;
109 WeightType min_weight_;
position-independet substitution weight matrix
WeightType GetMinWeight() const
Get the minimal substitution weight of the matrix.
void SetWeight(char aa_one, char aa_two, WeightType weight)
Set the substitution weight between two amino acids.
WeightType GetMaxWeight() const
Get the maximal substitution weight of the matrix.
void AssignPreset(Preset p)
void SetName(const String &name)
WeightType GetWeight(char aa_one, char aa_two) const
Get the substitution weight between two amino acids.
SubstWeightMatrix()
Initialize substitution matrix with zero.
boost::shared_ptr< SubstWeightMatrix > SubstWeightMatrixPtr
#define DLLEXPORT_OST_SEQ_ALG