Matrix Class Reference

#include <matrix.h>

List of all members.

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
Matrixoperator= (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
Matrixoperator= (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]


Detailed Description

Once the Matrix is constructed, it should be passed around as pointers.

Constructor & Destructor Documentation

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]

Parameters:
matrixName a known scoring matrix name
nucMatrix whether it is a matrix for nucleotide default is not.

References read().

Matrix::Matrix ( const Matrix mt  ) 

copy constructor

References aas, and mat.

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 (  ) 


Member Function Documentation

int Matrix::getMinScore (  )  const [inline]

References mins.

Referenced by Dynaln::Dynaln().

int Matrix::getMaxScore (  )  const [inline]

References maxs.

Matrix & Matrix::operator= ( const Matrix mt  ) 

Normally we don't copy matrices, because we usually only need one for the whole application! We usaully pass pointers around.

References aas, mat, maxs, mins, mismatch, name, numsymbol, path, words, wordsArraySize, and wordSize.

void Matrix::show (  ) 

to show the matrix in the actual array format output to cout

References mat, name, and path.

Referenced by main().

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]

returns the number of symbols in the matrix for protein matrix this is usually 22, but with selenocystein, this could be 23.

For nucleotide acids, this should be 5 with N being the 5th symbol.

References numsymbol.

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

References aas, and numsymbol.

Referenced by getWords().

void Matrix::expandWord ( char **&  in,
int &  insize,
int &  ws 
) const

References aas, numsymbol, and wordSize.

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]

References wordsArraySize.

Referenced by main().

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  ) 

bool Matrix::read ( const string &  p,
const string &  n 
) [inline]

References name, read(), and setPath().

void Matrix::setMatrix ( const string &  n  )  [inline]

read a new matrix from file. Expensive

References name, and read().

Referenced by Dynaln::Dynaln(), and Dynaln::setMatrix().

void Matrix::setPath ( const string &  p  )  [inline]

References path.

Referenced by read().

int Matrix::getMatchScore ( const char  c1,
const char  c2 
) [inline]

References match, and mismatch.

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

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.

Matrix& Matrix::operator= ( const Matrix mt  ) 

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

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.

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]

References name, read(), and setPath().

void Matrix::setMatrix ( const string &  n  )  [inline]

read a new matrix from file. Expensive

References name, and read().

void Matrix::setPath ( const string &  p  )  [inline]

References path.

int Matrix::getMatchScore ( const char  c1,
const char  c2 
) [inline]

References match, and mismatch.

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.

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


Member Data Documentation

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]

int Matrix::numsymbol [private]

char ** Matrix::words [mutable, private]

int Matrix::wordsArraySize [mutable, private]

int Matrix::wordSize [mutable, private]


The documentation for this class was generated from the following files:

Generated on Wed Aug 10 11:57:12 2011 for Softwares from Orpara by  doxygen 1.5.6