|
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 SpOMSProtein *protein_ptr) |
| 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 SpOMSProtein *protein_ptr, 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 SpOMSProtein *protein_ptr, 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. | |
| const std::vector< KeyCell > & | getInterestCells () const |
| convenient function for degub purpose | |
| const std::vector< KeyCell > & | oneAlignStep (const pappso::specpeptidoms::SpOMSProtein &sequence, const std::size_t row_number, const std::vector< AaPosition > &aa_positions, const SpOMSSpectrum &spectrum, const bool fast_align, const pappso::specpeptidoms::SpOMSProtein *protein_ptr) |
| function made for testing the fastAlign process, process one line and return the alignment matrix | |
| void | initFastAlign (const SpOMSSpectrum &spectrum) |
| function made for testing the fastAlign process, initiate the variables for alignment | |
| void | initpreciseAlign (const SpOMSSpectrum &spectrum, std::size_t length2) |
| function made for testing the preciseAlign process, initiate the variables for 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. | |
| static bool | checkSequenceDiversity (const QString &sequence, std::size_t window, std::size_t minimum_aa_diversity) |
| check that the sequence has a minimum of amino acid checkSequenceDiversity | |
Private Member Functions | |
| void | saveBestAlignment (const SpOMSProtein &sequence, const SpOMSSpectrum &spectrum, std::size_t offset) |
| Stores the best alignment from m_scenario in m_best_alignment. | |
| void | correctAlign (const SpOMSProtein &protein_subseq, const SpOMSProtein *protein_ptr, 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 pappso::specpeptidoms::SpOMSProtein &sequence, const std::size_t row_number, const std::vector< AaPosition > &aa_positions, const SpOMSSpectrum &spectrum, const bool fast_align, const pappso::specpeptidoms::SpOMSProtein *protein_ptr) |
| updates the scores of the alignment matrix for a given amino acid as well as the location heap/scenario. | |
| bool | perfectShiftPossible (const pappso::specpeptidoms::SpOMSProtein &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 pappso::specpeptidoms::SpOMSProtein &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. Returns the perfect shift origin if the shift is possible, otherwise returns the current row. | |
| std::size_t | perfectShiftPossibleEnd (const pappso::specpeptidoms::SpOMSProtein &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 91 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 79 of file semiglobalalignment.cpp.
References pappso::specpeptidoms::KeyCell::beginning, m_aaCode, m_interest_cells, m_precision_ptr, m_scorevalues, pappso::specpeptidoms::KeyCell::n_row, pappso::specpeptidoms::KeyCell::score, and pappso::specpeptidoms::KeyCell::tree_id.
| pappso::specpeptidoms::SemiGlobalAlignment::~SemiGlobalAlignment | ( | ) |
|
static |
check that the sequence has a minimum of amino acid checkSequenceDiversity
| sequence | protein sequence |
| window | the size of substring to check |
| minimum_aa_diversity | minimum number of different amino acid in this window |
Definition at line 1061 of file semiglobalalignment.cpp.
Referenced by preciseAlign(), pappso::cbor::psm::PsmSpecPeptidOmsScan::sequenceAlignment(), and pappso::cbor::psm::PsmSpecPeptidOmsScan::storeAlignment().
|
private |
Recursively performs the correction of the alignment.
| protein_seq | Protein reversed sequence to align. |
| protein_ptr | Protein pointer on the sequence 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 279 of file semiglobalalignment.cpp.
References pappso::specpeptidoms::CorrectionTree::addPeaks(), pappso::specpeptidoms::KeyCell::beginning, correctAlign(), pappso::specpeptidoms::SpOMSSpectrum::getAaPositions(), pappso::specpeptidoms::SpOMSSpectrum::getComplementaryPeak(), pappso::specpeptidoms::CorrectionTree::getPeaks(), pappso::specpeptidoms::SpOMSSpectrum::getPrecursorCharge(), pappso::specpeptidoms::SpOMSProtein::getSequence(), pappso::specpeptidoms::init, m_best_alignment, m_best_corrected_alignment, m_interest_cells, m_scenario, m_scorevalues, pappso::specpeptidoms::MIN_ALIGNMENT_SCORE(), pappso::specpeptidoms::KeyCell::n_row, saveBestAlignment(), pappso::specpeptidoms::KeyCell::score, pappso::specpeptidoms::KeyCell::tree_id, and updateAlignmentMatrix().
Referenced by correctAlign(), and preciseAlign().
| void pappso::specpeptidoms::SemiGlobalAlignment::fastAlign | ( | const SpOMSSpectrum & | spectrum, |
| const SpOMSProtein * | protein_ptr ) |
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_ptr | Protein pointer on the sequence to align. |
Definition at line 102 of file semiglobalalignment.cpp.
References pappso::specpeptidoms::SpOMSSpectrum::getAaPositions(), initFastAlign(), and updateAlignmentMatrix().
Referenced by pappso::cbor::psm::PsmSpecPeptidOmsScan::sequenceAlignment().
| const pappso::specpeptidoms::Alignment & pappso::specpeptidoms::SemiGlobalAlignment::getBestAlignment | ( | ) | const |
Returns a const ref to m_best_alignment.
Definition at line 1010 of file semiglobalalignment.cpp.
References m_best_alignment.
Referenced by pappso::cbor::psm::PsmSpecPeptidOmsScan::sequenceAlignment().
| const std::vector< pappso::specpeptidoms::KeyCell > & pappso::specpeptidoms::SemiGlobalAlignment::getInterestCells | ( | ) | const |
convenient function for degub purpose
Definition at line 96 of file semiglobalalignment.cpp.
References m_interest_cells.
Referenced by oneAlignStep().
| pappso::specpeptidoms::LocationSaver pappso::specpeptidoms::SemiGlobalAlignment::getLocationSaver | ( | ) | const |
Returns a copy of m_location_saver.
Definition at line 808 of file semiglobalalignment.cpp.
References m_location_saver.
Referenced by pappso::cbor::psm::PsmSpecPeptidOmsScan::sequenceAlignment().
|
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 1016 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.
Referenced by pappso::cbor::psm::PsmSpecPeptidOmsScan::sequenceAlignment().
| pappso::specpeptidoms::Scenario pappso::specpeptidoms::SemiGlobalAlignment::getScenario | ( | ) | const |
Returns a copy of m_scenario.
Definition at line 814 of file semiglobalalignment.cpp.
References m_scenario.
| void pappso::specpeptidoms::SemiGlobalAlignment::initFastAlign | ( | const SpOMSSpectrum & | spectrum | ) |
function made for testing the fastAlign process, initiate the variables for alignment
Definition at line 121 of file semiglobalalignment.cpp.
References pappso::specpeptidoms::KeyCell::beginning, pappso::specpeptidoms::init, m_interest_cells, m_scorevalues, m_updated_cells, pappso::specpeptidoms::KeyCell::n_row, pappso::specpeptidoms::KeyCell::score, and pappso::specpeptidoms::KeyCell::tree_id.
Referenced by fastAlign().
| void pappso::specpeptidoms::SemiGlobalAlignment::initpreciseAlign | ( | const SpOMSSpectrum & | spectrum, |
| std::size_t | length2 ) |
function made for testing the preciseAlign process, initiate the variables for alignment
Definition at line 145 of file semiglobalalignment.cpp.
References pappso::specpeptidoms::init, m_interest_cells, m_scenario, and m_scorevalues.
Referenced by preciseAlign().
| const std::vector< pappso::specpeptidoms::KeyCell > & pappso::specpeptidoms::SemiGlobalAlignment::oneAlignStep | ( | const pappso::specpeptidoms::SpOMSProtein & | sequence, |
| const std::size_t | row_number, | ||
| const std::vector< AaPosition > & | aa_positions, | ||
| const SpOMSSpectrum & | spectrum, | ||
| const bool | fast_align, | ||
| const pappso::specpeptidoms::SpOMSProtein * | protein_ptr ) |
function made for testing the fastAlign process, process one line and return the alignment matrix
Definition at line 1090 of file semiglobalalignment.cpp.
References getInterestCells(), and 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 |
| 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 701 of file semiglobalalignment.cpp.
References pappso::MzRange::contains(), pappso::specpeptidoms::SpOMSSpectrum::getMZShift(), m_precision_ptr, and pappso::PappsoException::qwhat().
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 768 of file semiglobalalignment.cpp.
References pappso::MzRange::contains(), pappso::specpeptidoms::SpOMSSpectrum::getMissingMass(), m_precision_ptr, and pappso::PappsoException::qwhat().
Referenced by saveBestAlignment().
|
private |
indicates if a perfect shift is possible from the spectrum beginning to the provided peak. Returns the perfect shift origin if the shift is possible, otherwise returns the current row.
| 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 741 of file semiglobalalignment.cpp.
References pappso::MzRange::contains(), pappso::specpeptidoms::SpOMSSpectrum::getMZShift(), and m_precision_ptr.
Referenced by updateAlignmentMatrix().
| void pappso::specpeptidoms::SemiGlobalAlignment::postProcessingAlign | ( | const SpOMSSpectrum & | spectrum, |
| const SpOMSProtein * | protein_ptr, | ||
| 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_ptr | Protein pointer on the sequence 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 363 of file semiglobalalignment.cpp.
References m_best_alignment, m_best_post_processed_alignment, and preciseAlign().
Referenced by pappso::cbor::psm::PsmSpecPeptidOmsScan::sequenceAlignment().
| void pappso::specpeptidoms::SemiGlobalAlignment::preciseAlign | ( | const SpOMSSpectrum & | spectrum, |
| const SpOMSProtein * | protein_ptr, | ||
| 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_ptr | Protein pointer on the sequence to align. |
| beginning | Index of the beginning of the subsequence to align. |
| length | Length of the subsequence to align. |
Definition at line 169 of file semiglobalalignment.cpp.
References pappso::specpeptidoms::CorrectionTree::addPeaks(), checkSequenceDiversity(), correctAlign(), pappso::specpeptidoms::SpOMSSpectrum::getAaPositions(), pappso::specpeptidoms::SpOMSSpectrum::getComplementaryPeak(), pappso::specpeptidoms::CorrectionTree::getPeaks(), pappso::specpeptidoms::SpOMSProtein::getSequence(), initpreciseAlign(), m_aaCode, m_best_alignment, m_best_corrected_alignment, m_scenario, pappso::specpeptidoms::MIN_ALIGNMENT_SCORE(), pappso::PappsoException::qwhat(), saveBestAlignment(), and updateAlignmentMatrix().
Referenced by postProcessingAlign(), and pappso::cbor::psm::PsmSpecPeptidOmsScan::sequenceAlignment().
|
private |
Stores the best alignment from m_scenario in m_best_alignment.
| sequence | reversed 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 820 of file semiglobalalignment.cpp.
References pappso::specglob::both, pappso::MzRange::contains(), pappso::specpeptidoms::found, pappso::specpeptidoms::foundShift, pappso::Aa::getMass(), pappso::specpeptidoms::SpOMSSpectrum::getMissingMass(), pappso::specpeptidoms::SpOMSSpectrum::getMZShift(), pappso::specpeptidoms::SpOMSSpectrum::getPrecursorMass(), pappso::specpeptidoms::init, pappso::specpeptidoms::AminoAcidModel::m_aminoAcid, m_best_alignment, pappso::specpeptidoms::AminoAcidModel::m_massDifference, m_precision_ptr, m_scenario, m_scorevalues, pappso::specpeptidoms::AminoAcidModel::m_skipped, pappso::specglob::native, pappso::specpeptidoms::notFound, pappso::specpeptidoms::perfectShift, perfectShiftPossibleEnd(), pappso::specpeptidoms::shift, pappso::specpeptidoms::SpOMSProtein::sliced(), 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 /!\ In case of a subsequence alignment, the provided protein must only contain the sequence to align. |
| 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_ptr | Protein pointer on the sequence to align. /!\ In case of a subsequence alignment, the provided protein must be the protein of origin (i.e. complete sequence). |
Definition at line 389 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(), m_aaCode, m_interest_cells, m_location_saver, m_scenario, m_scorevalues, m_updated_cells, pappso::MASSOXYGEN(), pappso::MHPLUS(), pappso::MPROTIUM(), pappso::specpeptidoms::KeyCell::n_row, pappso::specpeptidoms::notFound, pappso::specpeptidoms::SpOMSSpectrum::peakType(), pappso::specpeptidoms::perfectShift, perfectShiftPossible(), perfectShiftPossibleFrom0(), pappso::PappsoException::qwhat(), pappso::specpeptidoms::KeyCell::score, pappso::specpeptidoms::shift, pappso::specpeptidoms::TOL_PEAKS_MISSING(), pappso::specpeptidoms::TOL_PEAKS_MISSING_FIRST_COLUMN(), and pappso::specpeptidoms::KeyCell::tree_id.
Referenced by correctAlign(), fastAlign(), oneAlignStep(), and preciseAlign().
|
private |
Definition at line 300 of file semiglobalalignment.h.
Referenced by SemiGlobalAlignment(), preciseAlign(), and updateAlignmentMatrix().
|
private |
Definition at line 303 of file semiglobalalignment.h.
Referenced by correctAlign(), getBestAlignment(), postProcessingAlign(), preciseAlign(), and saveBestAlignment().
|
private |
Definition at line 304 of file semiglobalalignment.h.
Referenced by correctAlign(), and preciseAlign().
|
private |
Definition at line 305 of file semiglobalalignment.h.
Referenced by postProcessingAlign().
|
private |
Definition at line 295 of file semiglobalalignment.h.
Referenced by SemiGlobalAlignment(), correctAlign(), getInterestCells(), initFastAlign(), initpreciseAlign(), and updateAlignmentMatrix().
|
private |
Definition at line 301 of file semiglobalalignment.h.
Referenced by getLocationSaver(), and updateAlignmentMatrix().
|
private |
Definition at line 299 of file semiglobalalignment.h.
Referenced by SemiGlobalAlignment(), perfectShiftPossible(), perfectShiftPossibleEnd(), perfectShiftPossibleFrom0(), and saveBestAlignment().
|
private |
Definition at line 302 of file semiglobalalignment.h.
Referenced by correctAlign(), getScenario(), initpreciseAlign(), preciseAlign(), saveBestAlignment(), and updateAlignmentMatrix().
|
private |
Definition at line 297 of file semiglobalalignment.h.
Referenced by SemiGlobalAlignment(), correctAlign(), initFastAlign(), initpreciseAlign(), saveBestAlignment(), and updateAlignmentMatrix().
|
private |
Definition at line 296 of file semiglobalalignment.h.
Referenced by initFastAlign(), and updateAlignmentMatrix().
|
private |
Definition at line 298 of file semiglobalalignment.h.