Loading...
Searching...
No Matches
pappso::AaStringCodeMassMatching Class Reference

convert a list of mass to amino acid string codes More...

`#include <aastringcodemassmatching.h>`

## Classes

struct | aaCodeAndMassRange

## Public Member Functions

| AaStringCodeMassMatching (const AaCode &aa_code, std::size_t model_max_size, PrecisionPtr precision)
| AaStringCodeMassMatching (const AaStringCodeMassMatching &other)
| ~AaStringCodeMassMatching ()
PrecisionPtr | getPrecisionPtr () const
std::vector< uint32_t > | getAaCodeFromMassList (std::vector< double > &mass_list) const
std::vector< uint32_t > | getAaCodeFromMass (double mass) const
| get amino acid string code from a single mass delta
std::vector< uint32_t > | getAaCodeFromMassWearingModification (double mass, const Aa &aa, int quantifier) const
| get amino acid string code from a single mass delta wearing a specific modification
std::vector< uint32_t > | filterCodeList (std::vector< uint32_t > &code_list) const
| filter a list of amino acid string code find elementary amino acids (one base only) in the list and retrieve 2 or more amino acid string containing only basic aminio acid found

## Private Attributes

PrecisionPtr | m_precision = nullptr
const AaCode & | m_aaCode
AaStringCodec | m_aaCodec
uint32_t | m_base = 0
std::vector< aaCodeAndMassRange > | m_codeMassList

## Detailed Description

convert a list of mass to amino acid string codes

Definition at line 40 of file aastringcodemassmatching.h.

## Constructor & Destructor Documentation

## AaStringCodeMassMatching() [1/2]

AaStringCodeMassMatching::AaStringCodeMassMatching | ( | const AaCode & | aa_code,
|  | std::size_t | model_max_size,
|  | PrecisionPtr | precision )

Default constructor

Definition at line 36 of file aastringcodemassmatching.cpp.

: m_precision(precision), m_aaCode(aa_code), m_aaCodec(aa_code)
{
m_base = m_aaCode.getSize() + 1;
std::vector<pappso::CodeToMass> code_to_mass =
m_aaCodec.generateLlcCodeListUpToMaxPeptideSize(model_max_size);
for(auto &code_mass : code_to_mass)
{
aaCodeAndMassRange aaCodeMassRange;
aaCodeMassRange.code = code_mass.code;
double delta = precision->delta(code_mass.mass);
aaCodeMassRange.mz_range_low = code_mass.mass - delta;
aaCodeMassRange.mz = code_mass.mass;
aaCodeMassRange.mz_range_up = code_mass.mass + delta;
m_codeMassList.push_back(aaCodeMassRange);
}
std::sort(m_codeMassList.begin(),
m_codeMassList.end(),
[](const aaCodeAndMassRange &a, const aaCodeAndMassRange &b) {
return a.mz_range_low < b.mz_range_low;
});
}
pappso::AaStringCodeMassMatching::m_codeMassList
std::vector< aaCodeAndMassRange > m_codeMassList
Definition aastringcodemassmatching.h:113
pappso::AaStringCodeMassMatching::m_base
uint32_t m_base
Definition aastringcodemassmatching.h:103
pappso::AaStringCodeMassMatching::m_aaCodec
AaStringCodec m_aaCodec
Definition aastringcodemassmatching.h:100
pappso::AaStringCodeMassMatching::m_aaCode
const AaCode & m_aaCode
Definition aastringcodemassmatching.h:98
pappso::AaStringCodeMassMatching::m_precision
PrecisionPtr m_precision
Definition aastringcodemassmatching.h:97
pappso::PrecisionBase::delta
virtual pappso_double delta(pappso_double value) const =0
pappso::PeptideIonNter::a
@ a
Definition peptide.h:77
pappso::PeptideIonNter::b
@ b
Definition peptide.h:74
pappso::AaStringCodeMassMatching::aaCodeAndMassRange
Definition aastringcodemassmatching.h:106
pappso::AaStringCodeMassMatching::aaCodeAndMassRange::code
std::uint32_t code
Definition aastringcodemassmatching.h:107

References pappso::a, pappso::b, pappso::AaStringCodeMassMatching::aaCodeAndMassRange::code, pappso::PrecisionBase::delta(), m_aaCode, m_aaCodec, m_base, m_codeMassList, m_precision, pappso::AaStringCodeMassMatching::aaCodeAndMassRange::mz, pappso::AaStringCodeMassMatching::aaCodeAndMassRange::mz_range_low, and pappso::AaStringCodeMassMatching::aaCodeAndMassRange::mz_range_up.

Referenced by AaStringCodeMassMatching().

## AaStringCodeMassMatching() [2/2]

AaStringCodeMassMatching::AaStringCodeMassMatching | ( | const AaStringCodeMassMatching & | other | ) |

Copy constructor

Parameters

  other | TODO

Definition at line 66 of file aastringcodemassmatching.cpp.

: m_precision(other.m_precision), m_aaCode(other.m_aaCode), m_aaCodec(other.m_aaCode)
{
m_base = m_aaCode.getSize() + 1;
}

References AaStringCodeMassMatching(), m_aaCode, m_aaCodec, m_base, and m_precision.

## ~AaStringCodeMassMatching()

AaStringCodeMassMatching::~AaStringCodeMassMatching | ( |  | ) |

Destructor

Definition at line 72 of file aastringcodemassmatching.cpp.

{
}

## Member Function Documentation

## filterCodeList()

std::vector< uint32_t > pappso::AaStringCodeMassMatching::filterCodeList | ( | std::vector< uint32_t > & | code_list | ) | const

filter a list of amino acid string code find elementary amino acids (one base only) in the list and retrieve 2 or more amino acid string containing only basic aminio acid found

Definition at line 212 of file aastringcodemassmatching.cpp.

{
std::sort(code_list.begin(), code_list.end(), [](uint32_t a, uint32_t b) { return a < b; });
std::vector<uint32_t> filtered_aa_code_list;
std::vector<uint8_t> aa_ok;
auto it = code_list.begin();
while(*it < m_base)
{
aa_ok.push_back((uint8_t)*it);
// qDebug() << (uint8_t)*it << " "
// << m_aaCode.getAa((uint8_t)*it).getLetter();
it++;
}
for(uint32_t code : code_list)
{
if(m_aaCodec.codeOnlyContains(code, aa_ok))
{
filtered_aa_code_list.push_back(code);
}
}
return filtered_aa_code_list;
}

References pappso::a, pappso::b, m_aaCodec, and m_base.

## getAaCodeFromMass()

std::vector< uint32_t > pappso::AaStringCodeMassMatching::getAaCodeFromMass | ( | double | mass | ) | const

get amino acid string code from a single mass delta

Parameters

  mass | the mass to look for

Definition at line 85 of file aastringcodemassmatching.cpp.

{
std::vector<uint32_t> aa_code_list;
// auto it_aacode = m_codeMassList.begin();
auto it_aacode = std::upper_bound(
m_codeMassList.begin(),
m_codeMassList.end(),
mass,
[](double mass, const pappso::AaStringCodeMassMatching::aaCodeAndMassRange &mass_range) {
return mass_range.mz_range_up > mass;
});
bool previous_out_of_range = false;
while(it_aacode != m_codeMassList.end())
{
if(mass < it_aacode->mz_range_low)
{
if(previous_out_of_range)
break;
previous_out_of_range = true;
it_aacode++;
}
else
{
if(mass <= it_aacode->mz_range_up)
{
previous_out_of_range = false;
aa_code_list.push_back(it_aacode->code);
it_aacode++;
}
else
{
it_aacode++;
}
}
}
return aa_code_list;
}

References m_codeMassList.

Referenced by pappso::specself::SelfSpectrumDataPoint::fillAntiSpectrumDataPoint(), and pappso::specself::SelfSpectrumDataPoint::fillSelfSpectrumDataPoint().

## getAaCodeFromMassList()

std::vector< uint32_t > pappso::AaStringCodeMassMatching::getAaCodeFromMassList | ( | std::vector< double > & | mass_list | ) | const

Definition at line 181 of file aastringcodemassmatching.cpp.

{
std::sort(mass_list.begin(), mass_list.end(), [](double a, double b) { return a < b; });
std::vector<uint32_t> aa_code_list;
auto it_aacode = m_codeMassList.begin();
auto it_mass = mass_list.begin();
while((it_aacode != m_codeMassList.end()) && (it_mass != mass_list.end()))
{
if(*it_mass < it_aacode->mz_range_low)
{
it_mass++;
}
else
{
if(*it_mass <= it_aacode->mz_range_up)
{
aa_code_list.push_back(it_aacode->code);
it_aacode++;
}
else
{
it_aacode++;
}
}
}
return aa_code_list;
}

References pappso::a, pappso::b, and m_codeMassList.

## getAaCodeFromMassWearingModification()

std::vector< uint32_t > pappso::AaStringCodeMassMatching::getAaCodeFromMassWearingModification | ( | double | mass,
|  | const Aa & | aa,
|  | int | quantifier ) const

get amino acid string code from a single mass delta wearing a specific modification

Parameters

  mass | the mass to look for
  aa | amino acid with modification
  quantifier | the minimum number of this aa modified required in the given aa sequence

Definition at line 129 of file aastringcodemassmatching.cpp.

{
try
{
std::vector<uint32_t> aa_code_list;
double total_modification_mass = aa.getTotalModificationMass();
total_modification_mass *= quantifier;
mass = mass - total_modification_mass;
if(mass < 0)
return aa_code_list;
uint8_t aamodCode = m_aaCode.getAaCode(aa.getLetter());
auto it_aacode = m_codeMassList.begin();
while(it_aacode != m_codeMassList.end())
{
if(mass < it_aacode->mz_range_low)
{
it_aacode++;
}
else
{
if(mass <= it_aacode->mz_range_up)
{
if(m_aaCodec.uniqueCodeContainsAminoAcid(it_aacode->code, aamodCode, quantifier))
{
aa_code_list.push_back(it_aacode->code);
}
it_aacode++;
}
else
{
it_aacode++;
}
}
}
return aa_code_list;
}
catch(const pappso::PappsoException &err)
{
throw pappso::PappsoException(
QObject::tr("getAaCodeFromMassWearingModification failed :\n%1").arg(err.qwhat()));
}
}
pappso::PappsoException::qwhat
virtual const QString & qwhat() const
Definition pappsoexception.h:66
pappso::masschroq::PeakQualityCategory::aa
@ aa
best possible : more than one direct MS2 fragmentation in same MSRUN
Definition types.h:45

References m_aaCode, m_aaCodec, m_codeMassList, and pappso::PappsoException::qwhat().

Referenced by pappso::specself::SelfSpectrumDataPoint::setVariableModification().

## getPrecisionPtr()

pappso::PrecisionPtr pappso::AaStringCodeMassMatching::getPrecisionPtr | ( |  | ) | const

Definition at line 78 of file aastringcodemassmatching.cpp.

{
return m_precision;
}

References m_precision.

Referenced by pappso::specself::SelfSpectrumDataPoint::fillAntiSpectrumDataPoint().

## Member Data Documentation

## m_aaCode

const AaCode& pappso::AaStringCodeMassMatching::m_aaCode

private

Definition at line 98 of file aastringcodemassmatching.h.

Referenced by AaStringCodeMassMatching(), AaStringCodeMassMatching(), and getAaCodeFromMassWearingModification().

## m_aaCodec

AaStringCodec pappso::AaStringCodeMassMatching::m_aaCodec

private

Definition at line 100 of file aastringcodemassmatching.h.

Referenced by AaStringCodeMassMatching(), AaStringCodeMassMatching(), filterCodeList(), and getAaCodeFromMassWearingModification().

## m_base

uint32_t pappso::AaStringCodeMassMatching::m_base = 0

private

Definition at line 103 of file aastringcodemassmatching.h.

Referenced by AaStringCodeMassMatching(), AaStringCodeMassMatching(), and filterCodeList().

## m_codeMassList

std::vector<aaCodeAndMassRange> pappso::AaStringCodeMassMatching::m_codeMassList

private

Definition at line 113 of file aastringcodemassmatching.h.

Referenced by AaStringCodeMassMatching(), getAaCodeFromMass(), getAaCodeFromMassList(), and getAaCodeFromMassWearingModification().

## m_precision

PrecisionPtr pappso::AaStringCodeMassMatching::m_precision = nullptr

private

Definition at line 97 of file aastringcodemassmatching.h.

Referenced by AaStringCodeMassMatching(), AaStringCodeMassMatching(), and getPrecisionPtr().

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

- pappsomspp/core/amino_acid/aastringcodemassmatching.h
- pappsomspp/core/amino_acid/aastringcodemassmatching.cpp