spatialexperiment.io package

Submodules

spatialexperiment.io.tenx_visium module

Creates a SpatialExperiment from the Space Ranger output directories for 10x Genomics Visium spatial gene expression data

spatialexperiment.io.tenx_visium.read_img_data(path='.', sample_ids=None, image_sources=None, scale_factors=None, load=True)[source]

Read in images and scale factors for 10x Genomics Visium data, and return as a valid img_data object.

Parameters:
  • path (str) – A path where to find one or more images.

  • sample_ids (Optional[List[str]]) – The sample_id’s for the SpatialExperiment object.

  • image_sources (Optional[List[str]]) – The source path(s) to the image(s).

  • scale_factors (str) – The .json file where to find the scale factors.

  • load (bool) – A boolean specifying whether the image(s) should be loaded into memory? If False, will store the path/URL instead. Defaults to True.

Return type:

BiocFrame

spatialexperiment.io.tenx_visium.read_tenx_visium(samples, sample_ids=None, type='HDF5', data='filtered', images='lowres', load=True)[source]

Create a SpatialExperiment from the Space Ranger output directories for 10x Genomics Visium spatial gene expression data.

Parameters:
  • samples (List[Union[str, PathLike]]) – A list of strings specifying one or more directories, each corresponding to a 10x Genomics Visium sample; if provided, names will be used as sample identifiers.

  • sample_ids (Optional[List[str]]) – A list of strings specifying unique sample identifiers, one for each directory specified via samples.

  • type (str) – A string specifying the type of format to read count data from. Valid values are [‘auto’, ‘sparse’, ‘prefix’, ‘HDF5’] (see [read10xCounts](https://rdrr.io/github/MarioniLab/DropletUtils/man/read10xCounts.html)).

  • data (str) – A string specifying whether to read in filtered (spots mapped to tissue) or raw data (all spots). Valid values are “filtered”, “raw”.

  • images (List[str]) – A single string or a list of strings specifying which images to include. Valid values are “lowres”, “hires”, “fullres”, “detected”, “aligned”.

  • load (bool) – A boolean specifying whether the image(s) should be loaded into memory? If False, will store the path/URL instead. Defaults to True.

spatialexperiment.io.tenx_visium.read_tissue_positions(tissue_positions_path)[source]

Read and parse tissue position file.

Parameters:

tissue_positions_path – The path to tissue positions file from Space Ranger output. Can be either ‘tissue_positions.csv’ or ‘tissue_positions_list.csv’.

Return type:

pd.DataFrame

Returns:

A DataFrame with the tissue positions.

Module contents

spatialexperiment.io.read_tenx_visium(samples, sample_ids=None, type='HDF5', data='filtered', images='lowres', load=True)[source]

Create a SpatialExperiment from the Space Ranger output directories for 10x Genomics Visium spatial gene expression data.

Parameters:
  • samples (List[Union[str, PathLike]]) – A list of strings specifying one or more directories, each corresponding to a 10x Genomics Visium sample; if provided, names will be used as sample identifiers.

  • sample_ids (Optional[List[str]]) – A list of strings specifying unique sample identifiers, one for each directory specified via samples.

  • type (str) – A string specifying the type of format to read count data from. Valid values are [‘auto’, ‘sparse’, ‘prefix’, ‘HDF5’] (see [read10xCounts](https://rdrr.io/github/MarioniLab/DropletUtils/man/read10xCounts.html)).

  • data (str) – A string specifying whether to read in filtered (spots mapped to tissue) or raw data (all spots). Valid values are “filtered”, “raw”.

  • images (List[str]) – A single string or a list of strings specifying which images to include. Valid values are “lowres”, “hires”, “fullres”, “detected”, “aligned”.

  • load (bool) – A boolean specifying whether the image(s) should be loaded into memory? If False, will store the path/URL instead. Defaults to True.