67 static void resolve(
FeatureMap & features,
bool keep_matching =
false);
75 static void resolve(
ConsensusMap & features,
bool keep_matching =
false);
82 static void resolveBetweenFeatures(
FeatureMap & features);
89 static void resolveBetweenFeatures(
ConsensusMap & features);
99 p.setMetaValue(
"feature_id",
"not mapped");
104 c.setMetaValue(
"feature_id",
String(
c.getUniqueId()));
107 resolveConflict_(
c.getPeptideIdentifications(),
108 map.getUnassignedPeptideIdentifications(),
113 resolveConflictKeepMatching_(
c.getPeptideIdentifications(),
114 map.getUnassignedPeptideIdentifications(),
126 static void resolveConflict_(
127 std::vector<PeptideIdentification> & peptides,
128 std::vector<PeptideIdentification> & removed,
131 static void resolveConflictKeepMatching_(
132 std::vector<PeptideIdentification> & peptides,
133 std::vector<PeptideIdentification> & removed,
140 std::vector<PeptideIdentification>& unassigned = map.getUnassignedPeptideIdentifications();
144 typedef std::map<std::pair<Int, AASequence>,
typename T::value_type*> FeatureSet;
145 FeatureSet feature_set;
149 for (
typename T::value_type& element : map)
151 std::vector<PeptideIdentification>& pep_ids = element.getPeptideIdentifications();
153 if (!pep_ids.empty())
155 if (pep_ids.size() != 1)
163 pep_ids.front().sort();
164 const std::vector<PeptideHit>& hits = pep_ids.front().getHits();
168 const PeptideHit& highest_score_hit = hits.front();
171 std::pair<Int, AASequence> pair = std::make_pair(element.getCharge(), highest_score_hit.
getSequence());
176 typename FeatureSet::iterator feature_in_set = feature_set.find(pair);
177 if (feature_in_set != feature_set.end())
181 if (feature_in_set->second->getIntensity() < element.getIntensity())
184 std::vector<PeptideIdentification>& obsolete = feature_in_set->second->getPeptideIdentifications();
185 unassigned.insert(unassigned.end(), obsolete.begin(), obsolete.end());
186 std::vector<PeptideIdentification> pep_ids_empty;
187 feature_in_set->second->setPeptideIdentifications(pep_ids_empty);
190 feature_in_set->second = &(element);
195 std::vector<PeptideIdentification>& obsolete = element.getPeptideIdentifications();
196 unassigned.insert(unassigned.end(), obsolete.begin(), obsolete.end());
197 std::vector<PeptideIdentification> pep_ids_empty;
198 element.setPeptideIdentifications(pep_ids_empty);
204 feature_set[pair] = &(element);