@@ -7,6 +7,9 @@ Utilities for loading and analyzing 10x Genomics Xenium exports in Python.
77Install:
88
99``` bash
10+ # 稳定用法(本地开发/CI)
11+ pip install -U " git+https://github.com/hutaobo/pyXenium@main"
12+ # 或
1013pip install pyXenium
1114```
1215
@@ -56,6 +59,38 @@ adata = load_anndata_from_partial(
5659)
5760```
5861
62+ ### Protein + RNA correlation (Xenium)
63+
64+ Compute spatial correlation between ** mean protein intensity** and ** gene transcript density** on a user-defined grid.
65+
66+ ``` python
67+ from pyXenium.io.partial_xenium_loader import load_anndata_from_partial
68+ from pyXenium.analysis import protein_gene_correlation
69+
70+ # 1) Load data (RNA counts + optional cells/analysis attachments)
71+ BASE = " https://huggingface.co/datasets/<your-dataset>/resolve/main"
72+ adata = load_anndata_from_partial(
73+ base_url = BASE ,
74+ # or base_dir="/path/to/Xenium_Export"
75+ # If you also have analysis/cells zarr, pass them here to attach clusters & spatial centroids
76+ )
77+
78+ # 2) Run protein–gene correlation
79+ # transcripts_zarr_path 可为 .zarr 或 .zarr.zip(本地或远程,fsspec 透明读)
80+ pairs = [(" CD3E" , " CD3E" ), (" E-Cadherin" , " CDH1" )] # (protein, gene)
81+ summary = protein_gene_correlation(
82+ adata = adata,
83+ transcripts_zarr_path = BASE + " /transcripts.zarr.zip" ,
84+ pairs = pairs,
85+ output_dir = " ./protein_gene_corr" ,
86+ grid_size = (50 , 50 ), # 可自定义网格
87+ pixel_size_um = 0.2125 , # Xenium 常见像素尺寸
88+ qv_threshold = 20 ,
89+ overwrite = False
90+ )
91+ print (summary)
92+ ```
93+
5994### Troubleshooting
6095- ** FileNotFoundError: MEX missing files** → Ensure the three files exist in ` cell_feature_matrix/ ` :
6196 ` matrix.mtx.gz ` , ` features.tsv.gz ` , ` barcodes.tsv.gz ` .
0 commit comments