spatialdata_io.merscope#
- spatialdata_io.merscope(path, vpt_outputs=None, z_layers=3, region_name=None, slide_name=None, backend=None, transcripts=True, cells_boundaries=True, cells_table=True, mosaic_images=True, 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*.tifimages 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 dictionary, 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 oneintindex, or a list ofintindices. 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'. IfNonethen the name of thepathdirectory is used.slide_name (
str|None(default:None)) – Name of the slide/run. IfNonethen the name of the parent directory ofpathis used (whose name starts with a date).backend (
Optional[Literal['dask_image','rioxarray']] (default:None)) – Either"dask_image"or"rioxarray"(the latter uses less RAM, but requiresrioxarrayto be installed). By default, uses"rioxarray"if and only if therioxarraylibrary is installed.transcripts (
bool(default:True)) – Whether to read transcripts.cells_boundaries (
bool(default:True)) – Whether to read cell boundaries (polygons).cells_table (
bool(default:True)) – Whether to read cells table.mosaic_images (
bool(default:True)) – Whether to read the mosaic 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.
- Return type:
- Returns: