Skip to content
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

After removing rows with only NaN interactions, none remain. #840

Open
asmlgkj opened this issue Jun 12, 2024 · 6 comments
Open

After removing rows with only NaN interactions, none remain. #840

asmlgkj opened this issue Jun 12, 2024 · 6 comments
Assignees

Comments

@asmlgkj
Copy link

asmlgkj commented Jun 12, 2024

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
Copy link
Author

asmlgkj commented Jun 13, 2024

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

@LLehner
Copy link
Member

LLehner commented Jun 17, 2024

Hi @asmlgkj At what point does the problem appear?

@asmlgkj
Copy link
Author

asmlgkj commented Jun 17, 2024

thanks a lot. @LLehner

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

)

@giovp
Copy link
Member

giovp commented Jul 7, 2024

hi @asmlgkj are you using log normalized data?

@MEFarhadieh
Copy link

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.

@TTTPOB
Copy link

TTTPOB commented Sep 3, 2024

#871 (comment) same here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants