Skip to content

Commit

Permalink
fix: investigate hits edge case
Browse files Browse the repository at this point in the history
  • Loading branch information
tharwood3 committed Apr 24, 2024
1 parent d5daa2f commit ae0dab3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions metatlas/plots/dill2plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit ae0dab3

Please sign in to comment.