You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
muon/_core/preproc.py in filter_obs(data, var, func)
733 # filter_obs() for each modality
734 for m, mod in data.mod.items():
--> 735 obsmap = data.obsmap[m][obs_subset]
736 obsmap = obsmap[obsmap != 0] - 1
737 filter_obs(mod, mod.obs_names[obsmap])
anndata/_core/aligned_mapping.py in __getitem__(self, key)
146
147 def __getitem__(self, key: str) -> V:
--> 148 return self._data[key]
149
150 def __setitem__(self, key: str, value: V):
KeyError: 'x'
Minimal working example:
import numpy as np
import muon as mu
x = mu.AnnData(X=np.random.normal(size=1000).reshape(-1, 100))
y = mu.AnnData(X=np.random.normal(size=2000).reshape(-1, 100))
md = mu.MuData({"x": x, "y": y})
md['x'].obs['total_count'] = md['x'].X.sum(axis=1)
md['x'].obs['min_count'] = md['x'].X.min(axis=1)
md.update()
# filter one of the modalities.
mu.pp.filter_obs(md, 'x:min_count', lambda x: (x < -2))
mu.pp.filter_obs(md, 'x:total_count', lambda x: (x >0))
If you put md.update() between the two filter statements it does work. But to me this is not ideal if you are filtering on lots of categories sequentially
Is this desired behaviour ot something that could be updated such that one could just one run update command after sequential filters??
OS: CentOS Linux release 7.8.2003 (Core)
Python 3.9.5
Versions of libraries involved
numpy 1.20.3
muon 0.1.1
Thanks!
The text was updated successfully, but these errors were encountered:
I want to perform multiple filtering steps on my object e.g.:
Error message:
Minimal working example:
If you put
md.update()
between the two filter statements it does work. But to me this is not ideal if you are filtering on lots of categories sequentiallyIs this desired behaviour ot something that could be updated such that one could just one run
update
command after sequential filters??Thanks!
The text was updated successfully, but these errors were encountered: