Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

groupby is converted to a list before adding as dendrogram key #1465

Merged
merged 7 commits into from
Oct 24, 2020
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion scanpy/plotting/_anndata.py
Original file line number Diff line number Diff line change
Expand Up @@ -2112,7 +2112,10 @@ def _get_dendrogram_key(adata, dendrogram_key, groupby):
# the `dendrogram_key` can be a bool an NoneType or the name of the
# dendrogram key. By default the name of the dendrogram key is 'dendrogram'
if not isinstance(dendrogram_key, str):
dendrogram_key = f'dendrogram_{groupby}'
if isinstance(groupby, str):
dendrogram_key = f'dendrogram_{groupby}'
elif isinstance(groupby, list):
dendrogram_key = f'dendrogram_{"_".join(groupby)}'

if dendrogram_key not in adata.uns:
from ..tools._dendrogram import dendrogram
Expand Down
5 changes: 4 additions & 1 deletion scanpy/tools/_dendrogram.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,10 @@ def dendrogram(

if inplace:
if key_added is None:
key_added = f'dendrogram_{groupby}'
if len(groupby) == 1:
key_added = f'dendrogram_{groupby[0]}'
else:
key_added = f'dendropgram_{"_".join(groupby)}'
gokceneraslan marked this conversation as resolved.
Show resolved Hide resolved
logg.info(f'Storing dendrogram info using `.uns[{key_added!r}]`')
adata.uns[key_added] = dat
else:
Expand Down