squidpy icon indicating copy to clipboard operation
squidpy copied to clipboard

After removing rows with only NaN interactions, none remain.

Open asmlgkj opened this issue 1 year ago • 6 comments

Description

...

Minimal reproducible example

import numpy as np
import os
import scanpy as sc
import squidpy as sq

sc.logging.print_header()
print(f"squidpy=={sq.__version__}")
adata = sc.read_h5ad('seqfish.h5ad')

sq.pl.spatial_scatter(
    adata, color="celltype_mapped_refined", shape=None, figsize=(10, 10)
)

sq.gr.spatial_neighbors(adata, coord_type="generic")
sq.gr.nhood_enrichment(adata, cluster_key="celltype_mapped_refined")
sq.pl.nhood_enrichment(adata, cluster_key="celltype_mapped_refined", method="ward")

sq.gr.co_occurrence(adata, cluster_key="celltype_mapped_refined")
sq.pl.co_occurrence(
    adata,
    cluster_key="celltype_mapped_refined",
    clusters="Lateral plate mesoderm",
    figsize=(10, 5),
)

sq.gr.ligrec(
    adata,
    n_perms=100,
    cluster_key="celltype_mapped_refined",
)
sq.pl.ligrec(
    adata,
    cluster_key="celltype_mapped_refined",
    source_groups="Lateral plate mesoderm",
    target_groups=["Intermediate mesoderm", "Allantois"],
    means_range=(0.3, np.inf),
    alpha=1e-4,
    swap_axes=True,
)

Traceback

...

Version

scanpy==1.9.5 anndata==0.9.2 umap==0.5.6 numpy==1.24.3 scipy==1.11.3 pandas==2.2.2 scikit-learn==1.3.0 statsmodels==0.14.1 igraph==0.11.5 pynndescent==0.5.12 squidpy==1.5.0 ...

asmlgkj avatar Jun 12 '24 09:06 asmlgkj

it seems change the code as following sq.gr.ligrec(     adata,     n_perms=100,     cluster_key="celltype_mapped_refined",     use_raw=False,     threshold=0 ) sq.pl.ligrec(     adata,     cluster_key="celltype_mapped_refined",     source_groups="Lateral plate mesoderm",     target_groups=["Intermediate mesoderm", "Allantois"],     means_range=(0.3, np.inf),     alpha=1e-4,     swap_axes=True, ) but I do not know wthether it is right to set like this, because the tutorial does not do like this

asmlgkj avatar Jun 13 '24 12:06 asmlgkj

Hi @asmlgkj At what point does the problem appear?

LLehner avatar Jun 17 '24 19:06 LLehner

thanks a lot. @LLehner

when I run this code sq.gr.ligrec( adata, n_perms=100, cluster_key="celltype_mapped_refined",

)

asmlgkj avatar Jun 17 '24 22:06 asmlgkj

hi @asmlgkj are you using log normalized data?

giovp avatar Jul 07 '24 14:07 giovp

Dear @asmlgkj Thank you for providing edited parameters of sq.gr.ligrec function. I had same problem in both seqFISH and Slide-seq tutorials but when I applied use_raw=False and threshold=0 the problem is solved.

MEFarhadieh avatar Aug 04 '24 07:08 MEFarhadieh

https://github.com/scverse/squidpy/issues/871#issuecomment-2326748408 same here

TTTPOB avatar Sep 03 '24 14:09 TTTPOB