Skip to content

error at step: ds.plot_marker_heatmap  #117

Description

@JelenaKrneta

Describe the bug
After installing the latest version of python(3.12 (miniconda)) and the latest version of scarf (0.28.11),
basic workflow vignette fails at step: ds.plot_marker_heatmap with NotImplementedError :

NotImplementedError                       Traceback (most recent call last)
Cell In[32], line 1
----> 1 ds.plot_marker_heatmap(
      2 group_key='RNA_cluster',
      3 topn=5,
      4 figsize=(5, 9)
      5 )

File ~/miniconda3/envs/scarf_env/lib/python3.12/site-packages/scarf/datastore/datastore.py:1888, in DataStore.plot_marker_heatmap(self, from_assay, group_key, cell_key, topn, log_transform, vmin, vmax, savename, save_dpi, show_fig, **heatmap_kwargs)
   1884 normed_data = normed_data.to_dask_dataframe()
   1885 groups = daskarr.from_array(
   1886     assay.cells.fetch(group_key, cell_key), chunks=nc
   1887 ).to_dask_dataframe()
-> 1888 df = controlled_compute(normed_data.groupby(groups).mean(), self.nthreads)
   1889 df = df.apply(lambda x: (x - x.mean()) / x.std(), axis=0)
   1890 df.columns = assay.feats.fetch_all("names")[feat_idx]

File ~/miniconda3/envs/scarf_env/lib/python3.12/site-packages/dask_expr/_collection.py:2980, in DataFrame.groupby(self, by, group_keys, sort, observed, dropna, **kwargs)
   2975 if isinstance(by, FrameBase) and not isinstance(by, Series):
   2976     raise ValueError(
   2977         f"`by` must be a column name or list of columns, got {by}."
   2978     )
-> 2980 return GroupBy(
   2981     self,
   2982     by,
   2983     group_keys=group_keys,
   2984     sort=sort,
   2985     observed=observed,
   2986     dropna=dropna,
   2987     **kwargs,
   2988 )

File ~/miniconda3/envs/scarf_env/lib/python3.12/site-packages/dask_expr/_groupby.py:1508, in GroupBy.__init__(self, obj, by, group_keys, sort, observed, dropna, slice)
   1506     by = [_clean_by_expr(obj, x) for x in by]
   1507 else:
-> 1508     by = _clean_by_expr(obj, by)
   1510 by_ = by if isinstance(by, (tuple, list)) else [by]
   1511 if any(isinstance(key, pd.Grouper) for key in by_):

File ~/miniconda3/envs/scarf_env/lib/python3.12/site-packages/dask_expr/_groupby.py:1325, in _clean_by_expr(obj, by)
   1323 elif isinstance(by, Series):
   1324     if not are_co_aligned(obj.expr, by.expr):
-> 1325         raise NotImplementedError(
   1326             "by must be in the DataFrames columns or aligned with the DataFrame."
   1327         )
   1328     return by.expr
   1330 # By is a column name, e.g. str or int

NotImplementedError: by must be in the DataFrames columns or aligned with the DataFrame.

To Reproduce

Please paste here the code necessary to reproduce the error you got. Remove this line

Scarf and Python version
0.28.11
3.12

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions