Cases on 10x Visium 2D Data¶
Map IQ in adult mouse brain and serum creatinine in kidney using 10x Visium data.
10x Genomics · Visium datasets · gsMap Report preview (coronal brain)
Files needed for this tutorial¶
Run from gsmap_tutorials/. The three cases on this page share the same reference
files. Download shared resources/GWAS once from Downloads; download the
Visium ST bundle below only if it is not already installed.
gsmap_tutorials/
├── resources/ # shared; reuse
│ ├── 1000g-hc-grch38-v50-eur/
│ │ ├── snp_gene_weights.h5ad
│ │ └── w_ld/weights.{1..22}.l2.ldscore.gz # 22 files
│ └── homologs/mouse_human_homologs.txt
└── example_data/
├── example-traits/ # shared; reuse
│ ├── IQ.sumstats.gz
│ └── Serum_creatinine.sumstats.gz
└── mouse-visium/ST/ # this tutorial's ST data
├── V1_Adult_Mouse_Brain_Coronal_Section.h5ad
├── V1_Mouse_Brain_Sagittal_Posterior_Section.h5ad
└── V1_Mouse_Kidney.h5ad
{1..22} denotes the 22 chromosome files.
1. Download¶
First time using gsMap? Follow Installation and download the shared reference, homologs and example GWAS from Downloads. Then download this dataset. Skip this step if its folder already exists.
mkdir -p example_data
wget -O example_data/mouse-visium.tar.gz \
https://yanglab-obs.lab.westlake.edu.cn/public/gsMap/gsMap3D-r1/datasets/st/2d/mouse-visium/r1/bundle.tar.gz && \
tar -xzf example_data/mouse-visium.tar.gz -C example_data
Download links and checksum instructions are on Downloads.
2. Run gsMap¶
Choose a sample below, then its CLI or Python tab.
Case 1: Mouse Brain Coronal Section¶
10x Genomics · 2020 · Visium · gsMap Report preview (coronal)
Data: Visium data of adult mouse coronal section Trait: IQ
# Create output directory
mkdir -p results
# Run gsMap in quick mode
gsmap quick-mode \
--workdir "results" \
--project-name "visium-coronal" \
--dataset-type "spatial2D" \
--h5ad-path "example_data/mouse-visium/ST/V1_Adult_Mouse_Brain_Coronal_Section.h5ad" \
--homolog-file "resources/homologs/mouse_human_homologs.txt" \
--species MOUSE_GENE_SYM \
--w-ld-dir "resources/1000g-hc-grch38-v50-eur/w_ld" \
--snp-gene-weight-adata-path "resources/1000g-hc-grch38-v50-eur/snp_gene_weights.h5ad" \
--annotation "domain" \
--spatial-key "spatial" \
--data-layer "count" \
--trait-name "IQ" \
--sumstats-file "example_data/example-traits/IQ.sumstats.gz" \
--plot-origin "lower"
from gsMap.config import QuickModeConfig, DatasetType
from gsMap.pipeline import run_quick_mode
config = QuickModeConfig(
workdir="results",
project_name="visium-coronal",
dataset_type=DatasetType.SPATIAL_2D,
h5ad_path=[
"example_data/mouse-visium/ST/V1_Adult_Mouse_Brain_Coronal_Section.h5ad"
],
homolog_file="resources/homologs/mouse_human_homologs.txt",
species="MOUSE_GENE_SYM",
w_ld_dir="resources/1000g-hc-grch38-v50-eur/w_ld",
snp_gene_weight_adata_path="resources/1000g-hc-grch38-v50-eur/snp_gene_weights.h5ad",
annotation="domain",
spatial_key="spatial",
data_layer="count",
trait_name="IQ",
sumstats_file="example_data/example-traits/IQ.sumstats.gz",
plot_origin="lower",
)
run_quick_mode(config)
Case 2: Mouse Brain Sagittal Section¶
10x Genomics · 2020 · Visium · gsMap Report preview (sagittal)
Data: Visium data of adult mouse sagittal section Trait: IQ
mkdir -p results
gsmap quick-mode \
--workdir "results" \
--project-name "visium-sagittal" \
--dataset-type "spatial2D" \
--h5ad-path "example_data/mouse-visium/ST/V1_Mouse_Brain_Sagittal_Posterior_Section.h5ad" \
--homolog-file "resources/homologs/mouse_human_homologs.txt" \
--species MOUSE_GENE_SYM \
--w-ld-dir "resources/1000g-hc-grch38-v50-eur/w_ld" \
--snp-gene-weight-adata-path "resources/1000g-hc-grch38-v50-eur/snp_gene_weights.h5ad" \
--annotation "domain" \
--spatial-key "spatial" \
--data-layer "count" \
--trait-name "IQ" \
--sumstats-file "example_data/example-traits/IQ.sumstats.gz" \
--plot-origin "lower"
from gsMap.config import QuickModeConfig, DatasetType
from gsMap.pipeline import run_quick_mode
config = QuickModeConfig(
workdir="results",
project_name="visium-sagittal",
dataset_type=DatasetType.SPATIAL_2D,
h5ad_path=[
"example_data/mouse-visium/ST/V1_Mouse_Brain_Sagittal_Posterior_Section.h5ad"
],
homolog_file="resources/homologs/mouse_human_homologs.txt",
species="MOUSE_GENE_SYM",
w_ld_dir="resources/1000g-hc-grch38-v50-eur/w_ld",
snp_gene_weight_adata_path="resources/1000g-hc-grch38-v50-eur/snp_gene_weights.h5ad",
annotation="domain",
spatial_key="spatial",
data_layer="count",
trait_name="IQ",
sumstats_file="example_data/example-traits/IQ.sumstats.gz",
plot_origin="lower",
)
run_quick_mode(config)
Case 3: Mouse Kidney¶
10x Genomics · 2020 · Visium · gsMap Report preview (kidney)
Data: Visium data of adult mouse kidney Trait: Serum creatinine
mkdir -p results
gsmap quick-mode \
--workdir "results" \
--project-name "visium-kidney" \
--dataset-type "spatial2D" \
--h5ad-path "example_data/mouse-visium/ST/V1_Mouse_Kidney.h5ad" \
--homolog-file "resources/homologs/mouse_human_homologs.txt" \
--species MOUSE_GENE_SYM \
--w-ld-dir "resources/1000g-hc-grch38-v50-eur/w_ld" \
--snp-gene-weight-adata-path "resources/1000g-hc-grch38-v50-eur/snp_gene_weights.h5ad" \
--annotation "domain" \
--spatial-key "spatial" \
--data-layer "count" \
--trait-name "Serum_creatinine" \
--sumstats-file "example_data/example-traits/Serum_creatinine.sumstats.gz" \
--plot-origin "lower"
from gsMap.config import QuickModeConfig, DatasetType
from gsMap.pipeline import run_quick_mode
config = QuickModeConfig(
workdir="results",
project_name="visium-kidney",
dataset_type=DatasetType.SPATIAL_2D,
h5ad_path=["example_data/mouse-visium/ST/V1_Mouse_Kidney.h5ad"],
homolog_file="resources/homologs/mouse_human_homologs.txt",
species="MOUSE_GENE_SYM",
w_ld_dir="resources/1000g-hc-grch38-v50-eur/w_ld",
snp_gene_weight_adata_path="resources/1000g-hc-grch38-v50-eur/snp_gene_weights.h5ad",
annotation="domain",
spatial_key="spatial",
data_layer="count",
trait_name="Serum_creatinine",
sumstats_file="example_data/example-traits/Serum_creatinine.sumstats.gz",
plot_origin="lower",
)
run_quick_mode(config)
3. View results¶
Choose one interface per project. These are equivalent direct calls to gsMap,
not independent replicates. For CPU-only execution, set CUDA_VISIBLE_DEVICES=''
and add --no-gpu in the CLI, or set use_gpu=False in Python before starting.
An optional existing scratch directory uses --memmap-tmp-dir / memmap_tmp_dir.
gsmap report-view results/visium-coronal/gsmap_web_report --port 8080 --no-browser
Tip
Use the printed HTTP address on both local and remote machines; do not open the
HTML directly as file://. Copy the entire report directory when moving it.
Dataset |
Trait |
gsMap Report preview |
|---|---|---|
Coronal brain |
IQ |
|
Sagittal brain |
IQ |
|
Kidney |
Serum creatinine |
See Output Files Reference for GSS, association results and per-stage logs, CS8 human gastrulation for multiple sections, and Customization Guide for custom inputs.