single2spatial-spatial-mapping
Map scRNA-seq atlases onto spatial transcriptomics slides using omicverse's Single2Spatial workflow for deep-forest training, spot-level assessment, and marker visualisation.
Install
mkdir -p .claude/skills/single2spatial-spatial-mapping && curl -L -o skill.zip "https://mcp.directory/api/skills/download/2425" && unzip -o skill.zip -d .claude/skills/single2spatial-spatial-mapping && rm skill.zipInstalls to .claude/skills/single2spatial-spatial-mapping
About this skill
Single2Spatial spatial mapping
Overview
Apply this skill when converting single-cell references into spatially resolved profiles. It follows t_single2spatial.ipynb, demonstrating how Single2Spatial trains on PDAC scRNA-seq and Visium data, reconstructs spot-level proportions, and visualises marker expression.
Instructions
- Import dependencies and style
- Load
omicverse as ov,scanpy as sc,anndata,pandas as pd,numpy as np, andmatplotlib.pyplot as plt. - Call
ov.utils.ov_plot_set()(orov.plot_set()in older versions) to align plots with omicverse styling.
- Load
- Load single-cell and spatial datasets
- Read processed matrices with
pd.read_csv(...)then create AnnData objects (anndata.AnnData(raw_df.T)). - Attach metadata:
single_data.obs = pd.read_csv(...)[['Cell_type']]andspatial_data.obs = pd.read_csv(... )containing coordinates and slide metadata.
- Read processed matrices with
- Initialise Single2Spatial
- Instantiate
ov.bulk2single.Single2Spatial(single_data=single_data, spatial_data=spatial_data, celltype_key='Cell_type', spot_key=['xcoord','ycoord'], gpu=0). - Note that inputs should be normalised/log-scaled scRNA-seq matrices; ensure
spot_keymatches spatial coordinate columns.
- Instantiate
- Train the deep-forest model
- Execute
st_model.train(spot_num=500, cell_num=10, df_save_dir='...', df_save_name='pdac_df', k=10, num_epochs=1000, batch_size=1000, predicted_size=32)to fit the mapper and generate reconstructed spatial AnnData (sp_adata). - Explain that
spot_numdefines sampled pseudo-spots per iteration andcell_numcontrols per-spot cell draws.
- Execute
- Load pretrained weights
- Use
st_model.load(modelsize=14478, df_load_dir='.../pdac_df.pth', k=10, predicted_size=32)when checkpoints already exist to skip training.
- Use
- Assess spot-level outputs
- Call
st_model.spot_assess()to compute aggregated spot AnnData (sp_adata_spot) for QC. - Plot marker genes with
sc.pl.embedding(sp_adata, basis='X_spatial', color=['REG1A', 'CLDN1', ...], frameon=False, ncols=4).
- Call
- Visualise proportions and cell-type maps
- Use
sc.pl.embedding(sp_adata_spot, basis='X_spatial', color=['Acinar cells', ...], frameon=False)to highlight per-spot cell fractions. - Plot
sp_adatacoloured byCell_typewithpalette=ov.utils.ov_palette()[11:]to show reconstructed assignments.
- Use
- Export results
- Encourage saving generated AnnData objects (
sp_adata.write_h5ad(...),sp_adata_spot.write_h5ad(...)) and derived CSV summaries for downstream reporting.
- Encourage saving generated AnnData objects (
- Defensive validation
# Before Single2Spatial: verify spatial coordinates exist for col in spot_key: assert col in spatial_data.obs.columns, f"Spatial coordinate column '{col}' not found in spatial_data.obs" # Verify scRNA-seq is log-normalized (max should be <~15, not hundreds/thousands) if single_data.X.max() > 50: print("WARNING: scRNA-seq data may not be log-normalized. Raw counts cause scale mismatches.") # Verify cell type column exists assert celltype_key in single_data.obs.columns, f"Cell type column '{celltype_key}' not found" - Troubleshooting tips
- If training diverges, reduce
learning_ratevia keyword arguments or decreasepredicted_sizeto stabilise the forest. - Ensure scRNA-seq inputs are log-normalised; raw counts can lead to scale mismatches and poor spatial predictions.
- Verify GPU availability when
gpuis non-zero; fallback to CPU by omitting the argument or settinggpu=-1.
Examples
- "Train Single2Spatial on PDAC scRNA-seq and Visium slides, then visualise REG1A and CLDN1 spatial expression."
- "Load a saved Single2Spatial checkpoint to regenerate spot-level cell-type proportions for reporting."
- "Plot reconstructed cell-type maps with omicverse palettes to compare against histology."
References
- Tutorial notebook:
t_single2spatial.ipynb - Example datasets and models:
omicverse_guide/docs/Tutorials-bulk2single/data/pdac/ - Quick copy/paste commands:
reference.md
More by Starlitnightly
View all skills by Starlitnightly →You might also like
flutter-development
aj-geddes
Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.
drawio-diagrams-enhanced
jgtolentino
Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.
ui-ux-pro-max
nextlevelbuilder
"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."
godot
bfollington
This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.
nano-banana-pro
garg-aayush
Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.
fastapi-templates
wshobson
Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.
Related MCP Servers
Browse all serversMapbox: Geospatial intelligence — fast geocoding API, POI search API, routing API and isochrones for location-aware apps
Convert lat long or GPS data easily with GIS Operations. Perform coordinate transformations, MGRS, and military grid con
InfraNodus offers powerful text analysis and semantic analysis tools to find content gaps and improve research, SEO, and
OWL (Web Ontology Language) lets AI systems manage ontologies by adding, removing, or finding axioms with functional syn
GeoCalculator helps you convert lat long or coordinates easily and accurately for GIS and spatial analysis, saving time
Access geocoding, altitude, boundaries, and urban planning in France with the Géoportail integration for advanced spatia
Stay ahead of the MCP ecosystem
Get weekly updates on new skills and servers.