statistics::similarityMatrix Class Reference

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
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ similarityMatrix()

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

+ Here is the caller graph for this function:

◆ ~similarityMatrix()

statistics::similarityMatrix::~similarityMatrix ( )

Destructor.

Definition at line 88 of file similarityMatrix.cpp.

References memoryDeletion(), and numPositions.

+ Here is the call graph for this function:

Member Function Documentation

◆ alternativeSimilarityMatrices()

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.

Parameters
matrix_codeID of the matrix
datatypeNumberical 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().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ defaultAASimMatrix()

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ defaultNTDegeneratedSimMatrix()

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ defaultNTSimMatrix()

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getDistance()

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.

Parameters
aFirst residue to compare
bSecond residue to compare
Returns
Distance between A and B based on the similarity matrix loaded.

Definition at line 430 of file similarityMatrix.cpp.

References debug, distMat, IncorrectSymbol, reporting::reportManager::report(), UndefinedSymbol, and vhash.

Referenced by statistics::Similarity::calculateVectors().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadSimMatrix()

bool statistics::similarityMatrix::loadSimMatrix ( char *  filename)

Method to load a custom matrix.

Parameters
filenamePath to file containing the matrix to load
Returns
True if loaded
False if an error ocurred

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

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ memoryAllocation()

void statistics::similarityMatrix::memoryAllocation ( int  nPos)
private

Method to allocate memory for the similiarity matrix.

Parameters
nPosNumber of different possible residues in the alignment.
This are, on the default matrices:
  1. AA: 20 residues
  2. NT: 5 residues
  3. DEG NT: 15 residues

Definition at line 60 of file similarityMatrix.cpp.

References distMat, memoryDeletion(), numPositions, simMat, and vhash.

Referenced by alternativeSimilarityMatrices(), defaultAASimMatrix(), defaultNTDegeneratedSimMatrix(), defaultNTSimMatrix(), and loadSimMatrix().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ memoryDeletion()

void statistics::similarityMatrix::memoryDeletion ( )
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().

+ Here is the caller graph for this function:

◆ printMatrix()

void statistics::similarityMatrix::printMatrix ( )

Method to print the loaded matrix.

Definition at line 418 of file similarityMatrix.cpp.

References numPositions, and simMat.

Member Data Documentation

◆ distMat

◆ numPositions

◆ simMat

◆ vhash


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