libpappsomspp
Library for mass spectrometry
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)
 
 ~ProteinIntegerCode ()
 
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
 

Private Member Functions

std::vector< std::uint32_t > computePeptideCodeFragments (const AaStringCodec &codec, std::size_t fragment_size) 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 42 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 34 of file proteinintegercode.cpp.

37{
38 msp_protein = protein;
39
40 if(aa_str_max_size > 7)
41 {
43 QObject::tr("aa_str_max_size exceeds max size"));
44 }
45
46 QString seq_str = protein.get()->getSequence();
47 m_seqAaCode.clear();
48
49 for(const QChar &aa_str : seq_str)
50 {
51 m_seqAaCode.push_back(codec.getAaCode().getAaCode(aa_str.toLatin1()));
52 }
53
54 for(std::size_t i = 2; i <= aa_str_max_size; i++)
55 {
57 }
58}
uint8_t getAaCode(char aa_letter) const
Definition: aacode.cpp:81
const AaCode & getAaCode() const
std::vector< std::uint8_t > m_seqAaCode
std::vector< std::vector< std::uint32_t > > m_peptideCodedFragments
std::vector< std::uint32_t > computePeptideCodeFragments(const AaStringCodec &codec, std::size_t fragment_size) const

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
otherTODO

Definition at line 60 of file proteinintegercode.cpp.

References m_peptideCodedFragments, m_seqAaCode, and msp_protein.

◆ ~ProteinIntegerCode()

ProteinIntegerCode::~ProteinIntegerCode ( )

Destructor

Definition at line 69 of file proteinintegercode.cpp.

70{
71}

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 74 of file proteinintegercode.cpp.

76{
77 std::vector<std::uint32_t> fragments;
78
79 int max = (m_seqAaCode.size() - fragment_size);
80 if(max < 0)
81 return fragments;
82
83 auto it = m_seqAaCode.begin();
84 for(int i = 0; i <= max; i++)
85 {
86 fragments.push_back(codec.codeLlc(it, fragment_size));
87 it++;
88 }
89
90 return fragments;
91}
uint32_t codeLlc(const QString &aa_str) const
get the lowest common denominator integer from amino acide suite string
@ max
maximum of intensities

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

Referenced by ProteinIntegerCode().

◆ getPeptideCodedFragment()

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

Definition at line 95 of file proteinintegercode.cpp.

96{
97 if(size < 2)
98 {
99
100 throw ExceptionOutOfRange(QObject::tr("size too small"));
101 }
102 std::size_t indice = size - 2;
103 if(indice < m_peptideCodedFragments.size())
104 {
105 return m_peptideCodedFragments.at(indice);
106 }
107
108 throw ExceptionOutOfRange(QObject::tr("size too big"));
109}

◆ match()

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

Definition at line 113 of file proteinintegercode.cpp.

115{
116 std::vector<std::pair<std::size_t, std::uint32_t>> return_pos;
117 std::vector<uint32_t> code_list = code_list_in;
118
119 std::sort(code_list.begin(), code_list.end());
120 auto it_end = std::unique(code_list.begin(), code_list.end());
121 for(auto it_code = code_list.begin(); it_code != it_end; it_code++)
122 {
123
124 std::size_t size = 2;
125 for(auto &liste_protein_seq_code : m_peptideCodedFragments)
126 {
127
128 auto it_seq_position = std::find(liste_protein_seq_code.begin(),
129 liste_protein_seq_code.end(),
130 *it_code);
131 while(it_seq_position != liste_protein_seq_code.end())
132 {
133 // found
134 std::size_t position =
135 std::distance(liste_protein_seq_code.begin(), it_seq_position);
136 return_pos.push_back({size, position});
137
138 it_seq_position = std::find(
139 ++it_seq_position, liste_protein_seq_code.end(), *it_code);
140 qDebug();
141 }
142 size++;
143 qDebug();
144 }
145 qDebug();
146 }
147
148 return return_pos;
149}

Member Data Documentation

◆ m_peptideCodedFragments

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

Definition at line 78 of file proteinintegercode.h.

Referenced by ProteinIntegerCode().

◆ m_seqAaCode

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

Definition at line 77 of file proteinintegercode.h.

Referenced by ProteinIntegerCode().

◆ msp_protein

ProteinSp pappso::ProteinIntegerCode::msp_protein
private

Definition at line 75 of file proteinintegercode.h.

Referenced by ProteinIntegerCode().


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