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

Support for mudata.uns? #52

Open
benemead opened this issue Sep 8, 2023 · 2 comments · May be fixed by #53
Open

Support for mudata.uns? #52

benemead opened this issue Sep 8, 2023 · 2 comments · May be fixed by #53
Labels
bug Something isn't working
Milestone

Comments

@benemead
Copy link

benemead commented Sep 8, 2023

Describe the bug
After a read of the mudata documentation it's unclear to me if mudata supports the .uns akin to anndata. I see that each .mod (anndata) supports .uns, but when I assign a .uns directly to the mdata object, the behavior is unpredictable - specifically, any slice of the mdata object results in a loss of any mdata.uns, but otherwise I am able to interact with mdata.uns as expected.

To Reproduce

adata_dict = {'RNA':scanpy.AnnData(X=np.zeros(100,50))}
mdata = MuData(adata_dict)

test_dict = { 'test':'dict'}

mdata.uns['test_dict'] = test_dict

mdata = mdata[:50,:]

mdata.uns

Expected behaviour

returns: {} versus the expected { 'test_dict':{'test':'dict'}}

System

  • OS: macOS Ventura 13.5.1
  • Python version 3.11.4
  • Versions of libraries involved:
  • scanpy 1.9.3
  • muon 0.1.5
@benemead benemead added the bug Something isn't working label Sep 8, 2023
@gtca gtca linked a pull request Sep 10, 2023 that will close this issue
5 tasks
@gtca gtca added this to the v0.3.0 milestone Sep 10, 2023
@gtca gtca linked a pull request Sep 10, 2023 that will close this issue
5 tasks
@gtca
Copy link
Collaborator

gtca commented Sep 10, 2023

Thanks for noticing and reporting that, @benemead! It's an easy fix, and it will be there with v0.3.

@leuschjanphilipp
Copy link

leuschjanphilipp commented Mar 19, 2024

Hi,
I'm running in an error i think connected this issue. When trying to retreive all keys in .uns with mdata.uns_keys() I'll get the following: AttributeError: 'MuData' object has no attribute '_uns' . You can fix this in file /mudata/_core/mudata.py if you change return list(self._uns.keys()) to return list(self.uns.keys()) (line 1193). Not sure whether its intended to be that way or whether in the init self._uns (line 137) should be used instead of self.uns like the rest (self._obs, self._var, ...) . Im running mudata 0.2.3.
Cheers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants