void getAveragineIsotopeDistribution(double product_mz, std::vector<std::pair<double, double> >& isotopesSpec, double charge, int nr_isotopes, double mannmass) { typedef OpenMS::FeatureFinderAlgorithmPickedHelperStructs::TheoreticalIsotopePattern TheoreticalIsotopePattern; // create the theoretical distribution IsotopeDistribution d; TheoreticalIsotopePattern isotopes; d.setMaxIsotope(nr_isotopes); //std::cout << product_mz * charge << std::endl; d.estimateFromPeptideWeight(product_mz * charge); double mass = product_mz; for (IsotopeDistribution::Iterator it = d.begin(); it != d.end(); ++it) { isotopesSpec.push_back(std::make_pair(mass, it->second)); mass += mannmass; } } //end of dia_isotope_corr_sub
IsotopeDistributionCache::IsotopeDistributionCache(DoubleReal max_mass, DoubleReal mass_window_width, DoubleReal intensity_percentage, DoubleReal intensity_percentage_optional) : mass_window_width_(mass_window_width) { Size num_isotopes = std::ceil(max_mass / mass_window_width) + 1; //reserve enough space isotope_distributions_.resize(num_isotopes); //calculate distribution if necessary for (Size index = 0; index < num_isotopes; ++index) { //log_ << "Calculating iso dist for mass: " << 0.5*mass_window_width_ + index * mass_window_width_ << std::endl; IsotopeDistribution d; d.setMaxIsotope(20); d.estimateFromPeptideWeight(0.5 * mass_window_width + index * mass_window_width); //trim left and right. And store the number of isotopes on the left, to reconstruct the monoisotopic peak Size size_before = d.size(); d.trimLeft(intensity_percentage_optional); isotope_distributions_[index].trimmed_left = size_before - d.size(); d.trimRight(intensity_percentage_optional); for (IsotopeDistribution::Iterator it = d.begin(); it != d.end(); ++it) { isotope_distributions_[index].intensity.push_back(it->second); //log_ << " - " << it->second << std::endl; } //determine the number of optional peaks at the beginning/end Size begin = 0; Size end = 0; bool is_begin = true; bool is_end = false; for (Size i = 0; i < isotope_distributions_[index].intensity.size(); ++i) { if (isotope_distributions_[index].intensity[i] < intensity_percentage) { if (!is_end && !is_begin) is_end = true; if (is_begin) ++begin; else if (is_end) ++end; } else if (is_begin) { is_begin = false; } } isotope_distributions_[index].optional_begin = begin; isotope_distributions_[index].optional_end = end; //scale the distibution to a maximum of 1 DoubleReal max = 0.0; for (Size i = 0; i < isotope_distributions_[index].intensity.size(); ++i) { if (isotope_distributions_[index].intensity[i] > max) { max = isotope_distributions_[index].intensity[i]; } } isotope_distributions_[index].max = max; for (Size i = 0; i < isotope_distributions_[index].intensity.size(); ++i) { isotope_distributions_[index].intensity[i] /= max; } } }