DeepSpaceDB-Preview / README.md
vhoncharuk's picture
README: data vs processed overview
4a3f755 verified
|
Raw History Blame Contribute Delete
4.49 kB
metadata
license: mit
task_categories:
  - other
tags:
  - spatial-transcriptomics
  - xenium
  - spatial-omics
  - bioinformatics
pretty_name: DeepSpaceDB Xenium Preview

DeepSpaceDB Xenium Preview

A collection of processed 10x Genomics Xenium spatial transcriptomics samples, curated from public GEO depositions, stored as SpatialData zarr stores.

This is a small preview of the full DeepSpaceDB Xenium collection: 3 human breast cancer samples (DSIDX00001-DSIDX00003, GEO series GSE243168), each provided as an unfiltered data/ zarr and an analysis-ready processed/ zarr (see below). metadata.csv lists only these samples.

Structure

metadata.csv          # one row per sample: organ, condition, species, source, quality, etc.
data/
  DSIDX00001.zarr.zip  # one zipped SpatialData zarr store per sample (unfiltered)
  ...
processed/
  DSIDX00001.processed.zarr.zip  # same samples, filtered / normalized / clustered / annotated
  ...

Each <id>.zarr.zip (and <id>.processed.zarr.zip) is a SpatialData store containing (where available):

  • images: morphology_focus (DAPI/nuclear stain) and he_image (H&E, aligned via an Affine transform to the same coordinate space as the other elements)
  • labels: cell_labels, nucleus_labels (raster segmentation masks)
  • shapes: cell_boundaries, nucleus_boundaries, cell_circles
  • points: transcripts (per-molecule detections)
  • tables: table (cell x gene raw count matrix, AnnData)

data/ vs processed/

Both folders hold the same samples as SpatialData zarr stores with the same images, labels, shapes and transcripts. They differ in the tables/table AnnData (cell x gene table):

data/ processed/
Cells all cells from the Xenium output (DSIDX00001: 167,780) after cell-level QC filtering (DSIDX00001: 164,000)
Expression raw counts in X only X plus layers: counts, normalized, log1p
Embeddings / graph none obsm: X_pca, X_umap; varm: PCs; obsp: connectivities, distances
Clustering none obs.leiden (Leiden clusters), obs.banksy_domain (BANKSY spatial domains)
Cell types none obs.predicted_cell_type, obs.main_cell_type, obs.cell_type_correlation
Per-cell QC Xenium metrics only adds n_counts, n_genes_by_counts, log1p_n_genes_by_counts, log1p_total_counts, x, y
Per-gene stats none var: mean_counts, log1p_mean_counts, total_counts, log1p_total_counts, n_cells, n_cells_by_counts, pct_dropout_by_counts
uns spatialdata_attrs adds leiden, log1p, pca, umap

So data/ is the minimal, unfiltered Xenium output converted to SpatialData, and processed/ is the analysis-ready version: filtered, normalized, embedded, clustered and annotated. Cell types are assigned per Leiden cluster (by correlation to a reference), so all cells in a cluster share one label. morphology_mip is omitted from both. Files are named processed/<id>.processed.zarr.zip and load exactly like data/ (extract the zip, then sd.read_zarr).

Loading a sample

spatialdata.read_zarr() cannot currently read directly from a .zip (this is an open upstream limitation - see scverse/spatialdata#1141) - extract first, then read normally:

import zipfile
import spatialdata as sd

zipfile.ZipFile("DSIDX00001.zarr.zip").extractall("DSIDX00001.zarr")
sdata = sd.read_zarr("DSIDX00001.zarr")

Selecting samples by metadata

metadata.csv lets you filter before downloading any zarr data:

import pandas as pd
from huggingface_hub import hf_hub_download

meta = pd.read_csv(hf_hub_download(repo_id="vhoncharuk/DeepSpaceDB-Preview", repo_type="dataset", filename="metadata.csv"))
breast_samples = meta[meta.organ == "breast"]

for dsidx_id in breast_samples["id"]:
    hf_hub_download(repo_id="vhoncharuk/DeepSpaceDB-Preview", repo_type="dataset", filename=f"data/{dsidx_id}.zarr.zip")

Metadata columns

id (internal accession), sample_id (GEO GSM or source sample name), series_id (GEO GSE, or source collection), organism, condition / condition_detailed (+ Disease Ontology IDs), organ / organ_detailed (+ UBERON IDs), sex, age_or_stage, ethnicity_or_strain, description, source, URL, PMID, date_published, has_manual_annotation, platform, quality.