S1 — Load + QC
Goal
Initialize the project, load Visium data into a standardized AnnData, and filter low-quality spots.
Steps
- Init project:
init_spatial_project(project_dir=...)— creates the standardized directory layout. - Load data:
load_visium_data(counts_file=..., coordinates_file=..., sample_id=..., output_path=...)- h5ad: pass the h5ad path as
counts_file(coordinates already embedded). - 10x matrix: pass matrix/barcodes/features paths.
- wide CSV: pass counts CSV + spot coordinates CSV.
- Output: h5ad with
X= raw counts,obsm['spatial'],obs['barcode'].
- h5ad: pass the h5ad path as
- Filter spots:
filter_visium_spots(adata_path=..., output_path=..., plot_path=..., min_counts=..., min_genes=..., pct_mt=...)- Defaults:
min_counts=500,min_genes=250,pct_mt=20(adjust if user specifies). - Output: filtered h5ad + QC violin/spatial plots.
- Defaults:
Outputs
results/01_loading/<sample>_loaded.h5adresults/02_qc/<sample>_filtered.h5adresults/02_qc/<sample>_qc_*.png(pre/post filter plots)
Biological Interpretation
- Report spots retained:
filtered n / raw nand the fraction removed. - Look at spatial plots: is the removed area consistent with tissue edges / low-quality regions?
- State whether thresholds were reasonable or should be tightened/loosened.
Stop for Review
Present interpretation using the template from the parent spatial-transcriptomics skill. Wait for 通过 / 调整 / 跳过 before proceeding to S2.


