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

Method getFullProteins_

src/openms/source/FORMAT/OSWFile.cpp:509–581  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

507 }
508
509 void OSWFile::getFullProteins_(OSWData& swath_result, Size index)
510 {
511 String protein_subselect;
512 if (index == ALL_PROTEINS)
513 {
514 swath_result.clearProteins();
515 protein_subselect = "PROTEIN";
516 }
517 else
518 { // do not use accession to filter -- its as slow as full query
519 protein_subselect = "(select * from PROTEIN where ID = " + String(swath_result.getProteins().at(index).getID()) + ") as PROTEIN";
520 }
521
522
523 // check of SCORE_MS2 table is available (for OSW files which underwent pyProphet)
524 // set q_value to -1 if missing
525 String MS2_select = (has_SCOREMS2_ ? "SCORE_MS2.QVALUE as qvalue" : "-1 as qvalue");
526 String MS2_join = (has_SCOREMS2_ ? "inner join(select * from SCORE_MS2) as SCORE_MS2 on SCORE_MS2.FEATURE_ID = FEATURE.ID" : "");
527
528 // assemble the protein-PeptidePrecursor-Feature hierarchy
529 // note: when changing the query, make sure to keep the indices in ColProteinSelect in sync!!!
530 String select_sql = "select PROTEIN.ID as prot_id, PROTEIN_ACCESSION as prot_accession, PROTEIN.DECOY as decoy, "
531 " PEPTIDE.MODIFIED_SEQUENCE as modified_sequence,"
532 " PRECURSOR.ID as prec_id, PRECURSOR.PRECURSOR_MZ as pc_mz, PRECURSOR.CHARGE as pc_charge,"
533 " FEATURE.ID as feat_id, FEATURE.EXP_RT as rt_experimental, FEATURE.DELTA_RT as rt_delta, FEATURE.LEFT_WIDTH as rt_left_width, FEATURE.RIGHT_WIDTH as rt_right_width,"
534 " FeatTrMap.TRANSITION_ID as tr_id, " +
535 MS2_select +
536 " FROM " + protein_subselect +
537 " inner join(select* FROM PEPTIDE_PROTEIN_MAPPING) as PepProtMap on PepProtMap.PROTEIN_ID = PROTEIN.ID "
538 " inner join(select ID, MODIFIED_SEQUENCE FROM PEPTIDE) as PEPTIDE on PEPTIDE.ID = PepProtMap.PEPTIDE_ID "
539 " inner join(select * FROM PRECURSOR_PEPTIDE_MAPPING) as PrePepMap on PrePepMap.PEPTIDE_ID = PEPTIDE.ID "
540 " inner join(select * from PRECURSOR) as PRECURSOR on PRECURSOR.ID = PrePepMap.PRECURSOR_ID "
541 " inner join(select * from FEATURE) as FEATURE on FEATURE.PRECURSOR_ID = PRECURSOR.ID "
542 " inner join(select * from FEATURE_TRANSITION) as FeatTrMap on FeatTrMap.FEATURE_ID = FEATURE.ID " +
543 MS2_join +
544 " order by prot_id, prec_id, feat_id, qvalue, tr_id ";
545
546
547 sqlite3_stmt* stmt;
548 conn_.prepareStatement(&stmt, select_sql);
549
550 Sql::SqlState rc = Sql::nextRow(stmt);
551 if (sqlite3_column_count(stmt) != SIZE_OF_ColProteinSelect)
552 {
553 throw Exception::SqlOperationFailed(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "Query was changed! Please report this bug!");
554 }
555
556 if (rc == Sql::SqlState::SQL_DONE)
557 { // no data
558 return;
559 }
560
561 LineState current_line;
562 initLine(current_line, stmt);
563 OSWProtein prot;
564
565 if (index == ALL_PROTEINS)
566 {

Callers

nothing calls this directly

Calls 9

nextRowFunction · 0.85
initLineFunction · 0.85
nextProteinFunction · 0.85
clearProteinsMethod · 0.80
getIDMethod · 0.80
atMethod · 0.80
prepareStatementMethod · 0.80
StringClass · 0.50
addProteinMethod · 0.45

Tested by

no test coverage detected