#ifndef __W_MATRIX_POS_H__ #define __W_MATRIX_POS_H__ #include "w_matrix.h" //#define Matrix_scale 1000 //#define Max_num_letters 22 //#define Unknown_letter (Max_num_letters-1) class Weight_matrix_pos : public Weight_matrix { /** public : int elem[ Max_num_letters ][ Max_num_letters ]; double diag_average; double covariation; double mean, dispersion, mdisp; int type; int orig_elem[ Max_num_letters ][ Max_num_letters ]; **/ public : //+TMatrix* duplicate() { return new Weight_matrix( *this ); } Weight_matrix_pos( ) : Weight_matrix() {}; /** uc ord (char c) const { return nalpha[ ( unsigned char )c ]; } int _weight( uc ia, uc ib ) const { return elem[ ia ][ ib ]; } int weight( char a, char b ) const { return _weight( ord( a ), ord( b ) ); } void print(); void setPenal( int gap ); void makeDiag( ); void makeBlos62( ); //_________________________ The successors of the TMatrix abstaract class int recalcSum( int len, const char *sq1, const char *sq2, int sum, int base0, double& mult, double& add ) const; int fread( FILE *mfile ); int normalize( double *freq1, double *freq2 ); // double* makeFreq( int len, const char *seq ) const; void recast( double *freq1, double *freq2 ); int rescale( double homology_factor ) const { return int ( homology_factor * diag_average * Matrix_scale ); } void getWeight( const BankSeq &shCurr, const BankSeq &shBank, int *weight, int homFact, int base0 ) const; void getWeight( int ishSeq, const BankSeq &seq, int ishAli, WorkAli& ali, int len, int* weight, int homFac ) const; **/ void getWeight( const BankSeq &shCurr, int left1, const BankSeq &shBank, int left2, int len, int *weight, int homFact, int base0 ) const; }; /*================================================================ Fill given array with the weights for the two given sequences ================================================================*/ /** void Weight_matrix::getWeight( const BankSeq &shCurr, const BankSeq &shBank, int *wei, int homFact, int ) const { int len = shCurr.len(); for( int i = 0; i < len; i++ ) wei[ i ] = elem[ nalpha[ shCurr[ i ] ] ][ nalpha[ shBank[ i ] ] ] - homFact; } **/ void Weight_matrix_pos::getWeight( const BankSeq &shCurr, int left1, const BankSeq &shBank, int left2, int len, int *wei, int homFact, int ) const { //int len = shCurr.len(); for( int i = 0; i < len; i++ ) wei[ i ] = elem[ nalpha[ shCurr[ i + left1 ] ] ][ nalpha[ shBank[ i + left2 ] ] ] - homFact; } #endif