libpappsomspp
Library for mass spectrometry
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 ()
 

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 56 of file scenario.cpp.

57{
58}

◆ ~Scenario()

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

Destructor

Definition at line 60 of file scenario.cpp.

61{
62}

Member Function Documentation

◆ 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 72 of file scenario.cpp.

73{
74 std::pair<std::vector<ScenarioCell>, int> best_alignment;
75 ScenarioCell current_cell = m_best_alignment.first;
76 current_cell.alignment_type = AlignType::init;
77 while(current_cell.previous_column > 0 && current_cell.previous_row > 0)
78 {
79 best_alignment.first.push_back(current_cell);
80 current_cell = m_origin_matrix.at(current_cell.previous_row).at(current_cell.previous_column);
81 }
82 best_alignment.first.push_back(current_cell);
83 best_alignment.second = m_best_alignment.second;
84 return best_alignment;
85}
std::pair< ScenarioCell, int > m_best_alignment
Definition scenario.h:96
std::vector< std::vector< ScenarioCell > > m_origin_matrix
Definition scenario.h:95

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 88 of file scenario.cpp.

89{
90 return m_best_alignment.second;
91}

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 65 of file scenario.cpp.

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

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

◆ resetScenario()

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

Definition at line 94 of file scenario.cpp.

95{
96 m_best_alignment = {{0, 0, AlignType::init}, -15};
97}

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 41 of file scenario.cpp.

47{
48 if(score > m_best_alignment.second)
49 {
50 m_best_alignment = {{current_row, current_column, alignment_type}, score};
51 }
52 m_origin_matrix.at(current_row).at(current_column) = {
53 previous_row, previous_column, alignment_type};
54}

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 96 of file scenario.h.

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

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

◆ m_origin_matrix

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

Definition at line 95 of file scenario.h.

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


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