| 266 | |
| 267 | |
| 268 | TextFile PercolatorInfile::preparePin_( |
| 269 | const vector<PeptideIdentification>& peptide_ids, |
| 270 | const StringList& feature_set, |
| 271 | const std::string& enz, |
| 272 | int min_charge, |
| 273 | int max_charge) |
| 274 | { |
| 275 | TextFile txt; |
| 276 | txt.addLine(ListUtils::concatenate(feature_set, '\t')); |
| 277 | if (peptide_ids.empty()) |
| 278 | { |
| 279 | OPENMS_LOG_WARN << "No identifications provided. Creating empty percolator input." << endl; |
| 280 | return txt; |
| 281 | } |
| 282 | |
| 283 | // extract native id (usually in spectrum_reference) |
| 284 | const String sid = getScanIdentifier(peptide_ids[0], 0); |
| 285 | |
| 286 | // determine RegEx to extract scan/index number |
| 287 | boost::regex scan_regex = boost::regex(SpectrumLookup::getRegExFromNativeID(sid)); |
| 288 | |
| 289 | // keep track of errors |
| 290 | size_t missing_meta_value_count{}; |
| 291 | set<String> missing_meta_values; |
| 292 | |
| 293 | size_t index = 0; |
| 294 | for (const PeptideIdentification& pep_id : peptide_ids) |
| 295 | { |
| 296 | index++; |
| 297 | // try to make a file and scan unique identifier |
| 298 | String scan_identifier = getScanIdentifier(pep_id, index); |
| 299 | String file_identifier = pep_id.getMetaValue("file_origin", String()); |
| 300 | |
| 301 | file_identifier += (String)pep_id.getMetaValue("id_merge_index", String()); |
| 302 | |
| 303 | Int scan_number = SpectrumLookup::extractScanNumber(scan_identifier, scan_regex, true); |
| 304 | |
| 305 | double exp_mass = pep_id.getMZ(); |
| 306 | double retention_time = pep_id.getRT(); |
| 307 | for (const PeptideHit& psm : pep_id.getHits()) |
| 308 | { |
| 309 | if (psm.getPeptideEvidences().empty()) |
| 310 | { |
| 311 | OPENMS_LOG_WARN << "PSM (PeptideHit) without protein reference found. " |
| 312 | << "This may indicate incomplete mapping during PeptideIndexing (e.g., wrong enzyme settings)." |
| 313 | << "Will skip this PSM." << endl; |
| 314 | continue; |
| 315 | } |
| 316 | PeptideHit hit(psm); // make a copy of the hit to store temporary features |
| 317 | hit.setMetaValue("SpecId", file_identifier + scan_identifier); |
| 318 | hit.setMetaValue("ScanNr", scan_number); |
| 319 | |
| 320 | if (!hit.metaValueExists("target_decoy") |
| 321 | || hit.getMetaValue("target_decoy").toString().empty()) |
| 322 | { |
| 323 | continue; |
| 324 | } |
| 325 |
nothing calls this directly
no test coverage detected