| 398 | } |
| 399 | |
| 400 | SimpleSearchEngineAlgorithm::ExitCodes SimpleSearchEngineAlgorithm::search(const String& in_mzML, const String& in_db, vector<ProteinIdentification>& protein_ids, vector<PeptideIdentification>& peptide_ids) const |
| 401 | { |
| 402 | boost::regex peptide_motif_regex(peptide_motif_); |
| 403 | |
| 404 | bool precursor_mass_tolerance_unit_ppm = (precursor_mass_tolerance_unit_ == "ppm"); |
| 405 | bool fragment_mass_tolerance_unit_ppm = (fragment_mass_tolerance_unit_ == "ppm"); |
| 406 | |
| 407 | ModifiedPeptideGenerator::MapToResidueType fixed_modifications = ModifiedPeptideGenerator::getModifications(modifications_fixed_); |
| 408 | ModifiedPeptideGenerator::MapToResidueType variable_modifications = ModifiedPeptideGenerator::getModifications(modifications_variable_); |
| 409 | |
| 410 | // load MS2 map |
| 411 | PeakMap spectra; |
| 412 | MzMLFile f; |
| 413 | //f.setLogType(log_type_); |
| 414 | |
| 415 | PeakFileOptions options; |
| 416 | options.clearMSLevels(); |
| 417 | options.addMSLevel(2); |
| 418 | f.getOptions() = options; |
| 419 | f.load(in_mzML, spectra); |
| 420 | spectra.sortSpectra(true); |
| 421 | |
| 422 | startProgress(0, 1, "Filtering spectra..."); |
| 423 | preprocessSpectra_(spectra, fragment_mass_tolerance_, fragment_mass_tolerance_unit_ppm); |
| 424 | endProgress(); |
| 425 | |
| 426 | // build multimap of precursor mass to scan index |
| 427 | multimap<double, Size> multimap_mass_2_scan_index; |
| 428 | for (PeakMap::ConstIterator s_it = spectra.begin(); s_it != spectra.end(); ++s_it) |
| 429 | { |
| 430 | int scan_index = s_it - spectra.begin(); |
| 431 | vector<Precursor> precursor = s_it->getPrecursors(); |
| 432 | |
| 433 | // there should only one precursor and MS2 should contain at least a few peaks to be considered (e.g. at least for every AA in the peptide) |
| 434 | if (precursor.size() == 1 && s_it->size() >= peptide_min_size_) |
| 435 | { |
| 436 | Size precursor_charge = precursor[0].getCharge(); |
| 437 | |
| 438 | if (precursor_charge < precursor_min_charge_ |
| 439 | || precursor_charge > precursor_max_charge_) |
| 440 | { |
| 441 | continue; |
| 442 | } |
| 443 | |
| 444 | double precursor_mz = precursor[0].getMZ(); |
| 445 | |
| 446 | // calculate precursor mass (optionally corrected for misassignment) and map it to MS scan index |
| 447 | for (int isotope_number : precursor_isotopes_) |
| 448 | { |
| 449 | double precursor_mass = (double) precursor_charge * precursor_mz - (double) precursor_charge * Constants::PROTON_MASS_U; |
| 450 | |
| 451 | // correct for monoisotopic misassignments of the precursor annotation |
| 452 | if (isotope_number != 0) { precursor_mass -= isotope_number * Constants::C13C12_MASSDIFF_U; } |
| 453 | |
| 454 | multimap_mass_2_scan_index.insert(make_pair(precursor_mass, scan_index)); |
| 455 | } |
| 456 | } |
| 457 | } |
no test coverage detected