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

Method readTransitions_

src/openms/source/FORMAT/OSWFile.cpp:615–655  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

613 }
614
615 void OSWFile::readTransitions_(OSWData& swath_result)
616 {
617 swath_result.clear();
618
619 Size count = conn_.countTableRows("RUN");
620 if (count != 1)
621 {
622 throw Exception::Precondition(__FILE__, __LINE__, OPENMS_PRETTY_FUNCTION, "Database '" + filename_ + "' contains more than one RUN. This is currently not supported!");
623 }
624
625 // Grab transitions first
626 // We do this separately, because the full sql query below will show transitions in duplicates, because many features might use the same XIC at different positions
627 const StringList colnames_tr = { "ID", "PRODUCT_MZ", "TYPE", "DECOY", "ANNOTATION" };
628 enum COLIDs
629 {
630 ID,
631 PRODUCT_MZ,
632 TYPE,
633 DECOY,
634 ANNOTATION
635 };
636
637 // does not make the query below any faster...
638 //conn.executeStatement("ANALYZE");
639
640 String select_transitions = "SELECT " + ListUtils::concatenate(colnames_tr, ",") + " FROM TRANSITION ORDER BY ID;";
641 sqlite3_stmt* stmt;
642 conn_.prepareStatement(&stmt, select_transitions);
643 Sql::SqlState rc = Sql::nextRow(stmt);
644 while (rc == Sql::SqlState::SQL_ROW)
645 {
646 OSWTransition tr(Sql::extractString(stmt, COLIDs::ANNOTATION),
647 Sql::extractInt(stmt, COLIDs::ID),
648 Sql::extractFloat(stmt, COLIDs::PRODUCT_MZ),
649 Sql::extractChar(stmt, COLIDs::TYPE),
650 Sql::extractInt(stmt, COLIDs::DECOY));
651 swath_result.addTransition(std::move(tr));
652 rc = Sql::nextRow(stmt);
653 }
654 sqlite3_finalize(stmt);
655 }
656
657} // namespace OpenMS

Callers

nothing calls this directly

Calls 10

concatenateFunction · 0.85
nextRowFunction · 0.85
extractStringFunction · 0.85
extractIntFunction · 0.85
extractFloatFunction · 0.85
extractCharFunction · 0.85
countTableRowsMethod · 0.80
prepareStatementMethod · 0.80
clearMethod · 0.45
addTransitionMethod · 0.45

Tested by

no test coverage detected