vitessce / vitessce-python

Python API and Jupyter widget for Vitessce
https://python-docs.vitessce.io
MIT License
40 stars 7 forks source link

Warn if AnnDataWrapper options are empty as it would result in empty list for `vc['datasets']['files']` #356

Open falexwolf opened 3 months ago

falexwolf commented 3 months ago

I didn't find a unit test for this, but I found a notebook in the repo:

image

When I run it and look at the dict I get an empty list for the files key under datasets.

image

I might be wrong, but I'm pretty sure this wasn't empty a few months ago. I tried to understand whether something might have changed, upgraded and downgraded vitessce to the latest and older versions, and played with different environments.

Before I continue debugging: Is 'files' supposed to be populated with the storage path? And if not, where did the storage path go?

Complete json

``` {'version': '1.0.15', 'name': 'Test dataset', 'description': 'Test description', 'datasets': [{'uid': 'A', 'name': 'test1', 'files': []}], 'coordinationSpace': {'dataset': {'A': 'A'}, 'embeddingType': {'A': 'UMAP'}}, 'layout': [{'component': 'obsSets', 'coordinationScopes': {'dataset': 'A'}, 'x': 3.0, 'y': 0.0, 'w': 3.0, 'h': 6.0}, {'component': 'obsSetSizes', 'coordinationScopes': {'dataset': 'A'}, 'x': 6.0, 'y': 0.0, 'w': 6.0, 'h': 6.0}, {'component': 'scatterplot', 'coordinationScopes': {'dataset': 'A', 'embeddingType': 'A'}, 'x': 0.0, 'y': 0.0, 'w': 3.0, 'h': 6.0}, {'component': 'heatmap', 'coordinationScopes': {'dataset': 'A'}, 'x': 0.0, 'y': 6.0, 'w': 6.0, 'h': 6.0}, {'component': 'featureList', 'coordinationScopes': {'dataset': 'A'}, 'x': 6.0, 'y': 6.0, 'w': 6.0, 'h': 6.0}], 'initStrategy': 'auto'} ```

Context: I ran into this working on the below

keller-mark commented 3 months ago

This if statement may be the issue https://github.com/vitessce/vitessce-python/blob/bc7b3537b638fef893014365894257d0f5e5caee/vitessce/wrappers.py#L1123 - it only appends the file if there is at least one option specified. This restriction is not exactly necessary but in most cases Vitessce needs more details about keys/paths within the AnnData object to load data

I have started a pull request here https://github.com/vitessce/vitessce-python/pull/357 with a test

falexwolf commented 3 months ago

Oh, thanks! That would make sense! I also have an integration test that populated paths. Will try it.

falexwolf commented 3 months ago

Yes, this was it! As soon as I add another parameter, it's back:

image

Could you print a warning if there is no additional parameter? It was hard for me to find out what's going on as the function was so silent. Otherwise, feel free to close this issue.

keller-mark commented 3 months ago

Ah that is a good idea, I will update the title