scientific-skills/Data Analysis/spatial-transcriptomics-mapper/SKILL.md
Map spatial transcriptomics data from 10x Genomics Visium/Xenium onto.
npx skillsauth add aipoch/medical-research-skills spatial-transcriptomics-mapperInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
4 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
See ## Features above for related details.
scripts/__init__.py plus 1 additional script(s).See ## Prerequisites above for related details.
Python: 3.10+. Repository baseline for current packaged skills.h5py: unspecified. Declared in requirements.txt.matplotlib: unspecified. Declared in requirements.txt.numpy: unspecified. Declared in requirements.txt.pandas: unspecified. Declared in requirements.txt.pil: unspecified. Declared in requirements.txt.pyarrow: unspecified. Declared in requirements.txt.scanpy: unspecified. Declared in requirements.txt.seaborn: unspecified. Declared in requirements.txt.squidpy: unspecified. Declared in requirements.txt.tifffile: unspecified. Declared in requirements.txt.See ## Usage above for related details.
cd "20260318/scientific-skills/Data Analytics/spatial-transcriptomics-mapper"
python -m py_compile scripts/main.py
python scripts/main.py --help
Example run plan:
CONFIG block or documented parameters if the script uses fixed settings.python scripts/main.py with the validated inputs.See ## Workflow above for related details.
scripts/__init__.py with additional helper scripts under scripts/.Use this command to verify that the packaged script entry point can be parsed before deeper execution.
python -m py_compile scripts/main.py
Use these concrete commands for validation. They are intentionally self-contained and avoid placeholder paths.
python -m py_compile scripts/main.py
python scripts/main.py --help
Spatial Transcriptomics analysis tool for processing 10x Genomics Visium or Xenium data, projecting gene expression data back onto tissue section images to draw "gene-space" distribution maps. Supports gene expression visualization, spatial clustering analysis, and morphological feature correlation.
# Required dependencies
pip install scanpy squidpy matplotlib seaborn pillow numpy pandas h5py
# Optional: For Xenium data processing
pip install pyarrow dask
# Optional: For advanced image processing
pip install opencv-python scikit-image
Generate sample Visium data to test the tool:
# Generate test data
python scripts/generate_test_data.py \
--platform visium \
--output ./test_data/visium_sample \
--n-spots 500 \
--n-genes 1000
# Run analysis on test data
python scripts/main.py \
--platform visium \
--data-dir ./test_data/visium_sample \
--gene GENE_0000 \
--output ./test_output/
python scripts/main.py \
--platform visium \
--data-dir /path/to/spaceranger/outs/ \
--gene PIK3CA \
--output ./output/
python scripts/main.py \
--platform xenium \
--data-dir /path/to/xenium/outs/ \
--gene PIK3CA \
--output ./output/
python scripts/main.py \
--platform visium \
--data-dir /path/to/data/ \
--genes PIK3CA,PTEN,EGFR \
--mode overlay \
--output ./output/
python scripts/main.py \
--platform visium \
--data-dir /path/to/data/ \
--cluster-file ./clusters.csv \
--output ./output/
outs/
├── filtered_feature_bc_matrix.h5 # Gene expression matrix
├── raw_feature_bc_matrix.h5 # Raw counts (optional)
├── spatial/
│ ├── tissue_positions_list.csv # Spot positions
│ ├── tissue_lowres_image.png # Low-res H&E image
│ ├── tissue_hires_image.png # High-res H&E image
│ └── scalefactors_json.json # Scale factors
└── web_summary.html
outs/
├── cell_feature_matrix.h5 # Cell x gene matrix
├── transcripts.parquet # Transcript coordinates
├── nucleus_boundaries.parquet # Cell boundaries
├── cell_boundaries.parquet
├── morphology_focus.ome.tif # Morphology image
└── experiment.xenium
{gene}_spatial_map.png: Single gene spatial expression map{gene}_heatmap.png: Gene expression heatmapmulti_gene_overlay.png: Multi-gene overlay map (if using --mode overlay)cluster_spatial_map.png: Cluster spatial distribution mapcombined_report.html: Comprehensive HTML report| Parameter | Type | Default | Description |
|-----------|------|---------|-------------|
| --platform | str | required | Platform type: visium or xenium |
| --data-dir | str | required | Data directory path |
| --gene | str | optional | Single gene name |
| --genes | list | optional | Multiple genes, comma-separated |
| --mode | str | single | Mode: single/overlay/multi |
| --cluster-file | str | optional | Clustering result CSV file path |
| --output | str | ./output | Output directory |
| --dpi | int | 300 | Output image DPI |
| --cmap | str | viridis | Color map scheme |
| --spot-size | float | 1.0 | Visium spot size factor |
| --alpha | float | 0.8 | Transparency (0-1) |
| --min-count | int | 0 | Minimum expression filter |
| --crop | str | optional | Crop region (x1,y1,x2,y2) |
python scripts/main.py \
--platform visium \
--data-dir ./visium_sample/outs/ \
--gene EPCAM \
--cmap Reds \
--output ./results/
python scripts/main.py \
--platform visium \
--data-dir ./breast_cancer/outs/ \
--genes PIK3CA,ERBB2,ESR1,PGR \
--mode multi \
--cmap plasma \
--output ./tumor_markers/
python scripts/main.py \
--platform xenium \
--data-dir ./xenium_lung/outs/ \
--genes SFTPB,SFTPC,SCGB1A1 \
--dpi 600 \
--output ./xenium_results/
python scripts/main.py \
--platform visium \
--data-dir ./sample/outs/ \
--cluster-file ./seurat_clusters.csv \
--output ./clusters/
from skills.spatial_transcriptomics_mapper.scripts.main import SpatialMapper
# Initialize
mapper = SpatialMapper(
platform="visium",
data_dir="/path/to/data",
output_dir="./output"
)
# Load data
mapper.load_data()
# Plot single gene
mapper.plot_gene_spatial(
gene="PIK3CA",
cmap="viridis",
save_path="./output/pik3ca.png"
)
# Plot multiple genes
mapper.plot_multi_genes(
genes=["PIK3CA", "PTEN", "EGFR"],
mode="grid",
save_path="./output/multi.png"
)
# Get spatial statistics
stats = mapper.get_spatial_stats(gene="PIK3CA")
| Risk Indicator | Assessment | Level | |----------------|------------|-------| | Code Execution | Python/R scripts executed locally | Medium | | Network Access | No external API calls | Low | | File System Access | Read input files, write output files | Medium | | Instruction Tampering | Standard prompt guidelines | Low | | Data Exposure | Output files saved to workspace | Low |
# Python dependencies
pip install -r requirements.txt
Every final response should make these items explicit when they are relevant:
scripts/main.py fails, report the failure point, summarize what still can be completed safely, and provide a manual fallback.This skill accepts requests that match the documented purpose of spatial-transcriptomics-mapper and include enough context to complete the workflow safely.
Do not continue the workflow when the request is out of scope, missing a critical input, or would require unsupported assumptions. Instead respond:
spatial-transcriptomics-mapperonly handles its documented workflow. Please provide the missing required inputs or switch to a more suitable skill.
Use the following fixed structure for non-trivial requests:
If the request is simple, you may compress the structure, but still keep assumptions and limits explicit when they affect correctness.
tools
Generates complete conventional oncology bulk-transcriptome biomarker and hub-gene research designs from a user-provided cancer type and study direction. Always use this skill whenever a user wants to design, plan, or build a tumor bioinformatics study centered on differential expression, prognostic filtering or risk modeling, PPI-based hub-gene prioritization, diagnostic/prognostic evaluation, clinical association, immune infiltration context, methylation context, and optional tissue or cell validation. Covers five study patterns (signature-first prognostic workflow, hub-gene-first biomarker workflow, hybrid signature-to-hub workflow, immune-context biomarker workflow, translational validation workflow) and always outputs four workload configs (Lite / Standard / Advanced / Publication+) with recommended primary plan, step-by-step workflow, figure plan, validation strategy, minimal executable version, publication upgrade path...
development
Generates complete conventional non-oncology bioinformatics research designs from a user-provided disease context, process-related gene family or biological theme, and validation direction. Use when a study centers on multi-dataset bulk transcriptome integration, DEG analysis, process-gene intersection, enrichment analysis, GSEA, PPI hub-gene prioritization, TF/miRNA regulatory networks, ROC-based biomarker evaluation, and immune infiltration analysis. Covers five study patterns (process-DEG discovery, enrichment/GSEA interpretation, hub-gene prioritization, regulatory-network and immune interpretation, multi-layer public validation) and always outputs Lite / Standard / Advanced / Publication+ with a recommended primary plan, stepwise workflow, figure plan, validation hierarchy, minimal executable version, publication upgrade path, and strictly verified literature retrieval.
tools
Plans confounder control, variable adjustment logic, and bias mitigation strategies at the protocol stage for clinical, epidemiologic, translational, observational, and biomarker studies. Always use this skill when a user needs to identify major confounders, decide which variables should or should not be adjusted for, compare matching/stratification/weighting approaches, anticipate selection or measurement bias, or pressure-test a study design before execution. Focus on bias sensing, causal structure awareness, variable-role classification, and critical design review rather than generic statistical advice.
testing
Generates complete comparative network-toxicology research designs from a user-provided exposure pair, shared toxic phenotype, and validation direction. Use when a study centers on two related exposures under one outcome and needs target collection, shared-vs-specific target decomposition, enrichment, PPI hub prioritization, docking, optional transcriptomic cross-checks, and conservative mechanistic synthesis. Covers five study patterns and always outputs Lite / Standard / Advanced / Publication+ with a recommended primary plan, stepwise workflow, figure plan, validation hierarchy, minimal executable version, publication upgrade path, and strictly verified literature retrieval.