Class that contains information of similarity matrices.
These are used to calculate the similarity between residues on the same column.
Default matrices for AA, NT and DEG NT are provided, along with method for loading custom matrices.
More...
#include <similarityMatrix.h>
Public Member Functions | |
similarityMatrix () | |
Constructor. More... | |
~similarityMatrix () | |
Destructor. More... | |
bool | loadSimMatrix (char *filename) |
Method to load a custom matrix. More... | |
void | defaultAASimMatrix () |
Method to load the default AA similarity matrix. More... | |
void | defaultNTSimMatrix () |
Method to load the default NT similarity matrix. More... | |
void | defaultNTDegeneratedSimMatrix () |
Method to load the default DEG NT similarity matrix. More... | |
void | alternativeSimilarityMatrices (int matrix_code, int datatype) |
Method to load alternative similarity matrices also included on the suite. Currently, only one type of alternative matrix is available: matrix_code: 1 datatype SequenceTypes::AA. More... | |
float | getDistance (char a, char b) |
Method to get the similarity distance between two residues, A and B Characters provided must be both uppercase, please, refer to utils::toUpper. More... | |
void | printMatrix () |
Method to print the loaded matrix. More... | |
Private Member Functions | |
void | memoryAllocation (int nPos) |
Method to allocate memory for the similiarity matrix. More... | |
void | memoryDeletion () |
Method to deallocate memory allocated on the similarityMatrix::memoryAllocation method. It makes use of the numPositions to effectively remove the memory. More... | |
Private Attributes | |
int * | vhash |
float ** | simMat |
float ** | distMat |
int | numPositions |
Class that contains information of similarity matrices.
These are used to calculate the similarity between residues on the same column.
Default matrices for AA, NT and DEG NT are provided, along with method for loading custom matrices.
Definition at line 50 of file similarityMatrix.h.
statistics::similarityMatrix::similarityMatrix | ( | ) |
Constructor.
Definition at line 50 of file similarityMatrix.cpp.
References distMat, numPositions, simMat, and vhash.
Referenced by trimAlManager::create_or_use_similarity_matrix().
statistics::similarityMatrix::~similarityMatrix | ( | ) |
Destructor.
Definition at line 88 of file similarityMatrix.cpp.
References memoryDeletion(), and numPositions.
void statistics::similarityMatrix::alternativeSimilarityMatrices | ( | int | matrix_code, |
int | datatype | ||
) |
Method to load alternative similarity matrices also included on the suite. Currently, only one type of alternative matrix is available:
matrix_code: 1 datatype SequenceTypes::AA.
matrix_code | ID of the matrix |
datatype | Numberical representation of the data type. See SequenceTypes |
Definition at line 353 of file similarityMatrix.cpp.
References AA, DEG, distMat, DNA, memoryAllocation(), numPositions, RNA, simMat, and vhash.
Referenced by trimAlManager::create_or_use_similarity_matrix().
void statistics::similarityMatrix::defaultAASimMatrix | ( | void | ) |
Method to load the default AA similarity matrix.
Definition at line 251 of file similarityMatrix.cpp.
References distMat, memoryAllocation(), numPositions, simMat, and vhash.
Referenced by trimAlManager::create_or_use_similarity_matrix().
void statistics::similarityMatrix::defaultNTDegeneratedSimMatrix | ( | void | ) |
Method to load the default DEG NT similarity matrix.
Definition at line 320 of file similarityMatrix.cpp.
References distMat, memoryAllocation(), numPositions, simMat, and vhash.
Referenced by trimAlManager::create_or_use_similarity_matrix().
void statistics::similarityMatrix::defaultNTSimMatrix | ( | void | ) |
Method to load the default NT similarity matrix.
Definition at line 286 of file similarityMatrix.cpp.
References distMat, memoryAllocation(), numPositions, simMat, and vhash.
Referenced by trimAlManager::create_or_use_similarity_matrix().
float statistics::similarityMatrix::getDistance | ( | char | a, |
char | b | ||
) |
Method to get the similarity distance between two residues, A and B
Characters provided must be both uppercase, please, refer to utils::toUpper.
a | First residue to compare |
b | Second residue to compare |
Definition at line 430 of file similarityMatrix.cpp.
References debug, distMat, IncorrectSymbol, reporting::reportManager::report(), UndefinedSymbol, and vhash.
Referenced by statistics::Similarity::calculateVectors().
bool statistics::similarityMatrix::loadSimMatrix | ( | char * | filename | ) |
Method to load a custom matrix.
filename | Path to file containing the matrix to load |
Definition at line 118 of file similarityMatrix.cpp.
References distMat, utils::initlVect(), memoryAllocation(), memoryDeletion(), numPositions, utils::removeSpaces(), simMat, and vhash.
Referenced by trimAlManager::create_or_use_similarity_matrix().
|
private |
Method to allocate memory for the similiarity matrix.
nPos | Number of different possible residues in the alignment. This are, on the default matrices:
|
Definition at line 60 of file similarityMatrix.cpp.
References distMat, memoryDeletion(), numPositions, simMat, and vhash.
Referenced by alternativeSimilarityMatrices(), defaultAASimMatrix(), defaultNTDegeneratedSimMatrix(), defaultNTSimMatrix(), and loadSimMatrix().
|
private |
Method to deallocate memory allocated on the similarityMatrix::memoryAllocation method.
It makes use of the numPositions to effectively remove the memory.
Definition at line 97 of file similarityMatrix.cpp.
References distMat, numPositions, simMat, and vhash.
Referenced by loadSimMatrix(), memoryAllocation(), and ~similarityMatrix().
void statistics::similarityMatrix::printMatrix | ( | ) |
Method to print the loaded matrix.
Definition at line 418 of file similarityMatrix.cpp.
References numPositions, and simMat.
|
private |
Definition at line 54 of file similarityMatrix.h.
Referenced by alternativeSimilarityMatrices(), defaultAASimMatrix(), defaultNTDegeneratedSimMatrix(), defaultNTSimMatrix(), getDistance(), loadSimMatrix(), memoryAllocation(), memoryDeletion(), and similarityMatrix().
|
private |
Definition at line 55 of file similarityMatrix.h.
Referenced by alternativeSimilarityMatrices(), defaultAASimMatrix(), defaultNTDegeneratedSimMatrix(), defaultNTSimMatrix(), loadSimMatrix(), memoryAllocation(), memoryDeletion(), printMatrix(), similarityMatrix(), and ~similarityMatrix().
|
private |
Definition at line 53 of file similarityMatrix.h.
Referenced by alternativeSimilarityMatrices(), defaultAASimMatrix(), defaultNTDegeneratedSimMatrix(), defaultNTSimMatrix(), loadSimMatrix(), memoryAllocation(), memoryDeletion(), printMatrix(), and similarityMatrix().
|
private |
Definition at line 52 of file similarityMatrix.h.
Referenced by alternativeSimilarityMatrices(), defaultAASimMatrix(), defaultNTDegeneratedSimMatrix(), defaultNTSimMatrix(), getDistance(), loadSimMatrix(), memoryAllocation(), memoryDeletion(), and similarityMatrix().