| 1823 | { |
| 1824 | public: |
| 1825 | static vector<vector<double> > extractXICs(double seed_rt, vector<double> xic_mzs, double mz_toelrance_ppm, double rt_tolerance_s, const PeakMap& peak_map) |
| 1826 | { |
| 1827 | // point on first spectrum in tolerance window |
| 1828 | PeakMap::ConstIterator rt_begin = peak_map.RTBegin(seed_rt - rt_tolerance_s); |
| 1829 | |
| 1830 | // point on after last spectrum in tolerance window |
| 1831 | PeakMap::ConstIterator rt_end = peak_map.RTBegin(seed_rt + rt_tolerance_s); |
| 1832 | |
| 1833 | // create set containing all rts of spectra in tolerance window |
| 1834 | set<double> all_rts; |
| 1835 | for (PeakMap::ConstIterator rt_it = rt_begin; rt_it != rt_end; ++rt_it) |
| 1836 | { |
| 1837 | all_rts.insert(rt_it->getRT()); |
| 1838 | } |
| 1839 | |
| 1840 | vector<vector<double> > xics(xic_mzs.size(), vector<double>()); |
| 1841 | |
| 1842 | for (Size i = 0; i < xic_mzs.size(); ++i) |
| 1843 | { |
| 1844 | // create and initialize xic to contain values for all rts |
| 1845 | map<double, double> xic; // rt to summed intensity |
| 1846 | for (set<double>::const_iterator sit = all_rts.begin(); sit != all_rts.end(); ++sit) |
| 1847 | { |
| 1848 | xic[*sit] = 0; |
| 1849 | } |
| 1850 | |
| 1851 | double mz_da = mz_toelrance_ppm * xic_mzs[i] * 1e-6; // mz tolerance in Dalton |
| 1852 | PeakMap::ConstAreaIterator it = peak_map.areaBeginConst(seed_rt - rt_tolerance_s, seed_rt + rt_tolerance_s, xic_mzs[i] - mz_da, xic_mzs[i] + mz_da); |
| 1853 | |
| 1854 | for (; it != peak_map.areaEndConst(); ++it) |
| 1855 | { |
| 1856 | double rt = it.getRT(); |
| 1857 | if (xic.find(rt) != xic.end()) |
| 1858 | { |
| 1859 | xic[rt] += it->getIntensity(); |
| 1860 | } |
| 1861 | else |
| 1862 | { |
| 1863 | OPENMS_LOG_WARN << "RT: " << rt << " not contained in rt set." << endl; |
| 1864 | } |
| 1865 | } |
| 1866 | |
| 1867 | // copy map to vector for easier processing |
| 1868 | vector<double> v; |
| 1869 | for (map<double, double>::const_iterator xic_it = xic.begin(); xic_it != xic.end(); ++xic_it) |
| 1870 | { |
| 1871 | v.push_back(xic_it->second); |
| 1872 | } |
| 1873 | |
| 1874 | xics[i] = v; |
| 1875 | } |
| 1876 | return xics; |
| 1877 | } |
| 1878 | |
| 1879 | static vector<double> correlateXICsToMono(const vector<vector<double> >& xics) |
| 1880 | { |
nothing calls this directly
no test coverage detected