From d52b9232ced3794e6fc2afd2f3f726098e978f37 Mon Sep 17 00:00:00 2001 From: Isaac Virshup Date: Thu, 28 May 2020 14:30:05 +1000 Subject: [PATCH] Fix colors being changed by subsetting --- anndata/_core/anndata.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/anndata/_core/anndata.py b/anndata/_core/anndata.py index c2fc8935e..6669129ec 100644 --- a/anndata/_core/anndata.py +++ b/anndata/_core/anndata.py @@ -4,7 +4,7 @@ import warnings import collections.abc as cabc from collections import OrderedDict -from copy import deepcopy +from copy import copy, deepcopy from enum import Enum from functools import singledispatch from pathlib import Path @@ -351,7 +351,7 @@ def _init_as_view(self, adata_ref: "AnnData", oidx: Index, vidx: Index): self._varp = adata_ref.varp._view(self, vidx) # Speical case for old neighbors, backwards compat. Remove in anndata 0.8. uns_new = _slice_uns_sparse_matrices( - adata_ref._uns, self._oidx, adata_ref.n_obs + copy(adata_ref._uns), self._oidx, adata_ref.n_obs ) # fix categories self._remove_unused_categories(adata_ref.obs, obs_sub, uns_new)