| ,Question,Related code,Answer
|
| 1,Identify spatially distinct tissue domains in the human DLPFC using spatially-aware clustering. Do the detected domains correspond to known cortical layers (L1�L6 and white matter)?,,Y
|
| 2,"Visualize the spatial expression of known cortical layer markers (e.g., RELN for L1, RORB for L4, TBR1 for L6, MBP for white matter). Do their spatial patterns match expected laminar positions?",,Y
|
| 3,Perform neighborhood enrichment analysis using cell type labels. Which cell types are significantly co-localized or mutually exclusive in spatial proximity?,,Y
|
| 4,"Compare the proportion of cells assigned to each cortical layer domain across multiple tissue samples (stored in ""sample""). Are domain proportions consistent across donors?",,Y
|
| 5,Identify the top spatially variable genes (SVGs) using Moran's I. Are the top SVGs enriched for known layer-specific or cell-type-specific markers?,"import scanpy as sc |
| import squidpy as sq |
|
|
| adata = sc.read_h5ad(""./pipelines/data/human_dlpfc.h5ad"") |
| sq.gr.spatial_neighbors(adata, coord_type=""generic"") |
| sq.gr.spatial_autocorr( |
| adata, |
| mode=""moran"", |
| genes=adata.var_names, |
| n_perms=100, |
| n_jobs=-1 |
| ) |
|
|
| stats = adata.uns[""moranI""] |
| top_svg = stats[stats[""p_norm_adj""] < 0.05].sort_values(""I"", ascending=False).head(20) |
| print(top_svg)",Y
|
| 6,"Map mouse cortical layer markers (e.g., Cux1, Ctip2, Tbr1 in mouse casing) onto this dataset to identify layers.",,N
|
| 7,"Reconstruct the developmental trajectory of cortical neurogenesis from this dataset, tracing progenitor-to-neuron differentiation across layers.",,N
|
| 8,Determine which genes causally drive the formation of cortical Layer 4 by analyzing this spatial dataset.,,N
|
| 9,Identify individual cell boundaries and perform single-cell segmentation to measure cell morphology from this dataset.,,N
|
| 10,Integrate spatial chromatin accessibility (spatial ATAC-seq) with this dataset to identify layer-specific regulatory elements.,,N
|
| 11,"Use Squidpy�s built-in spatial clustering to identify cortical domains, store them in ""cluster"".","import scanpy as sc |
| import squidpy as sq |
|
|
| adata = sc.read_h5ad(""./pipelines/data/human_dlpfc.h5ad"") |
| sq.gr.spatial_neighbors(adata) |
| sq.tl.spatial_clustering(adata, cluster_key='cluster') |
| sc.pl.spatial(adata, color=""cluster"")",N
|
| 12,Run SpaGCN and compare the inferred spatially aware domains to cortical layers.,"import scanpy as sc |
| import SpaGCN as spg |
|
|
| adata = sc.read_h5ad(""./pipelines/data/human_dlpfc.h5ad"") |
| spg.run_spagcn(adata, s=1, b=49, res=0.7, seed=1234, use_histology=False) |
| adata.obs[""cluster""] = adata.obs[""pred""]",N
|
| 13,"Test whether neighboring domains are enriched or depleted using Scanpy�s enrichment tools, with ""cell_type"" as the clustering key.","import scanpy as sc |
|
|
| adata = sc.read_h5ad(""./pipelines/data/human_dlpfc.h5ad"") |
| sc.tl.enrichment(adata, groupby=""cell_type"")",N
|
| 14,Tune SpaGCN resolution to recover a reasonable number of cortical layers.,"import scanpy as sc |
| import SpaGCN as spg |
|
|
| adata = sc.read_h5ad(""./pipelines/data/human_dlpfc.h5ad"") |
| adj = spg.calculate_adj_matrix(x=adata.obsm[""spatial""][:,0], y=adata.obsm[""spatial""][:,1], histology=False) |
| l = spg.search_l(p=0.5, adj=adj, start=0.01, end=1000, tol=0.01, max_run=100) |
| res = spg.search_res(adata, adj, l, n_clusters=7, start_res=0.1)",N
|
| 15,"Find genes with significant spatial autocorrelation and extract them from adata.var[""moranI_pval""].","import scanpy as sc |
| import squidpy as sq |
|
|
| adata = sc.read_h5ad(""./pipelines/data/human_dlpfc.h5ad"") |
| sq.gr.spatial_neighbors(adata) |
| sq.gr.spatial_autocorr(adata, mode=""moran"") |
| svg = adata.var[adata.var[""moranI_pval""] < 0.05] |
| print(svg.head())",N |