From 1913e5b5d5635f07019a400e7f8a51760a961eea Mon Sep 17 00:00:00 2001 From: niekdejonge Date: Wed, 7 Aug 2024 11:42:47 +0200 Subject: [PATCH 1/6] Handle compound_name is not given in metadata. --- ms2query/results_table.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/ms2query/results_table.py b/ms2query/results_table.py index 88e52d10..e6dfa413 100644 --- a/ms2query/results_table.py +++ b/ms2query/results_table.py @@ -127,18 +127,26 @@ def export_to_dataframe( selected_analogs = selected_analogs[ (selected_analogs["ms2query_model_prediction"] > minimal_ms2query_score)] nr_of_analogs = len(selected_analogs) - # Return None if know analogs are selected. + # Return None if no analogs are selected. if selected_analogs.empty: return None # For each analog the compound name is selected from sqlite metadata_dict = self.sqlite_library.get_metadata_from_sqlite(list(selected_analogs["spectrum_ids"])) - compound_name_list = [metadata_dict[analog_spectrum_id]["compound_name"] - for analog_spectrum_id - in list(selected_analogs["spectrum_ids"])] - smiles_list = [metadata_dict[analog_spectrum_id]["smiles"] - for analog_spectrum_id - in list(selected_analogs["spectrum_ids"])] + + compound_name_list = [] + for metadata in metadata_dict.values(): + if "compound_name" in metadata.keys(): + compound_name_list.append(metadata["compound_name"]) + else: + compound_name_list.append(None) + + smiles_list = [] + for metadata in metadata_dict.values(): + if "smiles" in metadata.keys(): + smiles_list.append(metadata["smiles"]) + else: + smiles_list.append(None) # Add inchikey and ms2query model prediction to results df # results_df = selected_analogs.loc[:, ["spectrum_ids", "ms2query_model_prediction", "inchikey"]] From 9f354acb118e851822f07e096559da656d474cfa Mon Sep 17 00:00:00 2001 From: niekdejonge Date: Tue, 6 Aug 2024 15:10:42 +0200 Subject: [PATCH 2/6] Set matchms version to max 0.26.4 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 0d2c4f3a..d68bfcd4 100644 --- a/setup.py +++ b/setup.py @@ -29,7 +29,7 @@ test_suite="tests", python_requires='>=3.9', install_requires=[ - "matchms>=0.24.0", + "matchms>=0.24.0,<=0.26.4", "numpy", "spec2vec>=0.6.0", "h5py", From e4b1b31dd50a3b7d3c312d5c734e40ae277be1e6 Mon Sep 17 00:00:00 2001 From: Niek de Jonge <76995965+niekdejonge@users.noreply.github.com> Date: Tue, 6 Aug 2024 18:14:48 +0200 Subject: [PATCH 3/6] set limit for skl2onnx --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index d68bfcd4..b9341f42 100644 --- a/setup.py +++ b/setup.py @@ -41,6 +41,7 @@ "tqdm", "matplotlib", "skl2onnx", + "onnx<1.16.2", "onnxruntime<1.16", # 1.16 breaks the code due to the issue https://github.com/iomega/ms2query/issues/208 ], extras_require={"dev": ["bump2version", From 3f6e36791e9c99c64fd94d139acfe5879db4f010 Mon Sep 17 00:00:00 2001 From: Niek de Jonge <76995965+niekdejonge@users.noreply.github.com> Date: Tue, 6 Aug 2024 18:29:39 +0200 Subject: [PATCH 4/6] Update __version__.py --- ms2query/__version__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ms2query/__version__.py b/ms2query/__version__.py index 77f1c8e6..51ed7c48 100644 --- a/ms2query/__version__.py +++ b/ms2query/__version__.py @@ -1 +1 @@ -__version__ = '1.5.0' +__version__ = '1.5.1' From 4cdf81fdfbe69cb6b5c03c5c68d26b5d31e02037 Mon Sep 17 00:00:00 2001 From: Niek de Jonge <76995965+niekdejonge@users.noreply.github.com> Date: Tue, 6 Aug 2024 18:30:46 +0200 Subject: [PATCH 5/6] Update CHANGELOG.md --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d40a050..65e1336a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 1.5.1 +### Fixed +- Set max matchms version, since breaking change was introduced (missing add_losses) +- Set max scipy version, since breaking change was introduced (for windows) + ## 1.5.0 ### Changed - MS2Query is now tested on python 3.9 and 3.10 instead of 3.8 and 3.9 From 57e438b980160d00762e2b3f784fbea8cc532e56 Mon Sep 17 00:00:00 2001 From: niekdejonge Date: Wed, 7 Aug 2024 11:55:03 +0200 Subject: [PATCH 6/6] Add to changelog --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65e1336a..c2b91e72 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## 1.5.2 +### Fixed +- Handle missing compound names. Previously MS2Query would break, when no compound name was available for an analog. + ## 1.5.1 ### Fixed - Set max matchms version, since breaking change was introduced (missing add_losses)