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

[21.01] Fix setting metadata for some Loom files #12347

Merged

Conversation

nsoranzo
Copy link
Member

@nsoranzo nsoranzo commented Aug 14, 2021

Loom files created by recent versions of LoomExperiment Bioconductor package encode the Loom version in a binary array, which breaks metadata setting in Galaxy.

How to test the changes?

(Select all options that apply)

  • I've included appropriate automated tests.
  • This is a refactoring of components with existing test coverage.
  • Instructions for manual testing are as follows:
    1. [add testing steps and prerequisites here if you didn't write automated tests covering all your changes]

License

  • I agree to license these contributions under Galaxy's current license.
  • I agree to allow the Galaxy committers to license these and all my past contributions to the core galaxy codebase under the MIT license. If this condition is an issue, uncheck and just let us know why with an e-mail to [email protected].

@github-actions github-actions bot added this to the 21.05 milestone Aug 14, 2021
Add the second part in the following traceback:

```
DEBUG    galaxy.metadata:__init__.py:93 setting metadata externally failed for HistoryDatasetAssociation 1: Traceback (most recent call last):
  File "/usr/users/ga002/soranzon/software/nsoranzo_galaxy/lib/galaxy/model/metadata.py", line 246, in to_JSON_dict
    encoded_meta_dict = galaxy.model.custom_types.json_encoder.encode(meta_dict)
  File "/usr/lib/python3.8/json/encoder.py", line 199, in encode
    chunks = self.iterencode(o, _one_shot=True)
  File "/usr/lib/python3.8/json/encoder.py", line 257, in iterencode
    return _iterencode(o, 0)
  File "/usr/users/ga002/soranzon/software/nsoranzo_galaxy/lib/galaxy/model/custom_types.py", line 39, in default
    return json.JSONEncoder.default(self, obj)
  File "/usr/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type ndarray is not JSON serializable

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/users/ga002/soranzon/software/nsoranzo_galaxy/lib/galaxy/metadata/set_metadata.py", line 334, in set_metadata_portable
    dataset.metadata.to_JSON_dict(filename_out)  # write out results of set_meta
  File "/usr/users/ga002/soranzon/software/nsoranzo_galaxy/lib/galaxy/model/metadata.py", line 248, in to_JSON_dict
    raise Exception(f"Failed encoding metadata dictionary: {meta_dict}") from e
Exception: Failed encoding metadata dictionary: {'dbkey': '?', 'title': None, 'description': None, 'url': None, 'doi': None, 'loom_spec_version': array([b'2.0.1'], dtype='|S6'), 'shape': (5, 10), 'layers
_count': 0, 'layers_names': [], 'row_attrs_count': 1, 'row_attrs_names': ['rownames'], 'col_attrs_count': 2, 'col_attrs_names': ['colnames', 'colnames_factor'], 'col_graphs_count': 0, 'col_graphs_names':
 [], 'row_graphs_count': 0, 'row_graphs_names': []}
```
Loom files created by recent versions of LoomExperiment Bioconductor
package encode the Loom version in an binary array, which breaks
metadata setting in Galaxy.
@nsoranzo nsoranzo force-pushed the release_21.01_fix_Loom branch from ba676bb to 2915310 Compare September 7, 2021 12:16
@nsoranzo nsoranzo merged commit e905161 into galaxyproject:release_21.01 Sep 7, 2021
@nsoranzo nsoranzo deleted the release_21.01_fix_Loom branch September 7, 2021 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants