spatialdata_io.merscope#
- spatialdata_io.merscope(path, vpt_outputs=None, z_layers=3, region_name=None, slide_name=None, imread_kwargs=mappingproxy({}), image_models_kwargs=mappingproxy({}))#
Read MERSCOPE data from Vizgen.
This function reads the following files:
'cell_by_gene.csv'
: Counts file.'detected_transcripts.csv'
: Transcript file.'cell_metadata.csv'
: Per-cell metadata file.'cell_boundaries.parquet'
: Cell polygon boundaries.mosaic_**_z*.tif
images inside the'images'
directory.
- Parameters:
path (str | Path) – Path to the region/root directory containing the Merscope files (e.g.,
detected_transcripts.csv
).vpt_outputs (Path | str | dict[str, Any] | None (default:
None
)) –Optional arguments to indicate the output of the vizgen-postprocessing-tool (VPT), when used. If a folder path is provided, it looks inside the folder for the following files:
'cell_by_gene.csv'
'cell_metadata.csv'
'cell_boundaries.parquet'
If a dictionnary, then the following keys should be provided with the desired path:
'cell_by_gene'
'cell_metadata'
'cell_boundaries'
z_layers (int | list[int] | None (default:
3
)) – Indices of the z-layers to consider. Either oneint
index, or a list ofint
indices. IfNone
, then no image is loaded. By default, only the middle layer is considered (that is, layer 3).region_name (str | None (default:
None
)) – Name of the region of interest, e.g.,'region_0'
. IfNone
then the name of thepath
directory is used.slide_name (str | None (default:
None
)) – Name of the slide/run. IfNone
then the name of the parent directory ofpath
is used (whose name starts with a date).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.
- Return type:
SpatialData
- Returns: