libpappsomspp
Library for mass spectrometry
|
#include <semiglobalalignment.h>
Public Member Functions | |
SemiGlobalAlignment (const ScoreValues &score_values, const pappso::PrecisionPtr precision_ptr, const AaCode &aaCode) | |
~SemiGlobalAlignment () | |
void | fastAlign (const SpOMSSpectrum &spectrum, const QString &protein_seq, const QString &protein_id) |
perform the first alignment search between a protein sequence and a spectrum. The member location heap is filled with the candidates locations. | |
void | preciseAlign (const SpOMSSpectrum &spectrum, const QString &protein_seq, const QString &protein_id, const std::size_t beginning, const std::size_t length) |
performs the second alignment search between a protein subsequence and a spectrum. | |
void | postProcessingAlign (const SpOMSSpectrum &spectrum, const QString &protein_seq, const QString &protein_id, std::size_t beginning, std::size_t length, const std::vector< double > &shifts) |
performs the post-processing : generates corrected spectra and align them | |
LocationSaver | getLocationSaver () const |
Returns a copy of m_location_saver. | |
Scenario | getScenario () const |
Returns a copy of m_scenario. | |
const Alignment & | getBestAlignment () const |
Returns a const ref to m_best_alignment. | |
Static Public Member Functions | |
static std::vector< double > | getPotentialMassErrors (const pappso::AaCode &aa_code, const Alignment &alignment, const QString &protein_seq) |
Returns a list of the potential mass errors corresponding to the provided alignment in the provided protein sequence. | |
Private Member Functions | |
void | saveBestAlignment (const QString &sequence, const SpOMSSpectrum &spectrum, std::size_t offset) |
Stores the best alignment from m_scenario in m_best_alignment. | |
void | correctAlign (int recursive_call_count, const QString &protein_seq, const QString &protein_id, const SpOMSSpectrum &spectrum, std::vector< std::size_t > peaks_to_remove, std::size_t offset) |
Recursively performs the correction of the alignment. | |
void | updateAlignmentMatrix (const QString &sequence, const std::size_t row_number, const std::vector< AaPosition > aa_positions, const SpOMSSpectrum &spectrum, const bool fast_align, const QString &protein) |
updates the scores of the alignment matrix for a given amino acid as well as the location heap/scenario. | |
bool | perfectShiftPossible (const QString &sequence, const SpOMSSpectrum &spectrum, const std::size_t origin_row, const std::size_t current_row, const std::size_t l_peak, const std::size_t r_peak) const |
indicates if a perfect shift is possible between the provided positions | |
std::size_t | perfectShiftPossibleFrom0 (const QString &sequence, const SpOMSSpectrum &spectrum, const std::size_t current_row, const std::size_t r_peak) const |
indicates if a perfect shift is possible from the spectrum beginning to the provided peak. | |
std::size_t | perfectShiftPossibleEnd (const QString &sequence, const SpOMSSpectrum &spectrum, std::size_t end_row, std::size_t end_peak) const |
indicates if a perfect shift is possible between the provided positions | |
Private Attributes | |
std::vector< KeyCell > | m_interest_cells |
std::vector< std::pair< std::size_t, KeyCell > > | m_updated_cells |
const ScoreValues & | m_scorevalues |
const int | min_score = 15 |
pappso::PrecisionPtr | m_precision_ptr |
const AaCode & | m_aaCode |
LocationSaver | m_location_saver |
Scenario | m_scenario |
Alignment | m_best_alignment |
Alignment | m_best_corrected_alignment |
Alignment | m_best_post_processed_alignment |
Definition at line 73 of file semiglobalalignment.h.
pappso::specpeptidoms::SemiGlobalAlignment::SemiGlobalAlignment | ( | const ScoreValues & | score_values, |
const pappso::PrecisionPtr | precision_ptr, | ||
const AaCode & | aaCode ) |
Default constructor
Definition at line 58 of file semiglobalalignment.cpp.
References m_aaCode, m_interest_cells, m_precision_ptr, and m_scorevalues.
pappso::specpeptidoms::SemiGlobalAlignment::~SemiGlobalAlignment | ( | ) |
|
private |
Recursively performs the correction of the alignment.
protein_seq | Protein sequence to align. |
protein_id | ID of the protein to align. |
spectrum | Spectrum to align. |
peaks_to_remove | Peaks to remove from the spectrum. |
offset | Size of the protein sequence minus beginning of the alignment. Used to compute the position of the alignment in the protein sequence. |
Definition at line 226 of file semiglobalalignment.cpp.
References pappso::specpeptidoms::CorrectionTree::addPeaks(), correctAlign(), pappso::specpeptidoms::SpOMSSpectrum::getAaPositions(), pappso::specpeptidoms::SpOMSSpectrum::getComplementaryPeak(), pappso::specpeptidoms::CorrectionTree::getPeaks(), pappso::specpeptidoms::SpOMSSpectrum::getPrecursorCharge(), pappso::specpeptidoms::init, m_best_alignment, m_best_corrected_alignment, m_interest_cells, m_scenario, m_scorevalues, pappso::specpeptidoms::MIN_ALIGNMENT_SCORE(), saveBestAlignment(), and updateAlignmentMatrix().
Referenced by correctAlign(), and preciseAlign().
void pappso::specpeptidoms::SemiGlobalAlignment::fastAlign | ( | const SpOMSSpectrum & | spectrum, |
const QString & | protein_seq, | ||
const QString & | protein_id ) |
perform the first alignment search between a protein sequence and a spectrum. The member location heap is filled with the candidates locations.
spectrum | Spectrum to align |
protein_seq | Protein sequence to align. |
protein_id | ID of the protein to align. |
Definition at line 69 of file semiglobalalignment.cpp.
References pappso::specpeptidoms::SpOMSSpectrum::getAaPositions(), pappso::specpeptidoms::init, m_best_alignment, m_best_corrected_alignment, m_best_post_processed_alignment, m_interest_cells, m_location_saver, m_scorevalues, and updateAlignmentMatrix().
const pappso::specpeptidoms::Alignment & pappso::specpeptidoms::SemiGlobalAlignment::getBestAlignment | ( | ) | const |
Returns a const ref to m_best_alignment.
Definition at line 836 of file semiglobalalignment.cpp.
References m_best_alignment.
pappso::specpeptidoms::LocationSaver pappso::specpeptidoms::SemiGlobalAlignment::getLocationSaver | ( | ) | const |
Returns a copy of m_location_saver.
Definition at line 650 of file semiglobalalignment.cpp.
References m_location_saver.
|
static |
Returns a list of the potential mass errors corresponding to the provided alignment in the provided protein sequence.
aa_code | the amino acid code of reference to get aminon acid masses |
alignment | Alignment for which to get the potential mass errors. |
protein_seq | Protein sequence corresponding to the provided alignment. |
Definition at line 842 of file semiglobalalignment.cpp.
References pappso::specpeptidoms::Alignment::begin_shift, pappso::specpeptidoms::Alignment::beginning, pappso::specpeptidoms::Alignment::end, pappso::specpeptidoms::Alignment::end_shift, pappso::AaCode::getMass(), pappso::specpeptidoms::shift, and pappso::specpeptidoms::Alignment::shifts.
pappso::specpeptidoms::Scenario pappso::specpeptidoms::SemiGlobalAlignment::getScenario | ( | ) | const |
Returns a copy of m_scenario.
Definition at line 656 of file semiglobalalignment.cpp.
References m_scenario.
|
private |
indicates if a perfect shift is possible between the provided positions
sequence | Reversed sequence of the protein being aligned |
spectrum | Spectrum being aligned |
origin_row | beginning row of the aa gap to verify (== index of the first missing aa in sequence) |
current_row | row being processed (== index of the current AaPosition in sequence) |
l_peak | left peak index of the mz gap to verify |
r_peak | right peak index of the mz gap to verify |
Definition at line 571 of file semiglobalalignment.cpp.
References pappso::MzRange::contains(), pappso::specpeptidoms::SpOMSSpectrum::getMZShift(), m_aaCode, and m_precision_ptr.
Referenced by updateAlignmentMatrix().
|
private |
indicates if a perfect shift is possible between the provided positions
sequence | Reversed sequence of the protein being aligned |
spectrum | Spectrum being aligned |
end_row | Index of the last aligned row. |
end_peak | Index of the last aligned peak. |
Definition at line 618 of file semiglobalalignment.cpp.
References pappso::MzRange::contains(), pappso::specpeptidoms::SpOMSSpectrum::getMissingMass(), m_aaCode, and m_precision_ptr.
Referenced by saveBestAlignment().
|
private |
indicates if a perfect shift is possible from the spectrum beginning to the provided peak.
sequence | Reversed sequence of the protein being aligned |
spectrum | Spectrum being aligned |
current_row | row being processed (== index of the current AaPosition in sequence) |
r_peak | right peak index of the mz gap to verify |
Definition at line 590 of file semiglobalalignment.cpp.
References pappso::MzRange::contains(), pappso::specpeptidoms::SpOMSSpectrum::getMZShift(), m_aaCode, and m_precision_ptr.
Referenced by updateAlignmentMatrix().
void pappso::specpeptidoms::SemiGlobalAlignment::postProcessingAlign | ( | const SpOMSSpectrum & | spectrum, |
const QString & | protein_seq, | ||
const QString & | protein_id, | ||
std::size_t | beginning, | ||
std::size_t | length, | ||
const std::vector< double > & | shifts ) |
performs the post-processing : generates corrected spectra and align them
spectrum | Spectrum to align |
protein_seq | Protein sequence to align. |
protein_id | ID of the protein to align. |
beginning | Index of the beginning of the subsequence to align. |
length | Length of the subsequence to align. |
shifts | List of potential precursor mass errors to test. |
Definition at line 311 of file semiglobalalignment.cpp.
References m_best_alignment, m_best_post_processed_alignment, and preciseAlign().
void pappso::specpeptidoms::SemiGlobalAlignment::preciseAlign | ( | const SpOMSSpectrum & | spectrum, |
const QString & | protein_seq, | ||
const QString & | protein_id, | ||
const std::size_t | beginning, | ||
const std::size_t | length ) |
performs the second alignment search between a protein subsequence and a spectrum.
spectrum | Spectrum to align |
protein_seq | Protein sequence to align. |
protein_id | ID of the protein to align. |
beginning | Index of the beginning of the subsequence to align. |
length | Length of the subsequence to align. |
Definition at line 121 of file semiglobalalignment.cpp.
References pappso::specpeptidoms::CorrectionTree::addPeaks(), correctAlign(), pappso::specpeptidoms::SpOMSSpectrum::getAaPositions(), pappso::specpeptidoms::SpOMSSpectrum::getComplementaryPeak(), pappso::specpeptidoms::CorrectionTree::getPeaks(), pappso::specpeptidoms::init, m_best_alignment, m_best_corrected_alignment, m_interest_cells, m_scenario, m_scorevalues, pappso::specpeptidoms::MIN_ALIGNMENT_SCORE(), saveBestAlignment(), and updateAlignmentMatrix().
Referenced by postProcessingAlign().
|
private |
Stores the best alignment from m_scenario in m_best_alignment.
sequence | Protein sequence of the current alignment. |
spectrum | Spectrum currently being aligned. |
offset | Size of the protein sequence minus beginning of the alignment. Used to compute the position of the alignment in the protein sequence. |
Definition at line 662 of file semiglobalalignment.cpp.
References pappso::specglob::both, pappso::MzRange::contains(), pappso::specpeptidoms::found, pappso::specpeptidoms::foundShift, pappso::specpeptidoms::SpOMSSpectrum::getMissingMass(), pappso::specpeptidoms::SpOMSSpectrum::getMZShift(), pappso::specpeptidoms::init, m_aaCode, m_best_alignment, m_precision_ptr, m_scenario, m_scorevalues, pappso::specglob::native, pappso::specpeptidoms::notFound, pappso::specpeptidoms::perfectShift, perfectShiftPossibleEnd(), pappso::specpeptidoms::shift, pappso::specglob::symmetric, and pappso::specglob::synthetic.
Referenced by correctAlign(), and preciseAlign().
|
private |
updates the scores of the alignment matrix for a given amino acid as well as the location heap/scenario.
sequence | Reversed sequence of the protein being aligned |
row_number | number of the row to update (== index in sequence of the amino acid being aligned) |
aa_positions | list of the AaPositions of the current amino acid |
spectrum | Spectrum being aligned |
fast_align | Whether to use the fast version of the algorithm (for 1st alignemnt step) |
protein | Id of the protein being aligned. |
Definition at line 338 of file semiglobalalignment.cpp.
References pappso::specpeptidoms::ALIGNMENT_SURPLUS(), pappso::specpeptidoms::KeyCell::beginning, pappso::specglob::both, pappso::specpeptidoms::found, pappso::specpeptidoms::foundDouble, pappso::specpeptidoms::foundShift, pappso::specpeptidoms::foundShiftDouble, pappso::specpeptidoms::SpOMSSpectrum::getMissingMass(), pappso::specpeptidoms::SpOMSSpectrum::getMZShift(), m_aaCode, m_interest_cells, m_location_saver, m_scenario, m_scorevalues, m_updated_cells, pappso::specpeptidoms::KeyCell::n_row, pappso::specpeptidoms::notFound, pappso::specpeptidoms::SpOMSSpectrum::peakType(), pappso::specpeptidoms::perfectShift, perfectShiftPossible(), perfectShiftPossibleFrom0(), pappso::specpeptidoms::KeyCell::score, pappso::specpeptidoms::shift, and pappso::specpeptidoms::KeyCell::tree_id.
Referenced by correctAlign(), fastAlign(), and preciseAlign().
|
private |
Definition at line 160 of file semiglobalalignment.h.
Referenced by SemiGlobalAlignment(), perfectShiftPossible(), perfectShiftPossibleEnd(), perfectShiftPossibleFrom0(), saveBestAlignment(), and updateAlignmentMatrix().
|
private |
Definition at line 163 of file semiglobalalignment.h.
Referenced by correctAlign(), fastAlign(), getBestAlignment(), postProcessingAlign(), preciseAlign(), and saveBestAlignment().
|
private |
Definition at line 163 of file semiglobalalignment.h.
Referenced by correctAlign(), fastAlign(), and preciseAlign().
|
private |
Definition at line 163 of file semiglobalalignment.h.
Referenced by fastAlign(), and postProcessingAlign().
|
private |
Definition at line 155 of file semiglobalalignment.h.
Referenced by SemiGlobalAlignment(), correctAlign(), fastAlign(), preciseAlign(), and updateAlignmentMatrix().
|
private |
Definition at line 161 of file semiglobalalignment.h.
Referenced by fastAlign(), getLocationSaver(), and updateAlignmentMatrix().
|
private |
Definition at line 159 of file semiglobalalignment.h.
Referenced by SemiGlobalAlignment(), perfectShiftPossible(), perfectShiftPossibleEnd(), perfectShiftPossibleFrom0(), and saveBestAlignment().
|
private |
Definition at line 162 of file semiglobalalignment.h.
Referenced by correctAlign(), getScenario(), preciseAlign(), saveBestAlignment(), and updateAlignmentMatrix().
|
private |
Definition at line 157 of file semiglobalalignment.h.
Referenced by SemiGlobalAlignment(), correctAlign(), fastAlign(), preciseAlign(), saveBestAlignment(), and updateAlignmentMatrix().
|
private |
Definition at line 156 of file semiglobalalignment.h.
Referenced by updateAlignmentMatrix().
|
private |
Definition at line 158 of file semiglobalalignment.h.