vitessce-python icon indicating copy to clipboard operation
vitessce-python copied to clipboard

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

Open falexwolf opened this issue 1 year ago • 4 comments

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

  • https://github.com/laminlabs/lamindb/pull/1799

falexwolf avatar Aug 07 '24 18:08 falexwolf

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

keller-mark avatar Aug 07 '24 18:08 keller-mark

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

falexwolf avatar Aug 07 '24 18:08 falexwolf

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.

falexwolf avatar Aug 07 '24 19:08 falexwolf

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

keller-mark avatar Aug 07 '24 20:08 keller-mark