libpappsomspp
Library for mass spectrometry
Toggle main menu visibility
Loading...
Searching...
No Matches
grpmappeptidetogroup.cpp
Go to the documentation of this file.
1
/**
2
* \file pappsomspp/grouping/grpmappeptidegroup.cpp
3
* \date 15/12/2017
4
* \author Olivier Langella
5
* \brief keep trace of peptide to group assignment
6
*/
7
8
/*******************************************************************************
9
* Copyright (c) 2017 Olivier Langella <Olivier.Langella@u-psud.fr>.
10
*
11
* This file is part of the PAPPSOms++ library.
12
*
13
* PAPPSOms++ is free software: you can redistribute it and/or modify
14
* it under the terms of the GNU General Public License as published by
15
* the Free Software Foundation, either version 3 of the License, or
16
* (at your option) any later version.
17
*
18
* PAPPSOms++ is distributed in the hope that it will be useful,
19
* but WITHOUT ANY WARRANTY; without even the implied warranty of
20
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
* GNU General Public License for more details.
22
*
23
* You should have received a copy of the GNU General Public License
24
* along with PAPPSOms++. If not, see <http://www.gnu.org/licenses/>.
25
*
26
* Contributors:
27
* Olivier Langella <Olivier.Langella@u-psud.fr> - initial API and
28
*implementation
29
******************************************************************************/
30
31
#include "
grpmappeptidetogroup.h
"
32
33
namespace
pappso
34
{
35
36
GrpMapPeptideToGroup::GrpMapPeptideToGroup
()
37
{
38
}
39
40
GrpMapPeptideToGroup::GrpMapPeptideToGroup
(
const
GrpMapPeptideToGroup
&other)
41
:
m_mapPeptideToGroup
(other.
m_mapPeptideToGroup
)
42
{
43
}
44
45
GrpMapPeptideToGroup::~GrpMapPeptideToGroup
()
46
{
47
}
48
49
void
50
GrpMapPeptideToGroup::getGroupList
(
const
GrpPeptideSet
&peptide_set_in,
51
std::list<GrpGroupSp> &impacted_group_list)
const
52
{
53
auto
it_peptide_end = peptide_set_in.
m_peptidePtrList
.end();
54
std::map<GrpPeptide *, GrpGroupSp>::const_iterator it_map_end =
m_mapPeptideToGroup
.end();
55
56
for
(
auto
it_peptide = peptide_set_in.
m_peptidePtrList
.begin(); it_peptide != it_peptide_end;
57
it_peptide++)
58
{
59
std::map<GrpPeptide *, GrpGroupSp>::const_iterator it_map =
60
m_mapPeptideToGroup
.find(*it_peptide);
61
if
(it_map != it_map_end)
62
{
63
impacted_group_list.push_back(it_map->second);
64
}
65
}
66
impacted_group_list.sort();
67
impacted_group_list.unique();
68
}
69
70
void
71
GrpMapPeptideToGroup::set
(
const
GrpPeptideSet
&peptide_set_in,
GrpGroupSp
grp_group)
72
{
73
74
auto
it_peptide_end = peptide_set_in.
m_peptidePtrList
.end();
75
76
for
(
auto
it_peptide = peptide_set_in.
m_peptidePtrList
.begin(); it_peptide != it_peptide_end;
77
it_peptide++)
78
{
79
std::pair<std::map<GrpPeptide *, GrpGroupSp>::iterator,
bool
> ret =
80
m_mapPeptideToGroup
.insert(std::pair<GrpPeptide *, GrpGroupSp>(*it_peptide, grp_group));
81
if
(ret.second ==
false
)
82
{
//=> key already exists : replace by grp_group
83
ret.first->second = grp_group;
84
}
85
}
86
}
87
void
88
GrpMapPeptideToGroup::clear
(std::list<GrpGroupSp> &grp_group_list)
89
{
90
91
std::list<GrpGroupSp> new_list;
92
for
(
auto
&pair_map :
m_mapPeptideToGroup
)
93
{
94
new_list.push_back(pair_map.second);
95
}
96
new_list.sort();
97
new_list.unique();
98
99
grp_group_list.splice(grp_group_list.end(), new_list);
100
m_mapPeptideToGroup
.clear();
101
}
102
}
// namespace pappso
pappso::GrpMapPeptideToGroup::clear
void clear(std::list< GrpGroupSp > &grp_group_list)
Definition
grpmappeptidetogroup.cpp:88
pappso::GrpMapPeptideToGroup::m_mapPeptideToGroup
std::map< GrpPeptide *, GrpGroupSp > m_mapPeptideToGroup
Definition
grpmappeptidetogroup.h:45
pappso::GrpMapPeptideToGroup::GrpMapPeptideToGroup
GrpMapPeptideToGroup()
Definition
grpmappeptidetogroup.cpp:36
pappso::GrpMapPeptideToGroup::getGroupList
void getGroupList(const GrpPeptideSet &peptide_set_in, std::list< GrpGroupSp > &impacted_group_list) const
get all groups concerned by a list of peptides
Definition
grpmappeptidetogroup.cpp:50
pappso::GrpMapPeptideToGroup::set
void set(const GrpPeptideSet &peptide_set_in, GrpGroupSp grp_group)
set peptide keys pointing on the group
Definition
grpmappeptidetogroup.cpp:71
pappso::GrpMapPeptideToGroup::~GrpMapPeptideToGroup
~GrpMapPeptideToGroup()
Definition
grpmappeptidetogroup.cpp:45
pappso::GrpPeptideSet
Definition
grppeptideset.h:36
pappso::GrpPeptideSet::m_peptidePtrList
std::list< GrpPeptide * > m_peptidePtrList
Definition
grppeptideset.h:41
grpmappeptidetogroup.h
pappso
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
Definition
aa.cpp:39
pappso::GrpGroupSp
std::shared_ptr< GrpGroup > GrpGroupSp
Definition
grpgroup.h:39
pappsomspp
core
grouping
grpmappeptidetogroup.cpp
Generated on
for libpappsomspp by
1.17.0