From f16a41663132d3fb2099760b9c1ae80a4c5850cb Mon Sep 17 00:00:00 2001 From: Intron7 Date: Thu, 31 Aug 2023 17:26:09 +0200 Subject: [PATCH] fixed a bug --- anndata/_core/anndata.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/anndata/_core/anndata.py b/anndata/_core/anndata.py index d61391512..e612bf2a2 100644 --- a/anndata/_core/anndata.py +++ b/anndata/_core/anndata.py @@ -1280,12 +1280,13 @@ def _inplace_subset_var(self, index): self._remove_unused_categories(self.var, var_sub, uns) self._var = pd.DataFrame(var_sub) self._uns = uns - + if self.layers: for key, matrix in self.layers.items(): self.layers[key] = matrix[:, var_dx].reshape(self.n_obs, y_dim) self._varm = self.varm._view(self, (var_dx,)).copy() self._varp = self.varp._view(self, var_dx).copy() + self._is_view = False def _inplace_subset_obs(self, index): """\ @@ -1318,7 +1319,8 @@ def _inplace_subset_obs(self, index): self._obsm = self.obsm._view(self, (obs_dx,)).copy() self._obsp = self.obsp._view(self, obs_dx).copy() if self.raw: - self.raw = self.raw[obs_dx, :] + self.raw = self.raw[obs_dx, :].copy() + self._is_view = False # TODO: Update, possibly remove def __setitem__(