| 186 | } |
| 187 | |
| 188 | void FLASHDeconvFeatureFile::writePromexFeatures(const std::vector<FLASHDeconvHelperStructs::MassFeature>& mass_features, const std::map<int, PeakGroup>& precursor_peak_groups, |
| 189 | const std::map<int, double>& scan_rt_map, const FLASHDeconvHelperStructs::PrecalculatedAveragine& avg, std::fstream& fs) |
| 190 | { |
| 191 | int promexid = 1; |
| 192 | |
| 193 | auto per_isotope_intensity = std::vector<double>(avg.getMaxIsotopeIndex(), .0); |
| 194 | std::map<double, int> rt_scan_map; |
| 195 | for (auto const& item : scan_rt_map) |
| 196 | { |
| 197 | rt_scan_map[item.second] = item.first; |
| 198 | } |
| 199 | |
| 200 | for (auto& mass_feature : mass_features) |
| 201 | { |
| 202 | auto mt = mass_feature.mt; |
| 203 | double sum_intensity = .0; |
| 204 | |
| 205 | int min_scan_num = -1; |
| 206 | int max_scan_num = 0; |
| 207 | |
| 208 | for (auto& m : mt) |
| 209 | { |
| 210 | auto iter = rt_scan_map.lower_bound(m.getRT()); |
| 211 | if (iter != rt_scan_map.end()) |
| 212 | { |
| 213 | int scan = iter->second; |
| 214 | if (min_scan_num < 0) |
| 215 | { |
| 216 | min_scan_num = scan; |
| 217 | } |
| 218 | min_scan_num = std::min(min_scan_num, scan); |
| 219 | max_scan_num = std::max(max_scan_num, scan); |
| 220 | } |
| 221 | sum_intensity += m.getIntensity(); |
| 222 | } |
| 223 | |
| 224 | fs << promexid << "\t" << min_scan_num << "\t" << max_scan_num << "\t" << mass_feature.min_charge << "\t" << mass_feature.max_charge << "\t" << std::to_string(mt.getCentroidMZ()) << "\t" |
| 225 | << std::fixed << std::setprecision(2) << mass_feature.scan_number << "\t" << mass_feature.rep_charge << "\t" << mass_feature.rep_mz << "\t" << sum_intensity << "\t" |
| 226 | << mass_feature.scan_number << "\t" << sum_intensity << "\t" << mt.begin()->getRT() / 60.0 << "\t" << mt.rbegin()->getRT() / 60.0 << "\t" << mt.getTraceLength() / 60.0 << "\t"; |
| 227 | |
| 228 | int iso_end_index = 0; |
| 229 | |
| 230 | for (Size i = 0; i < mass_feature.per_isotope_intensity.size(); i++) |
| 231 | { |
| 232 | if (mass_feature.per_isotope_intensity[i] == 0) |
| 233 | { |
| 234 | continue; |
| 235 | } |
| 236 | iso_end_index = (int)i; |
| 237 | } |
| 238 | for (int i = 0; i <= iso_end_index; i++) |
| 239 | { |
| 240 | fs << i << "," << mass_feature.per_isotope_intensity[i]; |
| 241 | |
| 242 | if (i < iso_end_index) |
| 243 | { |
| 244 | fs << ";"; |
| 245 | } |
nothing calls this directly
no test coverage detected