void ProteinResolver::computeIntensityOfMSD_(vector<MSDGroup> & msd_groups) { // iteriert ueber alles msd gruppe for (vector<MSDGroup>::iterator group = msd_groups.begin(); group != msd_groups.end(); ++group) { DoubleList intensities; // iterierere ueber peptide entry (peptide identification), intensitaet (summe der einzelintensitaeten) for (list<PeptideEntry *>::iterator pep = group->peptides.begin(); pep != group->peptides.end(); ++pep) { intensities.push_back((*pep)->intensity); } // median von der list ist itensity der msd group group->intensity = Math::median(intensities.begin(), intensities.end()); } }
///////////////////////////////////////////////////////////// START_TEST( StatisticFunctions, "$Id$" ); ///////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////// START_SECTION([EXTRA](template <typename IteratorType> static DoubleReal sum(IteratorType begin, IteratorType end))) { int x[] = {-1, 0, 1, 2, 3}; TEST_EQUAL(int(Math::sum(x, x + 5)), 5); TEST_EQUAL(int(Math::sum(x, x)), 0); DoubleList y; y << -1.0 << -0.5 << 0.0 << 0.5 << 1.0 << 1.5 << 2.0; TEST_REAL_SIMILAR(Math::sum(y.begin(), y.end()), 3.5); } END_SECTION START_SECTION([EXTRA](template <typename IteratorType> static DoubleReal mean(IteratorType begin, IteratorType end))) { int x[] = {-1, 0, 1, 2, 3}; TEST_EQUAL(Math::mean(x, x + 5), 1); TEST_EXCEPTION(Exception::InvalidRange, Math::mean(x, x)); DoubleList y; y << -1.0 << -0.5 << 0.0 << 0.5 << 1.0 << 1.5 << 2.0; TEST_REAL_SIMILAR(Math::mean(y.begin(), y.end()), 0.5); } END_SECTION