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

Method performAlignment

src/openms_gui/source/VISUAL/Plot1DCanvas.cpp:1356–1394  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1354 }
1355
1356 void Plot1DCanvas::performAlignment(Size layer_index_1, Size layer_index_2, const Param& param)
1357 {
1358 alignment_layer_1_ = layer_index_1;
1359 alignment_layer_2_ = layer_index_2;
1360 aligned_peaks_mz_delta_.clear();
1361 aligned_peaks_indices_.clear();
1362
1363 if (layer_index_1 >= getLayerCount() || layer_index_2 >= getLayerCount())
1364 {
1365 return;
1366 }
1367 auto ptr_layer_1 = dynamic_cast<const LayerData1DPeak*>(&getLayer(layer_index_1));
1368 auto ptr_layer_2 = dynamic_cast<const LayerData1DPeak*>(&getLayer(layer_index_2));
1369 if (ptr_layer_1 == nullptr || ptr_layer_2 == nullptr)
1370 {
1371 return;
1372 }
1373 const ExperimentType::SpectrumType& spectrum_1 = ptr_layer_1->getCurrentSpectrum();
1374 const ExperimentType::SpectrumType& spectrum_2 = ptr_layer_2->getCurrentSpectrum();
1375
1376 SpectrumAlignment aligner;
1377 aligner.setParameters(param);
1378 aligner.getSpectrumAlignment(aligned_peaks_indices_, spectrum_1, spectrum_2);
1379
1380 for (Size i = 0; i < aligned_peaks_indices_.size(); ++i)
1381 {
1382 double line_begin_mz = spectrum_1[aligned_peaks_indices_[i].first].getMZ();
1383 double line_end_mz = spectrum_2[aligned_peaks_indices_[i].second].getMZ();
1384 aligned_peaks_mz_delta_.emplace_back(line_begin_mz, line_end_mz);
1385 }
1386
1387 show_alignment_ = true;
1388 update_(OPENMS_PRETTY_FUNCTION);
1389
1390 SpectrumAlignmentScore scorer;
1391 scorer.setParameters(param);
1392
1393 alignment_score_ = scorer(spectrum_1, spectrum_2);
1394 }
1395
1396 void Plot1DCanvas::resetAlignment()
1397 {

Callers

nothing calls this directly

Calls 6

getLayerCountFunction · 0.85
setParametersMethod · 0.80
emplace_backMethod · 0.80
clearMethod · 0.45
sizeMethod · 0.45
getMZMethod · 0.45

Tested by

no test coverage detected