MCPcopy Create free account
hub / github.com/OpenMS/OpenMS / nextProtein

Function nextProtein

src/openms/source/FORMAT/OSWFile.cpp:415–507  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

413
414
415 bool nextProtein(OSWProtein& prot, sqlite3_stmt* stmt, Sql::SqlState& rc, LineState& old_line)
416 {
417 LineState new_line;
418 // PROTEIN
419 std::vector<OSWPeptidePrecursor> precursors;
420 OSWPeptidePrecursor new_pc;
421 auto check_add_protein = [&](bool add_force = false)
422 {
423 precursors.push_back(new_pc); // the last PC already belonged to the old protein
424 if (old_line.prot_id != new_line.prot_id || add_force)
425 {
426 prot = OSWProtein(old_line.accession, old_line.prot_id, std::move(precursors));
427 old_line.updateProt(new_line);
428 precursors.clear();
429 return true;
430 }
431 return false;
432 };
433 // ... PRECURSOR
434 std::vector<OSWPeakGroup> features;
435 OSWPeakGroup new_feature;
436 auto check_add_pc = [&](bool add_force = false)
437 {
438 features.push_back(std::move(new_feature)); // the last feature belonged to the old PC
439 if (old_line.prec_id != new_line.prec_id || add_force)
440 {
441 new_pc = OSWPeptidePrecursor(old_line.seq, old_line.chargePC, old_line.decoy, old_line.precmz, std::move(features));
442 old_line.updatePC(new_line);
443 features.clear();
444 return true;
445 }
446 return false;
447 };
448
449 // ... FEATURE
450 std::vector<UInt32> transition_ids;
451 UInt32 new_transition;
452 auto check_add_feat = [&](bool add_force = false)
453 {
454 if (old_line.feat_id != new_line.feat_id || add_force)
455 {
456 new_feature = OSWPeakGroup(old_line.rt_exp, old_line.rt_lw, old_line.rt_rw, old_line.rt_delta, std::move(transition_ids), old_line.qvalue);
457 old_line.updateFeat(new_line);
458 transition_ids.clear();
459 return true;
460 }
461 else
462 { // if we enter the above block, we will parse the same sql row in the next iteration, so only add the tr-ID if its not a new block
463 transition_ids.push_back(new_transition); // the current transition belongs to the current feature...
464 }
465 return false;
466 };
467
468 // protein loop
469 while (rc == Sql::SqlState::SQL_ROW)
470 {
471 // precursor loop (peptide with charge)
472 while (rc == Sql::SqlState::SQL_ROW)

Callers 1

getFullProteins_Method · 0.85

Calls 13

OSWProteinFunction · 0.85
OSWPeptidePrecursorFunction · 0.85
OSWPeakGroupFunction · 0.85
extractIntFunction · 0.85
nextRowFunction · 0.85
updateProtMethod · 0.80
updatePCMethod · 0.80
updateFeatMethod · 0.80
setPCMethod · 0.80
setProtMethod · 0.80
push_backMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected