spatialdata_io.visium

Contents

spatialdata_io.visium#

spatialdata_io.visium(path, dataset_id=None, counts_file='filtered_feature_bc_matrix.h5', fullres_image_file=None, tissue_positions_file=None, scalefactors_file=None, imread_kwargs=mappingproxy({}), image_models_kwargs=mappingproxy({}), **kwargs)#

Read 10x Genomics Visium formatted dataset.

This function reads the following files:

  • (<dataset_id>_)`'filtered_feature_bc_matrix.h5'`: Counts and metadata file.

  • 'spatial/tissue_hires_image.png': High resolution image.

  • 'spatial/tissue_lowres_image.png': Low resolution image.

  • 'scalefactors_json.json': Scalefactors file.

  • 'tissue_positions_list.csv' (SpaceRanger 1) or 'tissue_positions.csv' (SpaceRanger 2):

    Spots positions file.

  • fullres_image_file: large microscopy image used as input for space ranger.

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

  • dataset_id (str | None (default: None)) – Dataset identifier to name the constructed SpatialData elements. The reader will try to infer it from the counts_file filen name (which defaults to 'filtered_feature_bc_matrix.h5') file name. If the file name does not contain the dataset id, it needs to be provided.

  • counts_file (str (default: 'filtered_feature_bc_matrix.h5')) – Name of the counts file, defaults to 'filtered_feature_bc_matrix.h5'; a common alternative is 'raw_feature_bc_matrix.h5'. Also, use when the file names are not following the standard SpaceRanger conventions.

  • fullres_image_file (str | Path | None (default: None)) – Path to the full-resolution image.

  • tissue_positions_file (str | Path | None (default: None)) – Path to the tissue positions file.

  • scalefactors_file (str | Path | None (default: None)) – Path to the scalefactors file.

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

  • image_models_kwargs (Mapping[str, Any] (default: mappingproxy({}))) – Keyword arguments passed to spatialdata.models.Image2DModel.

Return type:

SpatialData

Returns:

: spatialdata.SpatialData