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

add h5ad assert test #18778

Closed
wants to merge 1 commit into from
Closed

Conversation

nilchia
Copy link
Contributor

@nilchia nilchia commented Sep 5, 2024

Current h5 assertions (has_h5_keys and has_h5_attribute) are not enough for an h5ad object. Because the tool developer needs to check the content of each group (like if "cell_type" is in "obs") not the main attribute (which is "{'encoding-type': 'anndata', 'encoding-version': '0.1.0'}" for all h5ad files), for more info please see the anndata documentation.

I had this problem when I wanted to assert those when updating scanpy.

I also wrote an issue.

I wrote a new assert for this and tested that locally and it worked (I added the test to my local planemo ".../planemo/lib64/python3.12/site-packages/galaxy/tool_util/verify/asserts/hdf5.py"

I hope I put it correctly here :)

License

  • I agree to license these and all my past contributions to the core galaxy codebase under the MIT license.

@bernt-matthias
Copy link
Contributor

I think to some extent the present assertions can already check groups. See the last entry here

<has_h5_keys keys="bins, chroms,indexes,pixels,chroms/length" />

But maybe I'm wrong.

@nilchia
Copy link
Contributor Author

nilchia commented Sep 5, 2024

for anndata file the has_h5_keys works fine and returns: ['X', 'layers', 'obs', 'obsm', 'obsp', 'uns', 'var', 'varm', 'varp']
(Although it returns all potential keys, whether they have any value in the anndata or not)

But has_h5_attribute is not a good assertion for anndata. It only returns the encoding-type and the encoding-version.

We need an assertion that checks the entries of a group. Like if I run sc.pp.pca() does it add X_PCA in obsm or not.

@bernt-matthias
Copy link
Contributor

We need an assertion that checks the entries of a group. Like if I run sc.pp.pca() does it add X_PCA in obsm or not.

Would the following work:

<has_h5_keys keys="obsm/X_PCA" />

@nilchia
Copy link
Contributor Author

nilchia commented Sep 6, 2024

That works :)
Thanks @bernt-matthias

@nilchia nilchia closed this Sep 6, 2024
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