spatialdata_io.seqfish

Contents

spatialdata_io.seqfish#

spatialdata_io.seqfish(path, load_images=True, load_labels=True, load_points=True, load_shapes=True, cells_as_circles=False, rois=None, imread_kwargs=mappingproxy({}), raster_models_scale_factors=None)#

Read seqfish formatted dataset.

This function reads the following files:

  • `<roi_prefix>_'CellxGene''.csv'`: Counts and metadata file.

  • `<roi_prefix>_'CellCoordinates''.csv'`: Cell coordinates file.

  • `<roi_prefix>_'DAPI''.tiff'`: High resolution tiff image.

  • `<roi_prefix>_'Segmentation''.tiff'`: Cell mask file.

  • `<roi_prefix>_'TranscriptList''.csv'`: Transcript coordinates file.

See also

Parameters:
  • path (str | Path) – Path to the directory containing the data.

  • load_images (bool (default: True)) – Whether to load the images.

  • load_labels (bool (default: True)) – Whether to load cell segmentation.

  • load_points (bool (default: True)) – Whether to load the transcript locations.

  • load_shapes (bool (default: True)) – Whether to load cells as shape.

  • cells_as_circles (bool (default: False)) – Whether to read cells also as circles instead of labels.

  • rois (list[str] | None (default: None)) – Which ROIs (specified as strings, without trailing “_”) to load (the ROI strings are used as prefixes for the filenames). If None, all ROIs are loaded.

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

  • raster_models_scale_factors (list[int] | None (default: None)) – Scale factors to downscale high-resolution images and labels. The scale factors will be automatically set to obtain a multi-scale image for all the images and labels that are larger than 100 megapixels.

Return type:

SpatialData

Returns:

: spatialdata.SpatialData

Examples

This code shows how to change the annotation target of the table from the cell labels to the cell boundaries. Please check that the string Roi1 is used in the naming of your dataset, otherwise adjust the code below. >>> from spatialdata_io import seqfish >>> sdata = seqfish(“path/to/raw/data”) >>> sdata[“table_Roi1”].obs[“region”] = “Roi1_Boundaries” >>> sdata.set_table_annotates_spatialelement( … table_name=”table_Roi1”, region=”Roi1_Boundaries”, region_key=”region”, instance_key=”instance_id” … ) >>> sdata.write(“path/to/data.zarr”)