<jupyter_start><jupyter_text>Compute Moran\'s I score========================This example shows how to compute the Moran\'s I global spatialauto-correlation statistics.The Moran\'s I global spatial auto-correlation statistics evaluateswhether features (i.e. genes) shows a pattern that is clustered,dispersed or random in the tissue are under consideration.::: {.seealso}-   See `sphx_glr_auto_examples_graph_compute_co_occurrence.py` and    `sphx_glr_auto_examples_graph_compute_ripley.py` for other scores to    describe spatial patterns.-   See `sphx_glr_auto_examples_graph_compute_spatial_neighbors.py` for    general usage of `squidpy.gr.spatial_neighbors`.:::<jupyter_code>import scanpy as sc
import squidpy as sq

adata = sq.datasets.visium_hne_adata()
adata<jupyter_output><empty_output><jupyter_text>We can compute the Moran\'s I score with `squidpy.gr.moran`. We firstneed to compute a spatial graph with `squidpy.gr.moran`. We will alsosubset the number of genes to evaluate.<jupyter_code>genes = adata[:, adata.var.highly_variable].var_names.values[:100]
sq.gr.spatial_neighbors(adata)
sq.gr.moran(
    adata,
    genes=genes,
    n_perms=100,
    n_jobs=1,
)
adata.uns["moranI"].head(10)<jupyter_output><empty_output><jupyter_text>We can visualize some of those genes with `scanpy.pl.spatial`.<jupyter_code>sc.pl.spatial(adata, color=["Resp18", "Tuba4a"])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11579699785561115, 'fraction_numerical': 0.008577555396711936, 'mean_word_length': 6.368421052631579, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '436277', 'license': 'MIT', 'n_tokens_mistral': 513, 'n_tokens_neox': 475, 'n_words': 113, 'path': 'docs/source/auto_examples/graph/compute_moran.ipynb', 'repo_name': 'theislab/squidpy_notebooks', 'size': '1399'}