-
Notifications
You must be signed in to change notification settings - Fork 112
Open
Labels
bugSomething isn't workingSomething isn't working
Description
When calling velocity_clusters on an Anndata object, the call fails with an AttributeError if the value of the parameter match_with is not in the obs of the input data. (data.obs.drop is to remove 'clusters' from the example data provided by scv.datasets.pancreas(), which is the default value of match_with. The data where I originally found the bug does not have that column, though I am not at liberty to share that data.)
import scvelo as scv
data = scv.datasets.pancreas()
data.obs.drop(columns=['clusters'], inplace=True)
scv.pp.filter_and_normalize(data)
scv.pp.moments(data)
scv.tl.velocity(data)
scv.tl.velocity_graph(data)
scv.tl.velocity_clusters(data)Error output
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[6], line 1
----> 1 scv.tl.velocity_clusters(data)
File ~/scvelo/scvelo/tools/rank_velocity_genes.py:189, in velocity_clusters(data, vkey, match_with, sort_by, resolution, min_likelihood, copy)
187 vdata.obs["louvain"] = vc
188 else:
--> 189 vdata.obs["louvain"].cat.categories = np.arange(
190 len(vdata.obs["louvain"].cat.categories)
191 )
192 adata.obs[f"{vkey}_clusters"] = vdata.obs["louvain"].copy()
194 del vdata
File ~/miniforge3/envs/scvelo/lib/python3.12/site-packages/pandas/core/base.py:178, in NoNewAttributesMixin.__setattr__(self, key, value)
172 if getattr(self, "__frozen", False) and not (
173 key == "_cache"
174 or key in type(self).__dict__
175 or getattr(self, key, None) is not None
176 ):
177 raise AttributeError(f"You cannot add any new attribute '{key}'")
--> 178 object.__setattr__(self, key, value)
File ~/miniforge3/envs/scvelo/lib/python3.12/site-packages/pandas/core/accessor.py:99, in PandasDelegate._add_delegate_accessors.<locals>._create_delegator_property.<locals>._setter(self, new_values)
98 def _setter(self, new_values):
---> 99 return self._delegate_property_set(name, new_values)
File ~/miniforge3/envs/scvelo/lib/python3.12/site-packages/pandas/core/arrays/categorical.py:2915, in CategoricalAccessor._delegate_property_set(self, name, new_values)
2914 def _delegate_property_set(self, name: str, new_values): # type: ignore[override]
-> 2915 return setattr(self._parent, name, new_values)
AttributeError: property 'categories' of 'Categorical' object has no setterVersions
Calling scv.logging.print_version() gave the following error. Calling conda list gives the version of scvelo as 0.1.dev1238+g22b6e7e from PyPI.
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
Cell In[2], line 1
----> 1 scv.logging.print_version()
File ~/scvelo/scvelo/logging/_logging.py:187, in print_version()
185 def print_version():
186 """TODO."""
--> 187 from . import __version__
189 _write_log(
190 f"Running scvelo {__version__} "
191 f"(Python {python_version()}) on {datetime.now().strftime('%Y-%m-%d %H:%M')}.",
192 )
ImportError: cannot import name '__version__' from 'scvelo.logging' (/home/isaac/scvelo/scvelo/logging/__init__.py)Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working