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

Method run

src/openms/source/ANALYSIS/MAPMATCHING/SimplePairFinder.cpp:28–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26 }
27
28 void SimplePairFinder::run(const std::vector<ConsensusMap> & input_maps, ConsensusMap & result_map)
29 {
30 if (input_maps.size() != 2)
31 throw Exception::IllegalArgument(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "exactly two input maps required");
32 checkIds_(input_maps);
33
34 // progress dots
35 Int progress_dots = 0;
36 if (this->param_.exists("debug::progress_dots"))
37 {
38 progress_dots = (Int) this->param_.getValue("debug:progress_dots");
39 }
40 Int number_of_considered_element_pairs = 0;
41
42 // For each element in map 0, find its best friend in map 1
43 std::vector<UInt> best_companion_index_0(input_maps[0].size(), UInt(-1));
44 std::vector<double> best_companion_quality_0(input_maps[0].size(), 0);
45 for (UInt fi0 = 0; fi0 < input_maps[0].size(); ++fi0)
46 {
47 double best_quality = -std::numeric_limits<double>::max();
48 for (UInt fi1 = 0; fi1 < input_maps[1].size(); ++fi1)
49 {
50 double quality = similarity_(input_maps[0][fi0], input_maps[1][fi1]);
51 if (quality > best_quality)
52 {
53 best_quality = quality;
54 best_companion_index_0[fi0] = fi1;
55 }
56
57 ++number_of_considered_element_pairs;
58 if (progress_dots && !(number_of_considered_element_pairs % progress_dots))
59 {
60 std::cout << '-' << std::flush;
61 }
62
63 }
64 best_companion_quality_0[fi0] = best_quality;
65 }
66
67 // For each element in map 1, find its best friend in map 0
68 std::vector<UInt> best_companion_index_1(input_maps[1].size(), UInt(-1));
69 std::vector<double> best_companion_quality_1(input_maps[1].size(), 0);
70 for (UInt fi1 = 0; fi1 < input_maps[1].size(); ++fi1)
71 {
72 double best_quality = -std::numeric_limits<double>::max();
73 for (UInt fi0 = 0; fi0 < input_maps[0].size(); ++fi0)
74 {
75 double quality = similarity_(input_maps[0][fi0], input_maps[1][fi1]);
76 if (quality > best_quality)
77 {
78 best_quality = quality;
79 best_companion_index_1[fi1] = fi0;
80 }
81
82 ++number_of_considered_element_pairs;
83 if (progress_dots && !(number_of_considered_element_pairs % progress_dots))
84 {
85 std::cout << '+' << std::flush;

Callers

nothing calls this directly

Calls 7

computeConsensusMethod · 0.80
sizeMethod · 0.45
existsMethod · 0.45
getValueMethod · 0.45
insertMethod · 0.45
setQualityMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected