MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / computeMonoisotopicConsensus

Method computeMonoisotopicConsensus

src/openms/source/KERNEL/ConsensusFeature.cpp:211–253  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

209 }
210
211 void ConsensusFeature::computeMonoisotopicConsensus()
212 {
213 // for computing average rt position, minimal m/z position and intensity
214 double rt = 0.0;
215 double mz = std::numeric_limits<double>::max();
216 double intensity = 0.0;
217
218 // The most frequent charge state wins. Tie breaking prefers smaller charge.
219 std::map<Int, UInt> charge_occ;
220 Int charge_most_frequent = 0;
221 UInt charge_most_frequent_occ = 0;
222
223 for (ConsensusFeature::HandleSetType::const_iterator it = handles_.begin(); it != handles_.end(); ++it)
224 {
225 rt += it->getRT();
226 if (it->getMZ() < mz)
227 {
228 mz = it->getMZ();
229 }
230 intensity += it->getIntensity();
231 const Int it_charge = it->getCharge();
232 const UInt it_charge_occ = ++charge_occ[it_charge];
233 if (it_charge_occ > charge_most_frequent_occ)
234 {
235 charge_most_frequent_occ = it_charge_occ;
236 charge_most_frequent = it_charge;
237 }
238 else
239 {
240 if (it_charge_occ >= charge_most_frequent_occ && abs(it_charge) < abs(charge_most_frequent))
241 {
242 charge_most_frequent = it_charge;
243 }
244 }
245 }
246
247 // compute the position and intensity
248 setRT(rt / size());
249 setMZ(mz);
250 setIntensity(intensity / size());
251 setCharge(charge_most_frequent);
252 return;
253 }
254
255 void ConsensusFeature::computeDechargeConsensus(const FeatureMap& fm, bool intensity_weighted_averaging)
256 {

Callers 3

testConsensusFeatureFunction · 0.95
runMethod · 0.80

Calls 11

setChargeFunction · 0.85
setRTFunction · 0.50
sizeFunction · 0.50
setMZFunction · 0.50
setIntensityFunction · 0.50
beginMethod · 0.45
endMethod · 0.45
getRTMethod · 0.45
getMZMethod · 0.45
getIntensityMethod · 0.45
getChargeMethod · 0.45

Tested by 1

testConsensusFeatureFunction · 0.76