-
Notifications
You must be signed in to change notification settings - Fork 79
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
Ligand-receptor plot always report Error #871
Comments
hi @ryrl970311 did you normalize and log1p the data before using this function? |
I also encountered this error. In this new version, even the official example tutorial encounters the same issue. |
update: same here, my code # hidden code for read in the data
# then preprocess using standard scanpy pipeline
# standard scanpy pipeline for slice1
sc.pp.filter_cells(slice1, min_genes=200)
sc.pp.filter_genes(slice1, min_cells=3)
slice1.raw = slice1
slice1.layers["counts"] = slice1.X.copy()
sc.pp.normalize_total(slice1)
sc.pp.log1p(slice1)
sc.pp.highly_variable_genes(slice1, n_top_genes=2000)
sc.tl.pca(slice1)
sc.pp.neighbors(slice1)
sc.tl.umap(slice1)
sc.tl.leiden(slice1)
# then spatial scatterplot
# see it on the spatial image
sq.pl.spatial_scatter(
slice1,
img_res_key="lowres",
color=["leiden"],
size=12000,
) # then do the ligand receptor analysis
sq.gr.ligrec(
slice1,
n_perms=100,
cluster_key="leiden",
use_raw=True,
)
# above runs normally,
# plot fails
sq.pl.ligrec(
slice1,
cluster_key="leiden",
source_groups=["4"],
target_groups=["1", "2"],
means_range=(0.1, np.inf),
alpha=1e-4,
swap_axes=True,
) |
update, running the code from the tutorial would fail as well (the dataset is from this tutorial as well) sq.gr.ligrec(
adata,
n_perms=100,
cluster_key="cluster",
)
sq.pl.ligrec(
adata,
cluster_key="cluster",
source_groups="Hippocampus",
target_groups=["Pyramidal_layer", "Pyramidal_layer_dentate_gyrus"],
means_range=(3, np.inf),
alpha=1e-4,
swap_axes=True,
) |
Hello, I’m encountering the same issue. Have there been any updates or resolutions so far? |
Description
When I use
sq.pl.ligrec
aftersq.gr.ligrec( adata, n_perms=100, cluster_key="cluster", clusters=["Polydendrocytes", "Oligodendrocytes"], )
, it always report an error 'ValueError: After removing rows with only NaN interactions, none remain'. Is thes normal? I use the data fro tutorialsadata = sq.datasets.seqfish()
oradata = sq.datasets.slideseqv2()
, which do not raise error in examples. How should I solve it? Thanks.Minimal reproducible example
adata = sq.datasets.seqfish()
oradata = sq.datasets.slideseqv2()
...
sq.gr.ligrec(
adata,
n_perms=100,
cluster_key="cluster",
clusters=["Polydendrocytes", "Oligodendrocytes"],
)
sq.pl.ligrec(
adata,
cluster_key="cluster",
source_groups="Oligodendrocytes",
target_groups=["Polydendrocytes"],
pvalue_threshold=0.05,
swap_axes=True,
)
Traceback
ValueError Traceback (most recent call last)
Cell In[56], line 1
----> 1 sq.pl.ligrec(
2 adata,
3 cluster_key="cluster",
4 source_groups="Oligodendrocytes",
5 target_groups=["Polydendrocytes"],
6 pvalue_threshold=0.05,
7 swap_axes=True,
8 )
--> 290 pvals, means = filter_values(pvals, means, mask=~(pd.isnull(means) | pd.isnull(pvals)), kind="NaN")
291 if remove_nonsig_interactions and alpha is not None:
292 pvals, means = filter_values(pvals, means, mask=pvals <= alpha, kind="non-significant")
--> 200 raise ValueError(f"After removing rows with only {kind} interactions, none remain.")
202 mask_cols = mask.any(axis=0)
203 pvals = pvals.loc[:, mask_cols]
ValueError: After removing rows with only NaN interactions, none remain.
Version
python 3.12.4
squidpy==1.6.0
...
The text was updated successfully, but these errors were encountered: