Start a fresh conversation. Replace the highlighted placeholders.
Use single2spatial-spatial-mapping to map [log-normalized scRNA-seq atlas] onto [spatial transcriptomics data] using [cell-type and coordinate columns], producing spot-level proportions, marker visualizations, and exportable AnnData results.
Required inputs
[log-normalized scRNA-seq atlas]
[spatial transcriptomics data]
[cell-type and coordinate columns]
User-approved starter prompt based on a pinned source version; check current skill requirements before running. Task evidence ↗
SKILL.md
name: single2spatial-spatial-mappingtitle: Single2Spatial spatial mappingdescription: Map scRNA-seq atlases onto spatial transcriptomics slides using omicverse's Single2Spatial workflow for deep-forest training, spot-level assessment, and marker visualisation.
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, and matplotlib.pyplot as plt.
Call ov.utils.ov_plot_set() (or ov.plot_set() in older versions) to align plots with omicverse styling.
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']] and spatial_data.obs = pd.read_csv(... ) containing coordinates and slide metadata.
Note that inputs should be normalised/log-scaled scRNA-seq matrices; ensure spot_key matches spatial coordinate columns.
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_num defines sampled pseudo-spots per iteration and cell_num controls per-spot cell draws.
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.
Assess spot-level outputs
Call st_model.spot_assess() to compute aggregated spot AnnData (sp_adata_spot) for QC.