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

Method storeIdentifiedCompounds_

src/openms/source/FORMAT/OMSFileStore.cpp:787–832  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

785
786
787 void OMSFileStore::storeIdentifiedCompounds_(const IdentificationData& id_data)
788 {
789 if (id_data.getIdentifiedCompounds().empty()) return;
790
791 if (!db_->tableExists("ID_IdentifiedMolecule"))
792 {
793 createTableIdentifiedMolecule_();
794 }
795 auto& query_molecule = *prepared_queries_["ID_IdentifiedMolecule"];
796 query_molecule.bind(":molecule_type_id", int(ID::MoleculeType::COMPOUND) + 1);
797
798 createTable_(
799 "ID_IdentifiedCompound",
800 "molecule_id INTEGER UNIQUE NOT NULL , " \
801 "formula TEXT, " \
802 "name TEXT, " \
803 "smile TEXT, " \
804 "inchi TEXT, " \
805 "FOREIGN KEY (molecule_id) REFERENCES ID_IdentifiedMolecule (id)");
806 SQLite::Statement query_compound(*db_, "INSERT INTO ID_IdentifiedCompound VALUES (" \
807 ":molecule_id, " \
808 ":formula, " \
809 ":name, " \
810 ":smile, " \
811 ":inchi)");
812 Key id = 1;
813 for (const ID::IdentifiedCompound& compound : id_data.getIdentifiedCompounds())
814 {
815 query_molecule.bind(":id", id);
816 query_molecule.bind(":identifier", compound.identifier);
817 execWithExceptionAndReset(query_molecule, 1, __LINE__, OPENMS_PRETTY_FUNCTION, "error inserting data");
818
819 query_compound.bind(":molecule_id", id);
820 query_compound.bind(":formula", compound.formula.toString());
821 query_compound.bind(":name", compound.name);
822 query_compound.bind(":smile", compound.name);
823 query_compound.bind(":inchi", compound.inchi);
824 execWithExceptionAndReset(query_compound, 1, __LINE__, OPENMS_PRETTY_FUNCTION, "error inserting data");
825
826
827 identified_compound_keys_[&compound] = id;
828 ++id;
829 }
830 storeScoredProcessingResults_(id_data.getIdentifiedCompounds(), "ID_IdentifiedMolecule",
831 identified_compound_keys_);
832 }
833
834
835 void OMSFileStore::storeIdentifiedSequences_(const IdentificationData& id_data)

Callers

nothing calls this directly

Calls 4

tableExistsMethod · 0.80
emptyMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected