spatialdata_io.xenium

Contents

spatialdata_io.xenium#

spatialdata_io.xenium(path, n_jobs=1, cells_as_circles=True, cell_boundaries=True, nucleus_boundaries=True, cell_labels=True, nucleus_labels=True, transcripts=True, morphology_mip=True, morphology_focus=True, aligned_images=True, imread_kwargs=mappingproxy({}), image_models_kwargs=mappingproxy({}), labels_models_kwargs=mappingproxy({}))#

Read a 10X Genomics Xenium dataset into a SpatialData object.

This function reads the following files:

  • 'experiment.xenium': File containing specifications.

  • 'nucleus_boundaries.parquet': Polygons of nucleus boundaries.

  • 'cell_boundaries.parquet': Polygons of cell boundaries.

  • 'transcripts.parquet': File containing transcripts.

  • 'cell_feature_matrix.h5': File containing cell feature matrix.

  • 'cells.parquet': File containing cell metadata.

  • 'morphology_mip.ome.tif': File containing morphology mip.

  • 'morphology_focus.ome.tif': File containing morphology focus.

Parameters:
  • path (str | Path) – Path to the dataset.

  • n_jobs (int (default: 1)) – Number of jobs to use for parallel processing.

  • cells_as_circles (bool (default: True)) – Whether to read cells also as circles. Useful for performant visualization. The radii of the nuclei, not the ones of cells, will be used; using the radii of cells would make the visualization too cluttered (the cell boundaries are computed as a maximum expansion of the nuclei location and therefore the corresponding circles would show considerable overlap).

  • cell_boundaries (bool (default: True)) – Whether to read cell boundaries (polygons).

  • nucleus_boundaries (bool (default: True)) – Whether to read nucleus boundaries (polygons).

  • cell_labels (bool (default: True)) – Whether to read cell labels (raster). The polygonal version of the cell labels are simplified for visualization purposes, and using the raster version is recommended for analysis.

  • nucleus_labels (bool (default: True)) – Whether to read nucleus labels (raster). The polygonal version of the nucleus labels are simplified for visualization purposes, and using the raster version is recommended for analysis.

  • transcripts (bool (default: True)) – Whether to read transcripts.

  • morphology_mip (bool (default: True)) – Whether to read the morphology mip image (available in versions < 2.0.0).

  • morphology_focus (bool (default: True)) – Whether to read the morphology focus image.

  • aligned_images (bool (default: True)) – Whether to also parse, when available, additional H&E or IF aligned images.

  • imread_kwargs (Mapping[str, Any] (default: mappingproxy({}))) – Keyword arguments to pass to the image reader.

  • image_models_kwargs (Mapping[str, Any] (default: mappingproxy({}))) – Keyword arguments to pass to the image models.

  • labels_models_kwargs (Mapping[str, Any] (default: mappingproxy({}))) – Keyword arguments to pass to the labels models.

Return type:

SpatialData

Returns:

: spatialdata.SpatialData