hest.readers.XeniumReader

class hest.readers.XeniumReader

10x Xenium reader

Methods table

auto_read(path, **read_kwargs)

Automatically detect the file names and determine a reading strategy based on the detected files.

read(img_path, experiment_path[, ...])

Read a Xenium sample

Methods

XeniumReader.auto_read(path: str, **read_kwargs) XeniumHESTData

Automatically detect the file names and determine a reading strategy based on the detected files. For more control on the reading process, consider using read() instead

auto_read will automatically identify the following files based on their name: - a WSI: largest image in path (see find_biggest_img) - an image alignment file: any file ending with ‘imagealignment.csv’

this file contains an affine transformation used to align transcripts, and cells from DAPI to H&E. The transformation must be in the standard Xenium format

  • a transcript file: file named transcripts.parquet

  • an experiment file: experiment.xenium

  • a cell_feature_matrix.h5 file

  • a cells.parquet file

  • a nucleus_boundaries.parquet file

  • a cell_boundaries.parquet file

Parameters:

path (st) – path to the directory containing all the necessary files

Returns:

STObject that was read

Return type:

XeniumHESTData

XeniumReader.read(img_path: str, experiment_path: str, alignment_file_path: str = None, feature_matrix_path: str = None, transcripts_path: str = None, cells_path: str = None, nucleus_bound_path: str = None, cell_bound_path: str = None, dapi_path=None, load_img=True, use_dask=False, spot_size_um=100.0, nb_partitions=30) XeniumHESTData

Read a Xenium sample

Parameters:
  • img_path (str) – path to the WSI

  • experiment_path (str) – path to a experiment.xenium file

  • alignment_file_path (str, optional) – path to a DAPI->H&E matrix/keypoints alignment file, None if the H&E is already aligned with the DAPI. Defaults to None.

  • feature_matrix_path (str, optional) – path to a cell_feature_matrix.h5. Defaults to None.

  • transcripts_path (str, optional) – path to a transcripts.parquet, None to not load the transcripts. Defaults to None.

  • cells_path (str, optional) – path to a cells.parquet file, None to not load the cells. Defaults to None.

  • nucleus_bound_path (str, optional) – path to a nucleus_boundaries.parquet file. Defaults to None.

  • cell_bound_path (str, optional) – path to a cell_boundaries file. Defaults to None.

  • dapi_path (_type_, optional) – path to a morphology_focus_0000.ome.tif/morphology_focus.ome.tif file. Defaults to None.

  • load_img (bool, optional) – whenever to load the WSI. Defaults to True.

  • use_dask (bool, optional) – whenever to load the transcript dataframe with DASK (recommended if the transcript dataframe does not fit into the RAM). Defaults to False.

  • spot_size_um (float, optional) – transcripts are pooled into squares of spot_size_um x spot_size_um mirometers and then stored in HESTData.adata

  • nb_partitions (int, optional) – number of dask partition to use if use_dask is True. Defaults to 30

Returns:

Xenium sample

Return type:

XeniumHESTData