Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BaseSimilarity.matrix method errors if all scores/matches are 0 #633

Open
tharwood3 opened this issue Apr 25, 2024 · 0 comments
Open

BaseSimilarity.matrix method errors if all scores/matches are 0 #633

tharwood3 opened this issue Apr 25, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@tharwood3
Copy link

Describe the bug
If the BaseSimilarity.matrix method is given two lists of spectrum objects which all have resulting scores of 0, and the array_type is set to "numpy", the indexing of the numpy score_array produces an error. When array_type is set to "sparse" no error is produced.

To Reproduce
Steps to reproduce the behavior:
Provide the BaseSimilarity.matrix method with two sets of spectra with no matching ions using the default array_type parameter.

Expected behavior
Output should give a numpy array with all zeros in the shape of the score_array.

Screenshots
matrix_method_error

Desktop (please complete the following information):

  • OS: cray_shasta_c
  • Version: 5.14.21-150400.24.81_12.0.87

Additional context
Looking at the source code, this seems to be caused from the BaseSimilarity.keep_score method filtering all scores resulting in the idx_row and idx_col lists remaining empty; which causes an error when they are used to index the score_array. Maybe bypass the keep_score method when the array_type == "numpy"?

Please let me know if any additional information is required. Thanks all for building and maintaining MatchMS! It is a great resource for the metabolomics community.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants