nonchev's picture
update dataset card
b3b1dd9 verified
|
Raw
History Blame Contribute Delete
11.8 kB
---
language:
- en
pretty_name: "HEST-1k Visium Virtual Single-Cell Spatial Transcriptomics (DeepSpot2Cell)"
tags:
- spatial-transcriptomics
- histology
- pathology
- single-cell
- virtual-single-cell
- transcriptomics
- machine-learning
- HEST
- DeepSpot2Cell
size_categories:
- 1M<n<10M
license: cc-by-nc-sa-4.0
extra_gated_heading: "Acknowledge license to accept the repository"
extra_gated_description: >
This dataset is licensed under CC-BY-NC-SA-4.0. Commercial use is not permitted
unless explicit written permission is granted by the authors. By agreeing, you
accept to share your contact information (email and username) with the repository
authors and confirm that you will not use the dataset for harmful, unethical, or
malicious purposes. Redistribution and derivatives are permitted under the same
CC-BY-NC-SA-4.0 license, with attribution and non-commercial use only. Please
allow 3-5 business days for our team to process your request. Requests with
vague or insufficient descriptions of intended use will be declined.
extra_gated_fields:
Full name (first and last): text
Current affiliation (no abbreviations): text
Type of Affiliation: text
Current and official institutional email:
type: text
help: "This must match your primary email in your Hugging Face account. Emails from gmail, hotmail, and qq domains will be denied."
Please describe in detail how you intend to use this dataset:
type: text
help: "Be specific. Name your institution/lab, the broader research project or area, and concretely how it will be used (e.g. model training, benchmarking, validation). Generic answers such as 'for research purposes' are not sufficient and will be declined."
I confirm that I have read and understood the dataset license terms: checkbox
I agree to retain attribution and license any derivatives under CC-BY-NC-SA-4.0:
type: checkbox
help: "Redistribution and derivatives are permitted under the same CC-BY-NC-SA-4.0 license, with attribution and non-commercial use."
I agree to receive news and updates about this technology: checkbox
---
# HEST-1k Visium virtual single-cell spatial transcriptomics
Predicted **virtual single-cell** gene expression for HEST-1k Visium samples,
produced with **DeepSpot2Cell**. DeepSpot2Cell is a Deep Sets model that predicts
transcriptomic profiles at single-cell resolution from H&E images and CellViT cell
segmentations, trained with spot-level Visium supervision only (no single-cell
ground truth). At inference every detected cell in each Visium spot receives its
own predicted expression vector.
**Authors**: Max Neuwinger, Kalin Nonchev, Glib Manaiev, Viktor Hendrik Koelzer,
and Gunnar Raetsch.
**Code**: https://github.com/ratschlab/DeepSpot2Cell - the DeepSpot2Cell preprint
is on bioRxiv (see the citation below).
## Layout
Files are organized per organ; the virtual single-cell predictions are gzip
AnnData (`.h5ad`) keyed by the HEST-1k sample id:
```
<organ>/virtual_sc/<sample_id>.h5ad # e.g. bowel/virtual_sc/TENX147.h5ad
<organ>/thumbnails/<sample_id>_downscaled_fullres.jpeg
<organ>/tissue_seg/<sample_id>_contours.geojson (+ _vis.jpg)
<organ>/spatial_plots/<sample_id>_spatial_plots.png
<organ>/metadata/<sample_id>.json
<organ>/{gene_list.json,gene_stats.csv,sample_manifest.csv}
```
Per-sample metadata is in `metadata.csv` (join key `id`); it merges the HEST-1k
clinical/technical fields with this dataset's `split`, `n_cells`, `um_per_px` and
`patch_size_px`. Raw H&E whole-slide images are **not** re-hosted here (they are
identical to HEST-1k - see Download).
## Contents (1 samples across 1 organs, 6,030 virtual cells)
| Organ | #samples | #virtual cells |
|---|---|---|
| Breast | 1 | 6,030 |
*Auto-generated by the upload pipeline on 2026-07-17. Upload in progress - counts grow as files land.*
## Download
This is a **gated** dataset, so log in first (`pip install huggingface_hub`):
```python
from huggingface_hub import login, snapshot_download, hf_hub_download
login(token="YOUR_HF_TOKEN")
repo = "ratschlab/HEST_Visium_virtual_single_cell_transcriptomics"
local_dir = "DS2C_data"
# one organ - virtual single-cell predictions only
snapshot_download(repo, repo_type="dataset", local_dir=local_dir,
allow_patterns="bowel/virtual_sc/*")
# one organ - everything (predictions + thumbnails + segmentations + metadata)
snapshot_download(repo, repo_type="dataset", local_dir=local_dir,
allow_patterns="lung/*")
# all virtual single-cell predictions across every organ
snapshot_download(repo, repo_type="dataset", local_dir=local_dir,
allow_patterns="*/virtual_sc/*")
# gene panels + per-organ manifests only
snapshot_download(repo, repo_type="dataset", local_dir=local_dir,
allow_patterns=["*/gene_list.json", "*/gene_stats.csv",
"*/sample_manifest.csv"])
# specific samples (ids match HEST-1k)
snapshot_download(repo, repo_type="dataset", local_dir=local_dir,
allow_patterns=["bowel/virtual_sc/TENX147.h5ad",
"lung/virtual_sc/TENX62.h5ad"])
```
Use the top-level `metadata.csv` (join key `id`) to select samples by organ,
cancer type, disease state or train/val split before downloading:
```python
import pandas as pd
meta = pd.read_csv(hf_hub_download(repo, "metadata.csv", repo_type="dataset"))
sel = meta.loc[(meta["organ"] == "Lung") & (meta["split"] == "val")]
snapshot_download(repo, repo_type="dataset", local_dir=local_dir,
allow_patterns=[f"{o.lower()}/virtual_sc/{i}.h5ad"
for o, i in zip(sel["organ"], sel["id"])])
```
> **Raw H&E whole-slide images are not hosted here.** They are byte-identical to
> [HEST-1k](https://huggingface.co/datasets/MahmoodLab/hest); download the WSIs,
> full-resolution patches and CellViT segmentations from there using the same
> sample ids.
## Loading and plotting
Each virtual-SC file is an AnnData (`cells x genes`):
```python
import io, numpy as np, PIL.Image, scanpy as sc, squidpy as sq
adata = sc.read_h5ad("bowel/virtual_sc/TENX147.h5ad")
adata
# AnnData object with n_obs x n_vars = 97821 x 17956
# obs: 'cell_id', 'spot_barcode', 'is_inside_spot'
# var: 'gene'
# uns: 'sample_id', 'organ', 'oncotree_code', 'disease_state', 'species',
# 'um_per_px', 'patch_size_px', 'expression_space', 'normalization',
# 'fullres_px_width', 'fullres_px_height', 'thumbnail_jpeg', 'thumbnail_shape'
# obsm: 'spatial' # (he_x, he_y) in full-resolution WSI pixels
```
Overlay predicted expression on the embedded H&E thumbnail:
```python
img = np.asarray(PIL.Image.open(io.BytesIO(adata.uns["thumbnail_jpeg"].tobytes())))
lib = str(adata.uns["sample_id"])
adata.uns["spatial"] = {lib: {"images": {"hires": img / 255.0},
"scalefactors": {"tissue_hires_scalef": 1.0,
"spot_diameter_fullres": 1.0}}}
# obsm['spatial'] is (he_x, he_y) in full-res pixels; scale to the thumbnail and
# swap to (row, col) for squidpy.
scale = img.shape[1] / float(adata.uns["fullres_px_width"])
adata.obsm["spatial_plot"] = (adata.obsm["spatial"] * scale)[:, [1, 0]]
sq.pl.spatial_scatter(adata, basis="spatial_plot",
color=[None, "CEACAM5", "CD3E", "COL1A1"],
title=["H&E", "CEACAM5 (tumour)", "CD3E (T cell)", "COL1A1 (stroma)"],
size=4, img_alpha=0.9, ncols=2, library_id=lib)
```
## Data organization
| Field | Description |
|-------|-------------|
| `adata.X` | Dense **float16** matrix (cells x genes), log1p-normalized expression, clipped >= 0, **rounded to 3 decimals** (see note). |
| `adata.obs['cell_id']` | Unique cell identifier, traceable to the CellViT segmentation. |
| `adata.obs['spot_barcode']` | Visium spot the cell belongs to (`patch_<row>_<col>_<sample_id>`). |
| `adata.obs['is_inside_spot']` | 1 if the nucleus centroid falls inside the 55 um Visium spot, else 0. |
| `adata.var['gene']` | Gene names (organ-specific panel; see `gene_list.json`). |
| `adata.obsm['spatial']` | Cell centroid `(he_x, he_y)` in full-resolution WSI pixels. |
| `adata.uns['sample_id']` | HEST-1k sample id. |
| `adata.uns['um_per_px']` | Microns per pixel of the source WSI. |
| `adata.uns['patch_size_px']` | Inference patch crop size (pixels). |
| `adata.uns['expression_space']` | `"log1p_norm10k"`. |
| `adata.uns['thumbnail_jpeg']` | JPEG-encoded H&E overview (1-D uint8); `thumbnail_shape` is `[H, W, 3]`. |
| `adata.uns['organ']`, `['oncotree_code']`, `['disease_state']`, ... | HEST-1k metadata fields. |
**Expression space:** `log1p(10000 * raw_counts / total_counts_in_spot)` - standard
scanpy `normalize_total` + `log1p`. Recover approximate normalized counts with `np.expm1()`.
**Rounding note:** to keep the atlas compact, `X` is rounded to **3 decimal places**
in log1p space before storage (absolute error below 1e-3, mean 2.4e-4; the values
are float16 model predictions, so this is within their intrinsic precision, and it
roughly halves the download).
## Companion assets (per organ)
Alongside `virtual_sc/`, each organ ships:
- `thumbnails/<id>_downscaled_fullres.jpeg` - H&E overview.
- `tissue_seg/<id>_contours.geojson` (+ `<id>_vis.jpg`) - CellViT tissue/cell contours.
- `spatial_plots/<id>_spatial_plots.png` - spot-overlay QC visualization.
- `metadata/<id>.json` - per-sample HEST-1k metadata.
- `gene_list.json`, `gene_stats.csv`, `sample_manifest.csv` - panel + sample summary.
## Gene panels
Panels use a hybrid strategy: Xenium anchor genes present in >=50% of Visium
training samples come first (for cross-platform validation), then Visium HVGs
ranked by consensus votes across training samples.
| | Bowel | Breast | Lung |
|--|-------|--------|------|
| Xenium anchor genes | 409 | 393 | 286 |
| Visium filler genes | 17,547 | 18,029 | 13,929 |
| **Total** | **17,956** | **18,422** | **14,215** |
## Performance
Accuracy is evaluated on held-out **Xenium** test samples (true single-cell
measurements) by Pearson correlation between predicted and measured per-gene
expression.
![Pearson correlation across organs](pearson_performance.png)
## Model
- **Architecture** - DeepSpot2Cell: a Deep Sets model with multi-head cell
attention and neighbourhood context.
- **Foundation model** - H-Optimus-1 (patch + cell embeddings).
- **Cell segmentation** - CellViT++ (from HEST-1k).
- **Supervision** - spot-level Visium only; no single-cell ground truth is seen
during training.
- **Loss** - MSE + Pearson-correlation loss on log1p-normalized spot expression.
## How to cite
If you use this dataset, please cite:
```bibtex
@article{nonchev2025deepspot2cell,
title = {DeepSpot2Cell: Predicting Virtual Single-Cell Spatial Transcriptomics
from H&E Images using Spot-Level Supervision},
author = {Nonchev, Kalin and Manaiev, Glib and Koelzer, Viktor H. and Raetsch, Gunnar},
journal = {bioRxiv},
year = {2025},
doi = {10.1101/2025.09.23.678121}
}
@article{jaume2024hest,
title = {HEST-1k: A Dataset for Spatial Transcriptomics and Histology Image Analysis},
author = {Jaume, Guillaume and others},
journal = {Advances in Neural Information Processing Systems},
year = {2024}
}
```
#### NB
This dataset is a companion to [HEST-1k](https://huggingface.co/datasets/MahmoodLab/hest);
sample ids match HEST-1k exactly. The H&E images and Visium data originate from
HEST-1k - please also respect HEST-1k's terms of access. Computational analysis
was performed at [Leonhard Med](https://sis.id.ethz.ch/services/sensitiveresearchdata/),
the secure trusted research environment at ETH Zurich.