Adding "Mixed" category for neighborhood annotation does not add a color for it in .uns["cell_type_colors"] of AnnData. This causes error ValueError: The palette dictionary is missing keys: {'Mixed'}
I don't have a short way to reproduce it, but I received it after running the following code from the best practices book chapter with my data:
milo.annotate_nhoods(mdata, anno_col="cell_label")
# Define as mixed if fraction of cells in nhood with same label is lower than 0.75
mdata["milo"].var.loc[
mdata["milo"].var["nhood_annotation_frac"] < 0.75, "nhood_annotation"
] = "Mixed"
Report
I have 2 errors.
.uns["cell_type_colors"]
of AnnData. This causes errorValueError: The palette dictionary is missing keys: {'Mixed'}
I don't have a short way to reproduce it, but I received it after running the following code from the best practices book chapter with my data:
The full traceback:
Version information
adjustText 1.0.4 anndata 0.10.5.post1 matplotlib 3.8.3 mudata 0.2.3 numpy 1.26.4 pandas 2.2.0 pertpy 0.6.0 scanpy 1.10.0.dev217+g1ac74a78 scipy 1.12.0 seaborn 0.13.2 session_info 1.0.0
PIL 10.2.0 absl NA arviz 0.17.0 asciitree NA asttokens NA attr 23.2.0 bokeh 3.3.4 brotli 1.1.0 certifi 2024.02.02 cffi 1.16.0 chardet 5.2.0 charset_normalizer 3.3.2 chex 0.1.85 cloudpickle 3.0.0 colorama 0.4.6 comm 0.2.1 contextlib2 NA cycler 0.12.1 cython_runtime NA cytoolz 0.12.3 dask 2024.2.0 dateutil 2.8.2 debugpy 1.8.1 decorator 5.1.1 decoupler 1.6.0 docrep 0.3.2 etils 1.7.0 exceptiongroup 1.2.0 executing 2.0.1 flax 0.8.1 fsspec 2024.2.0 gmpy2 2.1.2 h5py 3.10.0 idna 3.6 igraph 0.11.4 importlib_metadata NA importlib_resources NA ipykernel 6.29.2 ipywidgets 8.1.2 jax 0.4.19 jaxlib 0.4.19.dev20231025 jaxopt NA jedi 0.19.1 jinja2 3.1.3 joblib 1.3.2 kiwisolver 1.4.5 legacy_api_wrap NA leidenalg 0.10.2 lightning 2.2.0.post0 lightning_fabric 2.1.3 lightning_utilities 0.10.1 llvmlite 0.42.0 lz4 4.3.3 markupsafe 2.1.5 matplotlib_inline 0.1.6 mizani 0.11.0 ml_collections NA ml_dtypes 0.3.2 mpl_toolkits NA mpmath 1.3.0 msgpack 1.0.7 multipledispatch 0.6.0 natsort 8.4.0 numba 0.59.0 numcodecs 0.12.1 numpyro 0.13.2 opt_einsum v3.3.0 optax 0.1.9 ott 0.4.5 packaging 23.2 parso 0.8.3 patsy 0.5.6 pickleshare 0.7.5 pkg_resources NA platformdirs 3.11.0 plotnine 0.13.0 ply 3.11 prompt_toolkit 3.0.42 psutil 5.9.8 pure_eval 0.2.2 pyarrow 13.0.0 pycparser 2.21 pydev_ipython NA pydevconsole NA pydevd 2.9.5 pydevd_file_utils NA pydevd_plugins NA pydevd_tracing NA pygments 2.17.2 pynndescent 0.5.11 pyomo 6.7.0 pyparsing 3.1.1 pyro 1.9.0 pytorch_lightning 2.1.3 pytz 2024.1 requests 2.31.0 rich NA rpy2 3.5.15 scvi 1.1.1 six 1.16.0 sklearn 1.4.1.post1 skmisc 0.3.1 socks 1.7.1 sparse 0.15.1 sparsecca 0.3.1 stack_data 0.6.2 statsmodels 0.14.1 sympy 1.12 tblib 3.0.0 texttable 1.7.0 threadpoolctl 3.3.0 tlz 0.12.3 toolz 0.12.1 torch 2.2.0 torchaudio 2.2.0 torchgen NA torchmetrics 1.2.1 torchvision 0.17.0 torio NA tornado 6.3.3 tqdm 4.66.2 traitlets 5.14.1 typing_extensions NA tzdata 2024.1 tzlocal NA umap 0.5.5 urllib3 2.2.1 wcwidth 0.2.13 xarray 2024.2.0 xarray_einstats 0.7.0 xyzservices 2023.10.1 yaml 6.0.1 zarr 2.17.0 zipp NA zmq 25.1.2 zoneinfo NA
IPython 8.21.0 jupyter_client 8.6.0 jupyter_core 5.7.1
Python 3.10.13 | packaged by conda-forge | (main, Dec 23 2023, 15:36:39) [GCC 12.3.0] Linux-4.18.0-513.11.1.el8_9.x86_64-x86_64-with-glibc2.28
Session information updated at 2024-02-21 18:10