diff --git a/metatlas/plots/dill2plots.py b/metatlas/plots/dill2plots.py index 6ec6ae49..aebd5b8c 100644 --- a/metatlas/plots/dill2plots.py +++ b/metatlas/plots/dill2plots.py @@ -2260,8 +2260,13 @@ def get_hits_per_compound(cos: Type[CosineHungarian], inchi_key: str, filtered_msms_data = msms_data[msms_data['inchi_key']==inchi_key].reset_index(drop=True).drop(columns=['inchi_key', 'precursor_mz']).copy() - scores_matches = cos.matrix(filtered_msms_data.matchms_spectrum.tolist(), - filtered_msms_refs.matchms_spectrum.tolist()) + try: + scores_matches = cos.matrix(filtered_msms_data.matchms_spectrum.tolist(), + filtered_msms_refs.matchms_spectrum.tolist()) + except: + filtered_msms_data.to_json('failed_msms_data.json') + filtered_msms_refs.to_json('failed_msms_refs.json') + raise Excpetion("MatchMS Scoring Failed :(") inchi_msms_hits = pd.merge(filtered_msms_data, filtered_msms_refs.drop(columns=['name', 'adduct']), how='cross') inchi_msms_hits['score'] = scores_matches['score'].flatten()