I was using v1.0.0 before and I have recently updated squidpy to v1.2.3. Unfortunately ligrec plotting function doesn’t work anymore and I get an error message:
(f"Expected all groups to have the same number of interacting clusters, found {size}.")
AttributeError: ‘int’ object has no attribute ‘values’
I have v1.0.0 still installed in another conda env and code works perfectly fine:
res = sq.gr.ligrec(
adata,
n_perms=1000,
cluster_key=“Cell_types”,
copy=True,
use_raw=False,
interactions_params={‘resources’: ‘CellPhoneDB’}
)
hey, I reinstalled from main and i am still getting this error - any other thoughts on the cause? break is in line 296 size = np.unique(list(size.values()))
for cls, size in (pvals.groupby(level=0, axis=1)).size().to_dict().items():
# print(size)
size = np.unique(list((pvals.groupby(level=0, axis=1)).size().to_dict().values()))
if len(size) != 1:
raise ValueError(f"Expected all groups to have the same number of interacting clusters, found `{size}`.")
size = size[0]
label_ranges[cls] = (start, start + size - 1)
start += size
label_ranges = {k: label_ranges[k] for k in sorted(label_ranges.keys())}
We can replace the size based on that dict. The plot looks good to me. I can create a pull request later.
It seems that the version in github already updated.