sparrow.io.xenium#
- sparrow.io.xenium(path, to_coordinate_system='global', aligned_images=True, cells_labels=False, nucleus_labels=False, cells_table=False, filter_gene_names=None, output=None)#
Read a 10X Genomics Xenium dataset into a SpatialData object.
Wrapper around
spatialdata_io.xenium, but with support for reading multiple samples into one spatialdata object. This function reads images, transcripts, masks (cell and nuclei) and tables, so it can be used for analysis.This function reads the following files:
{xx.XENIUM_SPECS!r}: File containing specifications.{xx.NUCLEUS_BOUNDARIES_FILE!r}: Polygons of nucleus boundaries.{xx.CELL_BOUNDARIES_FILE!r}: Polygons of cell boundaries.{xx.TRANSCRIPTS_FILE!r}: File containing transcripts.{xx.CELL_FEATURE_MATRIX_FILE!r}: File containing cell feature matrix.{xx.CELL_METADATA_FILE!r}: File containing cell metadata.{xx.MORPHOLOGY_MIP_FILE!r}: File containing morphology mip.{xx.MORPHOLOGY_FOCUS_FILE!r}: File containing morphology focus.
See also
- Parameters:
path (
str|Path|list[str] |list[Path]) – Specifies the location of the dataset. This can either be a single path or a list of paths, where each path corresponds to a different experiment/roi.to_coordinate_system (
str|list[str] (default:'global')) – The coordinate system to which the images, segmentation masks and transcripts will be added for each item in path. If provided as a list, its length should be equal to the number of paths specified inpath.aligned_images (
bool(default:True)) – Whether to also parse, when available, additional H&E or IF aligned images. For more control over the aligned images being read, in particular, to specify the axes of the aligned images, please set this parameter toFalseand use thexenium_aligned_imagefunction directly.cells_labels (
bool(default:False)) – Whether to read cell labels (raster) provided by Xenium. 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:False)) – Whether to read nucleus labels (raster) provided by Xenium. The polygonal version of the nucleus labels are simplified for visualization purposes, and using the raster version is recommended for analysis.cells_table (
bool(default:False)) – Whether to read the cell annotations in theAnnDatatable. Will be added to thef"table_{to_coordinate_system}"slot insdata.tables, or f”table_{to_coordinate_system[i]}” ifto_coordinate_systemis a list. IfTrue, labels layer annotating the table will also be added tosdata.filter_gene_names (
str|list[str] (default:None)) – Gene names that need to be filtered out (viastr.contains), mostly control genes that were added, and which you don’t want to use. Filtering is case insensitive. Also seesparrow.read_transcripts.output (
str|Path|None(default:None)) – The path where the resultingSpatialDataobject will be backed. IfNone, it will not be backed to a zarr store.
- Raises:
AssertionError – Raised when the number of elements in
pathandto_coordinate_systemare not the same.AssertionError – If elements in
to_coordinate_systemare not unique.AssertionError – If
cells_tableisTrue, but the labels layer annotating the table is not found.
- Return type:
SpatialData- Returns:
: A SpatialData object.