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

matchms networking: fix compatability with newer matchms tools #435

Closed
hechth opened this issue Nov 19, 2023 · 0 comments · Fixed by #436
Closed

matchms networking: fix compatability with newer matchms tools #435

hechth opened this issue Nov 19, 2023 · 0 comments · Fixed by #436
Assignees
Labels
bug Something isn't working

Comments

@hechth
Copy link
Member

hechth commented Nov 19, 2023

When running the networking on newer matchms output you get the following error:

Traceback (most recent call last):
  File "/opt/galaxy/shed_tools/toolshed.g2.bx.psu.edu/repos/recetox/matchms_networking/d8e937f335b8/matchms_networking/matchms_networking_wrapper.py", line 38, in <module>
    main(argv=sys.argv[1:])
  File "/opt/galaxy/shed_tools/toolshed.g2.bx.psu.edu/repos/recetox/matchms_networking/d8e937f335b8/matchms_networking/matchms_networking_wrapper.py", line 31, in main
    network.create_network(scores, args.score_name)
  File "/usr/local/tools/_conda/envs/__matchms@0.23.1/lib/python3.11/site-packages/matchms/networking/SimilarityNetwork.py", line 119, in create_network
    similars_idx, similars_scores = get_top_hits(scores, identifier_key=self.identifier_key,
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/tools/_conda/envs/__matchms@0.23.1/lib/python3.11/site-packages/matchms/networking/networking_functions.py", line 49, in get_top_hits
    r, _, v = scores.scores[:, i, score_name]
              ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
  File "/usr/local/tools/_conda/envs/__matchms@0.23.1/lib/python3.11/site-packages/sparsestack/StackedSparseArray.py", line 89, in __getitem__
    r, c, d = self._getitem_method(row, col, name)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/tools/_conda/envs/__matchms@0.23.1/lib/python3.11/site-packages/sparsestack/StackedSparseArray.py", line 110, in _getitem_method
    return self.row[idx], self.col[idx], self._slicing_data(name, idx)
                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/tools/_conda/envs/__matchms@0.23.1/lib/python3.11/site-packages/sparsestack/StackedSparseArray.py", line 131, in _slicing_data
    return self.data[name][idx]
           ~~~~~~~~~^^^^^^
ValueError: no field of name CosineGreedy_score

This can be fixed by looking for the proper score name in the scores object and then passing that one.

@hechth hechth self-assigned this Nov 19, 2023
@hechth hechth added the bug Something isn't working label Nov 19, 2023
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

Successfully merging a pull request may close this issue.

1 participant