double AbsoluteQuantitation::calculateRatio(const Feature & component_1, const Feature & component_2, const String & feature_name) { double ratio = 0.0; if (component_1.metaValueExists(feature_name) && component_2.metaValueExists(feature_name)) { double feature_1 = component_1.getMetaValue(feature_name); double feature_2 = component_2.getMetaValue(feature_name); // std::cout << "ratio = " << ratio << "." << std::endl; ratio = feature_1/feature_2; } else if (component_1.metaValueExists(feature_name)) { LOG_INFO << "Warning: no IS found for component " << component_1.getMetaValue("native_id") << "."; // std::cout << "Warning: no IS found for component " << component_1.getMetaValue("native_id") << "." << std::endl; double feature_1 = component_1.getMetaValue(feature_name); ratio = feature_1; } else { LOG_INFO << "Feature metaValue " << feature_name << " not found for components " << component_1.getMetaValue("native_id") << " and " << component_2.getMetaValue("native_id") << "."; // std::cout << "Feature metaValue " << feature_name << " not found for components " << component_1.getMetaValue("native_id") << " and " << component_2.getMetaValue("native_id") << "." << std::endl; } return ratio; }
EigenMatrixXdPtr ITRAQLabeler::getItraqIntensity_(const Feature& f, const double MS2_RT_time) const { double factor = getRTProfileIntensity_(f, MS2_RT_time); //std::cerr << "\n\nfactor is: " << factor << "\n"; // fill map with values present (all missing ones remain 0) MutableEigenMatrixXdPtr m(new Eigen::MatrixXd(ItraqConstants::CHANNEL_COUNT[itraq_type_], 1)); m->setZero(); Size ch(0); Size ch_internal(0); for (ChannelMapType::ConstIterator it = channel_map_.begin(); it != channel_map_.end(); ++it) { SimTypes::SimIntensityType intensity(0); if (it->second.active && f.metaValueExists(getChannelIntensityName(ch_internal))) // peptide is present in this channel { intensity = (double) f.getMetaValue(getChannelIntensityName(ch_internal)); ++ch_internal; } (* m)(ch, 0) = intensity * factor; ++ch; } return m; }
double AbsoluteQuantitation::calculateRatio(const Feature & component_1, const Feature & component_2, const String & feature_name) { double ratio = 0.0; // member feature_name access if (feature_name == "intensity") { if (component_1.metaValueExists("native_id") && component_2.metaValueExists("native_id")) { const double feature_1 = component_1.getIntensity(); const double feature_2 = component_2.getIntensity(); ratio = feature_1 / feature_2; } else if (component_1.metaValueExists("native_id")) { LOG_DEBUG << "Warning: no IS found for component " << component_1.getMetaValue("native_id") << "."; const double feature_1 = component_1.getIntensity(); ratio = feature_1; } } // metaValue feature_name access else { if (component_1.metaValueExists(feature_name) && component_2.metaValueExists(feature_name)) { const double feature_1 = component_1.getMetaValue(feature_name); const double feature_2 = component_2.getMetaValue(feature_name); ratio = feature_1/feature_2; } else if (component_1.metaValueExists(feature_name)) { LOG_DEBUG << "Warning: no IS found for component " << component_1.getMetaValue("native_id") << "."; const double feature_1 = component_1.getMetaValue(feature_name); ratio = feature_1; } else { LOG_DEBUG << "Feature metaValue " << feature_name << " not found for components " << component_1.getMetaValue("native_id") << " and " << component_2.getMetaValue("native_id") << "."; } } return ratio; }
double ITRAQLabeler::getRTProfileIntensity_(const Feature& f, const double MS2_RT_time) const { // compute intensity correction factor for feature from RT profile const DoubleList& elution_bounds = f.getMetaValue("elution_profile_bounds"); const DoubleList& elution_ints = f.getMetaValue("elution_profile_intensities"); // check that RT is within the elution bound: OPENMS_POSTCONDITION(f.getConvexHull().getBoundingBox().encloses(MS2_RT_time, f.getMZ()), "The MS2 spectrum has wrong parent features! The feature does not touch the spectrum's RT!") if (MS2_RT_time < elution_bounds[1] || elution_bounds[3] < MS2_RT_time) { LOG_WARN << "Warn: requesting MS2 RT for " << MS2_RT_time << ", but bounds are only from [" << elution_bounds[1] << "," << elution_bounds[3] << "]\n"; return 0; } // do linear interpolation double width = elution_bounds[3] - elution_bounds[1]; double offset = MS2_RT_time - elution_bounds[1]; Int index = floor(offset / (width / (elution_ints.size() - 1)) + 0.5); OPENMS_POSTCONDITION(index < (Int)elution_ints.size(), "Wrong index computation! (Too large)") return elution_ints[index]; }
p.setConvexHulls(hulls); p.getConvexHull(); //this pre-calculates the overall convex hull Feature::PositionType pos2; Feature::IntensityType i2; Feature copy_of_p(p); i2 = copy_of_p.getIntensity(); pos2 = copy_of_p.getPosition(); TEST_REAL_SIMILAR(i2, 123.456) TEST_REAL_SIMILAR(pos2[0], 21.21) TEST_REAL_SIMILAR(pos2[1], 22.22) TEST_EQUAL(p.getMetaValue("cluster_id"),DataValue(4711)); Feature::QualityType q2; q2 = copy_of_p.getOverallQuality(); TEST_REAL_SIMILAR(q2, 0.9) q2 = copy_of_p.getQuality(0); TEST_REAL_SIMILAR(q2, 0.1) q2 = copy_of_p.getQuality(1); TEST_REAL_SIMILAR(q2, 0.2) TEST_EQUAL(copy_of_p.getConvexHull().getHullPoints().size(),p.getConvexHull().getHullPoints().size()) TEST_EQUAL(copy_of_p.getConvexHulls().size(),p.getConvexHulls().size()) END_SECTION START_SECTION((Feature& operator = (const Feature& rhs))) Feature::PositionType pos; pos[0] = 21.21;