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

Method train

src/openms/source/FILTERING/CALIBRATION/MZTrafoModel.cpp:123–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121 }
122
123 bool MZTrafoModel::train( const CalibrationData& cd, MODELTYPE md, bool use_RANSAC, double rt_left /*= -std::numeric_limits<double>::max()*/, double rt_right /*= std::numeric_limits<double>::max() */ )
124 {
125 std::vector<double> obs_mz;
126 std::vector<double> theo_mz;
127 std::vector<double> weights;
128 const CalibrationData* p_cd;
129 CalibrationData cdm;
130 Size i, ie; // CalibrationData's start-to-end interval
131 if (cd.getNrOfGroups() > 0) // we have lock mass traces
132 { // this is extra work, since we need to collect peak groups and compute the median
133 cdm = cd.median(rt_left, rt_right);
134 p_cd = &cdm;
135 i = 0;
136 ie = cdm.size();
137 }
138 else
139 {
140 i = std::distance(cd.begin(), lower_bound(cd.begin(), cd.end(), rt_left, RichPeak2D::RTLess()));
141 ie = std::distance(cd.begin(), upper_bound(cd.begin(), cd.end(), rt_right, RichPeak2D::RTLess()));
142 p_cd = &cd;
143 }
144 for (Size j = i; j != ie; ++j)
145 {
146 obs_mz.push_back(p_cd->getError(j)); // could be ppm or [Th], depending on cd::use_ppm_
147 theo_mz.push_back(p_cd->getRefMZ(j));
148 weights.push_back(p_cd->getWeight(j));
149 }
150
151 this->rt_ = (rt_left + rt_right) / 2;
152
153 return (train(obs_mz, theo_mz, weights, md, use_RANSAC));
154 }
155
156 bool MZTrafoModel::train( std::vector<double> obs_mz, std::vector<double> theo_mz, std::vector<double> weights, MODELTYPE md, bool use_RANSAC )
157 {

Callers 1

calibrateMethod · 0.45

Calls 15

getPPMFunction · 0.85
ppmToMassFunction · 0.85
medianFunction · 0.85
MADFunction · 0.85
getNrOfGroupsMethod · 0.80
medianMethod · 0.80
getErrorMethod · 0.80
getRefMZMethod · 0.80
emplace_backMethod · 0.80
ransacMethod · 0.80
getInterceptMethod · 0.80
getAMethod · 0.80

Tested by

no test coverage detected