We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Describe the bug Running mu.pp.filter_obs results in a ValueError with the latest AnnData
mu.pp.filter_obs
ValueError
To Reproduce
import scanpy as sc import muon as mu adata = sc.datasets.pbmc3k_processed() mdata = mu.MuData({ "A": adata[:500, ].copy(), "B": adata[500:, ].copy() }) mu.pp.filter_obs(mdata, "A:louvain", lambda x: x == "B cells")
--------------------------------------------------------------------------- ValueError Traceback (most recent call last) Cell In[22], [line 1](vscode-notebook-cell:?execution_count=22&line=1) ----> [1](vscode-notebook-cell:?execution_count=22&line=1) mu.pp.filter_obs(mdata, "A:louvain", lambda x: x == "B cells") File ~/apps/micromamba/envs/test_scirpy/lib/python3.11/site-packages/muon/_core/preproc.py:763, in filter_obs(data, var, func) [761](https://file+.vscode-resource.vscode-cdn.net/home/sturm/projects/2020/scirpy/docs/tutorials/~/apps/micromamba/envs/test_scirpy/lib/python3.11/site-packages/muon/_core/preproc.py:761) obsmap = data.obsmap[m][obs_subset] [762](https://file+.vscode-resource.vscode-cdn.net/home/sturm/projects/2020/scirpy/docs/tutorials/~/apps/micromamba/envs/test_scirpy/lib/python3.11/site-packages/muon/_core/preproc.py:762) obsidx = obsmap > 0 --> [763](https://file+.vscode-resource.vscode-cdn.net/home/sturm/projects/2020/scirpy/docs/tutorials/~/apps/micromamba/envs/test_scirpy/lib/python3.11/site-packages/muon/_core/preproc.py:763) filter_obs(mod, mod.obs_names[obsmap[obsidx] - 1]) [764](https://file+.vscode-resource.vscode-cdn.net/home/sturm/projects/2020/scirpy/docs/tutorials/~/apps/micromamba/envs/test_scirpy/lib/python3.11/site-packages/muon/_core/preproc.py:764) maporder = np.argsort(obsmap[obsidx]) [765](https://file+.vscode-resource.vscode-cdn.net/home/sturm/projects/2020/scirpy/docs/tutorials/~/apps/micromamba/envs/test_scirpy/lib/python3.11/site-packages/muon/_core/preproc.py:765) nobsmap = np.empty(maporder.size) File ~/apps/micromamba/envs/test_scirpy/lib/python3.11/site-packages/muon/_core/preproc.py:728, in filter_obs(data, var, func) [725](https://file+.vscode-resource.vscode-cdn.net/home/sturm/projects/2020/scirpy/docs/tutorials/~/apps/micromamba/envs/test_scirpy/lib/python3.11/site-packages/muon/_core/preproc.py:725) data._n_obs = data.obs.shape[0] [727](https://file+.vscode-resource.vscode-cdn.net/home/sturm/projects/2020/scirpy/docs/tutorials/~/apps/micromamba/envs/test_scirpy/lib/python3.11/site-packages/muon/_core/preproc.py:727) # Subset .obsm --> [728](https://file+.vscode-resource.vscode-cdn.net/home/sturm/projects/2020/scirpy/docs/tutorials/~/apps/micromamba/envs/test_scirpy/lib/python3.11/site-packages/muon/_core/preproc.py:728) for k, v in data.obsm.items(): [729](https://file+.vscode-resource.vscode-cdn.net/home/sturm/projects/2020/scirpy/docs/tutorials/~/apps/micromamba/envs/test_scirpy/lib/python3.11/site-packages/muon/_core/preproc.py:729) data.obsm[k] = v[obs_subset] [731](https://file+.vscode-resource.vscode-cdn.net/home/sturm/projects/2020/scirpy/docs/tutorials/~/apps/micromamba/envs/test_scirpy/lib/python3.11/site-packages/muon/_core/preproc.py:731) # Subset .obsp File ~/apps/micromamba/envs/test_scirpy/lib/python3.11/site-packages/anndata/_core/aligned_mapping.py:422, in AlignedMappingProperty.__get__(self, obj, objtype) [420](https://file+.vscode-resource.vscode-cdn.net/home/sturm/projects/2020/scirpy/docs/tutorials/~/apps/micromamba/envs/test_scirpy/lib/python3.11/site-packages/anndata/_core/aligned_mapping.py:420) return self # type: ignore [421](https://file+.vscode-resource.vscode-cdn.net/home/sturm/projects/2020/scirpy/docs/tutorials/~/apps/micromamba/envs/test_scirpy/lib/python3.11/site-packages/anndata/_core/aligned_mapping.py:421) if not obj.is_view: --> [422](https://file+.vscode-resource.vscode-cdn.net/home/sturm/projects/2020/scirpy/docs/tutorials/~/apps/micromamba/envs/test_scirpy/lib/python3.11/site-packages/anndata/_core/aligned_mapping.py:422) return self.construct(obj, store=getattr(obj, f"_{self.name}")) [423](https://file+.vscode-resource.vscode-cdn.net/home/sturm/projects/2020/scirpy/docs/tutorials/~/apps/micromamba/envs/test_scirpy/lib/python3.11/site-packages/anndata/_core/aligned_mapping.py:423) parent_anndata = obj._adata_ref [424](https://file+.vscode-resource.vscode-cdn.net/home/sturm/projects/2020/scirpy/docs/tutorials/~/apps/micromamba/envs/test_scirpy/lib/python3.11/site-packages/anndata/_core/aligned_mapping.py:424) idxs = (obj._oidx, obj._vidx) ... ---> [97](https://file+.vscode-resource.vscode-cdn.net/home/sturm/projects/2020/scirpy/docs/tutorials/~/apps/micromamba/envs/test_scirpy/lib/python3.11/site-packages/anndata/_core/aligned_mapping.py:97) raise ValueError(msg) [99](https://file+.vscode-resource.vscode-cdn.net/home/sturm/projects/2020/scirpy/docs/tutorials/~/apps/micromamba/envs/test_scirpy/lib/python3.11/site-packages/anndata/_core/aligned_mapping.py:99) name = f"{self.attrname.title().rstrip('s')} {key!r}" [100](https://file+.vscode-resource.vscode-cdn.net/home/sturm/projects/2020/scirpy/docs/tutorials/~/apps/micromamba/envs/test_scirpy/lib/python3.11/site-packages/anndata/_core/aligned_mapping.py:100) return coerce_array(val, name=name, allow_df=self._allow_df) ValueError: Value passed for key 'X_pca' is of incorrect shape. Values of obsm must match dimensions ('obs',) of parent. Value had shape (500,) while it should have had (69,).
Expected behaviour Filter the mudata object as this has worked previously
System
anndata==0.10.9 mudata==0.3.1 muon==0.1.6 scanpy==1.10.2
The text was updated successfully, but these errors were encountered:
@gtca Can we have a call about this? I will keep trying to fix this but I'm have some questions
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Describe the bug
Running
mu.pp.filter_obs
results in aValueError
with the latest AnnDataTo Reproduce
Expected behaviour
Filter the mudata object as this has worked previously
System
The text was updated successfully, but these errors were encountered: