66 static void resolve(
FeatureMap & features,
bool keep_matching =
false);
74 static void resolve(
ConsensusMap & features,
bool keep_matching =
false);
81 static void resolveBetweenFeatures(
FeatureMap & features);
88 static void resolveBetweenFeatures(
ConsensusMap & features);
98 p.setMetaValue(
"feature_id",
"not mapped");
103 c.setMetaValue(
"feature_id",
String(
c.getUniqueId()));
106 resolveConflict_(
c.getPeptideIdentifications(),
107 map.getUnassignedPeptideIdentifications(),
112 resolveConflictKeepMatching_(
c.getPeptideIdentifications(),
113 map.getUnassignedPeptideIdentifications(),
125 static void resolveConflict_(
126 std::vector<PeptideIdentification> & peptides,
127 std::vector<PeptideIdentification> & removed,
130 static void resolveConflictKeepMatching_(
131 std::vector<PeptideIdentification> & peptides,
132 std::vector<PeptideIdentification> & removed,
139 std::vector<PeptideIdentification>& unassigned = map.getUnassignedPeptideIdentifications();
143 typedef std::map<std::pair<Int, AASequence>,
typename T::value_type*> FeatureSet;
144 FeatureSet feature_set;
148 for (
typename T::value_type& element : map)
150 std::vector<PeptideIdentification>& pep_ids = element.getPeptideIdentifications();
152 if (!pep_ids.empty())
154 if (pep_ids.size() != 1)
162 pep_ids.front().sort();
163 const std::vector<PeptideHit>& hits = pep_ids.front().getHits();
167 const PeptideHit& highest_score_hit = hits.front();
170 std::pair<Int, AASequence> pair = std::make_pair(element.getCharge(), highest_score_hit.
getSequence());
175 typename FeatureSet::iterator feature_in_set = feature_set.find(pair);
176 if (feature_in_set != feature_set.end())
180 if (feature_in_set->second->getIntensity() < element.getIntensity())
183 std::vector<PeptideIdentification>& obsolete = feature_in_set->second->getPeptideIdentifications();
184 unassigned.insert(unassigned.end(), obsolete.begin(), obsolete.end());
185 std::vector<PeptideIdentification> pep_ids_empty;
186 feature_in_set->second->setPeptideIdentifications(pep_ids_empty);
189 feature_in_set->second = &(element);
194 std::vector<PeptideIdentification>& obsolete = element.getPeptideIdentifications();
195 unassigned.insert(unassigned.end(), obsolete.begin(), obsolete.end());
196 std::vector<PeptideIdentification> pep_ids_empty;
197 element.setPeptideIdentifications(pep_ids_empty);
203 feature_set[pair] = &(element);