From 9329b228f18d97fbb06c2926477ef910812bff88 Mon Sep 17 00:00:00 2001 From: niekdejonge Date: Thu, 23 Nov 2023 23:46:37 +0100 Subject: [PATCH] Add get_ms2deepscore_embeddings (from sqlite) --- ms2query/query_from_sqlite_database.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ms2query/query_from_sqlite_database.py b/ms2query/query_from_sqlite_database.py index 83a6773d..648e4f3f 100644 --- a/ms2query/query_from_sqlite_database.py +++ b/ms2query/query_from_sqlite_database.py @@ -158,3 +158,14 @@ def contains_class_annotation(self) -> bool: if has_class_annotations is False: print("SQLite file does not contain compound class information (download a newer version)") return has_class_annotations + + def get_ms2deepscore_embeddings(self): + # Connect to the SQLite database + conn = sqlite3.connect(self.sqlite_file_name) + # Write an SQL query to select data from the table + query = "SELECT * FROM MS2Deepscore_embeddings" + # Use the read_sql_query function to execute the query and read the results into a DataFrame + ms2deepscore_embeddings = pd.read_sql_query(query, conn, index_col="spectrumid") + # Close the connection + conn.close() + return ms2deepscore_embeddings \ No newline at end of file