squidpy_notebooks
squidpy_notebooks copied to clipboard
ValueError: After removing rows with only NaN interactions, none remain.
Following the same jupyter notebook (tutorial_visium_hne.ipynb) with the same tutorial data but got the following error:
ValueError Traceback (most recent call last) Cell In[10], line 6 1 sq.gr.ligrec( 2 adata, 3 n_perms=100, 4 cluster_key="cluster", 5 ) ----> 6 sq.pl.ligrec( 7 adata, 8 cluster_key="cluster", 9 source_groups="Hippocampus", 10 target_groups=["Pyramidal_layer", "Pyramidal_layer_dentate_gyrus"], 11 means_range=(3, np.inf), 12 alpha=1e-4, 13 swap_axes=True, 14 )
File ~\squidpy\lib\site-packages\squidpy\pl_ligrec.py:295, in ligrec(adata, cluster_key, source_groups, target_groups, means_range, pvalue_threshold, remove_empty_interactions, remove_nonsig_interactions, dendrogram, alpha, swap_axes, title, figsize, dpi, save, **kwargs) 292 pvals = pvals[pvals <= pvalue_threshold] 294 if remove_empty_interactions: --> 295 pvals, means = filter_values(pvals, means, mask=~(pd.isnull(means) | pd.isnull(pvals)), kind="NaN") 296 if remove_nonsig_interactions and alpha is not None: 297 pvals, means = filter_values(pvals, means, mask=pvals <= alpha, kind="non-significant")
File ~\squidpy\lib\site-packages\squidpy\pl_ligrec.py:205, in ligrec.
ValueError: After removing rows with only NaN interactions, none remain.
Thank you for any help!
+1
+1
+1 yes the same error :(
hi, which version of squidpy are you using?
hi, which version of squidpy are you using?
1.4.1
I got the same error using squidpy on my own data. It happened when I was using raw counts. After log-normalizing, the function worked.
sc.pp.normalize_total(adata, target_sum=1e4)
sc.pp.log1p(adata)
@Silaschuwen have you used normalized data?
@Silaschuwen have you used normalized data?
i tried normalized data but it doesn't look like it's working out very well. here is my code (the same as the notebooks/examples)
@amonell may i ask you what is your version of squidpy?
import squidpy as sq
adata = sq.datasets.seqfish()
sc.pp.normalize_total(adata, target_sum=1e4)
sc.pp.log1p(adata)
res = sq.gr.ligrec(
adata,
n_perms=1000,
cluster_key="celltype_mapped_refined",
copy=True,
use_raw=True,
transmitter_params={"categories": "ligand"},
receiver_params={"categories": "receptor"},
)
sq.pl.ligrec(res, source_groups="Erythroid", alpha=0.005)
ValueError: After removing rows with only NaN interactions, none remain.
@Silaschuwen You have "use_raw" set to true which may be using un-normalized counts. I would try setting it to False. Maybe the default threshold is too high, you can try setting "threshold = 0".
I am using Squidpy version 1.3.1 in python 3.10
@Silaschuwen You have "use_raw" set to true which may be using un-normalized counts. I would try setting it to False. Maybe the default threshold is too high, you can try setting "threshold = 0".
I am using Squidpy version 1.3.1 in python 3.10
thanks so much! everything works smoothly~