Class to handle the calculation relative to similarity.
This class is narrowly connected to similarityMatrix, as the latter contains the information to calculate the similarity of the alignment.
More...
#include <Similarity.h>
Public Member Functions | |
Similarity (Alignment *parentAlignment, Similarity *mold) | |
void | calculateMatrixIdentity () |
Computes the matrix identity between alignment's columns. More... | |
Similarity (Alignment *parentAlignment) | |
Constructor without any parameters. More... | |
~Similarity () | |
Destructor. More... | |
bool | calculateVectors (bool cutByGap=true) |
Method to calculate the similarity values of a alignment matrix. More... | |
bool | applyWindow (int halfW) |
Allows us compute the conservationWindow's values. More... | |
bool | isDefinedWindow () |
Returns if a windows size value has been defined or not. More... | |
float * | getMdkWindowedVector () |
This methods returns a pointer to conservationWindow's vector. More... | |
bool | setSimilarityMatrix (similarityMatrix *sm) |
Stores a valid similarity matrix point to use. More... | |
bool | isSimMatrixDef () |
Returns if a similarity matrix is being used or not. More... | |
double | calcCutPoint (float baseLine, float conservationPct) |
Computes and selects the cut point values based on similarity's values. More... | |
void | printConservationColumns () |
Prints the similarity's value for each alignment's column. More... | |
void | printConservationAcl () |
Computes and prints the accumulative statistics associated to the alignment. More... | |
Public Attributes | |
Alignment * | alig |
int | halfWindow = -1 |
Half Window used on the calculation of the similarity. More... | |
float * | MDK = nullptr |
Raw similarity values. More... | |
float * | MDK_Window = nullptr |
Windowed convervation values. More... | |
float ** | matrixIdentity = nullptr |
Identity weight matrix between alignment rows. More... | |
similarityMatrix * | simMatrix = nullptr |
Similarity matrix used to similarity calculations. More... | |
int * | refCounter |
Counter of how many other instances share the same information. More... | |
Class to handle the calculation relative to similarity.
This class is narrowly connected to similarityMatrix, as the latter contains the information to calculate the similarity of the alignment.
Definition at line 52 of file Similarity.h.
statistics::Similarity::Similarity | ( | Alignment * | parentAlignment, |
Similarity * | mold | ||
) |
Definition at line 56 of file Similarity.cpp.
References alig, halfWindow, MDK, MDK_Window, refCounter, and simMatrix.
Referenced by statistics::Manager::Manager().
|
explicit |
Constructor without any parameters.
Definition at line 40 of file Similarity.cpp.
References alig, utils::initlVect(), MDK, Alignment::originalNumberOfResidues, refCounter, and simMatrix.
Referenced by statistics::Manager::calculateConservationStats(), and statistics::Manager::setSimilarityMatrix().
statistics::Similarity::~Similarity | ( | ) |
Destructor.
Definition at line 75 of file Similarity.cpp.
References alig, matrixIdentity, MDK, MDK_Window, Alignment::numberOfSequences, and refCounter.
bool statistics::Similarity::applyWindow | ( | int | halfW | ) |
Allows us compute the conservationWindow's values.
halfW | Half window size to apply. |
Definition at line 271 of file Similarity.cpp.
References alig, calculateVectors(), debug, halfWindow, MDK, MDK_Window, Alignment::originalNumberOfResidues, reporting::reportManager::report(), and SimilarityWindowTooBig.
Referenced by statistics::Manager::calculateConservationStats(), and getMdkWindowedVector().
double statistics::Similarity::calcCutPoint | ( | float | baseLine, |
float | conservationPct | ||
) |
Computes and selects the cut point values based on similarity's values.
baseLine | Percentage of columns desired. |
conservationPct | Percentage of similarity desired. |
Definition at line 381 of file Similarity.cpp.
References alig, utils::copyVect(), getMdkWindowedVector(), Alignment::originalNumberOfResidues, and utils::quicksort().
Referenced by Cleaner::clean(), and Cleaner::cleanConservation().
void statistics::Similarity::calculateMatrixIdentity | ( | ) |
Computes the matrix identity between alignment's columns.
Definition at line 97 of file Similarity.cpp.
References AA, alig, Alignment::getAlignmentType(), matrixIdentity, Alignment::originalNumberOfResidues, Alignment::originalNumberOfSequences, and Alignment::sequences.
Referenced by calculateVectors().
bool statistics::Similarity::calculateVectors | ( | bool | cutByGap = true | ) |
Method to calculate the similarity values of a alignment matrix.
cutByGap | Wheter to cut by gap or not |
Definition at line 157 of file Similarity.cpp.
References AA, alig, statistics::Manager::calculateGapStats(), calculateMatrixIdentity(), statistics::Manager::gaps, Alignment::getAlignmentType(), statistics::similarityMatrix::getDistance(), statistics::Gaps::getGapsWindow(), matrixIdentity, MDK, Alignment::numberOfResidues, Alignment::originalNumberOfResidues, Alignment::originalNumberOfSequences, Alignment::sequences, simMatrix, Alignment::Statistics, and utils::toUpper().
Referenced by applyWindow(), and statistics::Manager::calculateConservationStats().
float * statistics::Similarity::getMdkWindowedVector | ( | ) |
This methods returns a pointer to conservationWindow's vector.
Definition at line 338 of file Similarity.cpp.
References applyWindow(), halfWindow, isDefinedWindow(), MDK, and MDK_Window.
Referenced by Alignment::alignmentSummaryHTML(), Alignment::alignmentSummarySVG(), calcCutPoint(), Cleaner::clean(), Cleaner::cleanCombMethods(), Cleaner::cleanConservation(), and Alignment::statSVG().
bool statistics::Similarity::isDefinedWindow | ( | ) |
Returns if a windows size value has been defined or not.
Definition at line 330 of file Similarity.cpp.
References halfWindow.
Referenced by statistics::Manager::calculateConservationStats(), and getMdkWindowedVector().
bool statistics::Similarity::isSimMatrixDef | ( | ) |
Returns if a similarity matrix is being used or not.
Definition at line 373 of file Similarity.cpp.
References simMatrix.
Referenced by statistics::Manager::calculateConservationStats().
void statistics::Similarity::printConservationAcl | ( | ) |
Computes and prints the accumulative statistics associated to the alignment.
Definition at line 483 of file Similarity.cpp.
References alig, utils::copyVect(), Alignment::filename, MDK, MDK_Window, Alignment::originalNumberOfResidues, and utils::quicksort().
Referenced by statistics::Manager::printStatisticsConservationTotal().
void statistics::Similarity::printConservationColumns | ( | ) |
Prints the similarity's value for each alignment's column.
Definition at line 423 of file Similarity.cpp.
References alig, Alignment::filename, MDK, MDK_Window, and Alignment::originalNumberOfResidues.
Referenced by statistics::Manager::printStatisticsConservationColumns().
bool statistics::Similarity::setSimilarityMatrix | ( | similarityMatrix * | sm | ) |
Stores a valid similarity matrix point to use.
sm | Similarity matrix pointer to associate. |
Definition at line 355 of file Similarity.cpp.
References simMatrix.
Referenced by statistics::Manager::calculateConservationStats(), and statistics::Manager::setSimilarityMatrix().
Alignment* statistics::Similarity::alig |
Definition at line 57 of file Similarity.h.
Referenced by applyWindow(), calcCutPoint(), calculateMatrixIdentity(), calculateVectors(), printConservationAcl(), printConservationColumns(), Similarity(), and ~Similarity().
int statistics::Similarity::halfWindow = -1 |
Half Window used on the calculation of the similarity.
Definition at line 60 of file Similarity.h.
Referenced by applyWindow(), getMdkWindowedVector(), isDefinedWindow(), and Similarity().
float** statistics::Similarity::matrixIdentity = nullptr |
Identity weight matrix between alignment rows.
Definition at line 69 of file Similarity.h.
Referenced by calculateMatrixIdentity(), calculateVectors(), and ~Similarity().
float* statistics::Similarity::MDK = nullptr |
Raw similarity values.
Definition at line 64 of file Similarity.h.
Referenced by applyWindow(), calculateVectors(), getMdkWindowedVector(), printConservationAcl(), printConservationColumns(), Similarity(), and ~Similarity().
float* statistics::Similarity::MDK_Window = nullptr |
Windowed convervation values.
Definition at line 66 of file Similarity.h.
Referenced by applyWindow(), getMdkWindowedVector(), printConservationAcl(), printConservationColumns(), Similarity(), and ~Similarity().
int* statistics::Similarity::refCounter |
Counter of how many other instances share the same information.
Definition at line 75 of file Similarity.h.
Referenced by Similarity(), and ~Similarity().
similarityMatrix* statistics::Similarity::simMatrix = nullptr |
Similarity matrix used to similarity calculations.
Definition at line 72 of file Similarity.h.
Referenced by calculateVectors(), isSimMatrixDef(), setSimilarityMatrix(), and Similarity().