File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
ms2query/benchmarking/reference_methods Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -60,14 +60,17 @@ def select_inchikeys_with_highest_ms2deepscore(
6060 ms2deepscores = cosine_similarity_matrix (
6161 query_spectra .embeddings .embeddings , library_spectra .embeddings .embeddings
6262 )
63+ else :
64+ assert ms2deepscores .shape == (len (query_spectra .spectra ), len (library_spectra .spectra ))
6365
6466 max_ms2deepscores_per_inchikey = np .zeros (
6567 (ms2deepscores .shape [0 ], len (library_spectra .spectrum_indices_per_inchikey ))
6668 )
6769 for inchikey_index , spectrum_indexes in enumerate (library_spectra .spectrum_indices_per_inchikey .values ()):
6870 # For one library inchikey, get all the scores and calculate the maximum score with each query spectrum
6971 all_ms2deepscores_for_inchikey = ms2deepscores [:, spectrum_indexes ]
70- max_ms2deepscores_per_inchikey [inchikey_index ] = all_ms2deepscores_for_inchikey .max (axis = 1 )
72+ highest_score_per_inchikey = all_ms2deepscores_for_inchikey .max (axis = 1 )
73+ max_ms2deepscores_per_inchikey [:, inchikey_index ] = highest_score_per_inchikey
7174 inchikey_indexes_with_highest_ms2deepscore = np .argpartition (
7275 max_ms2deepscores_per_inchikey , - nr_of_inchikeys_to_select , axis = 1
7376 )[:, - nr_of_inchikeys_to_select :]
You can’t perform that action at this time.
0 commit comments