statistics::Similarity Class Reference

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

Alignmentalig
 
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...
 
similarityMatrixsimMatrix = nullptr
 Similarity matrix used to similarity calculations. More...
 
int * refCounter
 Counter of how many other instances share the same information. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ Similarity() [1/2]

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

+ Here is the caller graph for this function:

◆ Similarity() [2/2]

statistics::Similarity::Similarity ( Alignment parentAlignment)
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().

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

◆ ~Similarity()

statistics::Similarity::~Similarity ( )

Destructor.

Definition at line 75 of file Similarity.cpp.

References alig, matrixIdentity, MDK, MDK_Window, Alignment::numberOfSequences, and refCounter.

Member Function Documentation

◆ applyWindow()

bool statistics::Similarity::applyWindow ( int  halfW)

Allows us compute the conservationWindow's values.

Parameters
halfWHalf window size to apply.
Returns
False if there is a previously computed vector for this window size or half window size is greater than 1/4 of the alignment length.

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

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

◆ calcCutPoint()

double statistics::Similarity::calcCutPoint ( float  baseLine,
float  conservationPct 
)

Computes and selects the cut point values based on similarity's values.

Parameters
baseLinePercentage of columns desired.
conservationPctPercentage 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().

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

◆ calculateMatrixIdentity()

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

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

◆ calculateVectors()

bool statistics::Similarity::calculateVectors ( bool  cutByGap = true)

Method to calculate the similarity values of a alignment matrix.

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

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

◆ getMdkWindowedVector()

float * statistics::Similarity::getMdkWindowedVector ( )

This methods returns a pointer to conservationWindow's vector.

Returns
Similarity window 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().

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

◆ isDefinedWindow()

bool statistics::Similarity::isDefinedWindow ( )

Returns if a windows size value has been defined or not.

Returns
True if a windows size has been defined.False otherwise.

Definition at line 330 of file Similarity.cpp.

References halfWindow.

Referenced by statistics::Manager::calculateConservationStats(), and getMdkWindowedVector().

+ Here is the caller graph for this function:

◆ isSimMatrixDef()

bool statistics::Similarity::isSimMatrixDef ( )

Returns if a similarity matrix is being used or not.

Returns
True if there is a similarity matrix set, False otherwise.

Definition at line 373 of file Similarity.cpp.

References simMatrix.

Referenced by statistics::Manager::calculateConservationStats().

+ Here is the caller graph for this function:

◆ printConservationAcl()

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

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

◆ printConservationColumns()

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

+ Here is the caller graph for this function:

◆ setSimilarityMatrix()

bool statistics::Similarity::setSimilarityMatrix ( similarityMatrix sm)

Stores a valid similarity matrix point to use.

Parameters
smSimilarity matrix pointer to associate.
Returns
True if sm is valid, False if it's null

Definition at line 355 of file Similarity.cpp.

References simMatrix.

Referenced by statistics::Manager::calculateConservationStats(), and statistics::Manager::setSimilarityMatrix().

+ Here is the caller graph for this function:

Member Data Documentation

◆ alig

◆ halfWindow

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

◆ matrixIdentity

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

◆ MDK

float* statistics::Similarity::MDK = nullptr

◆ MDK_Window

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

◆ refCounter

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

◆ simMatrix

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


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