#include <matrix.h>
Public Member Functions | |
| Matrix () | |
| Matrix (const string &matrixName, bool nucMatrix=false) | |
| Matrix (const Matrix &mt) | |
| Matrix (int m, int mis) | |
| ~Matrix () | |
| int | getMinScore () const |
| int | getMaxScore () const |
| Matrix & | operator= (const Matrix &mt) |
| void | show () |
| const char * | getAlphabet () const |
| int | getNumberOfAlphabet () const |
| void | getWords (vector< string > &words, int ws) const |
| void | growWord (const vector< string > &in, vector< string > &ou) const |
| void | expandWord (char **&in, int &insize, int &ws) const |
| char ** | allwords (int ws) const |
| int | getNumberOfWords () const |
| int | getCurrentWordSize () const |
| void | showWords () const |
| int | similarWord_debug (ostream &ous, const char *w, int ws, int cutoff=10, float fractioncutoff=0.75) const |
| int | similarWord (vector< char * > &neighbor, const char *w, int ws, float cutoff=11, float fractioncutoff=0.8) const |
| bool | read (bool nucMatrix=false) |
| bool | read (const string &p, const string &n) |
| void | setMatrix (const string &n) |
| void | setPath (const string &p) |
| int | getMatchScore (const char c1, const char c2) |
| int | lookup (int row, int col) const |
| int | lookup (char row, char col) const |
| int | score (const int *x, const int *y, const int len) const |
| Matrix () | |
| Matrix (const string &matrixName, bool nucMatrix=false) | |
| Matrix (const Matrix &mt) | |
| Matrix (int m, int mis) | |
| ~Matrix () | |
| int | getMinScore () const |
| int | getMaxScore () const |
| Matrix & | operator= (const Matrix &mt) |
| void | show () |
| const char * | getAlphabet () const |
| int | getNumberOfAlphabet () const |
| void | getWords (vector< string > &words, int ws) const |
| void | growWord (const vector< string > &in, vector< string > &ou) const |
| void | expandWord (char **&in, int &insize, int &ws) const |
| char ** | allwords (int ws) const |
| int | getNumberOfWords () const |
| int | getCurrentWordSize () const |
| void | showWords () const |
| int | similarWord_debug (ostream &ous, const char *w, int ws, int cutoff=10, float fractioncutoff=0.75) const |
| int | similarWord (vector< char * > &neighbor, const char *w, int ws, float cutoff=11, float fractioncutoff=0.8) const |
| bool | read (bool nucMatrix=false) |
| bool | read (const string &p, const string &n) |
| void | setMatrix (const string &n) |
| void | setPath (const string &p) |
| int | getMatchScore (const char c1, const char c2) |
| int | lookup (int row, int col) const |
| int | lookup (char row, char col) const |
| int | score (const int *x, const int *y, const int len) const |
Public Attributes | |
| int | alpha |
| int | beta |
Private Attributes | |
| string | path |
| string | name |
| int | match |
| int | mismatch |
| int | mat [32][32] |
| int | maxs |
| int | mins |
| char | aas [32] |
| int | numsymbol |
| char ** | words |
| int | wordsArraySize |
| int | wordSize |
Static Private Attributes | |
| static int | default_mat [32][32] |
| Matrix::Matrix | ( | ) | [inline] |
Default matrix constructor.
This is expensive, it is reading in the matrix from file. For repeated usage, this should be avoided
The default path for the matrix is: /home/kzhou/proj/seqaln/matrix For production version this should be some central place.
References default_mat, and mat.
| Matrix::Matrix | ( | const string & | matrixName, | |
| bool | nucMatrix = false | |||
| ) | [inline] |
| matrixName | a known scoring matrix name | |
| nucMatrix | whether it is a matrix for nucleotide default is not. |
References read().
| Matrix::Matrix | ( | int | m, | |
| int | mis | |||
| ) | [inline] |
construct a matrix that has only two parameters
| Matrix::~Matrix | ( | ) |
References words, and wordsArraySize.
| Matrix::Matrix | ( | ) | [inline] |
This is expensive, it is reading in the matrix from file. For repeated usage, this should be avoided
References default_mat, and mat.
| Matrix::Matrix | ( | const string & | matrixName, | |
| bool | nucMatrix = false | |||
| ) | [inline] |
References read().
| Matrix::Matrix | ( | const Matrix & | mt | ) |
copy constructor
| Matrix::Matrix | ( | int | m, | |
| int | mis | |||
| ) | [inline] |
| Matrix::~Matrix | ( | ) |
| int Matrix::getMinScore | ( | ) | const [inline] |
| int Matrix::getMaxScore | ( | ) | const [inline] |
References maxs.
| void Matrix::show | ( | ) |
| const char* Matrix::getAlphabet | ( | ) | const [inline] |
returns the alphabet of the all amino acid symbols in the matrix
References aas.
| int Matrix::getNumberOfAlphabet | ( | ) | const [inline] |
| void Matrix::getWords | ( | vector< string > & | words, | |
| int | ws | |||
| ) | const |
put all possible words of length ws into the vector words
References aas, growWord(), and numsymbol.
| void Matrix::growWord | ( | const vector< string > & | in, | |
| vector< string > & | ou | |||
| ) | const |
| void Matrix::expandWord | ( | char **& | in, | |
| int & | insize, | |||
| int & | ws | |||
| ) | const |
| char ** Matrix::allwords | ( | int | ws | ) | const |
return a pointer to all the words generated in all combination. Symbol B Z X * U should not be used to build words.
References aas, expandCombination(), numsymbol, words, wordsArraySize, and wordSize.
Referenced by main(), similarWord(), and similarWord_debug().
| int Matrix::getNumberOfWords | ( | ) | const [inline] |
| int Matrix::getCurrentWordSize | ( | ) | const [inline] |
References wordSize.
| void Matrix::showWords | ( | ) | const |
References numsymbol, words, and wordsArraySize.
| int Matrix::similarWord_debug | ( | ostream & | ous, | |
| const char * | w, | |||
| int | ws, | |||
| int | cutoff = 10, |
|||
| float | fractioncutoff = 0.75 | |||
| ) | const |
debug show all similar words and scores input w The input word, this function finds all similar words and write them to the output stream.
For the real version, some words never have neighboring words, We can use a set, pre-load the words into a set, for speedy look up. This is for the future.
References allwords(), lookup(), score(), words, wordsArraySize, and wordSize.
Referenced by main().
| int Matrix::similarWord | ( | vector< char * > & | neighbor, | |
| const char * | w, | |||
| int | ws, | |||
| float | cutoff = 11, |
|||
| float | fractioncutoff = 0.8 | |||
| ) | const |
neighbor will be cleared first if it is not empty.
References allwords(), lookup(), score(), words, wordsArraySize, and wordSize.
Referenced by ltrie::build().
| bool Matrix::read | ( | bool | nucMatrix = false |
) |
References aachar2num(), aas, dissect(), hashbase(), ifstream(), mat, maxs, mins, name, numsymbol, and path.
Referenced by Matrix(), read(), and setMatrix().
| bool Matrix::read | ( | const string & | p, | |
| const string & | n | |||
| ) | [inline] |
| void Matrix::setMatrix | ( | const string & | n | ) | [inline] |
read a new matrix from file. Expensive
Referenced by Dynaln::Dynaln(), and Dynaln::setMatrix().
| int Matrix::lookup | ( | int | row, | |
| int | col | |||
| ) | const [inline] |
More efficient using code that is the result of the getcode() method of bioseq.
In debugged code, the bound checking shoould be removed.
References mat.
Referenced by Boxchain::buildAlignment(), Dynaln::buildAlnInfo(), LSDynaln::computeScoreBW(), LSDynaln::computeScoreFW(), Lale::extendhit(), Dynaln::getMatchArray(), Dynaln::getNgMatchArray(), Dynaln::global(), LSDynaln::local(), Dynaln::local(), LSDynaln::path(), score(), Alignsegex::shrink(), Alignseg::shrink(), similarWord(), and similarWord_debug().
| int Matrix::lookup | ( | char | row, | |
| char | col | |||
| ) | const [inline] |
use the aachar2num function in bioseq to convert letters to numbers with A as zero, B as 1, ... All letters must be upper case
References aachar2num(), and mat.
| int Matrix::score | ( | const int * | x, | |
| const int * | y, | |||
| const int | len | |||
| ) | const |
give two array of int code for sequence, it return the score for this segment of sequence alignment
References lookup().
Referenced by Alignsegex::attachTo(), Boxchain::buildAlignment(), Linkbox::connect(), Lale::findMatch(), Lale::mergeNeighbor(), similarWord(), and similarWord_debug().
| int Matrix::getMinScore | ( | ) | const [inline] |
References mins.
| int Matrix::getMaxScore | ( | ) | const [inline] |
References maxs.
Normally we don't copy matrices, because we usually only need one for the whole application! We usaully pass pointers around.
| void Matrix::show | ( | ) |
to show the matrix in the actual array format output to cout
| const char* Matrix::getAlphabet | ( | ) | const [inline] |
returns the alphabet of the all amino acid symbols in the matrix
References aas.
| int Matrix::getNumberOfAlphabet | ( | ) | const [inline] |
References numsymbol.
| void Matrix::getWords | ( | vector< string > & | words, | |
| int | ws | |||
| ) | const |
put all possible words of length ws into the vector words
| void Matrix::growWord | ( | const vector< string > & | in, | |
| vector< string > & | ou | |||
| ) | const |
| void Matrix::expandWord | ( | char **& | in, | |
| int & | insize, | |||
| int & | ws | |||
| ) | const |
| char** Matrix::allwords | ( | int | ws | ) | const |
return a pointer to all the words generated in all combination. Symbol B Z X * U should not be used to build words.
| int Matrix::getNumberOfWords | ( | ) | const [inline] |
References wordsArraySize.
| int Matrix::getCurrentWordSize | ( | ) | const [inline] |
References wordSize.
| void Matrix::showWords | ( | ) | const |
| int Matrix::similarWord_debug | ( | ostream & | ous, | |
| const char * | w, | |||
| int | ws, | |||
| int | cutoff = 10, |
|||
| float | fractioncutoff = 0.75 | |||
| ) | const |
| int Matrix::similarWord | ( | vector< char * > & | neighbor, | |
| const char * | w, | |||
| int | ws, | |||
| float | cutoff = 11, |
|||
| float | fractioncutoff = 0.8 | |||
| ) | const |
neighbor will be cleared first if it is not empty.
| bool Matrix::read | ( | bool | nucMatrix = false |
) |
| bool Matrix::read | ( | const string & | p, | |
| const string & | n | |||
| ) | [inline] |
| void Matrix::setMatrix | ( | const string & | n | ) | [inline] |
| void Matrix::setPath | ( | const string & | p | ) | [inline] |
References path.
| int Matrix::lookup | ( | int | row, | |
| int | col | |||
| ) | const [inline] |
| int Matrix::lookup | ( | char | row, | |
| char | col | |||
| ) | const [inline] |
use the aachar2num function in bioseq to convert letters to numbers with A as zero, B as 1, ... All letters must be upper case
References aachar2num(), and mat.
| int Matrix::score | ( | const int * | x, | |
| const int * | y, | |||
| const int | len | |||
| ) | const |
give two array of int code for sequence, it return the score for this segment of sequence alignment
| int Matrix::alpha |
| int Matrix::beta |
string Matrix::path [private] |
Referenced by operator=(), read(), setPath(), and show().
string Matrix::name [private] |
Referenced by operator=(), read(), setMatrix(), and show().
int Matrix::match [private] |
Referenced by getMatchScore().
int Matrix::mismatch [private] |
Referenced by getMatchScore(), and operator=().
int Matrix::mat [private] |
Referenced by lookup(), Matrix(), operator=(), read(), and show().
static int Matrix::default_mat [static, private] |
Referenced by Matrix().
int Matrix::maxs [private] |
Referenced by getMaxScore(), operator=(), and read().
int Matrix::mins [private] |
Referenced by getMinScore(), operator=(), and read().
char Matrix::aas [private] |
Referenced by allwords(), expandWord(), getAlphabet(), getWords(), growWord(), Matrix(), operator=(), and read().
int Matrix::numsymbol [private] |
Referenced by allwords(), expandWord(), getNumberOfAlphabet(), getWords(), growWord(), operator=(), read(), and showWords().
char ** Matrix::words [mutable, private] |
Referenced by allwords(), operator=(), showWords(), similarWord(), similarWord_debug(), and ~Matrix().
int Matrix::wordsArraySize [mutable, private] |
Referenced by allwords(), getNumberOfWords(), operator=(), showWords(), similarWord(), similarWord_debug(), and ~Matrix().
int Matrix::wordSize [mutable, private] |
Referenced by allwords(), expandWord(), getCurrentWordSize(), operator=(), similarWord(), and similarWord_debug().
1.5.6