squidpy.read.visium
- squidpy.read.visium(path, *, counts_file='filtered_feature_bc_matrix.h5', library_id=None, load_images=True, source_image_path=None, **kwargs)[source]
Read 10x Genomics Visium formatted dataset.
In addition to reading the regular Visium output, it looks for the spatial directory and loads the images, spatial coordinates and scale factors.
See also
squidpy.pl.spatial_scatter()
on how to plot spatial data.
- Parameters:
path (
PathLike
[str
] |str
) – Path to the root directory containing Visium files.counts_file (
str
) – Which file in the passed directory to use as the count file. Typically either filtered_feature_bc_matrix.h5 or raw_feature_bc_matrix.h5.library_id (
Optional
[str
]) – Identifier for the Visium library. Useful when concatenating multipleanndata.AnnData
objects.kwargs (
Any
) – Keyword arguments forscanpy.read_10x_h5()
,anndata.read_mtx()
orread_text()
.
- Return type:
- Returns:
: Annotated data object with the following keys:
anndata.AnnData.obsm
['spatial']
- spatial spot coordinates.anndata.AnnData.uns
['spatial']['{library_id}']['images']
- hires and lowres images.anndata.AnnData.uns
['spatial']['{library_id}']['scalefactors']
- scale factors for the spots.anndata.AnnData.uns
['spatial']['{library_id}']['metadata']
- various metadata.