Skip to content

Commit

Permalink
fixed a bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Intron7 committed Aug 31, 2023
1 parent cd36f11 commit f16a416
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions anndata/_core/anndata.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""\
Expand Down Expand Up @@ -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__(
Expand Down

0 comments on commit f16a416

Please sign in to comment.