RECETOX / galaxytools

Set of Galaxy tool wrappers developed at RECETOX
MIT License
13 stars 13 forks source link

matchms_formatter only works when 'compound_name' is present #444

Closed chufz closed 4 months ago

chufz commented 10 months ago

Currently, the formatter only works when compound_name is given. However, sometimes spectral similarity is calculated without known compounds, leading to the error message:


  File "/gpfs1/data/galaxy_server/galaxy/shed_tools/toolshed.g2.bx.psu.edu/repos/recetox/matchms_formatter/37da26e798f2/matchms_formatter/formatter.py", line 51, in <module>
    cli()
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1137, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1062, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1646, in invoke
    super().invoke(ctx)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.9/site-packages/click/core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "/gpfs1/data/galaxy_server/galaxy/shed_tools/toolshed.g2.bx.psu.edu/repos/recetox/matchms_formatter/37da26e798f2/matchms_formatter/formatter.py", line 45, in cli
    result = load_data(scores_filename)
  File "/gpfs1/data/galaxy_server/galaxy/shed_tools/toolshed.g2.bx.psu.edu/repos/recetox/matchms_formatter/37da26e798f2/matchms_formatter/formatter.py", line 36, in load_data
    scores = scores_to_dataframe(scores)
  File "/gpfs1/data/galaxy_server/galaxy/shed_tools/toolshed.g2.bx.psu.edu/repos/recetox/matchms_formatter/37da26e798f2/matchms_formatter/formatter.py", line 19, in scores_to_dataframe
    data.append([scores.queries[col].metadata['compound_name'], scores.references[row].metadata['compound_name'], *scores.scores.data[i]])
KeyError: 'compound_name' ```
hechth commented 10 months ago

@chufz have you tried running matchms convert or filter on your inputs? that might help

chufz commented 10 months ago

Yes i converted with matchms convert to the msp in matchms format in advance

hechth commented 10 months ago

Okay - we can add an option to choose a different column

bgruening commented 10 months ago

data_column might be useful here: https://docs.galaxyproject.org/en/latest/dev/schema.html#id33

hechth commented 4 months ago

@zargham-ahmad is this still the case? Didn't we include a key in the latest version?

zargham-ahmad commented 4 months ago

@hechth yes, this can be closed we added an optional key parameter in the latest version