Loading...
Searching...
No Matches
pappso::specpeptidoms::Scenario Class Reference

`#include <scenario.h>`

## Public Member Functions

| Scenario ()
| ~Scenario ()
void | saveOrigin (std::size_t current_row, std::size_t current_column, std::size_t previous_row, std::size_t previous_column, int score, AlignType alignment_type)
| Stores the origin (cell location and alignment type) of the provided cell in the backtracking matrix.
void | reserve (std::size_t n_rows, std::size_t n_columns)
| Allocate new storage to the backtracking matrix if needed.
std::pair< std::vector< ScenarioCell >, int > | getBestAlignment () const
| Returns the scenario cells corresponding to the best alignment and the best alignment's score.
int | getBestScore () const
void | resetScenario ()
void | clear ()

## Private Attributes

std::vector< std::vector< ScenarioCell > > | m_origin_matrix
std::pair< ScenarioCell, int > | m_best_alignment = {{0, 0, AlignType::init}, -15}

## Detailed Description

Definition at line 55 of file scenario.h.

## Constructor & Destructor Documentation

## Scenario()

pappso::specpeptidoms::Scenario::Scenario | ( |  | ) |

Constructor

Definition at line 75 of file scenario.cpp.

{
}

## ~Scenario()

pappso::specpeptidoms::Scenario::~Scenario | ( |  | ) |

Destructor

Definition at line 79 of file scenario.cpp.

{
}

## Member Function Documentation

## clear()

void pappso::specpeptidoms::Scenario::clear | ( |  | ) |

Definition at line 120 of file scenario.cpp.

{
m_origin_matrix.clear();
m_best_alignment = {{0, 0, AlignType::init}, -15};
}
pappso::specpeptidoms::Scenario::m_best_alignment
std::pair< ScenarioCell, int > m_best_alignment
Definition scenario.h:98
pappso::specpeptidoms::Scenario::m_origin_matrix
std::vector< std::vector< ScenarioCell > > m_origin_matrix
Definition scenario.h:97
pappso::specpeptidoms::AlignType::init
@ init
Definition types.h:56

References pappso::specpeptidoms::init, m_best_alignment, and m_origin_matrix.

## getBestAlignment()

std::pair< std::vector< pappso::specpeptidoms::ScenarioCell >, int > pappso::specpeptidoms::Scenario::getBestAlignment | ( |  | ) | const

Returns the scenario cells corresponding to the best alignment and the best alignment's score.

Definition at line 91 of file scenario.cpp.

{
std::pair<std::vector<ScenarioCell>, int> best_alignment;
ScenarioCell current_cell = m_best_alignment.first;
current_cell.alignment_type = AlignType::init;
while(current_cell.previous_column > 0 && current_cell.previous_row > 0)
{
best_alignment.first.push_back(current_cell);
current_cell = m_origin_matrix.at(current_cell.previous_row).at(current_cell.previous_column);
}
best_alignment.first.push_back(current_cell);
best_alignment.second = m_best_alignment.second;
return best_alignment;
}

References pappso::specpeptidoms::ScenarioCell::alignment_type, pappso::specpeptidoms::init, m_best_alignment, m_origin_matrix, pappso::specpeptidoms::ScenarioCell::previous_column, and pappso::specpeptidoms::ScenarioCell::previous_row.

## getBestScore()

int pappso::specpeptidoms::Scenario::getBestScore | ( |  | ) | const

Definition at line 107 of file scenario.cpp.

{
return m_best_alignment.second;
}

References m_best_alignment.

## reserve()

void pappso::specpeptidoms::Scenario::reserve | ( | std::size_t | n_rows,
|  | std::size_t | n_columns )

Allocate new storage to the backtracking matrix if needed.

Definition at line 84 of file scenario.cpp.

{
m_origin_matrix = std::vector<std::vector<ScenarioCell>>(
n_rows, std::vector<ScenarioCell>(n_columns, {0, 0, AlignType::init}));
}

References pappso::specpeptidoms::init, and m_origin_matrix.

## resetScenario()

void pappso::specpeptidoms::Scenario::resetScenario | ( |  | ) |

Definition at line 113 of file scenario.cpp.

{
// m_origin_matrix.clear();
m_best_alignment = {{0, 0, AlignType::init}, -15};
}

References pappso::specpeptidoms::init, and m_best_alignment.

## saveOrigin()

void pappso::specpeptidoms::Scenario::saveOrigin | ( | std::size_t | current_row,
|  | std::size_t | current_column,
|  | std::size_t | previous_row,
|  | std::size_t | previous_column,
|  | int | score,
|  | AlignType | alignment_type )

Stores the origin (cell location and alignment type) of the provided cell in the backtracking matrix.

Definition at line 42 of file scenario.cpp.

{
if(score > m_best_alignment.second)
{
m_best_alignment = {{current_row, current_column, alignment_type}, score};
}
try
{
m_origin_matrix.at(current_row).at(current_column) = {
previous_row, previous_column, alignment_type};
}
catch(const std::exception &error)
{
int max_column_size = 0;
if(current_row < m_origin_matrix.size())
{
max_column_size = m_origin_matrix.at(current_row).size();
}
throw pappso::ExceptionOutOfRange(
QObject::tr(
"Scenario::saveOrigin failed for current_row %1 (size %2) current_column %3 (size %4)")
.arg(current_row)
.arg(m_origin_matrix.size())
.arg(current_column)
.arg(max_column_size));
}
}

References m_best_alignment, and m_origin_matrix.

## Member Data Documentation

## m_best_alignment

std::pair<ScenarioCell, int> pappso::specpeptidoms::Scenario::m_best_alignment = {{0, 0, AlignType::init}, -15}

private

Definition at line 98 of file scenario.h.

{{0, 0, AlignType::init}, -15};

Referenced by clear(), getBestAlignment(), getBestScore(), resetScenario(), and saveOrigin().

## m_origin_matrix

std::vector<std::vector<ScenarioCell> > pappso::specpeptidoms::Scenario::m_origin_matrix

private

Definition at line 97 of file scenario.h.

Referenced by clear(), getBestAlignment(), reserve(), and saveOrigin().

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

- pappsomspp/core/processing/specpeptidoms/scenario.h
- pappsomspp/core/processing/specpeptidoms/scenario.cpp