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

missing var_names in BasePlot #3460

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/scanpy/plotting/_baseplot_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,18 @@ def __init__(

self._update_var_groups()

# exlude var_names not present in adata.var_names
missing_var_names = set(self.var_names).difference(adata.var_names)
if missing_var_names:
logg.warning(
f"The following var_names are not present in adata.var_names: {missing_var_names}"
)
self.var_names = [
var_name
for var_name in self.var_names
if var_name not in missing_var_names
]

self.categories, self.obs_tidy = _prepare_dataframe(
adata,
self.var_names,
Expand Down
Loading