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

`#include <proteinpresenceabsencematrix.h>`

## Public Types

enum class | ProteinPresenceAbsenceMatrixElement : std::uint8_t { absent = 0 , present = 1 }

## Public Member Functions

| ProteinPresenceAbsenceMatrix ()
| ProteinPresenceAbsenceMatrix (const ProteinPresenceAbsenceMatrix &other)
virtual | ~ProteinPresenceAbsenceMatrix ()
ProteinPresenceAbsenceMatrix & | operator= (const ProteinPresenceAbsenceMatrix &other)
void | fillMatrix (const pappso::ProteinIntegerCode &coded_protein, const std::vector< uint32_t > &code_list_from_spectrum)
std::vector< double > | convolution () const
| process convolution of spectrum code list along protein sequence
const boost::numeric::ublas::matrix< pappso::ProteinPresenceAbsenceMatrix::ProteinPresenceAbsenceMatrixElement > & | getPresenceAbsenceMatrix () const

## Private Member Functions

double | convolutionKernel (std::size_t position) const
double | getScore (std::size_t seq_position, std::size_t aa_fragment_size) const

## Private Attributes

boost::numeric::ublas::matrix< ProteinPresenceAbsenceMatrixElement > | m_presenceAbsenceMatrix

## Detailed Description

Definition at line 43 of file proteinpresenceabsencematrix.h.

## Member Enumeration Documentation

## ProteinPresenceAbsenceMatrixElement

enum class pappso::ProteinPresenceAbsenceMatrix::ProteinPresenceAbsenceMatrixElement : std::uint8_t

strong

Enumerator
absent | the aa sequence code is not present
present | the aa sequence code is present

Definition at line 72 of file proteinpresenceabsencematrix.h.

{
absent = 0, ///< the aa sequence code is not present
present = 1, ///< the aa sequence code is present
};

## Constructor & Destructor Documentation

## ProteinPresenceAbsenceMatrix() [1/2]

pappso::ProteinPresenceAbsenceMatrix::ProteinPresenceAbsenceMatrix | ( |  | ) |

Default constructor

Definition at line 32 of file proteinpresenceabsencematrix.cpp.

{
}

## ProteinPresenceAbsenceMatrix() [2/2]

pappso::ProteinPresenceAbsenceMatrix::ProteinPresenceAbsenceMatrix | ( | const ProteinPresenceAbsenceMatrix & | other | ) |

copy constructor

Definition at line 41 of file proteinpresenceabsencematrix.cpp.

{
m_presenceAbsenceMatrix = other.m_presenceAbsenceMatrix;
}
pappso::ProteinPresenceAbsenceMatrix::m_presenceAbsenceMatrix
boost::numeric::ublas::matrix< ProteinPresenceAbsenceMatrixElement > m_presenceAbsenceMatrix
Definition proteinpresenceabsencematrix.h:91

References m_presenceAbsenceMatrix.

## ~ProteinPresenceAbsenceMatrix()

pappso::ProteinPresenceAbsenceMatrix::~ProteinPresenceAbsenceMatrix | ( |  | ) |

virtual

Destructor

Definition at line 36 of file proteinpresenceabsencematrix.cpp.

{
}

## Member Function Documentation

## convolution()

std::vector< double > pappso::ProteinPresenceAbsenceMatrix::convolution | ( |  | ) | const

process convolution of spectrum code list along protein sequence

Definition at line 139 of file proteinpresenceabsencematrix.cpp.

{
std::vector<double> convolution_score;
for(std::size_t ipos = 0; ipos < m_presenceAbsenceMatrix.size1(); ipos++)
{
convolution_score.push_back(convolutionKernel(ipos));
}
return convolution_score;
}
pappso::ProteinPresenceAbsenceMatrix::convolutionKernel
double convolutionKernel(std::size_t position) const
Definition proteinpresenceabsencematrix.cpp:198

References convolutionKernel(), and m_presenceAbsenceMatrix.

## convolutionKernel()

double pappso::ProteinPresenceAbsenceMatrix::convolutionKernel | ( | std::size_t | position | ) | const

private

Definition at line 198 of file proteinpresenceabsencematrix.cpp.

{
double score = 0;
std::size_t size_seq = m_presenceAbsenceMatrix.size1();
// single :
double single_score = 0;
std::size_t endpos = std::min(position + 5, size_seq);
for(std::size_t ipos = position; ipos < endpos; ipos++)
{
single_score += getScore(ipos, 0);
}
// duo
double duo_score = 0;
endpos = std::min(position + 4, size_seq);
for(std::size_t ipos = position; ipos < endpos; ipos++)
{
duo_score += getScore(ipos, 1);
}
// trio
double trio_score = 0;
endpos = std::min(position + 3, size_seq);
for(std::size_t ipos = position; ipos < endpos; ipos++)
{
trio_score += getScore(ipos, 2);
}
// quatro
double quatro_score = 0;
endpos = std::min(position + 2, size_seq);
for(std::size_t ipos = position; ipos < endpos; ipos++)
{
quatro_score += getScore(ipos, 3);
}
// cinqo
score += getScore(position, 4);
return score * single_score * duo_score * trio_score * quatro_score;
}
pappso::ProteinPresenceAbsenceMatrix::getScore
double getScore(std::size_t seq_position, std::size_t aa_fragment_size) const
Definition proteinpresenceabsencematrix.cpp:153

References getScore(), and m_presenceAbsenceMatrix.

Referenced by convolution().

## fillMatrix()

void pappso::ProteinPresenceAbsenceMatrix::fillMatrix | ( | const pappso::ProteinIntegerCode & | coded_protein,
|  | const std::vector< uint32_t > & | code_list_from_spectrum )

Definition at line 64 of file proteinpresenceabsencematrix.cpp.

{
const std::vector<std::uint8_t> &seq_aa_code = coded_protein.getSeqAaCode();
m_presenceAbsenceMatrix.resize(seq_aa_code.size(), 5);
std::vector<std::uint8_t>::const_iterator it_aa = seq_aa_code.begin();
auto it_couple = coded_protein.getPeptideCodedFragment(2).begin();
auto it_trio = coded_protein.getPeptideCodedFragment(3).begin();
auto it_quatro = coded_protein.getPeptideCodedFragment(4).begin();
auto it_cinqo = coded_protein.getPeptideCodedFragment(5).begin();
for(std::size_t i = 0; i < seq_aa_code.size(); i++)
{
if(std::binary_search(
code_list_from_spectrum.begin(), code_list_from_spectrum.end(), (std::uint32_t)(*it_aa)))
{
// presence
m_presenceAbsenceMatrix(i, 0) = ProteinPresenceAbsenceMatrixElement::present;
}
else
{
m_presenceAbsenceMatrix(i, 0) = ProteinPresenceAbsenceMatrixElement::absent;
}
if(std::binary_search(
code_list_from_spectrum.begin(), code_list_from_spectrum.end(), *it_couple))
{
// presence
m_presenceAbsenceMatrix(i, 1) = ProteinPresenceAbsenceMatrixElement::present;
}
else
{
m_presenceAbsenceMatrix(i, 1) = ProteinPresenceAbsenceMatrixElement::absent;
}
if(std::binary_search(
code_list_from_spectrum.begin(), code_list_from_spectrum.end(), *it_trio))
{
// presence
m_presenceAbsenceMatrix(i, 2) = ProteinPresenceAbsenceMatrixElement::present;
}
else
{
m_presenceAbsenceMatrix(i, 2) = ProteinPresenceAbsenceMatrixElement::absent;
}
if(std::binary_search(
code_list_from_spectrum.begin(), code_list_from_spectrum.end(), *it_quatro))
{
// presence
m_presenceAbsenceMatrix(i, 3) = ProteinPresenceAbsenceMatrixElement::present;
}
else
{
m_presenceAbsenceMatrix(i, 3) = ProteinPresenceAbsenceMatrixElement::absent;
}
if(std::binary_search(
code_list_from_spectrum.begin(), code_list_from_spectrum.end(), *it_cinqo))
{
// presence
m_presenceAbsenceMatrix(i, 4) = ProteinPresenceAbsenceMatrixElement::present;
}
else
{
m_presenceAbsenceMatrix(i, 4) = ProteinPresenceAbsenceMatrixElement::absent;
}
it_aa++;
it_couple++;
it_trio++;
it_quatro++;
it_cinqo++;
}
}
pappso::ProteinIntegerCode::getPeptideCodedFragment
const std::vector< std::uint32_t > & getPeptideCodedFragment(std::size_t size) const
Definition proteinintegercode.cpp:107
pappso::ProteinIntegerCode::getSeqAaCode
const std::vector< std::uint8_t > & getSeqAaCode() const
Definition proteinintegercode.cpp:73
pappso::ProteinPresenceAbsenceMatrix::ProteinPresenceAbsenceMatrixElement::present
@ present
the aa sequence code is present
Definition proteinpresenceabsencematrix.h:75
pappso::ProteinPresenceAbsenceMatrix::ProteinPresenceAbsenceMatrixElement::absent
@ absent
the aa sequence code is not present
Definition proteinpresenceabsencematrix.h:74

References absent, pappso::ProteinIntegerCode::getPeptideCodedFragment(), pappso::ProteinIntegerCode::getSeqAaCode(), m_presenceAbsenceMatrix, and present.

## getPresenceAbsenceMatrix()

const boost::numeric::ublas::matrix< pappso::ProteinPresenceAbsenceMatrix::ProteinPresenceAbsenceMatrixElement > & pappso::ProteinPresenceAbsenceMatrix::getPresenceAbsenceMatrix | ( |  | ) | const

Definition at line 58 of file proteinpresenceabsencematrix.cpp.

{
return m_presenceAbsenceMatrix;
}

References m_presenceAbsenceMatrix.

## getScore()

double pappso::ProteinPresenceAbsenceMatrix::getScore | ( | std::size_t | seq_position,
|  | std::size_t | aa_fragment_size ) const

private

Definition at line 153 of file proteinpresenceabsencematrix.cpp.

{
if(m_presenceAbsenceMatrix(seq_position, aa_fragment_size) ==
ProteinPresenceAbsenceMatrixElement::present)
{
switch(aa_fragment_size)
{
case 0:
return 1;
case 1:
return 3;
case 2:
return 6;
case 3:
return 8;
case 4:
return 10;
default:
break;
}
}
else
{
// absent
switch(aa_fragment_size)
{
case 0:
return 0.1;
case 1:
return 0.3;
case 2:
return 0.6;
case 3:
return 0.8;
case 4:
return 1;
default:
break;
}
}
return 0.1;
}

References m_presenceAbsenceMatrix, and present.

Referenced by convolutionKernel().

## operator=()

pappso::ProteinPresenceAbsenceMatrix & pappso::ProteinPresenceAbsenceMatrix::operator= | ( | const ProteinPresenceAbsenceMatrix & | other | ) |

Definition at line 48 of file proteinpresenceabsencematrix.cpp.

{
m_presenceAbsenceMatrix = other.m_presenceAbsenceMatrix;
return *this;
}

References m_presenceAbsenceMatrix.

## Member Data Documentation

## m_presenceAbsenceMatrix

boost::numeric::ublas::matrix<ProteinPresenceAbsenceMatrixElement> pappso::ProteinPresenceAbsenceMatrix::m_presenceAbsenceMatrix

private

Definition at line 91 of file proteinpresenceabsencematrix.h.

Referenced by ProteinPresenceAbsenceMatrix(), convolution(), convolutionKernel(), fillMatrix(), getPresenceAbsenceMatrix(), getScore(), and operator=().

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

- pappsomspp/core/protein/proteinpresenceabsencematrix.h
- pappsomspp/core/protein/proteinpresenceabsencematrix.cpp