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

`#include <proteinintegercode.h>`

## Public Member Functions

| ProteinIntegerCode (ProteinSp protein, const AaStringCodec &codec, std::size_t aa_str_max_size=5)
| ProteinIntegerCode (const ProteinIntegerCode &other)
virtual | ~ProteinIntegerCode ()
const std::vector< std::uint8_t > & | getSeqAaCode () const
const std::vector< std::uint32_t > & | getPeptideCodedFragment (std::size_t size) const
std::vector< std::pair< std::size_t, std::uint32_t > > | match (const std::vector< uint32_t > &code_list) const
| list of positions and matched codes along protein sequence
std::vector< double > | convolution (const std::vector< uint32_t > &code_list_from_spectrum) const
| process convolution of spectrum code list along protein sequence
pappso::ProteinSp | getProteinSp () const

## Private Member Functions

std::vector< std::uint32_t > | computePeptideCodeFragments (const AaStringCodec &codec, std::size_t fragment_size) const
double | convolutionKernel (const std::vector< uint32_t > &spectrum_code_list, std::vector< std::uint8_t >::const_iterator it_aa, std::vector< std::uint32_t >::const_iterator it_couple, std::vector< std::uint32_t >::const_iterator it_trio, std::vector< std::uint32_t >::const_iterator it_quatro, std::vector< std::uint32_t >::const_iterator it_cinqo) const

## Private Attributes

ProteinSp | msp_protein
std::vector< std::uint8_t > | m_seqAaCode
std::vector< std::vector< std::uint32_t > > | m_peptideCodedFragments

## Detailed Description

Definition at line 43 of file proteinintegercode.h.

## Constructor & Destructor Documentation

## ProteinIntegerCode() [1/2]

ProteinIntegerCode::ProteinIntegerCode | ( | ProteinSp | protein,
|  | const AaStringCodec & | codec,
|  | std::size_t | aa_str_max_size = `5`
| ) |  |

Default constructor

Definition at line 35 of file proteinintegercode.cpp.

{
msp_protein = protein;
if(aa_str_max_size > 7)
{
throw ExceptionOutOfRange(
QObject::tr("aa_str_max_size exceeds max size"));
}
QString seq_str = protein.get()->getSequence();
m_seqAaCode.clear();
for(const QChar &aa_str : seq_str)
{
m_seqAaCode.push_back(codec.getAaCode().getAaCode(aa_str.toLatin1()));
}
for(std::size_t i = 2; i <= aa_str_max_size; i++)
{
m_peptideCodedFragments.push_back(computePeptideCodeFragments(codec, i));
}
}
pappso::AaCode::getAaCode
uint8_t getAaCode(char aa_letter) const
Definition aacode.cpp:81
pappso::AaStringCodec::getAaCode
const AaCode & getAaCode() const
Definition aastringcodec.cpp:307
pappso::ExceptionOutOfRange
Definition exceptionoutofrange.h:32
pappso::ProteinIntegerCode::m_seqAaCode
std::vector< std::uint8_t > m_seqAaCode
Definition proteinintegercode.h:103
pappso::ProteinIntegerCode::m_peptideCodedFragments
std::vector< std::vector< std::uint32_t > > m_peptideCodedFragments
Definition proteinintegercode.h:104
pappso::ProteinIntegerCode::msp_protein
ProteinSp msp_protein
Definition proteinintegercode.h:101
pappso::ProteinIntegerCode::computePeptideCodeFragments
std::vector< std::uint32_t > computePeptideCodeFragments(const AaStringCodec &codec, std::size_t fragment_size) const
Definition proteinintegercode.cpp:87

References computePeptideCodeFragments(), pappso::AaStringCodec::getAaCode(), pappso::AaCode::getAaCode(), m_peptideCodedFragments, m_seqAaCode, and msp_protein.

## ProteinIntegerCode() [2/2]

ProteinIntegerCode::ProteinIntegerCode | ( | const ProteinIntegerCode & | other | ) |

Copy constructor

Parameters

  other | TODO

Definition at line 61 of file proteinintegercode.cpp.

{
msp_protein = other.msp_protein;
m_seqAaCode = other.m_seqAaCode;
m_peptideCodedFragments = other.m_peptideCodedFragments;
}

References m_peptideCodedFragments, m_seqAaCode, and msp_protein.

## ~ProteinIntegerCode()

ProteinIntegerCode::~ProteinIntegerCode | ( |  | ) |

virtual

Destructor

Definition at line 70 of file proteinintegercode.cpp.

{
}

## Member Function Documentation

## computePeptideCodeFragments()

std::vector< std::uint32_t > pappso::ProteinIntegerCode::computePeptideCodeFragments | ( | const AaStringCodec & | codec,
|  | std::size_t | fragment_size
| ) |  | const

private

Definition at line 87 of file proteinintegercode.cpp.

{
std::vector<std::uint32_t> fragments;
int max = (m_seqAaCode.size() - fragment_size);
if(max < 0)
return fragments;
auto it = m_seqAaCode.begin();
for(int i = 0; i <= max; i++)
{
fragments.push_back(codec.codeLlc(it, fragment_size));
it++;
}
return fragments;
}
pappso::AaStringCodec::codeLlc
uint32_t codeLlc(const QString &aa_str) const
get the lowest common denominator integer from amino acide suite string
Definition aastringcodec.cpp:73
pappso::XicExtractMethod::max
@ max
maximum of intensities

References pappso::AaStringCodec::codeLlc(), and pappso::max.

Referenced by ProteinIntegerCode().

## convolution()

std::vector< double > pappso::ProteinIntegerCode::convolution | ( | const std::vector< uint32_t > & | code_list_from_spectrum | ) | const

process convolution of spectrum code list along protein sequence

Parameters

  code_list_from_spectrum | unique sorted sequence codes given by the spectrum decoder

Definition at line 165 of file proteinintegercode.cpp.

{
std::vector<double> convolution_score;
std::vector<std::uint8_t>::const_iterator it_aa = m_seqAaCode.begin();
auto it_couple = m_peptideCodedFragments[0].begin();
auto it_trio = m_peptideCodedFragments[1].begin();
auto it_quatro = m_peptideCodedFragments[2].begin();
auto it_cinqo = m_peptideCodedFragments[3].begin();
for(std::uint8_t aa_code [[maybe_unused]] : m_seqAaCode)
{
convolution_score.push_back(convolutionKernel(code_list_from_spectrum,
it_aa,
it_couple,
it_trio,
it_quatro,
it_cinqo));
it_aa++;
it_couple++;
it_trio++;
it_quatro++;
it_cinqo++;
}
return convolution_score;
}
pappso::ProteinIntegerCode::convolutionKernel
double convolutionKernel(const std::vector< uint32_t > &spectrum_code_list, std::vector< std::uint8_t >::const_iterator it_aa, std::vector< std::uint32_t >::const_iterator it_couple, std::vector< std::uint32_t >::const_iterator it_trio, std::vector< std::uint32_t >::const_iterator it_quatro, std::vector< std::uint32_t >::const_iterator it_cinqo) const
Definition proteinintegercode.cpp:195

## convolutionKernel()

double pappso::ProteinIntegerCode::convolutionKernel | ( | const std::vector< uint32_t > & | spectrum_code_list,
|  | std::vector< std::uint8_t >::const_iterator | it_aa,
|  | std::vector< std::uint32_t >::const_iterator | it_couple,
|  | std::vector< std::uint32_t >::const_iterator | it_trio,
|  | std::vector< std::uint32_t >::const_iterator | it_quatro,
|  | std::vector< std::uint32_t >::const_iterator | it_cinqo
| ) |  | const

private

Definition at line 195 of file proteinintegercode.cpp.

{
double score = 0;
// single :
auto it_end = it_aa + 5;
auto it = it_aa;
double single_score = 0;
while(it != it_end)
{
if(std::binary_search(spectrum_code_list.begin(),
spectrum_code_list.end(),
(std::uint32_t)(*it)))
{
single_score += 1;
}
else
{
single_score += 0.1;
}
it++;
}
// duo
auto itduo_end = it_couple + 4;
auto itduo = it_couple;
double duo_score = 0;
while(itduo != itduo_end)
{
if(std::binary_search(
spectrum_code_list.begin(), spectrum_code_list.end(), *itduo))
{
duo_score += 3;
}
else
{
duo_score += 0.2;
}
itduo++;
}
// trio
auto it3_end = it_trio + 3;
auto it3 = it_trio;
double trio_score = 0;
while(it3 != it3_end)
{
if(std::binary_search(
spectrum_code_list.begin(), spectrum_code_list.end(), *it3))
{
trio_score += 6;
}
else
{
trio_score += 0.5;
}
it3++;
}
// quatro
auto it4_end = it_quatro + 2;
auto it4 = it_quatro;
double quatro_score = 0;
while(it4 != it4_end)
{
// element < value
if(std::binary_search(
spectrum_code_list.begin(), spectrum_code_list.end(), *it4))
{
quatro_score += 8;
}
quatro_score += 0.8;
it4++;
}
// cinqo
if(std::binary_search(
spectrum_code_list.begin(), spectrum_code_list.end(), *it_cinqo))
{
score += 10;
}
else
{
score += 1;
}
return score * single_score * duo_score * trio_score * quatro_score;
}

## getPeptideCodedFragment()

const std::vector< std::uint32_t > & pappso::ProteinIntegerCode::getPeptideCodedFragment | ( | std::size_t | size | ) | const

Definition at line 108 of file proteinintegercode.cpp.

{
if(size < 2)
{
throw ExceptionOutOfRange(QObject::tr("size too small"));
}
std::size_t indice = size - 2;
if(indice < m_peptideCodedFragments.size())
{
return m_peptideCodedFragments.at(indice);
}
throw ExceptionOutOfRange(QObject::tr("size too big"));
}

Referenced by pappso::ProteinPresenceAbsenceMatrix::fillMatrix().

## getProteinSp()

pappso::ProteinSp pappso::ProteinIntegerCode::getProteinSp | ( |  | ) | const

Definition at line 80 of file proteinintegercode.cpp.

{
return msp_protein;
}

## getSeqAaCode()

const std::vector< std::uint8_t > & pappso::ProteinIntegerCode::getSeqAaCode | ( |  | ) | const

Definition at line 74 of file proteinintegercode.cpp.

{
return m_seqAaCode;
}

Referenced by pappso::ProteinPresenceAbsenceMatrix::fillMatrix().

## match()

std::vector< std::pair< std::size_t, std::uint32_t > > pappso::ProteinIntegerCode::match | ( | const std::vector< uint32_t > & | code_list | ) | const

list of positions and matched codes along protein sequence

Definition at line 126 of file proteinintegercode.cpp.

{
std::vector<std::pair<std::size_t, std::uint32_t>> return_pos;
std::vector<uint32_t> code_list = code_list_in;
std::sort(code_list.begin(), code_list.end());
auto it_end = std::unique(code_list.begin(), code_list.end());
for(auto it_code = code_list.begin(); it_code != it_end; it_code++)
{
std::size_t size = 2;
for(auto &liste_protein_seq_code : m_peptideCodedFragments)
{
auto it_seq_position = std::find(liste_protein_seq_code.begin(),
liste_protein_seq_code.end(),
*it_code);
while(it_seq_position != liste_protein_seq_code.end())
{
// found
std::size_t position =
std::distance(liste_protein_seq_code.begin(), it_seq_position);
return_pos.push_back({size, position});
it_seq_position = std::find(
++it_seq_position, liste_protein_seq_code.end(), *it_code);
qDebug();
}
size++;
qDebug();
}
qDebug();
}
return return_pos;
}

## Member Data Documentation

## m_peptideCodedFragments

std::vector<std::vector<std::uint32_t> > pappso::ProteinIntegerCode::m_peptideCodedFragments

private

Definition at line 104 of file proteinintegercode.h.

Referenced by ProteinIntegerCode(), and ProteinIntegerCode().

## m_seqAaCode

std::vector<std::uint8_t> pappso::ProteinIntegerCode::m_seqAaCode

private

Definition at line 103 of file proteinintegercode.h.

Referenced by ProteinIntegerCode(), and ProteinIntegerCode().

## msp_protein

ProteinSp pappso::ProteinIntegerCode::msp_protein

private

Definition at line 101 of file proteinintegercode.h.

Referenced by ProteinIntegerCode(), and ProteinIntegerCode().

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

- pappsomspp/protein/proteinintegercode.h
- pappsomspp/protein/proteinintegercode.cpp